diff --git a/.gitattributes b/.gitattributes index bed0738c7eeb449bca98b5d2f33c89a1ee56349a..f4feb1c2ff73e52540858f240420ad495154f59e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ *.7z filter=lfs diff=lfs merge=lfs -text +*.xcf filter=lfs diff=lfs merge=lfs -text *.arrow filter=lfs diff=lfs merge=lfs -text *.avro filter=lfs diff=lfs merge=lfs -text *.bin filter=lfs diff=lfs merge=lfs -text diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..dcd7c9ef7d30b12f7c4849f46f966a327b3a2abe --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# Set update schedule for GitHub Actions + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" + labels: + - "dependencies" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..8d3ee342f843d54c6d867d33ea5d2ac3a0dcf594 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: Build + +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + +jobs: + build: + name: Build and update nightlies + runs-on: ubuntu-latest + container: danteev/texlive:2025-07-15 + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Consider all directories safe + run: git config --global --add safe.directory '*' + + - name: Fetch all tags for `git describe` + run: git fetch --force --prune --unshallow --tags + + - name: Check em dash style + run: "! grep -r '[^ ]---[^ ]' --include='*.tex' || { echo 'Please space the em dashes'; exit 1; }" + + - name: Update ./errata.tex + # ./mark-errata should only run on the master branch of the main repo. + # This job is thus disabled for pull requests and forked repos. + if: ${{ github.repository_owner == 'HoTT' && github.ref == 'refs/heads/master' }} + run: | + ./mark-errata + if ! git diff --quiet -- ./errata.tex; then + git config --global user.name "github-actions" + git config --global user.email "github-actions@github.com" + git add errata.tex + git commit -m "Mark Errata (auto)" + git push + fi + + - name: Generate nightlies + run: ./generate-nightlies "./_www_dir/" "./_wiki_dir/" + + - name: Check if errata.tex is clean + # Interrupt the uploading if errata.tex somehow is not clean. + # This should not happen, but it does not hurt to check. + if: ${{ github.repository_owner == 'HoTT' && github.ref == 'refs/heads/master' }} + run: ./check-errata + + - name: Push GitHub pages + # This step is disabled for all forked repos. The idea is that the nightlies will + # not be useful for most usage of forked repos. However, there are no technical + # reasons not to enable it, if one wishes to do so. + if: ${{ github.repository_owner == 'HoTT' && github.ref == 'refs/heads/master' }} + uses: peaceiris/actions-gh-pages@v4 + with: + force_orphan: true + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: "./_www_dir/" + + - name: Install gh + # Needed for using Andrew-Chen-Wang/github-wiki-action@v5 + run: | + apt-get update + apt-get install -y gh + + - name: Push GitHub wiki pages + # This step would err if the forked repo does not already have wiki pages. + # As a workaround, it is disabled for all forked repos. + if: ${{ github.repository_owner == 'HoTT' && github.ref == 'refs/heads/master' }} + uses: Andrew-Chen-Wang/github-wiki-action@v5 + with: + path: _wiki_dir diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..accc5b90f112265b70582d1500eba1687a92daf4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,612 @@ +.svn +*.pyc +*.aux +*.aux.bak +hott-*.pdf +main.pdf +errata*.pdf +*.dvi +*.bbl +*.fls +*.toc +*.blg +*.brf +*.log +*.out +*.out.ps +*.sed +*.synctex.gz +*.nav +*.snm +*.idx +*.idx.bak +*.ilg +*.ind +auto/* +*~ +\#* +.\#* +cover/torus/preimg/* +cover/torus/srcimg/* +cover/torus/dstimg/* +_region_* +TAGS +.DS_Store +*.fdb_latexmk +main.labels +main.labelnumbers +exercise_solutions.pdf +indexterms.txt +cover-*.pdf +version.tex +hott-arxiv.tex +hott-arxiv.tar.gz +/Ustmry.fd +/barrdoc.pdf +/base.zip +/base/ +/braket.sty +/color.cfg +/comment.sty +/dvitogif89a +/empheq.drv +/empheq.dtx +/empheq.ins +/empheq.sty +/enumitem.sty +/etoolbox.def +/etoolbox.sty +/install-tds +/mathtools.drv +/mathtools.dtx +/mathtools.ins +/mathtools.sty +/mathtools.zip +/mathtools/ +/mhsetup.drv +/mhsetup.dtx +/mhsetup.ins +/mhsetup.sty +/movie.cls +/nextpage.sty +/pgf.cfg +/pgf.revision.tex +/pgf.sty +/pgf.tex +/pgfarrows.sty +/pgfautomata.sty +/pgfbaseimage.sty +/pgfbaseimage.tex +/pgfbaselayers.sty +/pgfbaselayers.tex +/pgfbasematrix.sty +/pgfbasematrix.tex +/pgfbasepatterns.sty +/pgfbasepatterns.tex +/pgfbaseplot.sty +/pgfbaseplot.tex +/pgfbaseshapes.sty +/pgfbaseshapes.tex +/pgfbasesnakes.sty +/pgfbasesnakes.tex +/pgfcalendar.code.tex +/pgfcalendar.sty +/pgfcalendar.tex +/pgfcomp-version-0-65.sty +/pgfcomp-version-1-18.sty +/pgfcore.code.tex +/pgfcore.sty +/pgfcore.tex +/pgfcorearrows.code.tex +/pgfcoreexternal.code.tex +/pgfcoregraphicstate.code.tex +/pgfcoreimage.code.tex +/pgfcorelayers.code.tex +/pgfcoreobjects.code.tex +/pgfcorepathconstruct.code.tex +/pgfcorepathprocessing.code.tex +/pgfcorepathusage.code.tex +/pgfcorepatterns.code.tex +/pgfcorepoints.code.tex +/pgfcorequick.code.tex +/pgfcorerdf.code.tex +/pgfcorescopes.code.tex +/pgfcoreshade.code.tex +/pgfcoretransformations.code.tex +/pgfcoretransparency.code.tex +/pgfexternal.tex +/pgfexternalwithdepth.tex +/pgffor.code.tex +/pgffor.sty +/pgffor.tex +/pgfheaps.sty +/pgfint.code.tex +/pgfkeys.code.tex +/pgfkeys.sty +/pgfkeys.tex +/pgfkeysfiltered.code.tex +/pgflibraryarrows.code.tex +/pgflibraryarrows.meta.code.tex +/pgflibraryarrows.spaced.code.tex +/pgflibraryarrows.sty +/pgflibraryautomata.sty +/pgflibrarybbox.code.tex +/pgflibrarycurvilinear.code.tex +/pgflibrarydatavisualization.barcharts.code.tex +/pgflibrarydatavisualization.formats.functions.code.tex +/pgflibrarydatavisualization.polar.code.tex +/pgflibrarydecorations.footprints.code.tex +/pgflibrarydecorations.fractals.code.tex +/pgflibrarydecorations.markings.code.tex +/pgflibrarydecorations.pathmorphing.code.tex +/pgflibrarydecorations.pathreplacing.code.tex +/pgflibrarydecorations.shapes.code.tex +/pgflibrarydecorations.text.code.tex +/pgflibraryfadings.code.tex +/pgflibraryfixedpointarithmetic.code.tex +/pgflibraryfpu.code.tex +/pgflibrarygraphdrawing.circular.code.tex +/pgflibrarygraphdrawing.code.tex +/pgflibrarygraphdrawing.examples.code.tex +/pgflibrarygraphdrawing.force.code.tex +/pgflibrarygraphdrawing.layered.code.tex +/pgflibrarygraphdrawing.trees.code.tex +/pgflibraryintersections.code.tex +/pgflibrarylindenmayersystems.code.tex +/pgflibraryluamath.code.tex +/pgflibrarypatterns.code.tex +/pgflibrarypatterns.meta.code.tex +/pgflibraryplothandlers.code.tex +/pgflibraryplothandlers.sty +/pgflibraryplotmarks.code.tex +/pgflibraryplotmarks.sty +/pgflibraryprofiler.code.tex +/pgflibraryshadings.code.tex +/pgflibraryshapes.arrows.code.tex +/pgflibraryshapes.callouts.code.tex +/pgflibraryshapes.code.tex +/pgflibraryshapes.gates.ee.IEC.code.tex +/pgflibraryshapes.gates.ee.code.tex +/pgflibraryshapes.gates.logic.IEC.code.tex +/pgflibraryshapes.gates.logic.US.code.tex +/pgflibraryshapes.gates.logic.code.tex +/pgflibraryshapes.geometric.code.tex +/pgflibraryshapes.misc.code.tex +/pgflibraryshapes.multipart.code.tex +/pgflibraryshapes.sty +/pgflibraryshapes.symbols.code.tex +/pgflibrarysnakes.code.tex +/pgflibrarysnakes.sty +/pgflibrarysvg.path.code.tex +/pgflibrarytikzbackgrounds.sty +/pgflibrarytikztrees.sty +/pgflibrarytimelines.code.tex +/pgfmath.code.tex +/pgfmath.sty +/pgfmath.tex +/pgfmathcalc.code.tex +/pgfmathfloat.code.tex +/pgfmathfunctions.base.code.tex +/pgfmathfunctions.basic.code.tex +/pgfmathfunctions.code.tex +/pgfmathfunctions.comparison.code.tex +/pgfmathfunctions.integerarithmetics.code.tex +/pgfmathfunctions.misc.code.tex +/pgfmathfunctions.random.code.tex +/pgfmathfunctions.round.code.tex +/pgfmathfunctions.trigonometric.code.tex +/pgfmathode.code.tex +/pgfmathparser.code.tex +/pgfmathtestsuite.tex +/pgfmathutil.code.tex +/pgfmoduleanimations.code.tex +/pgfmodulebending.code.tex +/pgfmoduledatavisualization.code.tex +/pgfmoduledecorations.code.tex +/pgfmodulematrix.code.tex +/pgfmodulenonlineartransformations.code.tex +/pgfmoduleoo.code.tex +/pgfmoduleparser.code.tex +/pgfmoduleplot.code.tex +/pgfmoduleshapes.code.tex +/pgfmodulesnakes.code.tex +/pgfmodulesorting.code.tex +/pgfnodes.sty +/pgfpages.sty +/pgfpict2e.sty +/pgfrcs.code.tex +/pgfrcs.sty +/pgfrcs.tex +/pgfshade.sty +/pgfsys-common-pdf-via-dvi.def +/pgfsys-common-pdf.def +/pgfsys-common-postscript.def +/pgfsys-common-svg.def +/pgfsys-dvi.def +/pgfsys-dvipdfm.def +/pgfsys-dvipdfmx.def +/pgfsys-dvips.def +/pgfsys-dvisvgm.def +/pgfsys-luatex.def +/pgfsys-pdftex.def +/pgfsys-tex4ht.def +/pgfsys-textures.def +/pgfsys-vtex.def +/pgfsys-xetex.def +/pgfsys.code.tex +/pgfsys.sty +/pgfsys.tex +/pgfsysanimations.code.tex +/pgfsysprotocol.code.tex +/pgfsyssoftpath.code.tex +/pgfutil-common-lists.tex +/pgfutil-common.tex +/pgfutil-context.def +/pgfutil-latex.def +/pgfutil-plain.def +/pnmrawtopcropwhite.c +/soul.dtx +/soul.ins +/soul.sty +/stmary10.600pk +/stmary10.657pk +/stmary10.mf +/stmary10.tfm +/stmary5.600pk +/stmary5.mf +/stmary5.tfm +/stmary6.600pk +/stmary6.mf +/stmary6.tfm +/stmary7.600pk +/stmary7.mf +/stmary7.tfm +/stmary8.600pk +/stmary8.mf +/stmary8.tfm +/stmary9.600pk +/stmary9.mf +/stmary9.tfm +/stmaryaj.mf +/stmaryba.mf +/stmarych.mf +/stmaryjg.mf +/stmaryrd.dtx +/stmaryrd.ins +/stmaryrd.mf +/stmaryrd.sty +/stmaryrd.zip +/stmaryrd/ +/supertabular.dtx +/supertabular.ins +/supertabular.sty +/svgnam.def +/t-pgf.tex +/t-pgfbim.tex +/t-pgfbla.tex +/t-pgfbma.tex +/t-pgfbpl.tex +/t-pgfbpt.tex +/t-pgfbsh.tex +/t-pgfbsn.tex +/t-pgfcal.tex +/t-pgfcor.tex +/t-pgffor.tex +/t-pgfkey.tex +/t-pgfmat.tex +/t-pgfmod.tex +/t-pgfrcs.tex +/t-pgfsys.tex +/t-tikz.tex +/tikz.code.tex +/tikz.sty +/tikz.tex +/tikzexternal.sty +/tikzexternalshared.code.tex +/tikzexternaltest.code.tex +/tikzexternaltest.sharedpreamble.tex +/tikzexternaltest.tex +/tikzexternaltestmakefile.tex +/tikzlibrary3d.code.tex +/tikzlibraryangles.code.tex +/tikzlibraryanimations.code.tex +/tikzlibraryarrows.code.tex +/tikzlibraryautomata.code.tex +/tikzlibrarybabel.code.tex +/tikzlibrarybackgrounds.code.tex +/tikzlibrarybending.code.tex +/tikzlibrarycalc.code.tex +/tikzlibrarycalendar.code.tex +/tikzlibrarychains.code.tex +/tikzlibrarycircuits.code.tex +/tikzlibrarycircuits.ee.IEC.code.tex +/tikzlibrarycircuits.ee.code.tex +/tikzlibrarycircuits.logic.CDH.code.tex +/tikzlibrarycircuits.logic.IEC.code.tex +/tikzlibrarycircuits.logic.US.code.tex +/tikzlibrarycircuits.logic.code.tex +/tikzlibrarydatavisualization.3d.code.tex +/tikzlibrarydatavisualization.barcharts.code.tex +/tikzlibrarydatavisualization.code.tex +/tikzlibrarydatavisualization.formats.functions.code.tex +/tikzlibrarydatavisualization.polar.code.tex +/tikzlibrarydatavisualization.sparklines.code.tex +/tikzlibrarydecorations.code.tex +/tikzlibrarydecorations.footprints.code.tex +/tikzlibrarydecorations.fractals.code.tex +/tikzlibrarydecorations.markings.code.tex +/tikzlibrarydecorations.pathmorphing.code.tex +/tikzlibrarydecorations.pathreplacing.code.tex +/tikzlibrarydecorations.shapes.code.tex +/tikzlibrarydecorations.text.code.tex +/tikzlibraryer.code.tex +/tikzlibraryexternal.code.tex +/tikzlibraryfadings.code.tex +/tikzlibraryfit.code.tex +/tikzlibraryfixedpointarithmetic.code.tex +/tikzlibraryfolding.code.tex +/tikzlibraryfpu.code.tex +/tikzlibrarygraphdrawing.code.tex +/tikzlibrarygraphdrawing.evolving.code.tex +/tikzlibrarygraphs.code.tex +/tikzlibrarygraphs.standard.code.tex +/tikzlibraryintersections.code.tex +/tikzlibrarylindenmayersystems.code.tex +/tikzlibrarymath.code.tex +/tikzlibrarymatrix.code.tex +/tikzlibrarymindmap.code.tex +/tikzlibrarypatterns.code.tex +/tikzlibrarypatterns.meta.code.tex +/tikzlibraryperspective.code.tex +/tikzlibrarypetri.code.tex +/tikzlibraryplothandlers.code.tex +/tikzlibraryplotmarks.code.tex +/tikzlibrarypositioning.code.tex +/tikzlibraryquotes.code.tex +/tikzlibraryrdf.code.tex +/tikzlibraryscopes.code.tex +/tikzlibraryshadings.code.tex +/tikzlibraryshadows.code.tex +/tikzlibraryshapes.arrows.code.tex +/tikzlibraryshapes.callouts.code.tex +/tikzlibraryshapes.code.tex +/tikzlibraryshapes.gates.logic.IEC.code.tex +/tikzlibraryshapes.gates.logic.US.code.tex +/tikzlibraryshapes.geometric.code.tex +/tikzlibraryshapes.misc.code.tex +/tikzlibraryshapes.multipart.code.tex +/tikzlibraryshapes.symbols.code.tex +/tikzlibrarysnakes.code.tex +/tikzlibraryspy.code.tex +/tikzlibrarysvg.path.code.tex +/tikzlibrarythrough.code.tex +/tikzlibrarytopaths.code.tex +/tikzlibrarytrees.code.tex +/tikzlibraryturtle.code.tex +/tikzlibraryviews.code.tex +/titleps.sty +/titlesec.sty +/titlesec.zip +/titlesec/ +/titletoc.sty +/unittest_luamathparser.tex +/wallpaper.sty +/x11nam.def +/xcolor.dtx +/xcolor.ins +/xcolor.lox +/xcolor.pro +/xcolor.sty +/xcolor1.tex +/xcolor2.tex +/xcolor3.tex +/xcolor4.tex +/xstring.sty +/xstring.tex +/xxcolor.sty +/xy.sty +/xy.tex +/xy16textures.tex +/xy17oztex.tex +/xy2cell.tex +/xy389dict.pro +/xy389src.tar.gz +/xyall.tex +/xyarc.tex +/xyarrow.tex +/xyatip.mf +/xyatip10.afm +/xyatip10.mf +/xyatip10.pfb +/xyatip10.pfm +/xyatip10.tfm +/xyatri.mf +/xybarr.tex +/xybsql10.afm +/xybsql10.mf +/xybsql10.pfb +/xybsql10.pfm +/xybsql10.tfm +/xybtip.mf +/xybtip10.afm +/xybtip10.mf +/xybtip10.pfb +/xybtip10.pfm +/xybtip10.tfm +/xybtri.mf +/xycirc.enc +/xycirc10.afm +/xycirc10.mf +/xycirc10.pfb +/xycirc10.pfm +/xycirc10.tfm +/xycm.mf +/xycmactex.tex +/xycmat10.afm +/xycmat10.mf +/xycmat10.pfb +/xycmat10.pfm +/xycmat10.tfm +/xycmat11.afm +/xycmat11.mf +/xycmat11.pfb +/xycmat11.pfm +/xycmat11.tfm +/xycmat12.afm +/xycmat12.mf +/xycmat12.pfb +/xycmat12.pfm +/xycmat12.tfm +/xycmbt10.afm +/xycmbt10.mf +/xycmbt10.pfb +/xycmbt10.pfm +/xycmbt10.tfm +/xycmbt11.afm +/xycmbt11.mf +/xycmbt11.pfb +/xycmbt11.pfm +/xycmbt11.tfm +/xycmbt12.afm +/xycmbt12.mf +/xycmbt12.pfb +/xycmbt12.pfm +/xycmbt12.tfm +/xycmtip.tex +/xycolor.tex +/xycrayon.tex +/xycurve.tex +/xyd.enc +/xyd.mf +/xyd2.enc +/xyd2.mf +/xydash10.afm +/xydash10.mf +/xydash10.pfb +/xydash10.pfm +/xydash10.tfm +/xydummy.tex +/xydvidrv.tex +/xydvips.tex +/xydvitops.tex +/xyemtex.tex +/xyeuat10.afm +/xyeuat10.mf +/xyeuat10.pfb +/xyeuat10.pfm +/xyeuat10.tfm +/xyeuat11.afm +/xyeuat11.mf +/xyeuat11.pfb +/xyeuat11.pfm +/xyeuat11.tfm +/xyeuat12.afm +/xyeuat12.mf +/xyeuat12.pfb +/xyeuat12.pfm +/xyeuat12.tfm +/xyeubt10.afm +/xyeubt10.mf +/xyeubt10.pfb +/xyeubt10.pfm +/xyeubt10.tfm +/xyeubt11.afm +/xyeubt11.mf +/xyeubt11.pfb +/xyeubt11.pfm +/xyeubt11.tfm +/xyeubt12.afm +/xyeubt12.mf +/xyeubt12.pfb +/xyeubt12.pfm +/xyeubt12.tfm +/xyeuler.mf +/xyframe.tex +/xygraph.tex +/xyguide.pdf +/xyidioms.tex +/xyimport.tex +/xyknot.tex +/xyline.tex +/xyline10.mf +/xyline10.tfm +/xylu.mf +/xyluat10.afm +/xyluat10.mf +/xyluat10.pfb +/xyluat10.pfm +/xyluat10.tfm +/xyluat11.afm +/xyluat11.mf +/xyluat11.pfb +/xyluat11.pfm +/xyluat11.tfm +/xyluat12.afm +/xyluat12.mf +/xyluat12.pfb +/xyluat12.pfm +/xyluat12.tfm +/xylubt10.afm +/xylubt10.mf +/xylubt10.pfb +/xylubt10.pfm +/xylubt10.tfm +/xylubt11.afm +/xylubt11.mf +/xylubt11.pfb +/xylubt11.pfm +/xylubt11.tfm +/xylubt12.afm +/xylubt12.mf +/xylubt12.pfb +/xylubt12.pfm +/xylubt12.tfm +/xymacpat.xyp +/xymatrix.tex +/xymisc10.mf +/xymisc10.tfm +/xymovie.tex +/xynecula.tex +/xyoztex.tex +/xypdf-co.tex +/xypdf-cu.tex +/xypdf-fr.tex +/xypdf-li.tex +/xypdf-ro.tex +/xypdf.pdf +/xypdf.tex +/xypic.map +/xypic.sty +/xypic.tex +/xypic.zip +/xypic/ +/xypicture.tex +/xypoly.tex +/xyps-c.tex +/xyps-col.tex +/xyps-f.tex +/xyps-l.tex +/xyps-pro.tex +/xyps-ps.tex +/xyps-r.tex +/xyps-s.tex +/xyps-t.tex +/xyps.tex +/xypsdict.tex +/xypspatt.tex +/xyqc10.mf +/xyqc10.tfm +/xyrecat.tex +/xyrefer.pdf +/xyrotate.tex +/xysmart.tex +/xysource.pdf +/xytech.mf +/xytextures.tex +/xytile.tex +/xytips.tex +/xytp-f.tex +/xytpic.tex +/xyv2.tex +/xyweb.tex +/xyxdvi.tex diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..8a07ab3e185fa32ba3e0266946c5e8cfe2b37ab6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,47 @@ +language: c + +sudo: true + +cache: + directories: + - $HOME/.cache/latex + +addons: + apt: + packages: + - wget + - curl + - sed + - grep + - texlive + - texlive-generic-extra + - texlive-latex-base + - texlive-latex-extra + - texlive-latex-recommended + - texlive-math-extra + - texlive-metapost + - texlive-omega + - texlive-plain-extra + - texlive-xetex + +env: + global: + - secure: "ehec8FC6y923UXtB2fMULF/xkQJkwWwzD6xFxyz0lc80IqR8Rmxh16nLKGxI9jD11qjbYSzp1yPVadXyBoSheop5aZPxeXixL49y26ikIRkyuQQdHyjsM34etoPmCKw2vVXvD+JAwjTa6qYpihSOdDXltog8ZNHF6Wp28ZaWW8g=" + +matrix: + include: + # only one of these should have UPDATE_ERRATA set to "yes", otherwise we risk race conditions on pushing + - env: LATEXMK="yes" UPDATE_ERRATA="" UPDATE_NIGHTLIES="" TARGETS="" + - env: LATEXMK="" UPDATE_ERRATA="yes" UPDATE_NIGHTLIES="yes" TARGETS="" + - env: LATEXMK="" UPDATE_ERRATA="" UPDATE_NIGHTLIES="" TARGETS="dvi" + +install: + - if test "$LATEXMK" = yes ; then sudo apt-get install latexmk ; fi + +script: make $TARGETS + +# add -f to force a push even if we're not on HoTT/HoTT. +# generally only useful for debugging +after_script: + - etc/ci/update_errata.sh + - etc/ci/update_nightlies.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..0442e8e60de056b353aa5711b2756c156d4d9e68 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,79 @@ +We are very happy to receive suggestions which fix typos, formatting, +and obvious mathematical errors; which clarify exposition in a +straightforward way; or which add new technical functionality (such as +versions for other devices). We are not asking for new mathematical +content from the public at this time. + +We are very grateful to everyone who is showing interest in our project, +and to anyone who helps us improve it! However, in order to avoid any +misunderstanding later, we should mention upfront that your +contributions will only be recorded on github commit logs, but not in +the book itself (because the book is officially an IAS project). + +Note that the version of the book you are working from (including the +version posted on the public web site) may not be the most recent one. +If you've found an error and want to check whether it has already been +corrected in the most recent version, you may need to clone the git +repository and compile the sources yourself, or else look at the +source code on github. + +If you only want to point out the existence of an error or make a +general suggestion, you can open an issue on the github project. The +authors will (eventually) respond and either implement a fix or decide +that no fix is necessary. If you would like to fix an error yourself +or suggest a specific concrete change, you can fork the github +project, commit the change in a branch on your fork, and open a pull +request to the parent project. + +Please make sure that your pull request is attached to the correct +branch. Changes which add new mathematics, or which alter the +numbering of existing sections, theorems, or equations, must wait for +the second edition. Other changes, as long as they are not of +unreasonable size, can be released as updates to the first edition. +To ensure that your change does not alter existing numberings, you can +run "make labelcheck". + +Corrections of mathematical typos and other errors, as well as changes +in exposition, should also be listed in the errata for the first +edition (`errata.tex`). + +- The first column in the errata table should be the nearest + surrounding numbered label, be it a section, theorem, or exercise. + +- The second column is obtained by running `git describe` on the + commit where the fix was merged into the master branch. You don't + know this when writing your fix, of course, so the correct thing to + put here is a comment of the form + + % merge of 1234567 + + where `1234567` is the commit hash in which you made the fix. (This + necessitates making two commits, one to make the fix and one to + record the erratum.) Please use _exactly_ this syntax so that it can + be automatically updated by the errata-marking script. + +- The third column is a description of the change. Please be specific + enough that someone looking at only a printed version (which may + have page breaks in different places) could easily find its + location. + +It is generally a good idea not to submit github pull requests from +your master branch. This is because whatever branch you submit a pull +request from, any new commits on that branch that happen before the +pull request is merged get added to the pull request. Thus, if you +submit pull requests from your master branch, you cannot have multiple +unrelated pull requests open at once, or do unrelated work on your +master branch before your pull request is merged. To create a special +branch for your pull request, run + + git checkout -b BRANCHNAME + +Make your commits in that branch, then run + + git push origin BRANCHNAME:BRANCHNAME + +assuming that your git remote `origin` is set up to be your github +fork (rather than the main `HoTT/book` repository). The main page of +your github fork should then have a little prompt asking you whether +you want to issue a pull request from your most recently pushed +branch. diff --git a/CONVENTIONS.txt b/CONVENTIONS.txt new file mode 100644 index 0000000000000000000000000000000000000000..7404b48c5f0ace004873aebff1ffd5a9fe5fda9e --- /dev/null +++ b/CONVENTIONS.txt @@ -0,0 +1,71 @@ + Authorial conventions for the HoTT Book + +1. To denote equality/identity/path types, you can write simply "=" + infix. Of course, this works for chains of equalities "a=b=c=d" + and also vertically-stacked ones. An alternative notation is + "\id{x}{y}", or "\id[A]{x}{y}" if you want to notate the type to + which x and y belong; this notation might produce "x=y" or + "Id(x,y)" in the future. If you want to be sure of producing + "Id(x,y)", write instead "\idtype{x}{y}" or "\idtype[A]{x}{y}". + Note that single-character non-optional arguments do not need + braces, so you can write "\idtype xy", but you need to write + "\idtype{(x+1)^2}{x^2+2x+1}". + +2. There are two macros that denote definitional/judgmental equality. + \jdeq or \judgeq should be used for an equality judgment being made + about two extant terms, while \defeq should be used when the + left-hand side is currently being defined to equal the right-hand + side. Both are used infix, and currently produce \equiv and + \coloneqq (that is, :=), respectively. + +3. Here is a cheatsheet of some more macros. Arguments in [brackets] + are optional and can be omitted. + + x = y identity type (fixed notation "x=y") + \id[A]{x}{y} identity type (agnostic notation) + \idtype[A]{x}{y} identity type (fixed notation "Id(x,y)") + x \jdeq y x is judged to be definitionally equal to y + x \defeq y x is currently being defined to equal y + \refl{x} reflexivity term at x + p \ct q concatenation of equalities p and q (diagrammatic order) + \opp{p} or \rev{p} the opposite equality of p + \trans{p}{x} covariant transport of x along p + \map{f}{p} map the path p under the function f + \mapdep{f}{p} likewise, for a dependently typed function f + \idfunc[A] the identity function of a type A + \eqv{A}{B} the type of equivalences from A to B + \type,\set,\prop universes of types, sets, and propositions + +3. In the style of a textbook or lecture notes, generally try to keep + citations and references out of the main text. Rather, each + chapter should have an unnumbered "Notes" section at the end + containing references to the literature and relevant comments. + References should go in the references.bib file in BibTeX format. + Use \cite for your citations so that they will all have a uniform + appearance. + +4. The following theorem-type environments are predefined: + + thm Theorem + cor Corollary + lem Lemma + defn Definition + rmk Remark + eg Example + egs Examples + ex Exercise + + When referring to a theorem defined elsewhere, use the macro + \autoref. This automatically produces words before numbers, such + as "Theorem 3.1", and automatically changes them if (for instance) + you change a theorem to a lemma. + + Similarly, try to add \label{}s to all of your theorem-environments + so that other people can refer to them. If you find yourself needing + a lemma that you think should appear in someone else's chapter, you + can add a stub to their chapter with a \label. Only the following + characters should be used in labels: letters, digits, colon : and + dash -. + +5. Each chapter is encouraged to also have an unnumbered section of + "Exercises" at the end. diff --git a/GIT_CHEATSHEET.txt b/GIT_CHEATSHEET.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b1be3c63cf9ce4ebddb63ec62c408cd41221b0a --- /dev/null +++ b/GIT_CHEATSHEET.txt @@ -0,0 +1,45 @@ +# SETUP 1: Install git +# see http:/git-scm.com/downloads +# Remember to set user.name and user.email: +git config --global user.name "James Bond" +git config --global user.email "007@mi6.gov.uk" + +# SETUP 2: signup for GitHub account +# see http://github.com +# Remember to email your username to: +# mshulman@ias.edu + +# SETUP 3: clone +cd dir_where_you_want_book_dir +git clone https://github.com/HoTT/book.git +cd book +#... + +# NOTE: Remaining commands must be run inside book/ + +# USAGE 1: add + commit +# To have git record your changes: +git commit -m "description of edit" + +# USAGE 2: pull +# To pull changes by others from GitHub: +# (Your local directory will still have your changes.) +# FIRST commit your changes as above, then +git pull + +# USAGE 3: compile + push +# To push your changes to GitHub: +# FIRST, commit your changes as above +# SECOND, pull changes from GitHub as above, then +latex main.tex +git push + + +# Which files did I change since the last commit? +git status + +# What changes did I make in those files? +git diff + +# Who wrote the crap in this file? +git blame diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..7f0762057ba0f458b9a7f6bc6e6af75931eca08b --- /dev/null +++ b/Makefile @@ -0,0 +1,192 @@ +.PHONY: default all clean version.tex dvi + +# Default top-level LaTeX to generate +DEFAULTTOPTEX = hott-online.tex + +# Top-level LaTeX files from which HoTT book can be generated +TOPTEXFILES = $(DEFAULTTOPTEX) hott-ustrade.tex hott-letter.tex hott-letter-exercises.tex hott-a4.tex hott-a4-exercises.tex hott-ebook.tex hott-ebook-wide.tex hott-ebook-narrow.tex hott-arxiv.tex + +# LaTeX files that actually comprise the book +# (that is, all of them except configuration) +BOOKTEXFILES = main.tex \ + macros.tex \ + version.tex \ + frontpage.tex \ + front.tex \ + preface.tex \ + introduction.tex \ + preliminaries.tex \ + basics.tex \ + logic.tex \ + equivalences.tex \ + induction.tex \ + hits.tex \ + hlevels.tex \ + homotopy.tex \ + categories.tex \ + setmath.tex \ + reals.tex \ + formal.tex \ + symbols.tex \ + back.tex \ + blurb.tex + +# Configuration files +OPTFILES = opt-letter.tex \ + opt-a4.tex \ + opt-ustrade.tex \ + opt-ebook.tex \ + opt-ebook-wide.tex \ + opt-ebook-narrow.tex \ + opt-color.tex \ + opt-black-white.tex \ + opt-cover.tex \ + opt-no-cover.tex \ + opt-bastard.tex \ + opt-no-bastard.tex + +# Image files +LORESPNGFILES = cover-lores-back-bw.png \ + cover-lores-back.png \ + cover-lores-front-bw.png \ + cover-lores-front.png \ + cover-lores.png \ + torus-lores-bw.png +HIRESPNGFILES = cover-hires-back-bw.png \ + cover-hires-back.png \ + cover-hires-front-bw.png \ + cover-hires-front.png \ + cover-hires.png \ + cover-hires-bw.png \ + torus-hires-bw.png + +# All the LaTeX files for the HoTT book in order of dependency +TEXFILES = $(TOPTEXFILES) $(BOOKTEXFILES) $(OPTFILES) + +# aux files to be used when combining info from HoTT book with +# exercises +BOOKAUXFILES := $(BOOKTEXFILES:.tex=.aux) + +# PDF and DVI files corresponding to HoTT book files +TOPPDFFILES:=$(TOPTEXFILES:.tex=.pdf) +TOPDVIFILES:=$(TOPTEXFILES:.tex=.dvi) + +# Default PDF file to make +DEFAULTPDF:=$(DEFAULTTOPTEX:.tex=.pdf) + +default: $(DEFAULTPDF) + +all: $(TOPPDFFILES) exercise_solutions.pdf errata.pdf cover-lulu-hardcover.pdf cover-lulu-paperback.pdf cover-letter.pdf cover-a4.pdf + +dvi: $(TOPDVIFILES) exercise_solutions.dvi errata.dvi cover-lulu-hardcover.dvi cover-lulu-paperback.dvi cover-letter.dvi cover-a4.dvi + +# Main targets +$(TOPPDFFILES) : %.pdf : %.tex $(TEXFILES) references.bib cover-lores-front.png cover-lores-back.png + if which latexmk > /dev/null 2>&1 ;\ + then latexmk -interaction=batchmode -g -pdf $< ;\ + else (echo "run 1: pdflatex $<"; pdflatex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) && \ + bibtex $(patsubst %.tex,%,$<) && \ + makeindex $(patsubst %.tex,%,$<) && \ + (echo "run 2: pdflatex $<"; pdflatex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) ;\ + pdflatex -halt-on-error $< ;\ + echo "HINT: If you think this took a long time you should install latexmk." ;\ + fi + +$(TOPDVIFILES) : %.dvi : %.tex $(TEXFILES) references.bib cover-lores-front.png cover-lores-back.png + if which latexmk > /dev/null 2>&1 ;\ + then latexmk -interaction=batchmode -dvi $< ;\ + else (echo "run 1: latex $<"; latex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) && \ + bibtex $(patsubst %.tex,%,$<) && \ + makeindex $(patsubst %.tex,%,$<) && \ + (echo "run 2: latex $<"; latex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) ;\ + latex -halt-on-error $< ;\ + echo "HINT: If you think this took a long time you should install latexmk." ;\ + fi + +all default: log-check +log-check: + : check for indexing errors + ! grep -n "!! Input index error" hott-online.ilg /dev/null + +version.tex: + printf '\\newcommand{\\OPTversion}{%s}\n' "`git describe --always --long`" > version.tex + +# these warnings are mostly spurious, and could have been prevented by a better makeindex algorithm +log-check-for-warnings: + : check for indexing warnings + - ! grep -n "## Warning" hott-online.ilg /dev/null + +$(BOOKAUXFILES) : %.aux : %.tex + echo "WARNING: assuming $@ is up-to-date" + +# Generate labels for the solutions +main.labels: $(BOOKAUXFILES) + cat $^ | grep ^.newlabel >$@ + +# Extract label numbers for verifying that they haven't changed within an edition. +# Discard symbol index numbers (not seen by user) and page numbers (we don't care about them). +main.labelnumbers: main.labels + sed 's/.*symindex.*//g' main.labels | sed 's/{\({[^}]*}\).*/\1/g' | sort >main.labelnumbers + +# Check that no labels have changed, by making sure that all label +# numbers from the first edition are still present +labelcheck: main.labelnumbers + diff -u main.labelnumbers.first-edition main.labelnumbers | grep '^-\\newlabel' && echo Some label numbers have changed since the first edition! + +cover-lulu-hardcover.pdf cover-lulu-paperback.pdf cover-letter.pdf cover-a4.pdf exercise_solutions.pdf errata.pdf : %.pdf : %.tex + if which latexmk > /dev/null 2>&1 ;\ + then latexmk -interaction=batchmode -pdf $<;\ + else pdflatex -halt-on-error $<; fi + +cover-lulu-hardcover.dvi cover-lulu-paperback.dvi cover-letter.dvi cover-a4.dvi exercise_solutions.dvi errata.dvi : %.dvi : %.tex + if which latexmk > /dev/null 2>&1 ;\ + then latexmk -interaction=batchmode -dvi $<;\ + else latex -halt-on-error $<; fi + +cover-lulu-hardcover.pdf cover-lulu-paperback.pdf cover-lulu-hardcover.dvi cover-lulu-paperback.dvi: cover-hires.png $(OPTFILES) + +cover-letter.pdf cover-a4.pdf cover-letter.dvi cover-a4.dvi: cover-lores-front.png cover-lores-back.png $(OPTFILES) + +hott-arxiv.tex: hott-online.tex main.tex + echo '% hott-arxiv.tex AUTOGENERATED FROM hott-online.tex AND main.tex' >hott-arxiv.tex + cat hott-online.tex >>hott-arxiv.tex + sed 's/\\input{main}//' hott-arxiv.tex.tmp + mv hott-arxiv.tex.tmp hott-arxiv.tex + cat main.tex >>hott-arxiv.tex + +hott-arxiv.tar.gz: hott-arxiv.pdf + tar -czf hott-arxiv.tar.gz hott-arxiv.tex hott-arxiv.bbl hott-arxiv.ind $(BOOKTEXFILES) $(OPTFILES) $(LORESPNGFILES) mathpartir.sty + +exercise_solutions.pdf exercise_solutions.dvi: main.labels + +errata.pdf errata.dvi: version.tex main.labels + +clean: + rm -f *~ *.aux {exercise_solutions,errata,hott-*}.{out,log,pdf,dvi,fls,fdb_latexmk,aux,brf,bbl,idx,ilg,ind,toc,sed} + if which latexmk > /dev/null 2>&1 ; then latexmk -interaction=batchmode -C hott-*.tex; fi + +# list the tex files explicitly because: +# - we want to tag them in the same order they appear in the book, so tag search is in logical sequence +# - there are many *.tex garbage files in this directory +TAGS: $(TEXFILES) exercise_solutions.tex errata.tex + etags $^ -o $@.tmp + mv $@.tmp $@ + +indexterms.txt: \ + other/index-helper.py \ + front.tex \ + preface.tex \ + introduction.tex \ + preliminaries.tex \ + basics.tex \ + logic.tex \ + equivalences.tex \ + induction.tex \ + hits.tex \ + hlevels.tex \ + homotopy.tex \ + categories.tex \ + setmath.tex \ + reals.tex \ + formal.tex + other/index-helper.py >$@ diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a607fed320b651d63dd0cb3644db87e6ab2028da --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +This is a textbook on informal homotopy type theory. +It is part of the [Univalent foundations of mathematics](http://www.math.ias.edu/sp/univalent) +project that took place at the Institute for Advanced Study in 2012/13. + +## License + +This work is licensed under the +[Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/). + +## Distribution + +Compiled and printed versions of the book are available at the +[homotopy type theory website](http://homotopytypetheory.org/book), +and nightly builds are available on the +[github wiki](https://github.com/HoTT/book/wiki/Nightly-Builds). + +## Editing the book + +This book is not a community project, but we do welcome our readers to suggest improvements. The best way to propose an edit is to [open a pull request](https://github.com/HoTT/book/compare) with your suggested change. You can also [open an issue](https://github.com/HoTT/book/issues/new/choose) if you do not have a concrete proposal yet. The issues and the pull requests are dedicated to improvements, questions, and other issues pertaining to the HoTT book itself. General discussions about homotopy type theory and topics related to the wider HoTT community are welcome at the [homotopytypetheory google group](https://groups.google.com/g/homotopytypetheory) or at the [HoTT zulip](https://hott.zulipchat.com). For further directions about editing the book, see the [guidelines for contributions](https://github.com/HoTT/book/blob/master/CONTRIBUTING.md) + +## Code of conduct + +For many, the HoTT book is their introduction to our subject and our diverse community, including people from any nationality, gender identity, sexual orientation, race, color, ability, and background. In order to ensure for everyone a welcoming and inclusive environment in our discussions, we follow the guidelines of the [GitHub code of conduct](https://docs.github.com/en/site-policy/github-terms/github-community-forum-code-of-conduct). You can expect from the authors and any participant that we are kind and respectful in discussions, that we use inclusive language, and that we do our best to understand each other's different perspectives. It might not always be that we accept the change in the way you proposed it, but we always value your input, regardless of your level of experience or status within the community. + +## Prerequisites and compilation + +To compile the book for yourself you need a fairly new version of LaTeX. +[Texlive](http://www.tug.org/texlive/) 2012 is confirmed to work. You might need +to install some packages; see `main.tex` for packages that are used by the book. + +[BasicTeX](http://www.tug.org/mactex/morepackages.html), which is a minimalistic +version of MacTeX, is confirmed to work once the following packages have been +installed: `tlmgr`, `install`, `braket`, `comment`, `courier`, `enumitem`, +`helvetic`, `mathpazo`, `nextpage`, `ntheorem`, `palatino`, `rsfs`, `stmaryrd`, +`symbol`, `titlesec`, `wallpaper`, `wasy`, `wasysym`, `xstring`, `zapfding`. + +You also need the `make` utility. The book is a fairly complex piece of LaTeX +code. Also, the file `version.tex` is generated on the fly, so you will need the +`make` utility with which you can compile the main files, as follows: + +* `make hott-online.pdf` -- the book appropriate for online reading, with colors and green links +* `make hott-ebook.pdf` -- the book with small margins, suitable for ebook readers +* `make hott-ebook-wide.pdf` -- the book with small margins, suitable for ebook readers, wider page +* `make hott-ebook-narrow.pdf` -- the book with small margins, suitable for ebook readers, narrower page +* `make hott-letter.pdf cover-letter.pdf` -- the book in black & white, letter paper format, + for printing at home, as well as a color cover (just two pages) +* `make hott-a4.pdf cover-a4.pdf` -- the book in black & white, A4 paper format, + for printing at home, as well as a color cover (just two pages) +* `make hott-arxiv.pdf` -- the version that is uploaded to arXiv +* `make hott-letter-exercises.pdf` -- the book in black & white, letter paper format, but with exercises one-per-page +* `make hott-a4-exercises.pdf` -- the book in black & white, A4 paper format, but with exercises one-per-page +* `make hott-ustrade.pdf cover-lulu-hardcover.pdf cover-lulu-paperback.pdf` -- + the book in US Trade format, without cover, used for the bound copy available + at http://lulu.com/ +* `make exercise_solutions.pdf` -- (some) solutions to exercises +* `make errata.pdf` -- errata for the HoTT Book, first edition + +Note: once `make` is run so that `version.tex` is generated, you need not run `make` every time you make +a change to the source file. You can just perform the usual LaTeX cycle from your favorite editor. + +#### Compiling without `make` + +If you do not have `make` (for example, because you are on MacOS and you did not +install the XCode command-line utilities), you can still fake it as follows. +Create the file `version.tex` and put in it (where "Joe Hacker" should be +replaced with your name): + + \newcommand{\OPTversion}{Joe-Hacker-version} + +Then use whatever tools you normally do to compile LaTeX. The main LaTeX files are called +`hott-XXX.tex`. But you really should have `make`, you know. + diff --git a/back.tex b/back.tex new file mode 100644 index 0000000000000000000000000000000000000000..0a57b674f7ffef2ba54d9e161eda236686194070 --- /dev/null +++ b/back.tex @@ -0,0 +1,17 @@ +\ifOPTcover +\cleartooddpage[\thispagestyle{empty}] +\pagestyle{empty} +\cleartoevenpage + +%%%%%%%%%%%%%%%%%%%% Back cover %%%%%%%%%%%%%%%%%%%% +\ThisLRCornerWallPaper{0.7}{\OPTbackimage} +\pagecolor{covercolor} +\color{covertext} +\input{blurb.tex} +\else +\fi + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "hott-online" +%%% End: diff --git a/basics.tex b/basics.tex new file mode 100644 index 0000000000000000000000000000000000000000..90f80eaa444c90137865efacbb2d0108dad00070 --- /dev/null +++ b/basics.tex @@ -0,0 +1,2699 @@ +\chapter{Homotopy type theory} +\label{cha:basics} + +The central new idea in homotopy type theory is that types can be regarded as +spaces in homotopy theory, or higher-dimensional groupoids in category +theory. + +\index{classical!homotopy theory|(} +\index{higher category theory|(} +We begin with a brief summary of the connection between homotopy theory +and higher-dimensional category theory. +In classical homotopy theory, a space $X$ is a set of points equipped +with a topology, +\indexsee{space!topological}{topological space} +\index{topological!space} +and a path between points $x$ and $y$ is represented by +a continuous map $p : [0,1] \to X$, where $p(0) = x$ and $p(1) = y$. +\index{path!topological} +\index{topological!path} +This function can be thought of as giving a point in $X$ at each +``moment in time''. For many purposes, strict equality of paths +(meaning, pointwise equal functions) is too fine a notion. For example, +one can define operations of path concatenation (if $p$ is a path from +$x$ to $y$ and $q$ is a path from $y$ to $z$, then the concatenation $p +\ct q$ is a path from $x$ to $z$) and inverses ($\opp p$ is a path +from $y$ to $x$). However, there are natural equations between these +operations that do not hold for strict equality: for example, the path +$p \ct \opp p$ (which walks from $x$ to $y$, and then back along the +same route, as time goes from $0$ to $1$) is not strictly equal to the +identity path (which stays still at $x$ at all times). + +The remedy is to consider a coarser notion of equality of paths called +\emph{homotopy}. +\index{homotopy!topological} +A homotopy between a pair of continuous maps $f : +X_1 \to X_2$ and $g : X_1\to X_2$ is a continuous map $H : X_1 +\times [0, 1] \to X_2$ satisfying $H(x, 0) = f (x)$ and $H(x, 1) = +g(x)$. In the specific case of paths $p$ and $q$ from $x$ to $y$, a homotopy is a +continuous map $H : [0,1] \times [0,1] \rightarrow X$ +such that $H(s,0) = p(s)$ and $H(s,1) = q(s)$ for all $s\in [0,1]$. +In this case we require also that $H(0,t) = x$ and $H(1,t)=y$ for all $t\in [0,1]$, +so that for each $t$ the function $H(\blank,t)$ is again a path from $x$ to $y$; +a homotopy of this sort is said to be \emph{endpoint-preserving} or \emph{rel endpoints}. +In simple cases, we can think of the image of the square $[0,1]\times [0,1]$ under $H$ as ``filling the space'' between $p$ and $q$, although for general $X$ this doesn't really make sense; it is better to think of $H$ as a continuous deformation of $p$ into $q$ that doesn't move the endpoints. +Since $[0,1]\times [0,1]$ is 2-dimensional, we also speak of $H$ as a 2-dimensional \emph{path between paths}.\index{path!2-} + +For example, because +$p \ct \opp p$ walks out and back along the same route, you know that +you can continuously shrink $p \ct \opp p$ down to the identity +path --- it won't, for example, get snagged around a hole in the space. +Homotopy is an equivalence relation, and operations such as +concatenation, inverses, etc., respect it. Moreover, the homotopy +equivalence classes of loops\index{loop} at some point $x_0$ (where two loops $p$ +and $q$ are equated when there is a \emph{based} homotopy between them, +which is a homotopy $H$ as above that additionally satisfies $H(0,t) = +H(1,t) = x_0$ for all $t$) form a group called the \emph{fundamental + group}.\index{fundamental!group} This group is an \emph{algebraic invariant} of a space, which +can be used to investigate whether two spaces are \emph{homotopy + equivalent} (there are continuous maps back and forth whose composites +are homotopic to the identity), because equivalent spaces have +isomorphic fundamental groups. + +Because homotopies are themselves a kind of 2-dimensional path, there is +a natural notion of 3-dimensional \emph{homotopy between homotopies},\index{path!3-} +and then \emph{homotopy between homotopies between homotopies}, and so +on. This infinite tower of points, paths, homotopies, homotopies between +homotopies, \ldots, equipped with algebraic operations such as the +fundamental group, is an instance of an algebraic structure called a +(weak) \emph{$\infty$-groupoid}. An $\infty$-groupoid\index{.infinity-groupoid@$\infty$-groupoid} consists of a +collection of objects, and then a collection of \emph{morphisms}\indexdef{morphism!in an .infinity-groupoid@in an $\infty$-groupoid} between +objects, and then \emph{morphisms between morphisms}, and so on, +equipped with some complex algebraic structure; a morphism at level $k$ is called a \define{$k$-morphism}\indexdef{k-morphism@$k$-morphism}. Morphisms at each level +have identity, composition, and inverse operations, which are weak in +the sense that they satisfy the groupoid laws (associativity of +composition, identity is a unit for composition, inverses cancel) only +up to morphisms at the next level, and this weakness gives rise to +further structure. For example, because associativity of composition of +morphisms $p \ct (q \ct r) = (p \ct q) \ct r$ is itself a +higher-dimensional morphism, one needs an additional operation relating +various proofs of associativity: the various ways to reassociate $p \ct +(q \ct (r \ct s))$ into $((p \ct q) \ct r) \ct s$ give rise to Mac +Lane's pentagon\index{pentagon, Mac Lane}. Weakness also creates non-trivial interactions between +levels. + +Every topological space $X$ has a \emph{fundamental $\infty$-groupoid} +\index{.infinity-groupoid@$\infty$-groupoid!fundamental} +\index{fundamental!.infinity-groupoid@$\infty$-groupoid} +whose +$k$-mor\-ph\-isms are the $k$-dimen\-sional paths in $X$. The weakness of the +$\infty$-group\-oid corresponds directly to the fact that paths form a +group only up to homotopy, with the $(k+1)$-paths serving as the +homotopies between the $k$-paths. Moreover, the view of a space as an +$\infty$-groupoid preserves enough aspects of the space to do homotopy theory: +the fundamental $\infty$-groupoid construction is adjoint\index{adjoint!functor} to the +geometric\index{geometric realization} realization of an $\infty$-groupoid as a space, and this +adjunction preserves homotopy theory (this is called the \emph{homotopy + hypothesis/theorem}, +\index{hypothesis!homotopy}% +\index{homotopy!hypothesis}% +because whether it is a hypothesis or theorem +depends on how you define $\infty$-groupoid). For example, you can +easily define the fundamental group of an $\infty$-groupoid, and if you +calculate the fundamental group of the fundamental $\infty$-groupoid of +a space, it will agree with the classical definition of fundamental +group of that space. Because of this correspondence, homotopy theory +and higher-dimensional category theory are intimately related. + +\index{classical!homotopy theory|)}% +\index{higher category theory|)}% + +\mentalpause + +Now, in homotopy type theory each type can be seen to have the structure +of an $\infty$-groupoid. Recall that for any type $A$, and any $x,y:A$, +we have an identity type $\id[A]{x}{y}$, also written $\idtype[A]{x}{y}$ +or just $x=y$. Logically, we may think of elements of $x=y$ as evidence +that $x$ and $y$ are equal, or as identifications of $x$ with +$y$. Furthermore, type theory (unlike, say, first-order logic) allows us +to consider such elements of $\id[A]{x}{y}$ also as individuals which +may be the subjects of further propositions. Therefore, we can +\emph{iterate} the identity type: we can form the type +$\id[{(\id[A]{x}{y})}]{p}{q}$ of identifications between +identifications $p,q$, and the type +$\id[{(\id[{(\id[A]{x}{y})}]{p}{q})}]{r}{s}$, and so on. The structure +of this tower of identity types corresponds precisely to that of the +continuous paths and (higher) homotopies between them in a space, or an +$\infty$-groupoid.\index{.infinity-groupoid@$\infty$-groupoid} + + +Thus, we will frequently refer to an element $p : \id[A]{x}{y}$ as +a \define{path} +\index{path} +from $x$ to $y$; we call $x$ its \define{start point} +\indexdef{start point of a path} +\indexdef{path!start point of} +and $y$ its \define{end point}. +\indexdef{end point of a path} +\indexdef{path!end point of} +Two paths $p,q : \id[A]{x}{y}$ with the same start and end point are said to be \define{parallel}, +\indexdef{parallel paths} +\indexdef{path!parallel} +in which case an element $r : \id[{(\id[A]{x}{y})}]{p}{q}$ can +be thought of as a homotopy, or a morphism between morphisms; +we will often refer to it as a \define{2-path} +\indexdef{path!2-}\indexsee{2-path}{path, 2-}% +or a \define{2-dimensional path}. +\index{dimension!of paths}% +\indexsee{2-dimensional path}{path, 2-}\indexsee{path!2-dimensional}{path, 2-}% +Similarly, $\id[{(\id[{(\id[A]{x}{y})}]{p}{q})}]{r}{s}$ is the type of +\define{3-dimensional paths} +\indexdef{path!3-}\indexsee{3-path}{path, 3-}\indexsee{3-dimensional path}{path, 3-}\indexsee{path!3-dimensional}{path, 3-}% +between two parallel 2-dimensional paths, and so on. If the +type $A$ is ``set-like'', such as \nat, these iterated identity types +will be uninteresting (see \cref{sec:basics-sets}), but in the +general case they can model non-trivial homotopy types. + +%% (Obviously, the +%% notation ``$\id[A]{x}{y}$'' has its limitations here. The style +%% $\idtype[A]{x}{y}$ is only slightly better in iterations: +%% $\idtype[{\idtype[{\idtype[A]{x}{y}}]{p}{q}}]{r}{s}$.) + +An important difference between homotopy type theory and classical homotopy theory is that homotopy type theory provides a \emph{synthetic} +\index{synthetic mathematics}% +\index{geometry, synthetic}% +\index{Euclid of Alexandria}% +description of spaces, in the following sense. Synthetic geometry is geometry in the style of Euclid~\cite{Euclid}: one starts from some basic notions (points and lines), constructions (a line connecting any two points), and axioms +(all right angles are equal), and deduces consequences logically. This is in contrast with analytic +\index{analytic mathematics}% +geometry, where notions such as points and lines are represented concretely using cartesian coordinates in $\R^n$ --- lines are sets of points --- and the basic constructions and axioms are derived from this representation. While classical homotopy theory is analytic (spaces and paths are made of points), homotopy type theory is synthetic: points, paths, and paths between paths are basic, indivisible, primitive notions. + +Moreover, one of the amazing things about homotopy type theory is that all of the basic constructions and axioms --- all of the +higher groupoid structure --- arises automatically from the induction +principle for identity types. +Recall from \cref{sec:identity-types} that this says that if +\begin{itemize} +\item for every $x,y:A$ and every $p:\id[A]xy$ we have a type $D(x,y,p)$, and +\item for every $a:A$ we have an element $d(a):D(a,a,\refl a)$, +\end{itemize} +then +\begin{itemize} +\item there exists an element $\indid{A}(D,d,x,y,p):D(x,y,p)$ for \emph{every} two elements $x,y:A$ and $p:\id[A]xy$, such that $\indid{A}(D,d,a,a,\refl a) \jdeq d(a)$. +\end{itemize} +In other words, given dependent functions +\begin{align*} +D & :\prd{x,y:A} (\id{x}{y}) \to \type\\ +d & :\prd{a:A} D(a,a,\refl{a}) +\end{align*} +there is a dependent function +\[\indid{A}(D,d):\prd{x,y:A}{p:\id{x}{y}} D(x,y,p)\] +such that +\begin{equation}\label{eq:Jconv} +\indid{A}(D,d,a,a,\refl{a})\jdeq d(a) +\end{equation} +for every $a:A$. +Usually, every time we apply this induction rule we will either not care about the specific function being defined, or we will immediately give it a different name. + +Informally, the induction principle for identity types says that if we want to construct an object (or prove a statement) which depends on an inhabitant $p:\id[A]xy$ of an identity type, then it suffices to perform the construction (or the proof) in the special case when $x$ and $y$ are the same (judgmentally) and $p$ is the reflexivity element $\refl{x}:x=x$ (judgmentally). +When writing informally, we may express this with a phrase such as ``by induction, it suffices to assume\dots''. +This reduction to the ``reflexivity case'' is analogous to the reduction to the ``base case'' and ``inductive step'' in an ordinary proof by induction on the natural numbers, and also to the ``left case'' and ``right case'' in a proof by case analysis on a disjoint union or disjunction.\index{induction principle!for identity type}% + + +The ``conversion rule''~\eqref{eq:Jconv} is less familiar in the context of proof by induction on natural numbers, but there is an analogous notion in the related concept of definition by recursion. +If a sequence\index{sequence} $(a_n)_{n\in \mathbb{N}}$ is defined by giving $a_0$ and specifying $a_{n+1}$ in terms of $a_n$, then in fact the $0^{\mathrm{th}}$ term of the resulting sequence \emph{is} the given one, and the given recurrence relation relating $a_{n+1}$ to $a_n$ holds for the resulting sequence. +(This may seem so obvious as to not be worth saying, but if we view a definition by recursion as an algorithm\index{algorithm} for calculating values of a sequence, then it is precisely the process of executing that algorithm.) +The rule~\eqref{eq:Jconv} is analogous: it says that if we define an object $f(p)$ for all $p:x=y$ by specifying what the value should be when $p$ is $\refl{x}:x=x$, then the value we specified is in fact the value of $f(\refl{x})$. + +This induction principle endows each type with the structure of an $\infty$-groupoid\index{.infinity-groupoid@$\infty$-groupoid}, and each function between two types with the structure of an $\infty$-functor\index{.infinity-functor@$\infty$-functor} between two such groupoids. This is interesting from a mathematical point of view, because it gives a new way to work with +$\infty$-groupoids. It is interesting from a type-theoretic point of view, because it reveals new operations that are associated with each type and function. In the remainder of this chapter, we begin to explore this structure. + +\section{Types are higher groupoids} +\label{sec:equality} + +\index{type!identity|(}% +\index{path|(}% +\index{.infinity-groupoid@$\infty$-groupoid!structure of a type|(}% +We now derive from the induction principle the beginnings of the structure of a higher groupoid. +We begin with symmetry of equality, which, in topological language, means that ``paths can be reversed''. + +\begin{lem}\label{lem:opp} + For every type $A$ and every $x,y:A$ there is a function + \begin{equation*} + (x= y)\to(y= x) + \end{equation*} + denoted $p\mapsto \opp{p}$, such that $\opp{\refl{x}}\jdeq\refl{x}$ for each $x:A$. + We call $\opp{p}$ the \define{inverse} of $p$. + \indexdef{path!inverse}% + \indexdef{inverse!of path}% + \index{equality!symmetry of}%a + \index{symmetry!of equality}% +\end{lem} + +Since this is our first time stating something as a ``Lemma'' or ``Theorem'', let us pause to consider what that means. +Recall that propositions (statements susceptible to proof) are identified with types, whereas lemmas and theorems (statements that have been proven) are identified with \emph{inhabited} types. +Thus, the statement of a lemma or theorem should be translated into a type, as in \cref{sec:pat}, and its proof translated into an inhabitant of that type. +According to the interpretation of the universal quantifier ``for every'', the type corresponding to \cref{lem:opp} is +\[ \prd{A:\UU}{x,y:A} (x= y)\to(y= x). \] +The proof of \cref{lem:opp} will consist of constructing an element of this type, i.e.\ deriving the judgment $f:\prd{A:\UU}{x,y:A} (x= y)\to(y= x)$ for some $f$. +We then introduce the notation $\opp{(\blank)}$ for this element $f$, in which the arguments $A$, $x$, and $y$ are omitted and inferred from context. +(As remarked in \cref{sec:types-vs-sets}, the secondary statement ``$\opp{\refl{x}}\jdeq\refl{x}$ for each $x:A$'' should be regarded as a separate judgment.) + +\begin{proof}[First proof] + Assume given $A:\UU$, and + let $D:\prd{x,y:A}(x= y) \to \type$ be the type family defined by $D(x,y,p)\defeq (y= x)$. + In other words, $D$ is a function assigning to any $x,y:A$ and $p:x=y$ a type, namely the type $y=x$. + Then we have an element + \begin{equation*} + d\defeq \lam{x} \refl{x}:\prd{x:A} D(x,x,\refl{x}). + \end{equation*} + Thus, the induction principle for identity types gives us an element + \narrowequation{ \indid{A}(D,d,x,y,p): (y= x)} + for each $p:(x= y)$. + We can now define the desired function $\opp{(\blank)}$ to be $\lam{p} \indid{A}(D,d,x,y,p)$, i.e.\ we set $\opp{p} \defeq \indid{A}(D,d,x,y,p)$. + The conversion rule~\eqref{eq:Jconv} gives $\opp{\refl{x}}\jdeq \refl{x}$, as required. +\end{proof} + +We have written out this proof in a very formal style, which may be helpful while the induction rule on identity types is unfamiliar. +To be even more formal, we could say that \cref{lem:opp} and its proof together consist of the judgment +\begin{narrowmultline*} + \lam{A}{x}{y}{p} \indid{A}((\lam{x}{y}{p} (y=x)), (\lam{x} \refl{x}), x, y, p) + \narrowbreak : \prd{A:\UU}{x,y:A} (x= y)\to(y= x) +\end{narrowmultline*} +(along with an additional equality judgment). +However, eventually we prefer to use more natural language, such as in the following equivalent proof. + +\begin{proof}[Second proof] + We want to construct, for each $x,y:A$ and $p:x=y$, an element $\opp{p}:y=x$. + By induction, it suffices to do this in the case when $y$ is $x$ and $p$ is $\refl{x}$. + But in this case, the type $x=y$ of $p$ and the type $y=x$ in which we are trying to construct $\opp{p}$ are both simply $x=x$. + Thus, in the ``reflexivity case'', we can define $\opp{\refl{x}}$ to be simply $\refl{x}$. + The general case then follows by the induction principle, and the conversion rule $\opp{\refl{x}}\jdeq\refl{x}$ is precisely the proof in the reflexivity case that we gave. +\end{proof} + +We will write out the next few proofs in both styles, to help the reader become accustomed to the latter one. +Next we prove the transitivity of equality, or equivalently we ``concatenate paths''. + +\begin{lem}\label{lem:concat} + For every type $A$ and every $x,y,z:A$ there is a function + \begin{equation*} + (x= y) \to (y= z)\to (x= z), + \end{equation*} + written $p \mapsto q \mapsto p\ct q$, such that $\refl{x}\ct \refl{x}\jdeq \refl{x}$ for any $x:A$. + We call $p\ct q$ the \define{concatenation} or \define{composite} of $p$ and $q$. + \indexdef{path!concatenation}% + \indexdef{path!composite}% + \indexdef{concatenation of paths}% + \indexdef{composition!of paths}% + \index{equality!transitivity of}% + \index{transitivity!of equality}% +\end{lem} + +Note that we choose to notate path concatenation in the opposite order from function composition: from $p:x=y$ and $q:y=z$ we get $p\ct q : x=z$, whereas from $f:A\to B$ and $g:B\to C$ we get $g\circ f : A\to C$ (see \cref{ex:composition}). + +\begin{proof}[First proof] + The desired function has type $\prd{x,y,z:A} (x= y) \to (y= z)\to (x= z)$. + We will instead define a function with the equivalent type $\prd{x,y:A} (x= y) \to \prd{z:A} (y= z)\to (x= z)$, which allows us to apply path induction twice. + Let $D:\prd{x,y:A} (x=y) \to \type$ be the type family + \begin{equation*} + D(x,y,p)\defeq \prd{z:A}{q:y=z} (x=z). + \end{equation*} + Note that $D(x,x,\refl x) \jdeq \prd{z:A}{q:x=z} (x=z)$. + Thus, in order to apply the induction principle for identity types to this $D$, we need a function of type + \begin{equation}\label{eq:concatD} + \prd{x:A} D(x,x,\refl{x}) + \end{equation} + which is to say, of type + \[ \prd{x,z:A}{q:x=z} (x=z). \] + Now let $E:\prd{x,z:A}{q:x=z}\type$ be the type family $E(x,z,q)\defeq (x=z)$. + Note that $E(x,x,\refl x) \jdeq (x=x)$. + Thus, we have the function + \begin{equation*} + e(x) \defeq \refl{x} : E(x,x,\refl{x}). + \end{equation*} + By the induction principle for identity types applied to $E$, we obtain a function + \begin{equation*} + d : \prd{x,z:A}{q:x=z} E(x,z,q). + \end{equation*} + But $E(x,z,q)\jdeq (x=z)$, so the type of $d$ is~\eqref{eq:concatD}. + Thus, we can use this function $d$ and apply the induction principle for identity types to $D$, to obtain our desired function of type + \begin{equation*} + \prd{x,y:A} (x= y) \to \prd{z:A} (y= z)\to (x= z) + \end{equation*} + and hence $\prd{x,y,z:A} (y=z) \to (x=y) \to (x=z)$. + The conversion rules for the two induction principles give us $\refl{x}\ct \refl{x}\jdeq \refl{x}$ for any $x:A$. +\end{proof} + +\begin{proof}[Second proof] + We want to construct, for every $x,y,z:A$ and every $p:x=y$ and $q:y=z$, an element of $x=z$. + By induction on $p$, it suffices to assume that $y$ is $x$ and $p$ is $\refl{x}$. + In this case, the type $y=z$ of $q$ is $x=z$. + Now by induction on $q$, it suffices to assume also that $z$ is $x$ and $q$ is $\refl{x}$. + But in this case, $x=z$ is $x=x$, and we have $\refl{x}:(x=x)$. +\end{proof} + +The reader may well feel that we have given an overly convoluted proof of this lemma. +In fact, we could stop after the induction on $p$, since at that point what we want to produce is an equality $x=z$, and we already have such an equality, namely $q$. +Why do we go on to do another induction on $q$? + +The answer is that, as described in the introduction, we are doing \emph{proof-relevant} mathematics. +\index{mathematics!proof-relevant}% +When we prove a lemma, we are defining an inhabitant of some type, and it can matter what \emph{specific} element we defined in the course of the proof, not merely the type inhabited by that element (that is, the \emph{statement} of the lemma). +\cref{lem:concat} has three obvious proofs: we could do induction over $p$, induction over $q$, or induction over both of them. +If we proved it three different ways, we would have three different elements of the same type. +It's not hard to show that these three elements are equal (see \cref{ex:basics:concat}), but as they are not \emph{definitionally} equal, there can still be reasons to prefer one over another. + +In the case of \cref{lem:concat}, the difference hinges on the computation rule. +If we proved the lemma using a single induction over $p$, then we would end up with a computation rule of the form $\refl{y} \ct q \jdeq q$. +If we proved it with a single induction over $q$, we would have instead $p\ct\refl{y}\jdeq p$, while proving it with a double induction (as we did) gives only $\refl{x}\ct\refl{x} \jdeq \refl{x}$. + +\index{mathematics!formalized}% +The asymmetrical computation rules can sometimes be convenient when doing formalized mathematics, as they allow the computer to simplify more things automatically. +However, in informal mathematics, and arguably even in the formalized case, it can be confusing to have a concatenation operation which behaves asymmetrically and to have to remember which side is the ``special'' one. +Treating both sides symmetrically makes for more robust proofs; this is why we have given the proof that we did. +(However, this is admittedly a stylistic choice.) + +The table below summarizes the ``equality'', ``homotopical'', and ``higher-groupoid" points of view on what we have done so far. +\begin{center} + \medskip + \begin{tabular}{ccc} + \toprule + Equality & Homotopy & $\infty$-Groupoid\\ + \midrule + reflexivity\index{equality!reflexivity of} & constant path & identity morphism\\ + symmetry\index{equality!symmetry of} & inversion of paths & inverse morphism\\ + transitivity\index{equality!transitivity of} & concatenation of paths & composition of morphisms\\ + \bottomrule + \end{tabular} + \medskip +\end{center} + +In practice, transitivity is often applied to prove an equality by a chain of intermediate steps. +We will use the common notation for this such as $a=b=c=d$. +If the intermediate expressions are long, or we want to specify the witness of each equality, we may write +\begin{align*} + a &= b & \text{(by $p$)}\\ &= c &\text{(by $q$)} \\ &= d &\text{(by $r$)}. +\end{align*} +In either case, the notation indicates construction of the element $(p\ct q)\ct r: (a=d)$. +(We choose left-associativity for concreteness, although in view of \cref{thm:omg}\ref{item:omg4} below it makes little difference.) +If it should happen that $b$ and $c$, say, are judgmentally equal, then we may write +\begin{align*} + a &= b & \text{(by $p$)}\\ &\jdeq c \\ &= d &\text{(by $r$)} +\end{align*} +to indicate construction of $p\ct r : (a=d)$. +We also follow common mathematical practice in not requiring the justifications in this notation (``by $p$'' and ``by $r$'') to supply the exact witness needed; instead we allow them to simply mention the most important (or least obvious) ingredient in constructing that witness. +For instance, if ``Lemma A'' states that for all $x$ and $y$ we have $f(x)=g(y)$, then we may write ``by Lemma A'' as a justification for the step $f(a) = g(b)$, trusting the reader to deduce that we apply Lemma A with $x\defeq a$ and $y\defeq b$. +We may also omit a justification entirely if we trust the reader to be able to guess it. + +Now, because of proof-relevance, we can't stop after proving ``symmetry'' and ``transitivity'' of equality: we need to know that these \emph{operations} on equalities are well-behaved. +(This issue is invisible in set theory, where symmetry and transitivity are mere \emph{properties} of equality, rather than structure on +paths.) +From the homotopy-theoretic point of view, concatenation and inversion are just the ``first level'' of higher groupoid structure --- we also need coherence\index{coherence} laws on these operations, and analogous operations at higher dimensions. +For instance, we need to know that concatenation is \emph{associative}, and that inversion provides \emph{inverses} with respect to concatenation. + +\begin{lem}\label{thm:omg}%[The $\omega$-groupoid structure of types] + \index{associativity!of path concatenation}% + \index{unit!law for path concatenation}% + Suppose $A:\type$, that $x,y,z,w:A$ and that $p:x= y$ and $q:y = z$ and $r:z=w$. + We have the following: + \begin{enumerate} + \item $p= p\ct \refl{y}$ and $p = \refl{x} \ct p$.\label{item:omg1} + \item $\opp{p}\ct p= \refl{y}$ and $p\ct \opp{p}= \refl{x}$.\label{item:omg2} + \item $\opp{(\opp{p})}= p$.\label{item:omg3} + \item $p\ct (q\ct r)= (p\ct q)\ct r$.\label{item:omg4} + \end{enumerate} +\end{lem} + +Note, in particular, that \ref{item:omg1}--\ref{item:omg4} are themselves propositional equalities, living in the identity types \emph{of} identity types, such as $p=_{x=y}q$ for $p,q:x=y$. +Topologically, they are \emph{paths of paths}, i.e.\ homotopies. +It is a familiar fact in topology that when we concatenate a path $p$ with the reversed path $\opp p$, we don't literally obtain a constant path (which corresponds to the equality $\refl{}$ in type theory) --- instead we have a homotopy, or higher path, from $p\ct\opp p$ to the constant path. + +\begin{proof}[Proof of~\cref{thm:omg}] + All the proofs use the induction principle for equalities. + \begin{enumerate} + \item \emph{First proof:} let $D:\prd{x,y:A} (x=y) \to \type$ be the type family given by + \begin{equation*} + D(x,y,p)\defeq (p= p\ct \refl{y}). + \end{equation*} + Then $D(x,x,\refl{x})$ is $\refl{x}=\refl{x}\ct\refl{x}$. + Since $\refl{x}\ct\refl{x}\jdeq\refl{x}$, it follows that $D(x,x,\refl{x})\jdeq (\refl{x}=\refl{x})$. + Thus, there is a function + \begin{equation*} + d\defeq\lam{x} \refl{\refl{x}}:\prd{x:A} D(x,x,\refl{x}). + \end{equation*} + Now the induction principle for identity types gives an element $\indid{A}(D,d,x,y,p):(p= p\ct\refl{y})$ for each $p:x= y$. + The other equality is proven similarly. + + \mentalpause + + \noindent + \emph{Second proof:} by induction on $p$, it suffices to assume that $y$ is $x$ and that $p$ is $\refl x$. + But in this case, we have $\refl{x}\ct\refl{x}\jdeq\refl{x}$. + \item \emph{First proof:} let $D:\prd{x,y:A} (x=y) \to \type$ be the type family given by + \begin{equation*} + D(x,y,p)\defeq (\opp{p}\ct p= \refl{y}). + \end{equation*} + Then $D(x,x,\refl{x})$ is $\opp{\refl{x}}\ct\refl{x}=\refl{x}$. + Since $\opp{\refl{x}}\jdeq\refl{x}$ and $\refl{x}\ct\refl{x}\jdeq\refl{x}$, we get that $D(x,x,\refl{x})\jdeq (\refl{x}=\refl{x})$. + Hence we find the function + \begin{equation*} + d\defeq\lam{x} \refl{\refl{x}}:\prd{x:A} D(x,x,\refl{x}). + \end{equation*} + Now path induction gives an element $\indid{A}(D,d,x,y,p):\opp{p}\ct p=\refl{y}$ for each $p:x= y$ in $A$. + The other equality is similar. + + \mentalpause + + \noindent \emph{Second proof:} by induction, it suffices to assume $p$ is $\refl x$. + But in this case, we have $\opp{p} \ct p \jdeq \opp{\refl x} \ct \refl x \jdeq \refl x$. + + \item \emph{First proof:} let $D:\prd{x,y:A} (x=y) \to \type$ be the type family given by + \begin{equation*} + D(x,y,p)\defeq (\opp{(\opp{p})}= p). + \end{equation*} + Then $D(x,x,\refl{x})$ is the type $(\opp{(\opp{\refl x})}=\refl{x})$. + But since $\opp{\refl{x}}\jdeq \refl{x}$ for each $x:A$, we have $\opp{(\opp{\refl{x}})}\jdeq \opp{\refl{x}} \jdeq\refl{x}$, and thus $D(x,x,\refl{x})\jdeq(\refl{x}=\refl{x})$. + Hence we find the function + \begin{equation*} + d\defeq\lam{x} \refl{\refl{x}}:\prd{x:A} D(x,x,\refl{x}). + \end{equation*} + Now path induction gives an element $\indid{A}(D,d,x,y,p):\opp{(\opp{p})}= p$ for each $p:x= y$. + + \mentalpause + + \noindent \emph{Second proof:} by induction, it suffices to assume $p$ is $\refl x$. + But in this case, we have $\opp{(\opp{p})}\jdeq \opp{(\opp{\refl x})} \jdeq \refl x$. + + \item \emph{First proof:} let $D_1:\prd{x,y:A} (x=y) \to \type$ be the type family given by + \begin{equation*} + D_1(x,y,p)\defeq\prd{z,w:A}{q:y= z}{r:z= w} \big(p\ct (q\ct r)= (p\ct q)\ct r\big). + \end{equation*} + Then $D_1(x,x,\refl{x})$ is + \begin{equation*} + \prd{z,w:A}{q:x= z}{r:z= w} \big(\refl{x}\ct(q\ct r)= (\refl{x}\ct q)\ct r\big). + \end{equation*} + To construct an element of this type, let $D_2:\prd{x,z:A} (x=z) \to \type$ be the type family + \begin{equation*} + D_2 (x,z,q) \defeq \prd{w:A}{r:z=w} \big(\refl{x}\ct(q\ct r)= (\refl{x}\ct q)\ct r\big). + \end{equation*} + Then $D_2(x,x,\refl{x})$ is + \begin{equation*} + \prd{w:A}{r:x=w} \big(\refl{x}\ct(\refl{x}\ct r)= (\refl{x}\ct \refl{x})\ct r\big). + \end{equation*} + To construct an element of \emph{this} type, let $D_3:\prd{x,w:A} (x=w) \to \type$ be the type family + \begin{equation*} + D_3(x,w,r) \defeq \big(\refl{x}\ct(\refl{x}\ct r)= (\refl{x}\ct \refl{x})\ct r\big). + \end{equation*} + Then $D_3(x,x,\refl{x})$ is + \begin{equation*} + \big(\refl{x}\ct(\refl{x}\ct \refl{x})= (\refl{x}\ct \refl{x})\ct \refl{x}\big) + \end{equation*} + which is definitionally equal to the type $(\refl{x} = \refl{x})$, and is therefore inhabited by $\refl{\refl{x}}$. + Applying the path induction rule three times, therefore, we obtain an element of the overall desired type. + + \mentalpause + + \noindent \emph{Second proof:} by induction, it suffices to assume $p$, $q$, and $r$ are all $\refl x$. + But in this case, we have + \begin{align*} + p\ct (q\ct r) + &\jdeq \refl{x}\ct(\refl{x}\ct \refl{x})\\ + &\jdeq \refl{x}\\ + &\jdeq (\refl{x}\ct \refl x)\ct \refl x\\ + &\jdeq (p\ct q)\ct r. + \end{align*} + Thus, we have $\refl{\refl{x}}$ inhabiting this type. \qedhere + \end{enumerate} +\end{proof} + +\begin{rmk} + There are other ways to define these higher paths. + For instance, in \cref{thm:omg}\ref{item:omg4} we might do induction only over one or two paths rather than all three. + Each possibility will produce a \emph{definitionally} different proof, but they will all be equal to each other. + Such an equality between any two particular proofs can, again, be proven by induction, reducing all the paths in question to reflexivities and then observing that both proofs reduce themselves to reflexivities. +\end{rmk} + +In view of \cref{thm:omg}\ref{item:omg4}, we will often write $p\ct q\ct r$ for $(p\ct q)\ct r$, and similarly $p\ct q\ct r \ct s$ for $((p\ct q)\ct r)\ct s$ and so on. +We choose left-associativity for definiteness, but it makes no real difference. +We generally trust the reader to insert instances of \cref{thm:omg}\ref{item:omg4} to reassociate such expressions as necessary. + +We are still not really done with the higher groupoid structure: the paths~\ref{item:omg1}--\ref{item:omg4} must also satisfy their own higher coherence\index{coherence} laws, which are themselves higher paths, +\index{associativity!of path concatenation!coherence of}% +\index{globular operad}% +\index{operad}% +\index{groupoid!higher}% +and so on ``all the way up to infinity'' (this can be made precise using e.g.\ the notion of a globular operad). +However, for most purposes it is unnecessary to make the whole infinite-dimensional structure explicit. +One of the nice things about homotopy type theory is that all of this structure can be \emph{proven} starting from only the inductive property of identity types, so we can make explicit as much or as little of it as we need. + +In particular, in this book we will not need any of the complicated combinatorics involved in making precise notions such as ``coherent structure at all higher levels''. +In addition to ordinary paths, we will use paths of paths (i.e.\ elements of a type $p =_{x=_A y} q$), which as remarked previously we call \emph{2-paths}\index{path!2-} or \emph{2-dimensional paths}, and perhaps occasionally paths of paths of paths (i.e.\ elements of a type $r = _{p =_{x=_A y} q} s$), which we call \emph{3-paths}\index{path!3-} or \emph{3-dimensional paths}. +It is possible to define a general notion of \emph{$n$-dimensional path} +\indexdef{path!n-@$n$-}% +\indexsee{n-path@$n$-path}{path, $n$-}% +\indexsee{n-dimensional path@$n$-dimensional path}{path, $n$-}% +\indexsee{path!n-dimensional@$n$-dimensional}{path, $n$-}% +(see \cref{ex:npaths}), but we will not need it. + +We will, however, use one particularly important and simple case of higher paths, which is when the start and end points are the same. +In set theory, the proposition $a=a$ is entirely uninteresting, but in homotopy theory, paths from a point to itself are called \emph{loops}\index{loop} and carry lots of interesting higher structure. +Thus, given a type $A$ with a point $a:A$, we define its \define{loop space} +\index{loop space}% +$\Omega(A,a)$ to be the type $\id[A]{a}{a}$. +We may sometimes write simply $\Omega A$ if the point $a$ is understood from context. + +Since any two elements of $\Omega A$ are paths with the same start and end points, they can be concatenated; +thus we have an operation $\Omega A\times \Omega A\to \Omega A$. +More generally, the higher groupoid structure of $A$ gives $\Omega A$ the analogous structure of a ``higher group''. + +It can also be useful to consider the loop space\index{loop space!iterated}\index{iterated loop space} \emph{of} the loop space of $A$, which is the space of 2-dimensional loops on the identity loop at $a$. +This is written $\Omega^2(A,a)$ and represented in type theory by the type $\id[({\id[A]{a}{a}})]{\refl{a}}{\refl{a}}$. +While $\Omega^2(A,a)$, as a loop space, is again a ``higher group'', it now also has some additional structure resulting from the fact that its elements are 2-dimensional loops between 1-dimensional loops. + +\begin{thm}[Eckmann--Hilton]\label{thm:EckmannHilton} + The composition operation on the second loop space + % + \begin{equation*} + \Omega^2(A)\times \Omega^2(A)\to \Omega^2(A) + \end{equation*} + is commutative: $\alpha\ct\beta = \beta\ct\alpha$, for any $\alpha, \beta:\Omega^2(A)$. + \index{Eckmann--Hilton argument}% +\end{thm} + +\begin{proof} +First, observe that the composition of $1$-loops $\Omega A\times \Omega A\to \Omega A$ induces an operation +\[ +\star : \Omega^2(A)\times \Omega^2(A)\to \Omega^2(A) +\] +as follows: consider elements $a, b, c : A$ and 1- and 2-paths, +% +\begin{align*} + p &: a = b, & r &: b = c \\ + q &: a = b, & s &: b = c \\ + \alpha &: p = q, & \beta &: r = s +\end{align*} +% +as depicted in the following diagram (with paths drawn as arrows). +% Changed this to xymatrix in the name of having uniform source code, +% maybe the original using xy looked better (I think it was too big). +% It is commented out below in case you want to reinstate it. +\[ + \xymatrix@+5em{ + {a} \rtwocell<10>^p_q{\alpha} + & + {b} \rtwocell<10>^r_s{\beta} + & + {c} + } +\] +Composing the upper and lower 1-paths, respectively, we get two paths $p\ct r,\ q\ct s : a = c$, and there is then a ``horizontal composition'' +% +\begin{equation*} + \alpha\hct\beta : p\ct r = q\ct s +\end{equation*} +% +between them, defined as follows. +First, we define $\alpha \rightwhisker r : p\ct r = q\ct r$ by path induction on $r$, so that +\[ \alpha \rightwhisker \refl{b} \jdeq \opp{\mathsf{ru}_p} \ct \alpha \ct \mathsf{ru}_q \] +where $\mathsf{ru}_p : p = p \ct \refl{b}$ is the right unit law from \cref{thm:omg}\ref{item:omg1}. +We could similarly define $\rightwhisker$ by induction on $\alpha$, or on all paths in sight, resulting in different judgmental equalities, but for present purposes the definition by induction on $r$ will make things simpler. +Similarly, we define $q\leftwhisker \beta : q\ct r = q\ct s$ by induction on $q$, so that +\[ \refl{b} \leftwhisker \beta \jdeq \opp{\mathsf{lu}_r} \ct \beta \ct \mathsf{lu}_s \] +where $\mathsf{lu}_r$ denotes the left unit law. +The operations $\leftwhisker$ and $\rightwhisker$ are called \define{whiskering}\indexdef{whiskering}. +Next, since $\alpha \rightwhisker r$ and $q\leftwhisker \beta$ are composable 2-paths, we can define the \define{horizontal composition} +\indexdef{horizontal composition!of paths}% +\indexdef{composition!of paths!horizontal}% +by: +\[ +\alpha\hct\beta\ \defeq\ (\alpha\rightwhisker r) \ct (q\leftwhisker \beta). +\] +Now suppose that $a \jdeq b \jdeq c$, so that all the 1-paths $p$, $q$, $r$, and $s$ are elements of $\Omega(A,a)$, and assume moreover that $p\jdeq q \jdeq r \jdeq s\jdeq \refl{a}$, so that $\alpha:\refl{a} = \refl{a}$ and $\beta:\refl{a} = \refl{a}$ are composable in both orders. +In that case, we have +\begin{align*} + \alpha\hct\beta + &\jdeq (\alpha\rightwhisker\refl{a}) \ct (\refl{a}\leftwhisker \beta)\\ + &= \opp{\mathsf{ru}_{\refl{a}}} \ct \alpha \ct \mathsf{ru}_{\refl{a}} \ct \opp{\mathsf{lu}_{\refl a}} \ct \beta \ct \mathsf{lu}_{\refl{a}}\\ + &\jdeq \opp{\refl{\refl{a}}} \ct \alpha \ct \refl{\refl{a}} \ct \opp{\refl{\refl a}} \ct \beta \ct \refl{\refl{a}}\\ + &= \alpha \ct \beta. +\end{align*} +(Recall that $\mathsf{ru}_{\refl{a}} \jdeq \mathsf{lu}_{\refl{a}} \jdeq \refl{\refl{a}}$, by the computation rule for path induction.) +On the other hand, we can define another horizontal composition analogously by +\[ +\alpha\hct'\beta\ \defeq\ (p\leftwhisker \beta)\ct (\alpha\rightwhisker s) +\] +and we similarly learn that +\[ +\alpha\hct'\beta = \beta\ct\alpha. +\] +\index{interchange law}% +But, in general, the two ways of defining horizontal composition agree, $\alpha\hct\beta = \alpha\hct'\beta$, as we can see by induction on $\alpha$ and $\beta$ and then on the two remaining 1-paths, to reduce everything to reflexivity. +Thus we have +\[\alpha \ct \beta = \alpha\hct\beta = \alpha\hct'\beta = \beta\ct\alpha. +\qedhere +\] +\end{proof} + +The foregoing fact, which is known as the \emph{Eckmann--Hilton argument}, comes from classical homotopy theory, and indeed it is used in \cref{cha:homotopy} below to show that the higher homotopy groups of a type are always abelian\index{group!abelian} groups. +The whiskering and horizontal composition operations defined in the proof are also a general part of the $\infty$-groupoid structure of types. +They satisfy their own laws (up to higher homotopy), such as +\[ \alpha \rightwhisker (p\ct q) = (\alpha \rightwhisker p) \rightwhisker q \] +and so on. +From now on, we trust the reader to apply path induction whenever needed to define further operations of this sort and verify their properties. + +As this example suggests, the algebra of higher path types is much more intricate than just the groupoid-like structure at each level; the levels interact to give many further operations and laws, as in the study of iterated loop spaces in homotopy theory. +Indeed, as in classical homotopy theory, we can make the following general definitions: + +\begin{defn} \label{def:pointedtype} + A \define{pointed type} + \indexsee{pointed!type}{type, pointed}% + \indexdef{type!pointed}% + $(A,a)$ is a type $A:\type$ together with a point $a:A$, called its \define{basepoint}. + \indexdef{basepoint}% + We write $\pointed{\type} \defeq \sm{A:\type} A$ for the type of pointed types in the universe $\type$. +\end{defn} + +\begin{defn} \label{def:loopspace} + Given a pointed type $(A,a)$, we define the \define{loop space} + \indexdef{loop space}% + of $(A,a)$ to be the following pointed type: + \[\Omega(A,a)\defeq ((\id[A]aa),\refl a).\] + An element of it will be called a \define{loop}\indexdef{loop} at $a$. + For $n:\N$, the \define{$n$-fold iterated loop space} $\Omega^{n}(A,a)$ + \indexdef{loop space!iterated}% + \indexsee{loop space!n-fold@$n$-fold}{loop space, iterated}% + of a pointed type $(A,a)$ is defined recursively by: + \begin{align*} + \Omega^0(A,a)&\defeq(A,a)\\ + \Omega^{n+1}(A,a)&\defeq\Omega^n(\Omega(A,a)). + \end{align*} + An element of it will be called an \define{$n$-loop} + \indexdef{loop!n-@$n$-}% + \indexsee{n-loop@$n$-loop}{loop, $n$-}% + or an \define{$n$-dimensional loop} + \indexsee{loop!n-dimensional@$n$-dimensional}{loop, $n$-}% + \indexsee{n-dimensional loop@$n$-dimensional loop}{loop, $n$-}% + at $a$. +\end{defn} + +We will return to iterated loop spaces in \cref{cha:hlevels,cha:hits,cha:homotopy}. +\index{.infinity-groupoid@$\infty$-groupoid!structure of a type|)}% +\index{type!identity|)} +\index{path|)}% + +\section{Functions are functors} +\label{sec:functors} + +\index{function|(}% +\index{functoriality of functions in type theory@``functoriality'' of functions in type theory}% +Now we wish to establish that functions $f:A\to B$ behave functorially on paths. +In traditional type theory, this is equivalently the statement that functions respect equality. +\index{continuity of functions in type theory@``continuity'' of functions in type theory}% +Topologically, this corresponds to saying that every function is ``continuous'', i.e.\ preserves paths. + +\begin{lem}\label{lem:map} + Suppose that $f:A\to B$ is a function. + Then for any $x,y:A$ there is an operation + \begin{equation*} + \apfunc f : (\id[A] x y) \to (\id[B] {f(x)} {f(y)}). + \end{equation*} + Moreover, for each $x:A$ we have $\apfunc{f}(\refl{x})\jdeq \refl{f(x)}$. + \indexdef{application!of function to a path}% + \indexdef{path!application of a function to}% + \indexdef{function!application to a path of}% + \indexdef{action!of a function on a path}% +\end{lem} + +The notation $\apfunc f$ can be read either as the \underline{ap}plication of $f$ to a path, or as the \underline{a}ction on \underline{p}aths of $f$. + +\begin{proof}[First proof] + Let $D:\prd{x,y:A} (x=y) \to \type$ be the type family defined by + \[D(x,y,p)\defeq (f(x)= f(y)).\] + Then we have + \begin{equation*} + d\defeq\lam{x} \refl{f(x)}:\prd{x:A} D(x,x,\refl{x}). + \end{equation*} + By path induction, we obtain $\apfunc f : \prd{x,y:A} (x=y) \to (f(x)=f(y))$. + The computation rule implies $\apfunc f({\refl{x}})\jdeq\refl{f(x)}$ for each $x:A$. +\end{proof} + +\begin{proof}[Second proof] + To define $\apfunc{f}(p)$ for all $p:x=y$, it suffices, by induction, to assume + $p$ is $\refl{x}$. + In this case, we may define $\apfunc f(p) \defeq \refl{f(x)}:f(x)= f(x)$. +\end{proof} + +We will often write $\apfunc f (p)$ as simply $\ap f p$. +This is strictly speaking ambiguous, but generally no confusion arises. +It matches the common convention in category theory of using the same symbol for the application of a functor to objects and to morphisms. + +We note that $\apfunc{}$ behaves functorially, in all the ways that one might expect. + +\begin{lem}\label{lem:ap-functor} + For functions $f:A\to B$ and $g:B\to C$ and paths $p:\id[A]xy$ and $q:\id[A]yz$, we have: + \begin{enumerate} + \item $\apfunc f(p\ct q) = \apfunc f(p) \ct \apfunc f(q)$.\label{item:apfunctor-ct} + \item $\apfunc f(\opp p) = \opp{\apfunc f (p)}$.\label{item:apfunctor-opp} + \item $\apfunc g (\apfunc f(p)) = \apfunc{g\circ f} (p)$.\label{item:apfunctor-compose} + \item $\apfunc {\idfunc[A]} (p) = p$. + \end{enumerate} +\end{lem} +\begin{proof} + Left to the reader. +\end{proof} +\index{function|)}% + +As was the case for the equalities in \cref{thm:omg}, those in \cref{lem:ap-functor} are themselves paths, which satisfy their own coherence laws (which can be proved in the same way), and so on. + + +\section{Type families are fibrations} +\label{sec:fibrations} + +\index{type!family of|(}% +\index{transport|(defstyle}% +Since \emph{dependently typed} functions are essential in type theory, we will also need a version of \cref{lem:map} for these. +However, this is not quite so simple to state, because if $f:\prd{x:A} B(x)$ and $p:x=y$, then $f(x):B(x)$ and $f(y):B(y)$ are elements of distinct types, so that \emph{a priori} we cannot even ask whether they are equal. +The missing ingredient is that $p$ itself gives us a way to relate the types $B(x)$ and $B(y)$. + +We have already seen this in \autoref{sec:identity-types}, where we called it ``indiscernibility of identicals''. +\index{indiscernibility of identicals}% +We now introduce a different name and notation for it that we will use from now on. + +\begin{lem}[Transport]\label{lem:transport} + Suppose that $P$ is a type family over $A$ and that $p:\id[A]xy$. + Then there is a function $\transf{p}:P(x)\to P(y)$. +\end{lem} + +\begin{proof}[First proof] + Let $D:\prd{x,y:A} (\id{x}{y}) \to \type$ be the type family defined by + \[D(x,y,p)\defeq P(x)\to P(y).\] + Then we have the function + \begin{equation*} + d\defeq\lam{x} \idfunc[P(x)]:\prd{x:A} D(x,x,\refl{x}), + \end{equation*} + so that the induction principle gives us $\indid{A}(D,d,x,y,p):P(x)\to P(y)$ for $p:x= y$, which we define to be $\transf p$. +\end{proof} + +\begin{proof}[Second proof] + By induction, it suffices to assume $p$ is $\refl x$. + But in this case, we can take $\transf{(\refl x)}:P(x)\to P(x)$ to be the identity function. +\end{proof} + +Sometimes, it is necessary to notate the type family $P$ in which the transport operation happens. +In this case, we may write +\[\transfib P p \blank : P(x) \to P(y).\] + +Recall that a type family $P$ over a type $A$ can be seen as a property of elements of $A$, which holds at $x$ in $A$ if $P(x)$ is inhabited. +Then the transportation lemma says that $P$ respects equality, in the sense that if $x$ is equal to $y$, then $P(x)$ holds if and only if $P(y)$ holds. +In fact, we will see later on that if $x=y$ then actually $P(x)$ and $P(y)$ are \emph{equivalent}. + +Topologically, the transportation lemma can be viewed as a ``path lifting'' operation in a fibration. +\index{fibration}% +\indexdef{total!space}% +We think of a type family $P:A\to \type$ as a \emph{fibration} with base space $A$, with $P(x)$ being the fiber over $x$, and with $\sm{x:A}P(x)$ being the \define{total space} of the fibration, with first projection $\sm{x:A}(P(x))\to A$. +The defining property of a fibration is that given a path $p:x=y$ in the base space $A$ and a point $u:P(x)$ in the fiber over $x$, we may lift the path $p$ to a path in the total space starting at $u$ (and this lifting can be done continuously). +The point $\trans p u$ can be thought of as the other endpoint of this lifted path. +We can also define the path itself in type theory: + +\begin{lem}[Path lifting property]\label{thm:path-lifting} + \indexdef{path!lifting}% + \indexdef{lifting!path}% + Let $P:A\to\type$ be a type family over $A$ and assume we have $u:P(x)$ for some $x:A$. + Then for any $p:x=y$, we have + \begin{equation*} + \mathsf{lift}(u,p):(x,u)=(y,\trans{p}{u}) + \end{equation*} + in $\sm{x:A}P(x)$, such that $\ap{\proj1}{\mathsf{lift}(u,p)} = p$. +\end{lem} +\begin{proof} + Left to the reader. + We will prove a more general theorem in \cref{sec:compute-sigma}. +\end{proof} + +In classical homotopy theory, a fibration is defined as a map for which there \emph{exist} liftings of paths; while in contrast, we have just shown that in type theory, every type family comes with a \emph{specified} ``path-lifting function''. +This accords with the philosophy of constructive mathematics, according to which we cannot show that something exists except by exhibiting it. +\index{continuity of functions in type theory@``continuity'' of functions in type theory}% +It also ensures automatically that the path liftings are chosen ``continuously'', since as we have seen, all functions in type theory are ``continuous''. + +\begin{rmk} + Although we may think of a type family $P:A\to \type$ as like a fibration, it is generally not a good idea to say things like ``the fibration $P:A\to\type$'', since this sounds like we are talking about a fibration with base $\type$ and total space $A$. + To repeat, when a type family $P:A\to \type$ is regarded as a fibration, the base is $A$ and the total space is $\sm{x:A} P(x)$. + + We may also occasionally use other topological terminology when speaking about type families. + For instance, we may refer to a dependent function $f:\prd{x:A} P(x)$ as a \define{section} + \indexdef{section!of a type family}% + of the fibration $P$, and we may say that something happens \define{fiberwise} + \indexdef{fiberwise}% + if it happens for each $P(x)$. + For instance, a section $f:\prd{x:A} P(x)$ shows that $P$ is ``fiberwise inhabited''. +\end{rmk} + +\index{function!dependent|(} +Now we can prove the dependent version of \cref{lem:map}. +The topological intuition is that given $f:\prd{x:A} P(x)$ and a path $p:\id[A]xy$, we ought to be able to apply $f$ to $p$ and obtain a path in the total space of $P$ which ``lies over'' $p$, as shown below. + +\begin{center} + \begin{tikzpicture}[yscale=.5,xscale=2] + \draw (0,0) arc (-90:170:8ex) node[anchor=south east] {$A$} arc (170:270:8ex); + \draw (0,6) arc (-90:170:8ex) node[anchor=south east] {$\sm{x:A} P(x)$} arc (170:270:8ex); + \draw[->] (0,5.8) -- node[auto] {$\proj1$} (0,3.2); + \node[circle,fill,inner sep=1pt,label=left:{$x$}] (b1) at (-.5,1.4) {}; + \node[circle,fill,inner sep=1pt,label=right:{$y$}] (b2) at (.5,1.4) {}; + \draw[decorate,decoration={snake,amplitude=1}] (b1) -- node[auto,swap] {$p$} (b2); + \node[circle,fill,inner sep=1pt,label=left:{$f(x)$}] (b1) at (-.5,7.2) {}; + \node[circle,fill,inner sep=1pt,label=right:{$f(y)$}] (b2) at (.5,7.2) {}; + \draw[decorate,decoration={snake,amplitude=1}] (b1) -- node[auto] {$f(p)$} (b2); + \end{tikzpicture} +\end{center} + +We \emph{can} obtain such a thing from \cref{lem:map}. +Given $f:\prd{x:A} P(x)$, we can define a non-dependent function $f':A\to \sm{x:A} P(x)$ by setting $f'(x)\defeq (x,f(x))$, and then consider $\ap{f'}{p} : f'(x) = f'(y)$. +Since $\proj1 \circ f' \jdeq \idfunc[A]$, by \cref{lem:ap-functor} we have $\ap{\proj1}{\ap{f'}{p}} = p$; thus $\ap{f'}{p}$ does ``lie over'' $p$ in this sense. +However, it is not obvious from the \emph{type} of $\ap{f'}{p}$ that it lies over any specific path in $A$ (in this case, $p$), which is sometimes important. + +The solution is to use the transport lemma. +By \cref{thm:path-lifting} we have a canonical path $\mathsf{lift}(u,p)$ from $(x,u)$ to $(y,\trans p u)$ which lies over $p$. +Thus, any path from $u:P(x)$ to $v:P(y)$ lying over $p$ should factor through $\mathsf{lift}(u,p)$, essentially uniquely, by a path from $\trans p u$ to $v$ lying entirely in the fiber $P(y)$. +Thus, up to equivalence, it makes sense to define ``a path from $u$ to $v$ lying over $p:x=y$'' to mean a path $\trans p u = v$ in $P(y)$. +And, indeed, we can show that dependent functions produce such paths. + +\begin{lem}[Dependent map]\label{lem:mapdep} + \indexdef{application!of dependent function to a path}% + \indexdef{path!application of a dependent function to}% + \indexdef{function!dependent!application to a path of}% + \indexdef{action!of a dependent function on a path}% + Suppose $f:\prd{x: A} P(x)$; then we have a map + \[\apdfunc f : \prd{p:x=y}\big(\id[P(y)]{\trans p{f(x)}}{f(y)}\big).\] +\end{lem} + +\begin{proof}[First proof] + Let $D:\prd{x,y:A} (\id{x}{y}) \to \type$ be the type family defined by + \begin{equation*} + D(x,y,p)\defeq \trans p {f(x)}= f(y). + \end{equation*} + Then $D(x,x,\refl{x})$ is $\trans{(\refl{x})}{f(x)}= f(x)$. + But since $\trans{(\refl{x})}{f(x)}\jdeq f(x)$, we get that $D(x,x,\refl{x})\jdeq (f(x)= f(x))$. + Thus, we find the function + \begin{equation*} + d\defeq\lam{x} \refl{f(x)}:\prd{x:A} D(x,x,\refl{x}) + \end{equation*} + and now path induction gives us $\apdfunc f(p):\trans p{f(x)}= f(y)$ for each $p:x= y$. +\end{proof} + +\begin{proof}[Second proof] + By induction, it suffices to assume $p$ is $\refl x$. + But in this case, the desired equation is $\trans{(\refl{x})}{f(x)}= f(x)$, which holds judgmentally. +\end{proof} + +We will refer generally to paths which ``lie over other paths'' in this sense as \emph{dependent paths}. +\indexsee{dependent!path}{path, dependent}% +\index{path!dependent}% +They will play an increasingly important role starting in \cref{cha:hits}. +In \cref{sec:computational} we will see that for a few particular kinds of type families, there are equivalent ways to represent the notion of dependent paths that are sometimes more convenient. + +Now recall from \cref{sec:pi-types} that a non-dependently typed function $f:A\to B$ is just the special case of a dependently typed function $f:\prd{x:A} P(x)$ when $P$ is a constant type family, $P(x) \defeq B$. +In this case, $\apdfunc{f}$ and $\apfunc{f}$ are closely related, because of the following lemma: + +\begin{lem}\label{thm:trans-trivial} + If $P:A\to\type$ is defined by $P(x) \defeq B$ for a fixed $B:\type$, then for any $x,y:A$ and $p:x=y$ and $b:B$ we have a path + \[ \transconst Bpb : \transfib P p b = b. \] +\end{lem} +\begin{proof}[First proof] + Fix a $b:B$, and let $D:\prd{x,y:A} (\id{x}{y}) \to \type$ be the type family defined by + \[ D(x,y,p) \defeq (\transfib P p b = b). \] + Then $D(x,x,\refl x)$ is $(\transfib P{\refl{x}}{b} = b)$, which is judgmentally equal to $(b=b)$ by the computation rule for transporting. + Thus, we have the function + \[ d \defeq \lam{x} \refl{b} : \prd{x:A} D(x,x,\refl x). \] + Now path induction gives us an element of + \narrowequation{ + \prd{x,y:A}{p:x=y}(\transfib P p b = b),} + as desired. +\end{proof} +\begin{proof}[Second proof] + By induction, it suffices to assume $y$ is $x$ and $p$ is $\refl x$. + But $\transfib P {\refl x} b \jdeq b$, so in this case what we have to prove is $b=b$, and we have $\refl{b}$ for this. +\end{proof} + +Thus, for any $x,y:A$ and $p:x=y$ and $f:A\to B$, by concatenating with $\transconst Bp{f(x)}$ and its inverse, respectively, we obtain functions +\begin{align} + \big(f(x) = f(y)\big) &\to \big(\trans{p}{f(x)} = f(y)\big)\label{eq:ap-to-apd} + \qquad\text{and} \\ + \big(\trans{p}{f(x)} = f(y)\big) &\to \big(f(x) = f(y)\big).\label{eq:apd-to-ap} +\end{align} +In fact, these functions are inverse equivalences (in the sense to be introduced in \cref{sec:basics-equivalences}), and they relate $\apfunc f (p)$ to $\apdfunc f (p)$. + +\begin{lem}\label{thm:apd-const} + For $f:A\to B$ and $p:\id[A]xy$, we have + \[ \apdfunc f(p) = \transconst B p{f(x)} \ct \apfunc f (p). \] +\end{lem} +\begin{proof}[First proof] + Let $D:\prd{x,y:A} (\id xy) \to \type$ be the type family defined by + \[ D(x,y,p) \defeq \big(\apdfunc f (p) = \transconst Bp{f(x)} \ct \apfunc f (p)\big). \] + Thus, we have + \[D(x,x,\refl x) \jdeq \big(\apdfunc f (\refl x) = \transconst B{\refl x}{f(x)} \ct \apfunc f ({\refl x})\big).\] + But by definition, all three paths appearing in this type are $\refl{f(x)}$, so we have + \[ \refl{\refl{f(x)}} : D(x,x,\refl x). \] + Thus, path induction gives us an element of $\prd{x,y:A}{p:x=y} D(x,y,p)$, which is what we wanted. +\end{proof} +\begin{proof}[Second proof] + By induction, it suffices to assume $y$ is $x$ and $p$ is $\refl x$. + In this case, what we have to prove is $\refl{f(x)} = \refl{f(x)} \ct \refl{f(x)}$, which is true judgmentally. +\end{proof} + +Because the types of $\apdfunc{f}$ and $\apfunc{f}$ are different, it is often clearer to use different notations for them. +% We may sometimes use a notation $\apd f p$ for $\apdfunc{f}(p)$, which is similar to the notation $\ap f p$ for $\apfunc{f}(p)$. + +\index{function!dependent|)}% + +At this point, we hope the reader is starting to get a feel for proofs by induction on identity types. +From now on we stop giving both styles of proofs, allowing ourselves to use whatever is most clear and convenient (and often the second, more concise one). +Here are a few other useful lemmas about transport; we leave it to the reader to give the proofs (in either style). + +\begin{lem}\label{thm:transport-concat} + Given $P:A\to\type$ with $p:\id[A]xy$ and $q:\id[A]yz$ while $u:P(x)$, we have + \[ \trans{q}{\trans{p}{u}} = \trans{(p\ct q)}{u}. \] +\end{lem} + +\begin{lem}\label{thm:transport-compose} + For a function $f:A\to B$ and a type family $P:B\to\type$, and any $p:\id[A]xy$ and $u:P(f(x))$, we have + \[ \transfib{P\circ f}{p}{u} = \transfib{P}{\apfunc f(p)}{u}. \] +\end{lem} + +\begin{lem}\label{thm:ap-transport} + For $P,Q:A\to \type$ and a family of functions $f:\prd{x:A} P(x)\to Q(x)$, and any $p:\id[A]xy$ and $u:P(x)$, we have + \[ \transfib{Q}{p}{f_x(u)} = f_y(\transfib{P}{p}{u}). \] +\end{lem} + +\index{type!family of|)}% +\index{transport|)} + +\section{Homotopies and equivalences} +\label{sec:basics-equivalences} + +\index{homotopy|(defstyle}% + +So far, we have seen how the identity type $\id[A]xy$ can be regarded as a type of \emph{identifications}, \emph{paths}, or \emph{equivalences} between two elements $x$ and~$y$ of a type $A$. +Now we investigate the appropriate notions of ``identification'' or ``sameness'' between \emph{functions} and between \emph{types}. +In \cref{sec:compute-pi,sec:compute-universe}, we will see that homotopy type theory allows us to identify these with instances of the identity type, but before we can do that we need to understand them in their own right. + +Traditionally, we regard two functions as the same if they take equal values on all inputs. +Under the propositions-as-types interpretation, this suggests that two functions $f$ and $g$ (perhaps dependently typed) should be the same if the type $\prd{x:A} (f(x)=g(x))$ is inhabited. +Under the homotopical interpretation, this dependent function type consists of \emph{continuous} paths or \emph{functorial} equivalences, and thus may be regarded as the type of \emph{homotopies} or of \emph{natural isomorphisms}.\index{isomorphism!natural} +We will adopt the topological terminology for this. + +\begin{defn} \label{defn:homotopy} + Let $f,g:\prd{x:A} P(x)$ be two sections of a type family $P:A\to\type$. + A \define{homotopy} + from $f$ to $g$ is a dependent function of type + \begin{equation*} + (f\htpy g) \defeq \prd{x:A} (f(x)=g(x)). + \end{equation*} +\end{defn} + +Note that a homotopy is not the same as an identification $(f=g)$. +However, in \cref{sec:compute-pi} we will introduce an axiom making homotopies and identifications ``equivalent''. + +The following proofs are left to the reader. + +\begin{lem}\label{lem:homotopy-props} + Homotopy is an equivalence relation on each dependent function type $\prd{x:A} P(x)$. + That is, we have elements of the types + \begin{gather*} + \prd{f:\prd{x:A} P(x)} (f\htpy f)\\ + \prd{f,g:\prd{x:A} P(x)} (f\htpy g) \to (g\htpy f)\\ + \prd{f,g,h:\prd{x:A} P(x)} (f\htpy g) \to (g\htpy h) \to (f\htpy h). + \end{gather*} +\end{lem} + +% This is judgmental and is \cref{ex:composition}. +% \begin{lem} +% Composition is associative and unital up to homotopy. +% That is: +% \begin{enumerate} +% \item If $f:A\to B$ then $f\circ \idfunc[A]\htpy f\htpy \idfunc[B]\circ f$. +% \item If $f:A\to B, g:B\to C$ and $h:C\to D$ then $h\circ (g\circ f) \htpy (h\circ g)\circ f$. +% \end{enumerate} +% \end{lem} + +\index{functoriality of functions in type theory@``functoriality'' of functions in type theory}% +\index{continuity of functions in type theory@``continuity'' of functions in type theory}% +Just as functions in type theory are automatically ``functors'', homotopies are automatically +\index{naturality of homotopies@``naturality'' of homotopies}% +``natural transformations''. +We will state and prove this only for non-dependent functions $f,g:A\to B$; in \cref{ex:dep-htpy-natural} we ask the reader to generalize it to dependent functions. + +Recall that for $f:A\to B$ and $p:\id[A]xy$, we may write $\ap f p$ to mean $\apfunc{f} (p)$. + +\begin{lem}\label{lem:htpy-natural} + Suppose $H:f\htpy g$ is a homotopy between functions $f,g:A\to B$ and let $p:\id[A]xy$. Then we have + \begin{equation*} + H(x)\ct\ap{g}{p}=\ap{f}{p}\ct H(y). + \end{equation*} + We may also draw this as a commutative diagram:\index{diagram} + \begin{align*} + \xymatrix{ + f(x) \ar@{=}[r]^{\ap fp} \ar@{=}[d]_{H(x)} & f(y) \ar@{=}[d]^{H(y)} \\ + g(x) \ar@{=}[r]_{\ap gp} & g(y) + } + \end{align*} +\end{lem} +\begin{proof} + By induction, we may assume $p$ is $\refl x$. + Since $\apfunc{f}$ and $\apfunc g$ compute on reflexivity, in this case what we must show is + \[ H(x) \ct \refl{g(x)} = \refl{f(x)} \ct H(x). \] + But this follows since both sides are equal to $H(x)$. +\end{proof} + +\begin{cor}\label{cor:hom-fg} + Let $H : f \htpy \idfunc[A]$ be a homotopy, with $f : A \to A$. Then for any $x : A$ we have \[ H(f(x)) = \ap f{H(x)}. \] + % The above path will be denoted by $\com{H}{f}{x}$. +\end{cor} +\noindent +Here $f(x)$ denotes the ordinary application of $f$ to $x$, while $\ap f{H(x)}$ denotes $\apfunc{f}(H(x))$. +\begin{proof} +By naturality of $H$, the following diagram of paths commutes: +\begin{align*} +\xymatrix@C=3pc{ +ffx \ar@{=}[r]^-{\ap f{Hx}} \ar@{=}[d]_{H(fx)} & fx \ar@{=}[d]^{Hx} \\ +fx \ar@{=}[r]_-{Hx} & x +} +\end{align*} +That is, $\ap f{H x} \ct H x = H(f x) \ct H x$. +We can now whisker by $\opp{(H x)}$ to cancel $H x$, obtaining +\[ \ap f{H x} += \ap f{H x} \ct H x \ct \opp{(H x)} += H(f x) \ct H x \ct \opp{(H x)} += H(f x) +\] +as desired (with some associativity paths suppressed). +\end{proof} + +Of course, like the functoriality of functions (\cref{lem:ap-functor}), the equality in \cref{lem:htpy-natural} is a path which satisfies its own coherence laws, and so on. + +\index{homotopy|)}% + +\index{equivalence|(}% +Moving on to types, from a traditional perspective one may say that a function $f:A\to B$ is an \emph{isomorphism} if there is a function $g:B\to A$ such that both composites $f\circ g$ and $g\circ f$ are pointwise equal to the identity, i.e.\ such that $f \circ g \htpy \idfunc[B]$ and $g\circ f \htpy \idfunc[A]$. +\indexsee{homotopy!equivalence}{equivalence}% +A homotopical perspective suggests that this should be called a \emph{homotopy equivalence}, and from a categorical one, it should be called an \emph{equivalence of (higher) groupoids}. +However, when doing proof-relevant mathematics, +\index{mathematics!proof-relevant}% +the corresponding type +\begin{equation} + \sm{g:B\to A} \big((f \circ g \htpy \idfunc[B]) \times (g\circ f \htpy \idfunc[A])\big)\label{eq:qinvtype} +\end{equation} +is poorly behaved. +For instance, for a single function $f:A\to B$ there may be multiple unequal inhabitants of~\eqref{eq:qinvtype}. +(This is closely related to the observation in higher category theory that often one needs to consider \emph{adjoint} equivalences\index{adjoint!equivalence} rather than plain equivalences.) +For this reason, we give~\eqref{eq:qinvtype} the following historically accurate, but slightly de\-rog\-a\-to\-ry-sounding name instead. + +\begin{defn}\label{defn:quasi-inverse} + For a function $f:A\to B$, a \define{quasi-inverse} + \indexdef{quasi-inverse}% + \indexsee{function!quasi-inverse of}{quasi-inverse}% + of $f$ is a triple $(g,\alpha,\beta)$ consisting of a function $g:B\to A$ and homotopies +$\alpha:f\circ g\htpy \idfunc[B]$ and $\beta:g\circ f\htpy \idfunc[A]$. +\end{defn} + +\symlabel{qinv} +Thus,~\eqref{eq:qinvtype} is \emph{the type of quasi-inverses of $f$}; we may denote it by $\qinv(f)$. + +\begin{eg}\label{eg:idequiv} + \index{identity!function}% + \index{function!identity}% + The identity function $\idfunc[A]:A\to A$ has a quasi-inverse given by $\idfunc[A]$ itself, together with homotopies defined by $\alpha(y) \defeq \refl{y}$ and $\beta(x) \defeq \refl{x}$. +\end{eg} + +\begin{eg}\label{eg:concatequiv} + For any $p:\id[A]xy$ and $z:A$, the functions + \begin{align*} + (p\ct \blank)&:(\id[A]yz) \to (\id[A]xz) \qquad\text{and}\\ + (\blank \ct p)&:(\id[A]zx) \to (\id[A]zy) + \end{align*} + have quasi-inverses given by $(\opp p \ct \blank)$ and $(\blank \ct \opp p)$, respectively; see \cref{ex:equiv-concat}. +\end{eg} + +\begin{eg}\label{thm:transportequiv} + For any $p:\id[A]xy$ and $P:A\to\type$, the function + \[\transfib{P}{p}{\blank}:P(x) \to P(y)\] + has a quasi-inverse given by $\transfib{P}{\opp p}{\blank}$; this follows from \narrowbreak \cref{thm:transport-concat}. +\end{eg} + +\symlabel{basics-isequiv}\symlabel{basics:iso} +In general, we will only use the word \emph{isomorphism} +\index{isomorphism!of sets} +(and similar words such as \emph{bijection}, and the associated notation $A\cong B$) +\index{bijection} +in the special case when the types $A$ and $B$ ``behave like sets'' (see \cref{sec:basics-sets}). +In this case, the type~\eqref{eq:qinvtype} is unproblematic. +We will reserve the word \emph{equivalence} for an improved notion $\isequiv (f)$ with the following properties:% +\begin{enumerate} +\item For each $f:A\to B$ there is a function $\qinv(f) \to \isequiv (f)$.\label{item:be1} +\item Similarly, for each $f$ we have $\isequiv (f) \to \qinv(f)$; thus the two are logically equivalent (see \cref{sec:pat}).\label{item:be2} +\item For any two inhabitants $e_1,e_2:\isequiv(f)$ we have $e_1=e_2$.\label{item:be3} +\end{enumerate} +In \cref{cha:equivalences} we will see that there are many different definitions of $\isequiv(f)$ which satisfy these three properties, but that all of them are equivalent. +For now, to convince the reader that such things exist, we mention only the easiest such definition: +\begin{equation}\label{eq:isequiv-invertible} + \isequiv(f) \;\defeq\; + \Parens{\sm{g:B\to A} (f\circ g \htpy \idfunc[B])} + \times + \Parens{\sm{h:B\to A} (h\circ f \htpy \idfunc[A])}. +\end{equation} +We can show~\ref{item:be1} and~\ref{item:be2} for this definition now. +A function $\qinv(f) \to \isequiv (f)$ is easy to define by taking $(g,\alpha,\beta)$ to $(g,\alpha,g,\beta)$. +In the other direction, given $(g,\alpha,h,\beta)$, let $\gamma$ be the composite homotopy +\[ g \overset{\beta}{\htpy} h\circ f\circ g \overset{\alpha}{\htpy} h, \] +meaning that $\gamma(x) \defeq \opp{\beta(g(x))} \ct \ap{h}{\alpha(x)}$. +Now define $\beta':g\circ f\htpy \idfunc[A]$ by $\beta'(x) \defeq \gamma(f(x)) \ct \beta(x)$. +Then $(g,\alpha,\beta'):\qinv(f)$. + +Property~\ref{item:be3} for this definition is not too hard to prove either, but it requires identifying the identity types of cartesian products and dependent pair types, which we will discuss in \cref{sec:compute-cartprod,sec:compute-sigma}. +Thus, we postpone it as well; see \cref{sec:biinv}. +At this point, the main thing to take away is that there is a well-behaved type which we can pronounce as ``$f$ is an equivalence'', and that we can prove $f$ to be an equivalence by exhibiting a quasi-inverse to it. +In practice, this is the most common way to prove that a function is an equivalence. + +In accord with the proof-relevant philosophy, +\index{mathematics!proof-relevant}% +\emph{an equivalence} from $A$ to $B$ is defined to be a function $f:A\to B$ together with an inhabitant of $\isequiv (f)$, i.e.\ a proof that it is an equivalence. +We write $(\eqv A B)$ for the type of equivalences from $A$ to $B$, i.e.\ the type +\begin{equation}\label{eq:eqv} + (\eqv A B) \defeq \sm{f:A\to B} \isequiv(f). +\end{equation} +Property~\ref{item:be3} above will ensure that if two equivalences are equal as functions (that is, the underlying elements of $A\to B$ are equal), then they are also equal as equivalences (see \cref{sec:compute-sigma}). +Thus, we often abuse notation and blur the distinction between equivalences and their underlying functions. +For instance, if we have a function $f:A\to B$ and we know that $e:\isequiv(f)$, we may write $f:\eqv A B$, rather than $\tup{f}{e}$. +Or conversely, if we have an equivalence $g:\eqv A B$, we may write $g(a)$ when given $a:A$, rather than $(\proj1 g)(a)$. + +We conclude by observing: + +\begin{lem}\label{thm:equiv-eqrel} + Type equivalence is an equivalence relation on \type. + More specifically: + \begin{enumerate} + \item For any $A$, the identity function $\idfunc[A]$ is an equivalence; hence $\eqv A A$. + \item For any $f:\eqv A B$, we have an equivalence $f^{-1} : \eqv B A$. + \item For any $f:\eqv A B$ and $g:\eqv B C$, we have $g\circ f : \eqv A C$. + \end{enumerate} +\end{lem} +\begin{proof} + The identity function is clearly its own quasi-inverse; hence it is an equivalence. + + If $f:A\to B$ is an equivalence, then it has a quasi-inverse, say $f^{-1}:B\to A$. + Then $f$ is also a quasi-inverse of $f^{-1}$, so $f^{-1}$ is an equivalence $B\to A$. + + Finally, given $f:\eqv A B$ and $g:\eqv B C$ with quasi-inverses $f^{-1}$ and $g^{-1}$, say, then for any $a:A$ we have $f^{-1} g^{-1} g f a = f^{-1} f a = a$, and for any $c:C$ we have $g f f^{-1} g^{-1} c = g g^{-1} c = c$. + Thus $f^{-1} \circ g^{-1}$ is a quasi-inverse to $g\circ f$, hence the latter is an equivalence. +\end{proof} + +\index{equivalence|)}% + + +\section{The higher groupoid structure of type formers} +\label{sec:computational} + +In \cref{cha:typetheory}, we introduced many ways to form new types: cartesian products, disjoint unions, dependent products, dependent sums, etc. +In \cref{sec:equality,sec:functors,sec:fibrations}, we saw that \emph{all} types in homotopy type theory behave like spaces or higher groupoids. +Our goal in the rest of the chapter is to make explicit how this higher structure behaves in the case of the particular types defined in \cref{cha:typetheory}. + +It turns out that for many types $A$, the equality types $\id[A]xy$ can be characterized, up to equivalence, in terms of whatever data was used to construct $A$. +For example, if $A$ is a cartesian product $B\times C$, and $x\jdeq (b,c)$ and $y\jdeq(b',c')$, then we have an equivalence +\begin{equation}\label{eq:prodeqv} + \eqv{\big((b,c)=(b',c')\big)}{\big((b=b')\times (c=c')\big)}. +\end{equation} +In more traditional language, two ordered pairs are equal just when their components are equal (but the equivalence~\eqref{eq:prodeqv} says rather more than this). +The higher structure of the identity types can also be expressed in terms of these equivalences; for instance, concatenating two equalities between pairs corresponds to pairwise concatenation. + +Similarly, when a type family $P:A\to\type$ is built up fiberwise using the type forming rules from \cref{cha:typetheory}, the operation $\transfib{P}{p}{\blank}$ can be characterized, up to homotopy, in terms of the corresponding operations on the data that went into $P$. +For instance, if $P(x) \jdeq B(x)\times C(x)$, then we have +\[\transfib{P}{p}{(b,c)} = \big(\transfib{B}{p}{b},\transfib{C}{p}{c}\big).\] + +Finally, the type forming rules are also functorial, and if a function $f$ is built from this functoriality, then the operations $\apfunc f$ and $\apdfunc f$ can be computed based on the corresponding ones on the data going into $f$. +For instance, if $g:B\to B'$ and $h:C\to C'$ and we define $f:B\times C \to B'\times C'$ by $f(b,c)\defeq (g(b),h(c))$, then modulo the equivalence~\eqref{eq:prodeqv}, we can identify $\apfunc f$ with ``$(\apfunc g,\apfunc h)$''. + +The next few sections (\crefrange{sec:compute-cartprod}{sec:compute-nat}) will be devoted to stating and proving theorems of this sort for all the basic type forming rules, with one section for each basic type former. +Here we encounter a certain apparent deficiency in currently available type theories; +as will become clear in later chapters, it would seem to be more convenient and intuitive if these characterizations of identity types, transport, and so on were \emph{judgmental}\index{judgmental equality} equalities. +However, in the theory presented in \cref{cha:typetheory}, the identity types are defined uniformly for all types by their induction principle, so we cannot ``redefine'' them to be different things at different types. +Thus, the characterizations for particular types to be discussed in this chapter are, for the most part, \emph{theorems} which we have to discover and prove, if possible. + +Actually, the type theory of \cref{cha:typetheory} is insufficient to prove the desired theorems for two of the type formers: $\Pi$-types and universes. +For this reason, we are forced to introduce axioms into our type theory, in order to make those ``theorems'' true. +Type-theoretically, an \emph{axiom} (c.f.~\cref{sec:axioms}) is an ``atomic'' element that is declared to inhabit some specified type, without there being any rules governing its behavior other than those pertaining to the type it inhabits. +\index{axiom!versus rules}% + +\index{function extensionality}% +\indexsee{extensionality, of functions}{function extensionality} +\index{univalence axiom}% +The axiom for $\Pi$-types (\cref{sec:compute-pi}) is familiar to type theorists: it is called \emph{function extensionality}, and states (roughly) that if two functions are homotopic in the sense of \cref{sec:basics-equivalences}, then they are equal. +The axiom for universes (\cref{sec:compute-universe}), however, is a new contribution of homotopy type theory due to Voevodsky: it is called the \emph{univalence axiom}, and states (roughly) that if two types are equivalent in the sense of \cref{sec:basics-equivalences}, then they are equal. +We have already remarked on this axiom in the introduction; it will play a very important role in this book.% +\footnote{We have chosen to introduce these principles as axioms, but there are potentially other ways to formulate a type theory in which they hold. + See the Notes to this chapter.} + +It is important to note that not \emph{all} identity types can be ``determined'' by induction over the construction of types. +Counterexamples include most nontrivial higher inductive types (see \cref{cha:hits,cha:homotopy}). +For instance, calculating the identity types of the types $\Sn^n$ (see \cref{sec:circle}) is equivalent to calculating the higher homotopy groups of spheres, a deep and important field of research in algebraic topology. + + +\section{Cartesian product types} +\label{sec:compute-cartprod} + +\index{type!product|(}% +Given types $A$ and $B$, consider the cartesian product type $A \times B$. +For any elements $x,y:A\times B$ and a path $p:\id[A\times B]{x}{y}$, by functoriality we can extract paths $\ap{\proj1}p:\id[A]{\proj1(x)}{\proj1(y)}$ and $\ap{\proj2}p:\id[B]{\proj2(x)}{\proj2(y)}$. +Thus, we have a function +\begin{equation}\label{eq:path-prod} + (\id[A\times B]{x}{y}) \to (\id[A]{\proj1(x)}{\proj1(y)}) \times (\id[B]{\proj2(x)}{\proj2(y)}). +\end{equation} + +\begin{thm}\label{thm:path-prod} + For any $x$ and $y$, the function~\eqref{eq:path-prod} is an equivalence. +\end{thm} + +Read logically, this says that two pairs are equal just if they are equal +componentwise. Read category-theoretically, this says that the +morphisms in a product groupoid are pairs of morphisms. Read +homotopy-theoretically, this says that the paths in a product +space are pairs of paths. + +\begin{proof} + We need a function in the other direction: + \begin{equation} + (\id[A]{\proj1(x)}{\proj1(y)}) \times (\id[B]{\proj2(x)}{\proj2(y)}) \to (\id[A\times B]{x}{y}). \label{eq:path-prod-inverse} + \end{equation} + By the induction rule for cartesian products, we may assume that $x$ and $y$ are both pairs, i.e.\ $x\jdeq (a,b)$ and $y\jdeq (a',b')$ for some $a,a':A$ and $b,b':B$. + In this case, what we want is a function + \begin{equation*} + (\id[A]{a}{a'}) \times (\id[B]{b}{b'}) \to \big(\id[A\times B]{(a,b)}{(a',b')}\big). + \end{equation*} + Now by induction for the cartesian product in its domain, we may assume given $p:a=a'$ and $q:b=b'$. + And by two path inductions, we may assume that $a\jdeq a'$ and $b\jdeq b'$ and both $p$ and $q$ are reflexivity. + But in this case, we have $(a,b)\jdeq(a',b')$ and so we can take the output to also be reflexivity. + + It remains to prove that~\eqref{eq:path-prod-inverse} is quasi-inverse to~\eqref{eq:path-prod}. + This is a simple sequence of inductions, but they have to be done in the right order. + + In one direction, let us start with $r:\id[A\times B]{x}{y}$. + We first do a path induction on $r$ in order to assume that $x\jdeq y$ and $r$ is reflexivity. + In this case, since $\apfunc{\proj1}$ and $\apfunc{\proj2}$ are defined by path induction,~\eqref{eq:path-prod} takes $r\jdeq \refl{x}$ to the pair $(\refl{\proj1x},\refl{\proj2x})$. + Now by induction on $x$, we may assume $x\jdeq (a,b)$, so that this is $(\refl a, \refl b)$. + Thus,~\eqref{eq:path-prod-inverse} takes it by definition to $\refl{(a,b)}$, which (under our current assumptions) is $r$. + + In the other direction, if we start with $s:(\id[A]{\proj1(x)}{\proj1(y)}) \times (\id[B]{\proj2(x)}{\proj2(y)})$, then we first do induction on $x$ and $y$ to assume that they are pairs $(a,b)$ and $(a',b')$, and then induction on $s:(\id[A]{a}{a'}) \times (\id[B]{b}{b'})$ to reduce it to a pair $(p,q)$ where $p:a=a'$ and $q:b=b'$. + Now by induction on $p$ and $q$, we may assume they are reflexivities $\refl a$ and $\refl b$, in which case~\eqref{eq:path-prod-inverse} yields $\refl{(a,b)}$ and then~\eqref{eq:path-prod} returns us to $(\refl a,\refl b)\jdeq (p,q)\jdeq s$. +\end{proof} + +In particular, we have shown that~\eqref{eq:path-prod} has an inverse~\eqref{eq:path-prod-inverse}, which we may denote by +\symlabel{defn:pairpath} +\[ +\pairpath : (\id{\proj{1}(x)}{\proj{1}(y)}) \times (\id{\proj{2}(x)}{\proj{2}(y)}) \to (\id x y). +\] +Note that a special case of this yields the propositional uniqueness principle\index{uniqueness!principle, propositional!for product types} for products: $z = (\proj1(z),\proj2(z))$. + +It can be helpful to view \pairpath as a \emph{constructor} or \emph{introduction rule} for $\id x y$, analogous to the ``pairing'' constructor of $A\times B$ itself, which introduces the pair $(a,b)$ given $a:A$ and $b:B$. +From this perspective, the two components of~\eqref{eq:path-prod}: +\begin{align*} + \projpath{1} &: (\id{x}{y}) \to (\id{\proj{1}(x)}{\proj{1} (y)})\\ + \projpath{2} &: (\id{x}{y}) \to (\id{\proj{2}(x)}{\proj{2} (y)}) +\end{align*} +are \emph{elimination} rules. +Similarly, the two homotopies which witness~\eqref{eq:path-prod-inverse} as quasi-inverse to~\eqref{eq:path-prod} consist, respectively, of \emph{propositional computation rules}: +\index{computation rule!propositional!for identities between pairs}% +\begin{align*} + {\projpath{1}{(\pairpath(p, q)})} + &= %_{(\id{\proj{1} x}{\proj{1} y})} + {p} \\ + {\projpath{2}{(\pairpath(p,q)})} + &= %_{(\id{\proj{2} x}{\proj{2} y})} + {q} +\end{align*} +for $p:\id{\proj{1} x}{\proj{1} y}$ and $q:\id{\proj{2} x}{\proj{2} y}$, +and a \emph{propositional uniqueness principle}: +\index{uniqueness!principle, propositional!for identities between pairs}% +\[ +\id{r}{\pairpath(\projpath{1} (r), \projpath{2} (r)) } +\qquad\text{for } r : \id[A \times B] x y. +\] + +We can also characterize the reflexivity, inverses, and composition of paths in $A\times B$ componentwise: +\begin{align*} + {\refl{(z : A \times B)}} + &= {\pairpath (\refl{\proj{1} z},\refl{\proj{2} z})} \\ + {\opp{p}} + &= {\pairpath \big(\opp{\projpath{1} (p)},\, \opp{\projpath{2} (p)}\big)} \\ + {{p \ct q}} + &= {\pairpath \big({\projpath{1} (p)} \ct {\projpath{1} (q)},\,{\projpath{2} (p)} \ct {\projpath{2} (q)}\big)}. +\end{align*} +Or, written differently: +\begin{alignat*}{2} + \projpath{i}(\refl{(z : A \times B)}) &= \refl{\proj{i} z} &\qquad (i=1,2)\\ + \pairpath(\opp p, \opp q) &= \opp{\pairpath(p,q)}\\ + \pairpath(p\ct q, p'\ct q') &= \pairpath(p,p') \ct \pairpath(q,q'). +\end{alignat*} +All of these equations can be derived by using path induction on the given paths and then returning reflexivity. +The same is true for the rest of the higher groupoid structure considered in \cref{sec:equality}, although it begins to get tedious to insert enough other coherence paths to yield an equation that will typecheck. +For instance, if we denote the inverse of the path in \cref{thm:omg}\ref{item:omg4} by $\ctassoc(p,q,r)$ and the last path displayed above by $\pairct(p,q,p',q')$, then for any $u,v,z,w:A\times B$ and $p,q,r,p',q',r'$ of appropriate types we have +\begin{equation*} + \begin{array}{l} + \pairct(p\ct q, r, p'\ct q', r') \\ + \ct\; (\pairct(p,q,p',q') \rightwhisker \pairpath(r,r')) \\ + \ct\; \ctassoc(\pairpath(p,p'),\pairpath(q,q'),\pairpath(r,r'))\\ + = + \begin{array}[t]{l} + \apfunc{\pairpath}({\pairpath(\ctassoc(p,q,r),\ctassoc(p',q',r'))})\\ + \ct\; \pairct(p, q\ct r, p', q'\ct r')\\ + \ct\; (\pairpath(p,p') \leftwhisker \pairct(q,r,q',r')). + \end{array} + \end{array} +\end{equation*} +Fortunately, we will never have to use any such higher-dimensional coherences. + +\index{transport!in product types}% +We now consider transport in a pointwise product of type families. +Given type families $ A, B : Z \to \type$, we abusively write $A\times B:Z\to \type$ for the type family defined by $(A\times B)(z) \defeq A(z) \times B(z)$. +Now given $p : \id[Z]{z}{w}$ and $x : A(z) \times B(z)$, we can transport $x$ along $p$ to obtain an element of $A(w)\times B(w)$. + +\begin{thm}\label{thm:trans-prod} + In the above situation, we have + \[ + \id[A(w) \times B(w)] + {\transfib{A\times B}px} + {(\transfib{A}{p}{\proj{1}x}, \transfib{B}{p}{\proj{2}x})}. + \] +\end{thm} +\begin{proof} + By path induction, we may assume $p$ is reflexivity, in which case we have + \begin{align*} + \transfib{A\times B}px&\jdeq x\\ + \transfib{A}{p}{\proj{1}x}&\jdeq \proj1x\\ + \transfib{B}{p}{\proj{2}x}&\jdeq \proj2x. + \end{align*} + Thus, it remains to show $x = (\proj1 x, \proj2x)$. + But this is the propositional uniqueness principle for product types, which, as we remarked above, follows from \cref{thm:path-prod}. +\end{proof} + +Finally, we consider the functoriality of $\apfunc{}$ under cartesian products. +Suppose given types $A,B,A',B'$ and functions $g:A\to A'$ and $h:B\to B'$; then we can define a function $f:A\times B\to A'\times B'$ by $f(x) \defeq (g(\proj1x),h(\proj2x))$. + +\begin{thm}\label{thm:ap-prod} + In the above situation, given $x,y:A\times B$ and $p:\proj1x=\proj1y$ and $q:\proj2x=\proj2y$, we have + \[ \id[(f(x)=f(y))]{\ap{f}{\pairpath(p,q)}} {\pairpath(\ap{g}{p},\ap{h}{q})}. \] +\end{thm} +\begin{proof} + Note first that the above equation is well-typed. + On the one hand, since $\pairpath(p,q):x=y$ we have $\ap{f}{\pairpath(p,q)}:f(x)=f(y)$. + On the other hand, since $\proj1(f(x))\jdeq g(\proj1x)$ and $\proj2(f(x))\jdeq h(\proj2x)$, we also have $\pairpath(\ap{g}{p},\ap{h}{q}):f(x)=f(y)$. + + Now, by induction, we may assume $x\jdeq(a,b)$ and $y\jdeq(a',b')$, in which case we have $p:a=a'$ and $q:b=b'$. + Thus, by path induction, we may assume $p$ and $q$ are reflexivity, in which case the desired equation holds judgmentally. +\end{proof} + +\index{type!product|)}% + +\section{\texorpdfstring{$\Sigma$}{Σ}-types} +\label{sec:compute-sigma} + +\index{type!dependent pair|(}% +Let $A$ be a type and $P:A\to\type$ a type family. +Recall that the $\Sigma$-type, or dependent pair type, $\sm{x:A} P(x)$ is a generalization of the cartesian product type. +Thus, we expect its higher groupoid structure to also be a generalization of the previous section. +In particular, its paths should be pairs of paths, but it takes a little thought to give the correct types of these paths. + +Suppose that we have a path $p:w=w'$ in $\sm{x:A}P(x)$. +Then we get $\ap{\proj{1}}{p}:\proj{1}(w)=\proj{1}(w')$. +However, we cannot directly ask whether $\proj{2}(w)$ is identical to $\proj{2}(w')$ since they don't have to be in the same type. +But we can transport\index{transport} $\proj{2}(w)$ along the path $\ap{\proj{1}}{p}$, and this does give us an element of the same type as $\proj{2}(w')$. +By path induction, we do in fact obtain a path $\trans{\ap{\proj{1}}{p}}{\proj{2}(w)}=\proj{2}(w')$. + +Recall from the discussion preceding \cref{lem:mapdep} that +\narrowequation{ + \trans{\ap{\proj{1}}{p}}{\proj{2}(w)}=\proj{2}(w') +} +can be regarded as the type of paths from $\proj2(w)$ to $\proj2(w')$ which lie over the path $\ap{\proj1}{p}$ in $A$. +\index{fibration}% +\index{total!space}% +Thus, we are saying that a path $w=w'$ in the total space determines (and is determined by) a path $p:\proj1(w)=\proj1(w')$ in $A$ together with a path from $\proj2(w)$ to $\proj2(w')$ lying over $p$, which seems sensible. + +\begin{rmk}\label{rmk:sigma-equality-extraction} + Note that if we have $x:A$ and $u,v:P(x)$ such that $(x,u)=(x,v)$, it does not follow that $u=v$ --- see \cref{ex:sigma-eq-components-neq} for a counterexample. + All we can conclude is that there exists $p:x=x$ such that $\trans p u = v$. + This is a well-known source of confusion for newcomers to type theory, but it makes sense from a topological viewpoint: the existence of a path $(x,u)=(x,v)$ in the total space of a fibration between two points that happen to lie in the same fiber does not imply the existence of a path $u=v$ lying entirely \emph{within} that fiber. +\end{rmk} + +The next theorem states that we can also reverse this process. +Since it is a direct generalization of \cref{thm:path-prod}, we will be more concise. + +\begin{thm}\label{thm:path-sigma} +Suppose that $P:A\to\type$ is a type family over a type $A$ and let $w,w':\sm{x:A}P(x)$. Then there is an equivalence +\begin{equation*} +\eqvspaced{(w=w')}{\dsm{p:\proj{1}(w)=\proj{1}(w')} \trans{p}{\proj{2}(w)}=\proj{2}(w')}. +\end{equation*} +\end{thm} + +\begin{proof} +We define a function +\begin{equation*} +f : \prd{w,w':\sm{x:A}P(x)} (w=w') \to \dsm{p:\proj{1}(w)=\proj{1}(w')} \trans{p}{\proj{2}(w)}=\proj{2}(w') +\end{equation*} +by path induction, with +\begin{equation*} +f(w,w,\refl{w})\defeq(\refl{\proj{1}(w)},\refl{\proj{2}(w)}). +\end{equation*} +We want to show that $f$ is an equivalence. + +In the reverse direction, we define +\begin{narrowmultline*} + g : \prd{w,w':\sm{x:A}P(x)} + \Parens{\sm{p:\proj{1}(w)=\proj{1}(w')}\trans{p}{\proj{2}(w)}=\proj{2}(w')} + \to + \narrowbreak + (w=w') +\end{narrowmultline*} +by first inducting on $w$ and $w'$, which splits them into $(w_1,w_2)$ and +$(w_1',w_2')$ respectively, so it suffices to show +\begin{equation*} +\Parens{\sm{p:w_1 = w_1'}\trans{p}{w_2}=w_2'} \to ((w_1,w_2)=(w_1',w_2')). +\end{equation*} +Next, given a pair $\sm{p:w_1 = w_1'}\trans{p}{w_2}=w_2'$, we can +use $\Sigma$-induction to get $p : w_1 = w_1'$ and $q : +\trans{p}{w_2}=w_2'$. Inducting on $p$, we have $q : +\trans{(\refl{w_1})}{w_2}=w_2'$, and it suffices to show +$(w_1,w_2)=(w_1,w_2')$. But $\trans{(\refl{w_1})}{w_2} \jdeq w_2$, so +inducting on $q$ reduces the goal to +$(w_1,w_2)=(w_1,w_2)$, which we can prove with $\refl{(w_1,w_2)}$. + +Next we show that $f(g(r))=r$ for all $w$, $w'$ and +$r$, where $r$ has type +\[\dsm{p:\proj{1}(w)=\proj{1}(w')} (\trans{p}{\proj{2}(w)}=\proj{2}(w')).\] +First, we break apart the pairs $w$, $w'$, and $r$ by pair induction, as in the +definition of $g$, and then use two path inductions to reduce both components +of $r$ to \refl{}. Then it suffices to show that +$f (g(\refl{w_1},\refl{w_2})) = (\refl{w_1},\refl{w_2})$, which is true by definition. + +Similarly, to show that $g(f(p))=p$ for all $w$, $w'$, +and $p : w = w'$, we can do path induction on $p$, and then pair induction to +split $w$, at which point it suffices to show that +$g(f (\refl{(w_1,w_2)})) = \refl{(w_1,w_2)}$, which is true by +definition. + +Thus, $f$ has a quasi-inverse, and is therefore an equivalence. +\end{proof} + +As we did in the case of cartesian products, we can deduce a propositional uniqueness principle as a special case. + +\begin{cor}\label{thm:eta-sigma} + \index{uniqueness!principle, propositional!for dependent pair types}% + For $z:\sm{x:A} P(x)$, we have $z = (\proj1(z),\proj2(z))$. +\end{cor} +\begin{proof} + We have $\refl{\proj1(z)} : \proj1(z) = \proj1(\proj1(z),\proj2(z))$, so by \cref{thm:path-sigma} it will suffice to exhibit a path $\trans{(\refl{\proj1(z)})}{\proj2(z)} = \proj2(\proj1(z),\proj2(z))$. + But both sides are judgmentally equal to $\proj2(z)$. +\end{proof} + +Like with binary cartesian products, we can think of +the backward direction of \cref{thm:path-sigma} as +an introduction form (\pairpath{}{}), the forward direction as +elimination forms (\projpath{1} and \projpath{2}), and the equivalence +as giving a propositional computation rule and uniqueness principle for these. + +Note that the lifted path $\mathsf{lift}(u,p)$ of $p:x=y$ at $u:P(x)$ defined in \cref{thm:path-lifting} may be identified with the special case of the introduction form +\[\pairpath(p,\refl{\trans p u}):(x,u) = (y,\trans p u).\] +\index{transport!in dependent pair types}% +This appears in the statement of action of transport on $\Sigma$-types, which is also a generalization of the action for binary cartesian products: + +\begin{thm}\label{transport-Sigma} + Suppose we have type families + % + \begin{equation*} + P:A\to\type + \qquad\text{and}\qquad + Q:\Parens{\sm{x:A} P(x)}\to\type. + \end{equation*} + % + Then we can construct the type family over $A$ defined by + \begin{equation*} + x \mapsto \sm{u:P(x)} Q(x,u). + \end{equation*} + For any path $p:x=y$ and any $(u,z):\sm{u:P(x)} Q(x,u)$ we have + \begin{equation*} + \trans{p}{u,z}=\big(\trans{p}{u},\,\trans{\pairpath(p,\refl{\trans pu})}{z}\big). + \end{equation*} +\end{thm} + +\begin{proof} +Immediate by path induction. +\end{proof} + +We leave it to the reader to state and prove a generalization of +\cref{thm:ap-prod} (see \cref{ex:ap-sigma}), and to characterize +the reflexivity, inverses, and composition of $\Sigma$-types +componentwise. + +\index{type!dependent pair|)}% + +\section{The unit type} +\label{sec:compute-unit} + +\index{type!unit|(}% +Trivial cases are sometimes important, so we mention briefly the case of the unit type~\unit. + +\begin{thm}\label{thm:path-unit} + For any $x,y:\unit$, we have $\eqv{(x=y)}{\unit}$. +\end{thm} + +It may be tempting to begin this proof by $\unit$-induction on $x$ and $y$, reducing the problem to $\eqv{(\ttt=\ttt)}{\unit}$. +However, at this point we would be stuck, since we would be unable to perform a path induction on $p:\ttt=\ttt$. +Thus, we instead work with a general $x$ and $y$ as much as possible, reducing them to $\ttt$ by induction only at the last moment. + +\begin{proof} + A function $(x=y)\to\unit$ is easy to define by sending everything to \ttt. + Conversely, for any $x,y:\unit$ we may assume by induction that $x\jdeq \ttt\jdeq y$. + In this case we have $\refl{\ttt}:x=y$, yielding a constant function $\unit\to(x=y)$. + + To show that these are inverses, consider first an element $u:\unit$. + We may assume that $u\jdeq\ttt$, but this is also the result of the composite $\unit \to (x=y)\to\unit$. + + On the other hand, suppose given $p:x=y$. + By path induction, we may assume $x\jdeq y$ and $p$ is $\refl x$. + We may then assume that $x$ is \ttt, in which case the composite $(x=y) \to \unit\to(x=y)$ takes $p$ to $\refl x$, i.e.\ to~$p$. +\end{proof} + +In particular, any two elements of $\unit$ are equal. +We leave it to the reader to formulate this equivalence in terms of introduction, elimination, computation, and uniqueness rules. +\index{transport!in unit type}% +The transport lemma for \unit is simply the transport lemma for constant type families (\cref{thm:trans-trivial}). + +\index{type!unit|)}% + +\section{\texorpdfstring{$\Pi$}{Π}-types and the function extensionality axiom} +\label{sec:compute-pi} + +\index{type!dependent function|(}% +\index{type!function|(}% +\index{homotopy|(}% +Given a type $A$ and a type family $B : A \to \type$, consider the dependent function type $\prd{x:A}B(x)$. +We expect the type $f=g$ of paths from $f$ to $g$ in $\prd{x:A} B(x)$ to be equivalent to +the type of pointwise paths:\index{pointwise!equality of functions} +\begin{equation} + \eqvspaced{(\id{f}{g})}{\Parens{\prd{x:A} (\id[B(x)]{f(x)}{g(x)})}}.\label{eq:path-forall} +\end{equation} +From a traditional perspective, this would say that two functions which are equal at each point are equal as functions. +\index{continuity of functions in type theory@``continuity'' of functions in type theory}% +From a topological perspective, it would say that a path in a function space is the same as a continuous homotopy. +\index{functoriality of functions in type theory@``functoriality'' of functions in type theory}% +And from a categorical perspective, it would say that an isomorphism in a functor category is a natural family of isomorphisms. + +Unlike the case in the previous sections, however, the basic type theory presented in \cref{cha:typetheory} is insufficient to prove~\eqref{eq:path-forall}. +All we can say is that there is a certain function +\begin{equation}\label{eq:happly} + \happly : (\id{f}{g}) \to \prd{x:A} (\id[B(x)]{f(x)}{g(x)}) +\end{equation} +which is easily defined by path induction. +For the moment, therefore, we will assume: + +\begin{axiom}[Function extensionality]\label{axiom:funext} + \indexsee{axiom!function extensionality}{function extensionality}% + \indexdef{function extensionality}% + For any $A$, $B$, $f$, and $g$, the function~\eqref{eq:happly} is an equivalence. +\end{axiom} + +We will see in later chapters that this axiom follows both from univalence (see \cref{sec:compute-universe,sec:univalence-implies-funext}) and from an interval type (see \cref{sec:interval} and \cref{ex:funext-from-interval}). + +In particular, \cref{axiom:funext} implies that~\eqref{eq:happly} has a quasi-inverse +\[ +\funext : \Parens{\prd{x:A} (\id{f(x)}{g(x)})} \to {(\id{f}{g})}. +\] +This function is also referred to as ``function extensionality''. +As we did with $\pairpath$ in \cref{sec:compute-cartprod}, we can regard $\funext$ as an \emph{introduction rule} for the type $\id f g$. +From this point of view, $\happly$ is the \emph{elimination rule}, while the homotopies witnessing $\funext$ as quasi-inverse to $\happly$ become a propositional computation rule\index{computation rule!propositional!for identities between functions} +\[ +\id{\happly({\funext{(h)}},x)}{h(x)} \qquad\text{for }h:\prd{x:A} (\id{f(x)}{g(x)}) +\] +and a propositional uniqueness principle\index{uniqueness!principle!for identities between functions}: +\[ +\id{p}{\funext (x \mapsto \happly(p,{x}))} \qquad\text{for } p: \id f g. +\] + +We can also compute the identity, inverses, and composition in $\Pi$-types; they are simply given by pointwise operations:\index{pointwise!operations on functions} +\begin{align*} +\refl{f} &= \funext(x \mapsto \refl{f(x)}) \\ +\opp{\alpha} &= \funext (x \mapsto \opp{\happly (\alpha,x)}) \\ +{\alpha} \ct \beta &= \funext (x \mapsto {\happly({\alpha},x) \ct \happly({\beta},x)}). +\end{align*} +The first of these equalities follows from the definition of $\happly$, while the second and third are easy path inductions. + +Since the non-dependent function type $A\to B$ is a special case of the dependent function type $\prd{x:A} B(x)$ when $B$ is independent of $x$, everything we have said above applies in non-dependent cases as well. +\index{transport!in function types}% +The rules for transport, however, are somewhat simpler in the non-dependent case. +Given a type $X$, a path $p:\id[X]{x_1}{x_2}$, type families $A,B:X\to \type$, and a function $f : A(x_1) \to B(x_1)$, we have +\begin{align}\label{eq:transport-arrow} + \transfib{A\to B}{p}{f} &= + \Big(x \mapsto \transfib{B}{p}{f(\transfib{A}{\opp p}{x})}\Big) +\end{align} +where $A\to B$ denotes abusively the type family $X\to \type$ defined by +\[(A\to B)(x) \defeq (A(x)\to B(x)).\] +In other words, when we transport a function $f:A(x_1)\to B(x_1)$ along a path $p:x_1=x_2$, we obtain the function $A(x_2)\to B(x_2)$ which transports its argument backwards along $p$ (in the type family $A$), applies $f$, and then transports the result forwards along $p$ (in the type family $B$). +This can be proven easily by path induction. + +\index{transport!in dependent function types}% +Transporting dependent functions is similar, but more complicated. +Suppose given $X$ and $p$ as before, type families $A:X\to \type$ and $B:\prd{x:X} (A(x)\to\type)$, and also a dependent function $f : \prd{a:A(x_1)} B(x_1,a)$. +Then for $a:A(x_2)$, we have +\begin{narrowmultline*} + \transfib{\Pi_A(B)}{p}{f}(a) = \narrowbreak + \Transfib{\widehat{B}}{\opp{(\pairpath(\opp{p},\refl{ \trans{\opp p}{a} }))}}{f(\transfib{A}{\opp p}{a})} +\end{narrowmultline*} +where $\Pi_A(B)$ and $\widehat{B}$ denote respectively the type families +\begin{equation}\label{eq:transport-arrow-families} +\begin{array}{rclcl} +\Pi_A(B) &\defeq& \big(x\mapsto \prd{a:A(x)} B(x,a) \big) &:& X\to \type\\ +\widehat{B} &\defeq& \big(w \mapsto B(\proj1w,\proj2w) \big) &:& \big(\sm{x:X} A(x)\big) \to \type. +\end{array} +\end{equation} +If these formulas look a bit intimidating, don't worry about the details. +The basic idea is just the same as for the non-dependent function type: we transport the argument backwards, apply the function, and then transport the result forwards again. + +Now recall that for a general type family $P:X\to\type$, in \cref{sec:functors} we defined the type of \emph{dependent paths} over $p:\id[X]xy$ from $u:P(x)$ to $v:P(y)$ to be $\id[P(y)]{\trans{p}{u}}{v}$. +When $P$ is a family of function types, there is an equivalent way to represent this which is often more convenient. +\index{path!dependent!in function types} + +\begin{lem}\label{thm:dpath-arrow} + Given type families $A,B:X\to\type$ and $p:\id[X]xy$, and also $f:A(x)\to B(x)$ and $g:A(y)\to B(y)$, we have an equivalence + \[ \eqvspaced{ \big(\trans{p}{f} = {g}\big) } { \prd{a:A(x)} (\trans{p}{f(a)} = g(\trans{p}{a})) }. \] + Moreover, if $q:\trans{p}{f} = {g}$ corresponds under this equivalence to $\widehat q$, then for $a:A(x)$, the path + \[ \happly(q,\trans p a) : (\trans p f)(\trans p a) = g(\trans p a)\] + is equal to the concatenated path $i\ct j\ct k$, where + \begin{itemize} + \item $i:(\trans p f)(\trans p a) = \trans p {f (\trans {\opp p}{\trans p a})}$ comes from~\eqref{eq:transport-arrow}, + \item $j:\trans p {f (\trans {\opp p}{\trans p a})} = \trans p {f(a)}$ comes from \cref{thm:transport-concat,thm:omg}, and + \item $k:\trans p {f(a)}= g(\trans p a)$ is $\widehat{q}(a)$. + \end{itemize} +\end{lem} +\begin{proof} + By path induction, we may assume $p$ is reflexivity, in which case the desired equivalence reduces to function extensionality. + The second statement then follows by the computation rule for function extensionality. +\end{proof} + +In general, it happens quite frequently that we want to consider a concatenation of paths each of which arises from some previously proven lemmas or hypothesized objects, and it can be rather tedious to describe this by giving a name to each path in the concatenation as we did in the second statement above. +Thus, we adopt a convention of writing such concatenations in the familiar mathematical style of ``chains of equalities with reasons'', and allow ourselves to omit reasons that the reader can easily fill in. +For instance, the path $i\ct j\ct k$ from \cref{thm:dpath-arrow} would be written like this: + \begin{align*} + (\trans p f)(\trans p a) + &= \trans p {f (\trans {\opp p}{\trans p a})} + \tag{by~\eqref{eq:transport-arrow}}\\ + &= \trans p {f(a)}\\ + &= g(\trans p a). + \tag{by $\widehat{q}$} + \end{align*} +In ordinary mathematics, such a chain of equalities would be merely proving that two things are equal. +We are enhancing this by using it to describe a \emph{particular} path between them. + +As usual, there is a version of \cref{thm:dpath-arrow} for dependent functions that is similar, but more complicated. +\index{path!dependent!in dependent function types} + +\begin{lem}\label{thm:dpath-forall} + Given type families $A:X\to\type$ and $B:\prd{x:X} A(x)\to\type$ and $p:\id[X]xy$, and also $f:\prd{a:A(x)} B(x,a)$ and $g:\prd{a:A(y)} B(y,a)$, we have an equivalence + \[ \eqvspaced{ \big(\trans{p}{f} = {g}\big) } { \Parens{\prd{a:A(x)} \transfib{\widehat{B}}{\pairpath(p,\refl{\trans pa})}{f(a)} = g(\trans{p}{a}) } } \] + with $\widehat{B}$ as in~\eqref{eq:transport-arrow-families}. +\end{lem} + +We leave it to the reader to prove this and to formulate a suitable computation rule. + +\index{homotopy|)}% +\index{type!dependent function|)}% +\index{type!function|)}% + +\section{Universes and the univalence axiom} +\label{sec:compute-universe} + +\index{type!universe|(}% +\index{equivalence|(}% +Given two types $A$ and $B$, we may consider them as elements of some universe type \type, and thereby form the identity type $\id[\type]AB$. +As mentioned in the introduction, \emph{univalence} is the identification of $\id[\type]AB$ with the type $(\eqv AB)$ of equivalences from $A$ to $B$, which we described in \cref{sec:basics-equivalences}. +We perform this identification by way of the following canonical function. + +\begin{lem}\label{thm:idtoeqv} + For types $A,B:\type$, there is a certain function, + \begin{equation}\label{eq:uidtoeqv} + \idtoeqv : (\id[\type]AB) \to (\eqv A B), + \end{equation} + defined in the proof. +\end{lem} +\begin{proof} + We could construct this directly by induction on equality, but the following description is more convenient. + \index{identity!function}% + \index{function!identity}% + Note that the identity function $\idfunc[\type]:\type\to\type$ may be regarded as a type family indexed by the universe \type; it assigns to each type $X:\type$ the type $X$ itself. + (When regarded as a fibration, its total space is the type $\sm{A:\type}A$ of ``pointed types''; see also \cref{sec:object-classification}.) + Thus, given a path $p:A =_\type B$, we have a transport\index{transport} function $\transf{p}:A \to B$. + We claim that $\transf{p}$ is an equivalence. + But by induction, it suffices to assume that $p$ is $\refl A$, in which case $\transf{p} \jdeq \idfunc[A]$, which is an equivalence by \cref{eg:idequiv}. + Thus, we can define $\idtoeqv(p)$ to be $\transf{p}$ (together with the above proof that it is an equivalence). +\end{proof} + +We would like to say that \idtoeqv is an equivalence. +However, as with $\happly$ for function types, the type theory described in \cref{cha:typetheory} is insufficient to guarantee this. +Thus, as we did for function extensionality, we formulate this property as an axiom: Voevodsky's \emph{univalence axiom}. + +\begin{axiom}[Univalence]\label{axiom:univalence} + \indexdef{univalence axiom}% + \indexsee{axiom!univalence}{univalence axiom}% + For any $A,B:\type$, the function~\eqref{eq:uidtoeqv} is an equivalence. +\end{axiom} + +In particular, therefore, we have + \[ +\eqv{(\id[\type]{A}{B})}{(\eqv A B)}. +\] + +Technically, the univalence axiom is a statement about a particular universe type $\UU$. +If a universe $\UU$ satisfies this axiom, we say that it is \define{univalent}. +\indexdef{type!universe!univalent}% +\indexdef{univalent universe}% +Except when otherwise noted (e.g.\ in \cref{sec:univalence-implies-funext}) we will assume that \emph{all} universes are univalent. + +\begin{rmk} + It is important for the univalence axiom that we defined $\eqv AB$ using a ``good'' version of $\isequiv$ as described in \cref{sec:basics-equivalences}, rather than (say) as $\sm{f:A\to B} \qinv(f)$. + See \cref{ex:qinv-univalence}. +\end{rmk} + +In particular, univalence means that \emph{equivalent types may be identified}. +As we did in previous sections, it is useful to break this equivalence into: +% +\symlabel{ua} +\begin{itemize} +\item An introduction rule for {(\id[\type]{A}{B})}, denoted $\ua$ for ``univalence axiom'': + \[ + \ua : ({\eqv A B}) \to (\id[\type]{A}{B}). + \] +\item The elimination rule, which is $\idtoeqv$, + \[ + \idtoeqv \jdeq \transfibf{X \mapsto X} : (\id[\type]{A}{B}) \to (\eqv A B). + \] +\item The propositional computation rule\index{computation rule!propositional!for univalence}, + \[ + \transfib{X \mapsto X}{\ua(f)}{x} = f(x). + \] +\item The propositional uniqueness principle: \index{uniqueness!principle, propositional!for univalence} + for any $p : \id A B$, + \[ + \id{p}{\ua(\transfibf{X \mapsto X}(p))}. + \] +\end{itemize} +% +We can also identify the reflexivity, concatenation, and inverses of equalities in the universe with the corresponding operations on equivalences: +\begin{align*} + \refl{A} &= \ua(\idfunc[A]) \\ + \ua(f) \ct \ua(g) &= \ua(g\circ f) \\ + \opp{\ua(f)} &= \ua(f^{-1}). +\end{align*} +The first of these follows because $\idfunc[A] = \idtoeqv(\refl{A})$ by definition of \idtoeqv, and \ua is the inverse of \idtoeqv. +For the second, if we define $p \defeq \ua(f)$ and $q\defeq \ua(g)$, then we have +\[ \ua(g\circ f) = \ua(\idtoeqv(q) \circ \idtoeqv(p)) = \ua(\idtoeqv(p\ct q)) = p\ct q\] +using \cref{thm:transport-concat} and the definition of $\idtoeqv$. +The third is similar. + +The following observation, which is a special case of \cref{thm:transport-compose}, is often useful when applying the univalence axiom. + +\begin{lem}\label{thm:transport-is-ap} + For any type family $B:A\to\type$ and $x,y:A$ with a path $p:x=y$ and $u:B(x)$, we have + \begin{align*} + \transfib{B}{p}{u} &= \transfib{X\mapsto X}{\apfunc{B}(p)}{u}\\ + &= \idtoeqv(\apfunc{B}(p))(u). + \end{align*} +\end{lem} + +\index{equivalence|)}% +\index{type!universe|)}% + +\section{Identity type} +\label{sec:compute-paths} + +\index{type!identity|(}% +Just as the type \id[A]{a}{a'} is characterized up to isomorphism, with +a separate ``definition'' for each $A$, there is no simple +characterization of the type \id[{\id[A]{a}{a'}}]{p}{q} of paths between +paths $p,q : \id[A]{a}{a'}$. +However, our other general classes of theorems do extend to identity types, such as the fact that they respect equivalence. + +\begin{thm}\label{thm:paths-respects-equiv} + If $f : A \to B$ is an equivalence, then for all $a,a':A$, so is + \[\apfunc{f} : (\id[A]{a}{a'}) \to (\id[B]{f(a)}{f(a')}).\] +\end{thm} +\begin{proof} + Let $\opp f$ be a quasi-inverse of $f$, with homotopies + % + \begin{equation*} + \alpha:\prd{b:B} (f(\opp f(b))=b) + \qquad\text{and}\qquad + \beta:\prd{a:A} (\opp f(f(a)) = a). + \end{equation*} + % + The quasi-inverse of $\apfunc{f}$ is, essentially, + \[\apfunc{\opp f} : (\id{f(a)}{f(a')}) \to (\id{\opp f(f(a))}{\opp f(f(a'))}).\] + However, in order to obtain an element of $\id[A]{a}{a'}$ from $\apfunc{\opp f}(q)$, we must concatenate with the paths $\opp{\beta_a}$ and $\beta_{a'}$ on either side. + To show that this gives a quasi-inverse of $\apfunc{f}$, on one hand we must show that for any $p:\id[A]{a}{a'}$ we have + \[ \opp{\beta_a} \ct \apfunc{\opp f}(\apfunc{f}(p)) \ct \beta_{a'} = p. \] + This follows from the functoriality of $\apfunc{}$ and the naturality of homotopies, \cref{lem:ap-functor,lem:htpy-natural}. + On the other hand, we must show that for any $q:\id[B]{f(a)}{f(a')}$ we have + \[ \apfunc{f}\big( \opp{\beta_a} \ct \apfunc{\opp f}(q) \ct \beta_{a'} \big) = q. \] + The proof of this is a little more involved, but each step is again an application of \cref{lem:ap-functor,lem:htpy-natural} (or simply canceling inverse paths): + \begin{align*} + \apfunc{f}\big( \narrowamp\opp{\beta_a} \ct \apfunc{\opp f}(q) \ct \beta_{a'} \big) \narrowbreak + &= \opp{\alpha_{f(a)}} \ct {\alpha_{f(a)}} \ct + \apfunc{f}\big( \opp{\beta_a} \ct \apfunc{\opp f}(q) \ct \beta_{a'} \big) + \ct \opp{\alpha_{f(a')}} \ct {\alpha_{f(a')}}\\ + &= \opp{\alpha_{f(a)}} \ct + \apfunc f \big(\apfunc{\opp f}\big(\apfunc{f}\big( \opp{\beta_a} \ct \apfunc{\opp f}(q) \ct \beta_{a'} \big)\big)\big) + \ct {\alpha_{f(a')}}\\ + &= \opp{\alpha_{f(a)}} \ct + \apfunc f \big(\beta_a \ct \opp{\beta_a} \ct \apfunc{\opp f}(q) \ct \beta_{a'} \ct \opp{\beta_{a'}} \big) + \ct {\alpha_{f(a')}}\\ + &= \opp{\alpha_{f(a)}} \ct + \apfunc f (\apfunc{\opp f}(q)) + \ct {\alpha_{f(a')}}\\ + &= q.\qedhere + \end{align*} +\end{proof} + +Thus, if for some type $A$ we have a full characterization of $\id[A]{a}{a'}$, the type $\id[{\id[A]{a}{a'}}]{p}{q}$ is determined as well. +For example: +\begin{itemize} +\item Paths $p = q$, where $p,q : \id[A \times B]{w}{w'}$, are equivalent to pairs of paths + \[\id[{\id[A]{\proj{1} w}{\proj{1} w'}}]{\projpath{1}{p}}{\projpath{1}{q}} + \quad\text{and}\quad + \id[{\id[B]{\proj{2} w}{\proj{2} w'}}]{\projpath{2}{p}}{\projpath{2}{q}}. + \] +\item Paths $p = q$, where $p,q : \id[\prd{x:A} B(x)]{f}{g}$, are equivalent to homotopies + \[\prd{x:A} (\id[f(x)=g(x)] {\happly(p)(x)}{\happly(q)(x)}).\] +\end{itemize} + +\index{transport!in identity types}% +Next we consider transport in families of paths, i.e.\ transport in $C:A\to\type$ where each $C(x)$ is an identity type. +The simplest case is when $C(x)$ is a type of paths in $A$ itself, perhaps with one endpoint fixed. + +\begin{lem}\label{cor:transport-path-prepost} + For any $A$ and $a:A$, with $p:x_1=x_2$, we have + % + \begin{align*} + \transfib{x \mapsto (\id{a}{x})} {p} {q} &= q \ct p + & &\text{for $q:a=x_1$,}\\ + \transfib{x \mapsto (\id{x}{a})} {p} {q} &= \opp {p} \ct q + & &\text{for $q:x_1=a$,}\\ + \transfib{x \mapsto (\id{x}{x})} {p} {q} &= \opp{p} \ct q \ct p + & &\text{for $q:x_1=x_1$.} + \end{align*} +\end{lem} +\begin{proof} + Path induction on $p$, followed by the unit laws for composition. +\end{proof} + +In other words, transporting with ${x \mapsto \id{c}{x}}$ is post-composition, and transporting with ${x \mapsto \id{x}{c}}$ is contravariant pre-composition. +These may be familiar as the functorial actions of the covariant and contravariant hom-functors $\hom(c, {\blank})$ and $\hom({\blank},c)$ in category theory. + +Similarly, we can prove the following more general form of \cref{cor:transport-path-prepost}, which is related to \cref{thm:transport-compose}. + +\begin{thm}\label{thm:transport-path} + For $f,g:A\to B$, with $p : \id[A]{a}{a'}$ and $q : \id[B]{f(a)}{g(a)}$, we have + \begin{equation*} + \id[f(a') = g(a')]{\transfib{x \mapsto \id[B]{f(x)}{g(x)}}{p}{q}} + {\opp{(\apfunc{f}{p})} \ct q \ct \apfunc{g}{p}}. + \end{equation*} +\end{thm} + +Because $\apfunc{(x \mapsto x)}$ is the identity function and $\apfunc{(x \mapsto c)}$ (where $c$ is a constant) is $p \mapsto\refl{c}$, \cref{cor:transport-path-prepost} is a special case. +A yet more general version is when $B$ can be a family of types indexed on $A$: + +\begin{thm}\label{thm:transport-path2} + Let $B : A \to \type$ and $f,g : \prd{x:A} B(x)$, with $p : \id[A]{a}{a'}$ and $q : \id[B(a)]{f(a)}{g(a)}$. + Then we have + \begin{equation*} + \transfib{x \mapsto \id[B(x)]{f(x)}{g(x)}}{p}{q} = + \opp{(\apdfunc{f}(p))} \ct \apfunc{(\transfibf{B}{p})}(q) \ct \apdfunc{g}(p). + \end{equation*} +\end{thm} + +Finally, as in \cref{sec:compute-pi}, for families of identity types there is another equivalent characterization of dependent paths. +\index{path!dependent!in identity types} + +\begin{thm}\label{thm:dpath-path} + For $p:\id[A]a{a'}$ with $q:a=a$ and $r:a'=a'$, we have + \[ \eqvspaced{ \big(\transfib{x\mapsto (x=x)}{p}{q} = r \big) }{ \big( q \ct p = p \ct r \big). } \] +\end{thm} +\begin{proof} + Path induction on $p$, followed by the fact that composing with the unit equalities $q\ct 1 = q$ and $r = 1\ct r$ is an equivalence. +\end{proof} + +There are more general equivalences involving the application of functions, akin to \cref{thm:transport-path,thm:transport-path2}. + +\index{type!identity|)}% + +\section{Coproducts} +\label{sec:compute-coprod} + +\index{type!coproduct|(}% +\index{encode-decode method|(}% +So far, most of the type formers we have considered have been what are called \emph{negative}. +\index{type!negative}\index{negative!type}% +\index{polarity}% +Intuitively, this means that their elements are determined by their behavior under the elimination rules: a (dependent) pair is determined by its projections, and a (dependent) function is determined by its values. +The identity types of negative types can almost always be characterized straightforwardly, along with all of their higher structure, as we have done in \crefrange{sec:compute-cartprod}{sec:compute-pi}. +The universe is not exactly a negative type, but its identity types behave similarly: we have a straightforward characterization (univalence) and a description of the higher structure. +Identity types themselves, of course, are a special case. + +We now consider our first example of a \emph{positive} type former. +\index{type!positive}\index{positive!type}% +Again informally, a positive type is one which is ``presented'' by certain constructors, with the universal property of a presentation\index{presentation!of a positive type by its constructors} being expressed by its elimination rule. +(Categorically speaking, a positive type has a ``mapping out'' universal property, while a negative type has a ``mapping in'' universal property.) +Because computing with presentations is, in general, an uncomputable problem, for positive types we cannot always expect a straightforward characterization of the identity type. +However, in many particular cases, a characterization or partial characterization does exist, and can be obtained by the general method that we introduce with this example. + +(Technically, our chosen presentation of cartesian products and $\Sigma$-types is also positive. +However, because these types also admit a negative presentation which differs only slightly, their identity types have a direct characterization that does not require the method to be described here.) + +Consider the coproduct type $A+B$, which is ``presented'' by the injections $\inl:A\to A+B$ and $\inr:B\to A+B$. +Intuitively, we expect that $A+B$ contains exact copies of $A$ and $B$ disjointly, so that we should have +\begin{align} + {(\inl(a_1)=\inl(a_2))}&\eqvsym {(a_1=a_2)} \label{eq:inlinj}\\ + {(\inr(b_1)=\inr(b_2))}&\eqvsym {(b_1=b_2)}\\ + {(\inl(a)= \inr(b))} &\eqvsym {\emptyt}. \label{eq:inlrdj} +\end{align} +We prove this as follows. +Fix an element $a_0:A$; we will characterize the type family +\begin{equation} + (x\mapsto (\inl(a_0)=x)) : A+B \to \type.\label{eq:sumcodefam} +\end{equation} +A similar argument would characterize the analogous family $x\mapsto (x = \inr(b_0))$ for any $b_0:B$. +Together, these characterizations imply~\eqref{eq:inlinj}--\eqref{eq:inlrdj}. + +In order to characterize~\eqref{eq:sumcodefam}, we will define a type family $\code:A+B\to\type$ and show that $\prd{x:A+B} (\eqv{(\inl(a_0)=x)}{\code(x)})$. +Since we want to conclude~\eqref{eq:inlinj} from this, we should have $\code(\inl(a)) = (a_0=a)$, and since we also want to conclude~\eqref{eq:inlrdj}, we should have $\code (\inr(b)) = \emptyt$. +The essential insight is that we can use the recursion principle of $A+B$ to \emph{define} $\code:A+B\to\type$ by these two equations: +\begin{align*} + \code(\inl(a)) &\defeq (a_0=a),\\ + \code(\inr(b)) &\defeq \emptyt. +\end{align*} +This is a very simple example of a proof technique that is used quite a +bit when doing homotopy theory in homotopy type theory; see +e.g.\ \cref{sec:pi1-s1-intro,sec:general-encode-decode}. +% +We can now show: + +\begin{thm}\label{thm:path-coprod} + For all $x:A+B$ we have $\eqv{(\inl(a_0)=x)}{\code(x)}$. +\end{thm} +\begin{proof} + The key to the following proof is that we do it for all points $x$ together, enabling us to use the elimination principle for the coproduct. + We first define a function + \[ \encode : \prd{x:A+B}{p:\inl(a_0)=x} \code(x) \] + by transporting reflexivity along $p$: + \[ \encode(x,p) \defeq \transfib{\code}{p}{\refl{a_0}}. \] + Note that $\refl{a_0} : \code(\inl(a_0))$, since $\code(\inl(a_0))\jdeq (a_0=a_0)$ by definition of \code. + Next, we define a function + \[ \decode : \prd{x:A+B}{c:\code(x)} (\inl(a_0)=x). \] + To define $\decode(x,c)$, we may first use the elimination principle of $A+B$ to divide into cases based on whether $x$ is of the form $\inl(a)$ or the form $\inr(b)$. + + In the first case, where $x\jdeq \inl(a)$, then $\code(x)\jdeq (a_0=a)$, so that $c$ is an identification between $a_0$ and $a$. + Thus, $\apfunc{\inl}(c):(\inl(a_0)=\inl(a))$ so we can define this to be $\decode(\inl(a),c)$. + + In the second case, where $x\jdeq \inr(b)$, then $\code(x)\jdeq \emptyt$, so that $c$ inhabits the empty type. + Thus, the elimination rule of $\emptyt$ yields a value for $\decode(\inr(b),c)$. + + This completes the definition of \decode; we now show that $\encode(x,{\blank})$ and $\decode(x,{\blank})$ are quasi-inverses for all $x$. + On the one hand, suppose given $x:A+B$ and $p:\inl(a_0)=x$; we want to show + \narrowequation{ + \decode(x,\encode(x,p)) = p. + } + But now by (based) path induction, it suffices to consider $x\jdeq\inl(a_0)$ and $p\jdeq \refl{\inl(a_0)}$: + \begin{align*} + \decode(x,\encode(x,p)) + &\jdeq \decode(\inl(a_0),\encode(\inl(a_0),\refl{\inl(a_0)}))\\ + &\jdeq \decode(\inl(a_0),\transfib{\code}{\refl{\inl(a_0)}}{\refl{a_0}})\\ + &\jdeq \decode(\inl(a_0),\refl{a_0})\\ + &\jdeq \apfunc{\inl}(\refl{a_0})\\ + &\jdeq \refl{\inl(a_0)}\\ + &\jdeq p. + \end{align*} + On the other hand, let $x:A+B$ and $c:\code(x)$; we want to show $\encode(x,\decode(x,c))=c$. + We may again divide into cases based on $x$. + If $x\jdeq\inl(a)$, then $c:a_0=a$ and $\decode(x,c)\jdeq \apfunc{\inl}(c)$, so that + \begin{align} + \encode(x,\decode(x,c)) + &\jdeq \transfib{\code}{\apfunc{\inl}(c)}{\refl{a_0}} + \notag\\ + &= \transfib{a\mapsto (a_0=a)}{c}{\refl{a_0}} + \tag{by \cref{thm:transport-compose}}\\ + &= \refl{a_0} \ct c + \tag{by \cref{cor:transport-path-prepost}}\\ + &= c. \notag + \end{align} + Finally, if $x\jdeq \inr(b)$, then $c:\emptyt$, so we may conclude anything we wish. +\end{proof} + +\noindent +Of course, there is a corresponding theorem if we fix $b_0:B$ instead of $a_0:A$. + +In particular, \cref{thm:path-coprod} implies that for any $a : A$ and $b : B$ there are functions +% +\[ \encode(\inl(a), {\blank}) : (\inl(a_0)=\inl(a)) \to (a_0=a)\] +% +and +% +\[ \encode(\inr(b), {\blank}) : (\inl(a_0)=\inr(b)) \to \emptyt. \] +% +The second of these states +``$\inl(a_0)$ is not equal to $\inr(b)$'', i.e.\ the images of \inl and \inr are disjoint. The traditional reading of the first one, where identity types are viewed as propositions, is just injectivity of $\inl$. The +full homotopical statement of \cref{thm:path-coprod} gives more information: the types $\inl(a_0)=\inl(a)$ and +$a_0=a$ are actually equivalent, as are $\inr(b_0)=\inr(b)$ and $b_0=b$. + +\begin{rmk}\label{rmk:true-neq-false} +In particular, since the two-element type $\bool$ is equivalent to $\unit+\unit$, we have $\bfalse\neq\btrue$. +\end{rmk} + +This proof illustrates a general method for describing path spaces, which we will use often. To characterize a path space, the first step is to define a comparison fibration ``$\code$'' that provides a more explicit description of the paths. There are several different methods for proving that such a comparison fibration is equivalent to the paths (we show a few different proofs of the same result in \cref{sec:pi1-s1-intro}). The one we have used here is called the \define{encode-decode method}: +\indexdef{encode-decode method} +the key idea is to define $\decode$ generally for all instances of the fibration (i.e.\ as a function $\prd{x:A+B} \code(x) \to (\inl(a_0)=x)$), so that path induction can be used to analyze $\decode(x,\encode(x,p))$. + +\index{transport!in coproduct types}% +As usual, we can also characterize the action of transport in coproduct types. +Given a type~$X$, a path $p:\id[X]{x_1}{x_2}$, and type families $A,B:X\to\type$, we have +\begin{align*} + \transfib{A+B}{p}{\inl(a)} &= \inl (\transfib{A}{p}{a}),\\ + \transfib{A+B}{p}{\inr(b)} &= \inr (\transfib{B}{p}{b}), +\end{align*} +where as usual, $A+B$ in the superscript denotes abusively the type family $x\mapsto A(x)+B(x)$. +The proof is an easy path induction. + +\index{encode-decode method|)}% +\index{type!coproduct|)}% + +\section{Natural numbers} +\label{sec:compute-nat} + +\index{natural numbers|(}% +\index{encode-decode method|(}% +We use the encode-decode method to characterize the path space of the natural numbers, which are also a positive type. +In this case, rather than fixing one endpoint, we characterize the two-sided path space all at once. +Thus, the codes for identities are a type family +\[\code:\N\to\N\to\type,\] +defined by double recursion over \N as follows: +\begin{align*} + \code(0,0) &\defeq \unit\\ + \code(\suc(m),0) &\defeq \emptyt\\ + \code(0,\suc(n)) &\defeq \emptyt\\ + \code(\suc(m),\suc(n)) &\defeq \code(m,n). +\end{align*} +We also define by recursion a dependent function $r:\prd{n:\N} \code(n,n)$, with +\begin{align*} + r(0) &\defeq \ttt\\ + r(\suc(n)) &\defeq r(n). +\end{align*} + +\begin{thm}\label{thm:path-nat} + For all $m,n:\N$ we have $\eqv{(m=n)}{\code(m,n)}$. +\end{thm} +\begin{proof} + We define + \[ \encode : \prd{m,n:\N} (m=n) \to \code(m,n) \] + by transporting, $\encode(m,n,p) \defeq \transfib{\code(m,{\blank})}{p}{r(m)}$. + (We could also define $\encode$ directly by path induction, but the definition in terms of transport often makes subsequent computations easier.) + And we define + \[ \decode : \prd{m,n:\N} \code(m,n) \to (m=n) \] + by double induction on $m,n$. + When $m$ and $n$ are both $0$, we need a function $\unit \to (0=0)$, which we define to send everything to $\refl{0}$. + When $m$ is a successor and $n$ is $0$ or vice versa, the domain $\code(m,n)$ is \emptyt, so the eliminator for \emptyt suffices. + And when both are successors, we can define $\decode(\suc(m),\suc(n))$ to be the composite + % + \begin{narrowmultline*} + \code(\suc(m),\suc(n))\jdeq\code(m,n) + \xrightarrow{\decode(m,n)} \narrowbreak + (m=n) + \xrightarrow{\apfunc{\suc}} + (\suc(m)=\suc(n)). + \end{narrowmultline*} + % + Next we show that $\encode(m,n)$ and $\decode(m,n)$ are quasi-inverses for all $m,n$. + + On one hand, if we start with $p:m=n$, then by induction on $p$ it suffices to show + \[\decode(n,n,\encode(n,n,\refl{n}))=\refl{n}.\] + But $\encode(n,n,\refl{n}) \jdeq r(n)$, so it suffices to show that $\decode(n,n,r(n)) =\refl{n}$. + We can prove this by induction on $n$. + If $n\jdeq 0$, then $\decode(0,0,r(0)) =\refl{0}$ by definition of \decode. + And in the case of a successor, by the inductive hypothesis we have $\decode(n,n,r(n)) = \refl{n}$, so it suffices to observe that $\apfunc{\suc}(\refl{n}) \jdeq \refl{\suc(n)}$. + + On the other hand, if we start with $c:\code(m,n)$, then we proceed by double induction on $m$ and $n$. + If both are $0$, then $\decode(0,0,c) \jdeq \refl{0}$, while $\encode(0,0,\refl{0})\jdeq r(0) \jdeq \ttt$. + Thus, it suffices to recall from \cref{sec:compute-unit} that every inhabitant of $\unit$ is equal to \ttt. + If $m$ is $0$ but $n$ is a successor, or vice versa, then $c:\emptyt$, so we are done. + And in the case of two successors, we have + \begin{multline*} + \encode(\suc(m),\suc(n),\decode(\suc(m),\suc(n),c))\\ + \begin{aligned} + &= \encode(\suc(m),\suc(n),\apfunc{\suc}(\decode(m,n,c)))\\ + &= \transfib{\code(\suc(m),{\blank})}{\apfunc{\suc}(\decode(m,n,c))}{r(\suc(m))}\\ + &= \transfib{\code(\suc(m),\suc({\blank}))}{\decode(m,n,c)}{r(\suc(m))}\\ + &= \transfib{\code(m,{\blank})}{\decode(m,n,c)}{r(m)}\\ + &= \encode(m,n,\decode(m,n,c))\\ + &= c + \end{aligned} + \end{multline*} + using the inductive hypothesis. + (In fact this proof is longer than necessary; see \cref{ex:n-set}.) +\end{proof} + +In particular, we have +\begin{equation}\label{eq:zero-not-succ} + \encode(\suc(m),0) : (\suc(m)=0) \to \emptyt +\end{equation} +which shows that ``$0$ is not the successor of any natural number''. +We also have the composite +\begin{narrowmultline}\label{eq:suc-injective} + (\suc(m)=\suc(n)) + \xrightarrow{\encode} \narrowbreak + \code(\suc(m),\suc(n)) + \jdeq \code(m,n) \xrightarrow{\decode} (m=n) +\end{narrowmultline} +which shows that the function $\suc$ is injective. +\index{successor}% + +We will study more general positive types in \cref{cha:induction,cha:hits}. +In \cref{cha:homotopy}, we will see that the same technique used here to characterize the identity types of coproducts and \nat can also be used to calculate homotopy groups of spheres. + +\index{encode-decode method|)}% +\index{natural numbers|)}% + +\section{Example: equality of structures} +\label{sec:equality-of-structures} + +We now consider one example to illustrate the interaction between the groupoid structure on a type and the type +formers. In the introduction we remarked that one of the +advantages of univalence is that two isomorphic things are interchangeable, +in the sense that every property or construction involving one also +applies to the other. Common ``abuses of notation''\index{abuse!of notation} become formally +true. Univalence itself says that equivalent types are equal, and +therefore interchangeable, which includes e.g.\ the common practice of identifying isomorphic sets. Moreover, when we define other +mathematical objects as sets, or even general types, equipped with structure or properties, we +can derive the correct notion of equality for them from univalence. We will illustrate this +point with a significant example in \cref{cha:category-theory}, where we +define the basic notions of category theory in such a way that equality +of categories is equivalence, equality of functors is natural +isomorphism, etc. See in particular \cref{sec:sip}. + In this section, we describe a very simple example, coming from algebra. + +For simplicity, we use \emph{semigroups} as our example, where a +semigroup is a type equipped with an associative ``multiplication'' +operation. The same ideas apply to other algebraic structures, such as +monoids, groups, and rings. +Recall from \cref{sec:sigma-types,sec:pat} that the definition of a kind of mathematical structure should be interpreted as defining the type of such structures as a certain iterated $\Sigma$-type. +In the case of semigroups this yields the following. + +\begin{defn} +Given a type $A$, the type \semigroupstr{A} of \define{semigroup structures} +\indexdef{semigroup!structure}% +\index{structure!semigroup}% +\index{associativity!of semigroup operation}% +with carrier\index{carrier} $A$ is defined by +\[ +\semigroupstr{A} \defeq \sm{m:A \to A \to A} \prd{x,y,z:A} m(x,m(y,z)) = m(m(x,y),z). +\] +% +A \define{semigroup} +\indexdef{semigroup}% +is a type together with such a structure: +% +\[ +\semigroup \defeq \sm{A:\type} \semigroupstr A +\] +\end{defn} + +\noindent +In the next two subsections, we describe two ways in which univalence makes +it easier to work with such semigroups. + +\subsection{Lifting equivalences} + +\index{lifting!equivalences}% +When working loosely, one might say that a bijection between sets $A$ +and $B$ ``obviously'' induces an isomorphism between semigroup +structures on $A$ and semigroup structures on $B$. With univalence, +this is indeed obvious, because given an equivalence between types $A$ +and $B$, we can automatically derive a semigroup structure on $B$ from +one on $A$, and moreover show that this derivation is an equivalence of +semigroup structures. The reason is that \semigroupstrsym\ is a family +of types, and therefore has an action on paths between types given by +$\mathsf{transport}$: +\[ +\transfibf{\semigroupstrsym}{(\ua(e))} : \semigroupstr{A} \to \semigroupstr{B}. +\] +Moreover, this map is an equivalence, because +$\transfibf{C}(\alpha)$ is always an equivalence with inverse +$\transfibf{C}{(\opp \alpha)}$, see \cref{thm:transport-concat,thm:omg}. + +While the univalence axiom\index{univalence axiom} ensures that this map exists, we need to use +facts about $\mathsf{transport}$ proven in the preceding sections to +calculate what it actually does. Let $(m,a)$ be a semigroup structure on +$A$, and we investigate the induced semigroup structure on $B$ given by +\[ +\transfib{\semigroupstrsym}{\ua(e)}{(m,a)}. +\] +First, because +\semigroupstr{X} is defined to be a $\Sigma$-type, by +\cref{transport-Sigma}, +\[ +\transfib{\semigroupstrsym}{\ua(e)}{(m,a)} = (m',a') +\] +where $m'$ is an induced multiplication operation on $B$ +\begin{flalign*} +& m' : B \to B \to B \\ +& m'(b_1,b_2) \defeq \transfib{X \mapsto (X \to X \to X)}{\ua(e)}{m}(b_1,b_2) +\end{flalign*} +and $a'$ an induced proof that $m'$ is associative. +We have, again by \cref{transport-Sigma}, +\begin{equation}\label{eq:transport-semigroup-step1} + \begin{aligned} +{}&a' : \mathsf{Assoc}(B,m')\\ + &a' \defeq \transfib{(X,m) \mapsto \mathsf{Assoc}(X,m)}{(\pairpath(\ua(e),\refl{m'}))}{a}, + \end{aligned} +\end{equation} +where $\mathsf{Assoc}(X,m)$ is the type $\prd{x,y,z:X} m(x,m(y,z)) = m(m(x,y),z)$. +By function extensionality, it suffices to investigate the behavior of $m'$ when +applied to arguments $b_1,b_2 : B$. By applying +\eqref{eq:transport-arrow} twice, we have that $m'(b_1,b_2)$ is equal to +% +\begin{narrowmultline*} + \transfibf{X \mapsto X}\big( + \ua(e), \narrowbreak + m(\transfib{X \mapsto X}{\opp{\ua(e)}}{b_1}, + \transfib{X \mapsto X}{\opp{\ua(e)}}{b_2} + ) + \big). +\end{narrowmultline*} +% +Then, because $\ua$ is quasi-inverse to $\transfibf{X\mapsto X}$, this is equal to +\[ +e(m(\opp{e}(b_1), \opp{e}(b_2))). +\] +Thus, given two elements of $B$, the induced multiplication $m'$ +sends them to $A$ using the equivalence $e$, multiplies them in $A$, and +then brings the result back to $B$ by $e$, just as one would expect. + +Moreover, though we do not show the proof, one can calculate that the +induced proof that $m'$ is associative (see \eqref{eq:transport-semigroup-step1}) +is equal to a function sending +$b_1,b_2,b_3 : B$ to a path given by the following steps: +\begin{equation} + \label{eq:transport-semigroup-assoc} + \begin{aligned} + m'(m'(b_1,b_2),b_3) + &= e(m(\opp{e}(m'(b_1,b_2)),\opp{e}(b_3))) \\ + &= e(m(\opp{e}(e(m(\opp{e}(b_1),\opp{e}(b_2)))),\opp{e}(b_3))) \\ + &= e(m(m(\opp{e}(b_1),\opp{e}(b_2)),\opp{e}(b_3))) \\ + &= e(m(\opp{e}(b_1),m(\opp{e}(b_2),\opp{e}(b_3)))) \\ + &= e(m(\opp{e}(b_1),\opp{e}(e(m(\opp{e}(b_2),\opp{e}(b_3)))))) \\ + &= e(m(\opp{e}(b_1),\opp{e}(m'(b_2,b_3)))) \\ + &= m'(b_1,m'(b_2,b_3)). +\end{aligned} +\end{equation} +These steps use the proof $a$ that $m$ is associative and the inverse +laws for~$e$. From an algebra perspective, it may seem strange to +investigate the identity of a proof that an operation is associative, +but this makes sense if we think of $A$ and $B$ as general spaces, with +non-trivial homotopies between paths. In \cref{cha:logic}, we will +introduce the notion of a \emph{set}, which is a type with only trivial +homotopies, and if we consider semigroup structures on sets, then any +two such associativity proofs are automatically equal. + +\subsection{Equality of semigroups} +\label{sec:equality-semigroups} + +Using the equations for path spaces discussed in the previous sections, +we can investigate when two semigroups are equal. Given semigroups +$(A,m,a)$ and $(B,m',a')$, by \cref{thm:path-sigma}, the type of paths +\narrowequation{ + (A,m,a) =_\semigroup (B,m',a') +} +is equal to the type of pairs +\begin{align*} +p_1 &: A =_{\type} B \qquad\text{and}\\ +p_2 &: \transfib{\semigroupstrsym}{p_1}{(m,a)} = {(m',a')}. +\end{align*} +By univalence, $p_1$ is $\ua(e)$ for some equivalence $e$. By +\cref{thm:path-sigma}, function extensionality, and the above analysis of +transport in the type family $\semigroupstrsym$, $p_2$ is equivalent to a pair +of proofs, the first of which shows that +\begin{equation} \label{eq:equality-semigroup-mult} +\prd{y_1,y_2:B} e(m(\opp{e}(y_1), \opp{e}(y_2))) = m'(y_1,y_2) +\end{equation} +and the second of which shows that $a'$ is equal to the induced +associativity proof constructed from $a$ in +\eqref{eq:transport-semigroup-assoc}. But by cancellation of inverses +\eqref{eq:equality-semigroup-mult} is equivalent to +\[ +\prd{x_1,x_2:A} e(m(x_1, x_2)) = m'(e(x_1),e(x_2)). +\] +This says that $e$ commutes with the binary operation, in the sense +that it takes multiplication in $A$ (i.e.\ $m$) to multiplication in $B$ +(i.e.\ $m'$). A similar rearrangement is possible for the equation relating +$a$ and $a'$. Thus, an equality of semigroups consists exactly of an +equivalence on the carrier types that commutes with the semigroup +structure. + +For general types, the proof of associativity is thought of as part of +the structure of a semigroup. However, if we restrict to set-like types +(again, see \cref{cha:logic}), the +equation relating $a$ and $a'$ is trivially true. Moreover, in this +case, an equivalence between sets is exactly a bijection. Thus, we have +arrived at a standard definition of a \emph{semigroup isomorphism}:\index{isomorphism!semigroup} a +bijection on the carrier sets that preserves the multiplication +operation. It is also possible to use the category-theoretic definition +of isomorphism, by defining a \emph{semigroup homomorphism}\index{homomorphism!semigroup} to be a map +that preserves the multiplication, and arrive at the conclusion that equality of +semigroups is the same as two mutually inverse homomorphisms; but we +will not show the details here; see \cref{sec:sip}. + +The conclusion is that, thanks to univalence, semigroups are equal +precisely when they are isomorphic as algebraic structures. As we will see in \cref{sec:sip}, the +conclusion applies more generally: in homotopy type theory, all constructions of +mathematical structures automatically respect isomorphisms, without any +tedious proofs or abuse of notation. + +\section{Universal properties} +\label{sec:universal-properties} + +\index{universal!property|(}% +By combining the path computation rules described in the preceding sections, we can show that various type forming operations satisfy the expected universal properties, interpreted in a homotopical way as equivalences. +For instance, given types $X,A,B$, we have a function +\index{type!product}% +\begin{equation}\label{eq:prod-ump-map} + (X\to A\times B) \to (X\to A)\times (X\to B) +\end{equation} +defined by $f \mapsto (\proj1 \circ f, \proj2\circ f)$. + +\begin{thm}\label{thm:prod-ump} + \index{universal!property!of cartesian product}% + \eqref{eq:prod-ump-map} is an equivalence. +\end{thm} +\begin{proof} + We define the quasi-inverse by sending $(g,h)$ to $\lam{x}(g(x),h(x))$. + (Technically, we have used the induction principle for the cartesian product $(X\to A)\times (X\to B)$, to reduce to the case of a pair. + From now on we will often apply this principle without explicit mention.) + + Now given $f:X\to A\times B$, the round-trip composite yields the function + \begin{equation} + \lam{x} (\proj1(f(x)),\proj2(f(x))).\label{eq:prod-ump-rt1} + \end{equation} + By \cref{thm:path-prod}, for any $x:X$ we have $(\proj1(f(x)),\proj2(f(x))) = f(x)$. + Thus, by function extensionality, the function~\eqref{eq:prod-ump-rt1} is equal to $f$. + + On the other hand, given $(g,h)$, the round-trip composite yields the pair $(\lam{x} g(x),\lam{x} h(x))$. + By the uniqueness principle for functions, this is (judgmentally) equal to $(g,h)$. +\end{proof} + +In fact, we also have a dependently typed version of this universal property. +Suppose given a type $X$ and type families $A,B:X\to \type$. +Then we have a function +\begin{equation}\label{eq:prod-umpd-map} + \Parens{\prd{x:X} (A(x)\times B(x))} \to \Parens{\prd{x:X} A(x)} \times \Parens{\prd{x:X} B(x)} +\end{equation} +defined as before by $f \mapsto (\proj1 \circ f, \proj2\circ f)$. + +\begin{thm}\label{thm:prod-umpd} + \eqref{eq:prod-umpd-map} is an equivalence. +\end{thm} +\begin{proof} + Left to the reader. +\end{proof} + +Just as $\Sigma$-types are a generalization of cartesian products, they satisfy a generalized version of this universal property. +Jumping right to the dependently typed version, suppose we have a type $X$ and type families $A:X\to \type$ and $P:\prd{x:X} A(x)\to\type$. +Then we have a function +\index{type!dependent pair}% +\begin{equation} + \label{eq:sigma-ump-map} + \Parens{\prd{x:X}\dsm{a:A(x)} P(x,a)} \to + \Parens{\sm{g:\prd{x:X} A(x)} \prd{x:X} P(x,g(x))}. +\end{equation} +Note that if we have $P(x,a) \defeq B(x)$ for some $B:X\to\type$, then~\eqref{eq:sigma-ump-map} reduces to~\eqref{eq:prod-umpd-map}. + +\begin{thm}\label{thm:ttac} + \index{universal!property!of dependent pair type}% + \eqref{eq:sigma-ump-map} is an equivalence. +\end{thm} +\begin{proof} + As before, we define a quasi-inverse to send $(g,h)$ to the function $\lam{x} (g(x),h(x))$. + Now given $f:\prd{x:X} \sm{a:A(x)} P(x,a)$, the round-trip composite yields the function + \begin{equation} + \lam{x} (\proj1(f(x)),\proj2(f(x))).\label{eq:prod-ump-rt2} + \end{equation} + Now for any $x:X$, by \cref{thm:eta-sigma} (the uniqueness principle for $\Sigma$-types) we have + % + \begin{equation*} + (\proj1(f(x)),\proj2(f(x))) = f(x). + \end{equation*} + % + Thus, by function extensionality,~\eqref{eq:prod-ump-rt2} is equal to $f$. + On the other hand, given $(g,h)$, the round-trip composite yields $(\lam {x} g(x),\lam{x} h(x))$, which is judgmentally equal to $(g,h)$ as before. +\end{proof} + +\index{axiom!of choice!type-theoretic} +This is noteworthy because the propositions-as-types interpretation of~\eqref{eq:sigma-ump-map} is ``the axiom of choice''. +If we read $\Sigma$ as ``there exists'' and $\Pi$ (sometimes) as ``for all'', we can pronounce: +\begin{itemize} +\item $\prd{x:X} \sm{a:A(x)} P(x,a)$ as ``for all $x:X$ there exists an $a:A(x)$ such that $P(x,a)$'', and +\item $\sm{g:\prd{x:X} A(x)} \prd{x:X} P(x,g(x))$ as ``there exists a choice function $g:\prd{x:X} A(x)$ such that for all $x:X$ we have $P(x,g(x))$''. +\end{itemize} +Thus, \cref{thm:ttac} says that not only is the axiom of choice ``true'', its antecedent is actually equivalent to its conclusion. +(On the other hand, the classical\index{mathematics!classical} mathematician may find that~\eqref{eq:sigma-ump-map} does not carry the usual meaning of the axiom of choice, since we have already specified the values of $g$, and there are no choices left to be made. +We will return to this point in \cref{sec:axiom-choice}.) + +The above universal property for pair types is for ``mapping in'', which is familiar from the category-theoretic notion of products. +However, pair types also have a universal property for ``mapping out'', which may look less familiar. +In the case of cartesian products, the non-dependent version simply expresses +the cartesian closure adjunction\index{adjoint!functor}: +\[ \eqvspaced{\big((A\times B) \to C\big)}{\big(A\to (B\to C)\big)}.\] +The dependent version of this is formulated for a type family $C:A\times B\to \type$: +\[ \eqvspaced{\Parens{\prd{w:A\times B} C(w)}}{\Parens{\prd{x:A}{y:B} C(x,y)}}. \] +Here the right-to-left function is simply the induction principle for $A\times B$, while the left-to-right is evaluation at a pair. +We leave it to the reader to prove that these are quasi-inverses. +There is also a version for $\Sigma$-types: +\begin{equation} + \eqvspaced{\Parens{\prd{w:\sm{x:A} B(x)} C(w)}}{\Parens{\prd{x:A}{y:B(x)} C(x,y)}}.\label{eq:sigma-lump} +\end{equation} +Again, the right-to-left function is the induction principle. + +Some other induction principles are also part of universal properties of this sort. +For instance, path induction is the right-to-left direction of an equivalence as follows: +\index{type!identity}% +\index{universal!property!of identity type}% +\begin{equation} + \label{eq:path-lump} + \eqvspaced{\Parens{\prd{x:A}{p:a=x} B(x,p)}}{B(a,\refl a)} +\end{equation} +for any $a:A$ and type family $B:\prd{x:A} (a=x) \to\type$. +However, inductive types with recursion, such as the natural numbers, have more complicated universal properties; see \cref{cha:induction}. + +\index{type!limit}% +\index{type!colimit}% +\index{limit!of types}% +\index{colimit!of types}% +Since \cref{thm:prod-ump} expresses the usual universal property of a cartesian product (in an appropriate homotopy-theoretic sense), the categorically inclined reader may well wonder about other limits and colimits of types. +In \cref{ex:coprod-ump} we ask the reader to show that the coproduct type $A+B$ also has the expected universal property, and the nullary cases of $\unit$ (the terminal object) and $\emptyt$ (the initial object) are easy. +\index{type!empty}% +\index{type!unit}% +\indexsee{initial!type}{type, empty}% +\indexsee{terminal!type}{type, unit}% + +\indexdef{pullback}% +For pullbacks, the expected explicit construction works: given $f:A\to C$ and $g:B\to C$, we define +\begin{equation} + A\times_C B \defeq \sm{a:A}{b:B} (f(a)=g(b)).\label{eq:defn-pullback} +\end{equation} +In \cref{ex:pullback} we ask the reader to verify this. +Some more general homotopy limits can be constructed in a similar way, but for colimits we will need a new ingredient; see \cref{cha:hits}. + +\index{universal!property|)}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +\sectionNotes + +The definition of identity types, with their induction principle, is due to Martin-L\"of \cite{Martin-Lof-1973}. +\index{intensional type theory}% +\index{extensional!type theory}% +\index{type theory!intensional}% +\index{type theory!extensional}% +\index{reflection rule}% +As mentioned in the notes to \cref{cha:typetheory}, our identity types are those that belong to \emph{intensional} type theory, rather than \emph{extensional} type theory. +In general, a notion of equality is said to be ``intensional'' if it distinguishes objects based on their particular definitions, and ``extensional'' if it does not distinguish between objects that have the same ``extension'' or ``observable behavior''. +In the terminology of Frege, an intensional equality compares \emph{sense}, while an extensional one compares only \emph{reference}. +We may also speak of one equality being ``more'' or ``less'' extensional than another, meaning that it takes account of fewer or more intensional aspects of objects, respectively. + +\emph{Intensional} type theory is so named because its \emph{judgmental} equality, $x\jdeq y$, is a very intensional equality: it says essentially that $x$ and $y$ ``have the same definition'', after we expand the defining equations of functions. +By contrast, the propositional equality type $\id xy$ is more extensional, even in the axiom-free intensional type theory of \cref{cha:typetheory}: for instance, we can prove by induction that $n+m=m+n$ for all $m,n:\N$, but we cannot say that $n+m\jdeq m+n$ for all $m,n:\N$, since the \emph{definition} of addition treats its arguments asymmetrically. +We can make the identity type of intensional type theory even more extensional by adding axioms such as function extensionality (two functions are equal if they have the same behavior on all inputs, regardless of how they are defined) and univalence (which can be regarded as an extensionality property for the universe: two types are equal if they behave the same in all contexts). +The axioms of function extensionality, and univalence in the special case of mere propositions (``propositional extensionality''), appeared already in the first type theories of Russell and Church. + +As mentioned before, \emph{extensional} type theory includes also a ``reflection rule'' saying that if $p:x=y$, then in fact $x\jdeq y$. +Thus extensional type theory is so named because it does \emph{not} admit any purely \emph{intensional} equality: the reflection rule forces the judgmental equality to coincide with the more extensional identity type. +Moreover, from the reflection rule one may deduce function extensionality (at least in the presence of a judgmental uniqueness principle for functions). +However, the reflection rule also implies that all the higher groupoid structure collapses (see \cref{ex:equality-reflection}), and hence is inconsistent with the univalence axiom (see \cref{thm:type-is-not-a-set}). +Therefore, regarding univalence as an extensionality property, one may say that intensional type theory permits identity types that are ``more extensional'' than extensional type theory does. + +The proofs of symmetry (inversion) and transitivity (concatenation) for equalities are well-known in type theory. +The fact that these make each type into a 1-groupoid (up to homotopy) was exploited in~\cite{hs:gpd-typethy} to give the first ``homotopy'' style semantics for type theory. + +The actual homotopical interpretation, with identity types as path spaces, and type families as fibrations, is due to \cite{AW}, who used the formalism of Quillen model categories. An interpretation in (strict) $\infty$-groupoids\index{.infinity-groupoid@$\infty$-groupoid} was also given in the thesis \cite{mw:thesis}. +For a construction of \emph{all} the higher operations and coherences of an $\infty$-groupoid in type theory, see~\cite{pll:wkom-type} and~\cite{bg:type-wkom}. + +\index{proof!assistant!Coq@\textsc{Coq}}% +Operations such as $\transfib{P}{p}{\blank}$ and $\apfunc{f}$, and one good notion of equivalence, were first studied extensively in type theory by Voevodsky, using the proof assistant \Coq. +Subsequently, many other equivalent definitions of equivalence have been found, which are compared in \cref{cha:equivalences}. + +The ``computational'' interpretation of identity types, transport, and so on described in \cref{sec:computational} has been emphasized by~\cite{lh:canonicity}. +They also described a ``1-truncated'' type theory (see \cref{cha:hlevels}) in which these rules are judgmental equalities. +The possibility of extending this to the full untruncated theory is a subject of current research. + +\index{function extensionality}% +The naive form of function extensionality which says that ``if two functions are pointwise equal, then they are equal'' is a common axiom in type theory, going all the way back to \cite{PM2}. +Some stronger forms of function extensionality were considered in~\cite{garner:depprod}. +The version we have used, which identifies the identity types of function types up to equivalence, was first studied by Voevodsky, who also proved that it is implied by the naive version (and by univalence; see \cref{sec:univalence-implies-funext}). + +\index{univalence axiom}% +The univalence axiom is also due to Voevodsky. +It was originally motivated by semantic considerations in the simplicial set model; see~\cite{klv:ssetmodel}. +A similar axiom motivated by the groupoid model was proposed by Hofmann and Streicher~\cite{hs:gpd-typethy} under the name ``universe extensionality''. +It used quasi-inverses~\eqref{eq:qinvtype} rather than a good notion of ``equivalence'', and hence is correct (and equivalent to univalence) only for a universe of 1-types (see \cref{defn:1type}). + +In the type theory we are using in this book, function extensionality and univalence have to be assumed as axioms, i.e.\ elements asserted to belong to some type but not constructed according to the rules for that type. +While serviceable, this has a few drawbacks. +For instance, type theory is formally better-behaved if we can base it entirely on rules rather than asserting axioms. +It is also sometimes inconvenient that the theorems of \crefrange{sec:compute-cartprod}{sec:compute-nat} are only propositional equalities (paths) or equivalences, since then we must explicitly mention whenever we pass back and forth across them. +One direction of current research in homotopy type theory is to describe a type system in which these rules are \emph{judgmental} equalities, solving both of these problems at once. +So far this has only been done in some simple cases, although preliminary results such as~\cite{lh:canonicity} are promising. +There are also other potential ways to introduce univalence and function extensionality into a type theory, such as having a sufficiently powerful notion of ``higher quotients'' or ``higher inductive-recursive types''. + +The simple conclusions in \crefrange{sec:compute-coprod}{sec:compute-nat} such as ``$\inl$ and $\inr$ are injective and disjoint'' are well-known in type theory, and the construction of the function \encode is the usual way to prove them. +The more refined approach we have described, which characterizes the entire identity type of a positive type (up to equivalence), is a more recent development; see e.g.~\cite{ls:pi1s1}. + +\index{axiom!of choice!type-theoretic}% +The type-theoretic axiom of choice~\eqref{eq:sigma-ump-map} was noticed in William Howard's original paper~\cite{howard:pat} on the propositions-as-types correspondence, and was studied further by Martin-L\"of with the introduction of his dependent type theory. It is mentioned as a ``distributivity law'' in Bourbaki's set theory \cite{Bourbaki}.\index{Bourbaki}% + +For a more comprehensive (and formalized) discussion of pullbacks and more general homotopy limits in homotopy type theory, see~\cite{AKL13}. +Limits\index{limit!of types} of diagrams over directed graphs\index{graph} are the easiest general sort of limit to formalize; the problem with diagrams over categories (or more generally $(\infty,1)$-categories) +\index{.infinity1-category@$(\infty,1)$-category}% +\indexsee{category!.infinity1-@$(\infty,1)$-}{$(\infty,1)$-category}% +is that in general, infinitely many coherence conditions are involved in the notion of (homotopy coherent) diagram.\index{diagram} +Resolving this problem is an important open question\index{open!problem} in homotopy type theory. + +\sectionExercises + +\begin{ex}\label{ex:basics:concat} + Show that the three obvious proofs of \cref{lem:concat} are pairwise equal. +\end{ex} + +\begin{ex}\label{ex:eq-proofs-commute} + Show that the three equalities of proofs constructed in the previous exercise form a commutative triangle. + In other words, if the three definitions of concatenation are denoted by $(p \mathbin{\ct_1} q)$, $(p\mathbin{\ct_2} q)$, and $(p\mathbin{\ct_3} q)$, then the concatenated equality + \[(p\mathbin{\ct_1} q) = (p\mathbin{\ct_2} q) = (p\mathbin{\ct_3} q)\] + is equal to the equality $(p\mathbin{\ct_1} q) = (p\mathbin{\ct_3} q)$. +\end{ex} + +\begin{ex}\label{ex:fourth-concat} + Give a fourth, different, proof of \cref{lem:concat}, and prove that it is equal to the others. +\end{ex} + +\begin{ex}\label{ex:npaths} + Define, by induction on $n$, a general notion of \define{$n$-dimensional path}\index{path!n-@$n$-} in a type $A$, simultaneously with the type of boundaries for such paths. +\end{ex} + +\begin{ex}\label{ex:ap-to-apd-equiv-apd-to-ap} + Prove that the functions~\eqref{eq:ap-to-apd} and~\eqref{eq:apd-to-ap} are inverse equivalences. + % and that they take $\apfunc f(p)$ to $\apdfunc f (p)$ and vice versa. (that was \cref{thm:apd-const}) +\end{ex} + +\begin{ex}\label{ex:equiv-concat} + Prove that if $p:x=y$, then the function $(p\ct \blank):(y=z) \to (x=z)$ is an equivalence. +\end{ex} + +\begin{ex}\label{ex:ap-sigma} + State and prove a generalization of \cref{thm:ap-prod} from cartesian products to $\Sigma$-types. +\end{ex} + +\begin{ex}\label{ex:ap-coprod} + State and prove an analogue of \cref{thm:ap-prod} for coproducts. +\end{ex} + +\begin{ex}\label{ex:coprod-ump} + \index{universal!property!of coproduct}% + Prove that coproducts have the expected universal property, + \[ \eqv{(A+B \to X)}{(A\to X)\times (B\to X)}. \] + Can you generalize this to an equivalence involving dependent functions? +\end{ex} + +\begin{ex}\label{ex:sigma-assoc} + Prove that $\Sigma$-types are ``associative'', + \index{associativity!of Sigma-types@of $\Sigma$-types}% + in that for any $A:\UU$ and families $B:A\to\UU$ and $C:(\sm{x:A} B(x))\to\UU$, we have + \[\eqvspaced{\Parens{\sm{x:A}{y:B(x)} C(\pairr{x,y})}}{\Parens{\sm{p:\sm{x:A}B(x)} C(p)}}. \] +\end{ex} + +\begin{ex}\label{ex:pullback} + A (homotopy) \define{commutative square} + \indexdef{commutative!square}% + \begin{equation*} + \vcenter{\xymatrix{ + P\ar[r]^h\ar[d]_k & + A\ar[d]^f\\ + B\ar[r]_g & + C + }} + \end{equation*} + consists of functions $f$, $g$, $h$, and $k$ as shown, together with a path $f \circ h= g \circ k$. + Note that this is exactly an element of the pullback $(P\to A) \times_{P\to C} (P\to B)$ as defined in~\eqref{eq:defn-pullback}. + A commutative square is called a (homotopy) \define{pullback square} + \indexdef{pullback}% + if for any $X$, the induced map + \[ (X\to P) \to (X\to A) \times_{(X\to C)} (X\to B) \] + is an equivalence. + Prove that the pullback $P \defeq A\times_C B$ defined in~\eqref{eq:defn-pullback} is the corner of a pullback square. +\end{ex} + +\begin{ex}\label{ex:pullback-pasting} + Suppose given two commutative squares + \begin{equation*} + \vcenter{\xymatrix{ + A\ar[r]\ar[d] & + C\ar[r]\ar[d] & + E\ar[d]\\ + B\ar[r] & + D\ar[r] & + F + }} + \end{equation*} + and suppose that the right-hand square is a pullback square. + Prove that the left-hand square is a pullback square if and only if the outer rectangle is a pullback square. +\end{ex} + +\begin{ex}\label{ex:eqvboolbool} + Show that $\eqv{(\eqv\bool\bool)}{\bool}$. +\end{ex} + +\begin{ex}\label{ex:equality-reflection} + Suppose we add to type theory the \emph{equality reflection rule} which says that if there is an element $p:x=y$, then in fact $x\jdeq y$. + Prove that for any $p:x=x$ we have $p\jdeq \refl{x}$. + (This implies that every type is a \emph{set} in the sense to be introduced in \cref{sec:basics-sets}; see \cref{sec:hedberg}.) +\end{ex} + +\begin{ex}\label{ex:strengthen-transport-is-ap} + Show that \cref{thm:transport-is-ap} can be strengthened to + \[\transfib{B}{p}{{\blank}} =_{B(x)\to B(y)} \idtoeqv(\apfunc{B}(p))\] + without using function extensionality. + (In this and other similar cases, the apparently weaker formulation has been chosen for readability and consistency.) +\end{ex} + +\begin{ex}\label{ex:strong-from-weak-funext} + Suppose that rather than function extensionality (\cref{axiom:funext}), we suppose only the existence of an element + \[ \funext : \prd{A:\UU}{B:A\to \UU}{f,g:\prd{x:A} B(x)} (f\htpy g) \to (f=g) \] + (with no relationship to $\happly$ assumed). + Prove that in fact, this is sufficient to imply the whole function extensionality axiom (that $\happly$ is an equivalence). + This is due to Voevodsky; its proof is tricky and may require concepts from later chapters. +\end{ex} + +\begin{ex}\label{ex:equiv-functor-types}\ + \begin{enumerate} + \item Show that if $\eqv{A}{A'}$ and $\eqv{B}{B'}$, then $\eqv{(A\times B)}{(A'\times B')}$. + \item Give two proofs of this fact, one using univalence and one not using it, and show that the two proofs are equal. + \item Formulate and prove analogous results for the other type formers: $\Sigma$, $\to$, $\Pi$, and $+$. +\end{enumerate} +\end{ex} + +\begin{ex}\label{ex:dep-htpy-natural} + State and prove a version of \cref{lem:htpy-natural} for dependent functions. +\end{ex} + +\begin{ex}\label{ex:sigma-eq-components-neq} + We have seen that $\bfalse \neq \btrue$ (\cref{rmk:true-neq-false}). Show that, nevertheless, $(\bool, \bfalse) =_{\sm{A:\type}A} (\bool, \btrue)$ (see \cref{rmk:sigma-equality-extraction}). +\end{ex} + +% Local Variables: +% TeX-master: "hott-online" +% End: diff --git a/blurb.tex b/blurb.tex new file mode 100644 index 0000000000000000000000000000000000000000..8fb95945923535077c195247821137bd463c4cee --- /dev/null +++ b/blurb.tex @@ -0,0 +1,32 @@ +% Blurb on back cover, gets included in lulu cover as well +% as regular version, so be careful with formatting + +{ +\parindent=0pt +\parskip=\baselineskip +{\OPTbacktitlefont +\textit{From the Introduction:}} +\OPTbackfont + +\emph{Homotopy type theory} is a new branch of mathematics that combines aspects of several different fields in a surprising way. It is based on a recently discovered connection between \emph{homotopy theory} and \emph{type theory}. +It touches on topics as seemingly distant as the homotopy groups of spheres, the algorithms for type checking, and the definition of weak $\infty$-groupoids. + +Homotopy type theory brings new ideas into the very foundation of mathematics. +On the one hand, there is Voevodsky's subtle and beautiful \emph{univalence axiom}. +The univalence axiom implies, in particular, that isomorphic structures can be identified, a principle that mathematicians have been happily using on workdays, despite its incompatibility with the ``official'' doctrines of conventional foundations. +On the other hand, we have \emph{higher inductive types}, which provide direct, logical descriptions of some of the basic spaces and constructions of homotopy theory: spheres, cylinders, truncations, localizations, etc. +Both ideas are impossible to capture directly in classical set-theoretic foundations, but when combined in homotopy type theory, they permit an entirely new kind of ``logic of homotopy types''. + +This suggests a new conception of foundations of mathematics, with intrinsic homotopical content, an ``invariant'' conception of the objects of mathematics --- and convenient machine implementations, which can serve as a practical aid to the working mathematician. +This is the \emph{Univalent Foundations} program. + +The present book is intended as a first systematic exposition of the basics of univalent foundations, and a collection of examples of this new style of reasoning --- but without requiring the reader to know or learn any formal logic, or to use any computer proof assistant. +We believe that univalent foundations will eventually become a viable alternative to set theory as the ``implicit foundation'' for the unformalized mathematics done by most mathematicians. + +\bigskip + +\begin{center} + {\Large + \textit{Get a free copy of the book at HomotopyTypeTheory.org.}} +\end{center} +} diff --git a/bmpsize-hack.tex b/bmpsize-hack.tex new file mode 100644 index 0000000000000000000000000000000000000000..d7a6180c0e9842c2e1422a3a1b56a2903b098d1e --- /dev/null +++ b/bmpsize-hack.tex @@ -0,0 +1,38 @@ +\RequirePackage{bmpsize-base} +\RequirePackage{ifpdf} +\makeatletter +% Fix \includegraphics for dvi mode, but only if not making a pdf +\ifpdf + \expandafter\@gobble +\else + \expandafter\@firstofone +\fi{% +\AtBeginDocument{% +\let\Gin@ii@old=\Gin@ii +\def\Gin@ii[#1]#2{% + \begingroup + \let\@found\@empty + \@for\@type:=\bmpsize@types\do{% + \ifx\@found\@empty + \@nameuse{bmpsize@read@\@type}{#2.\@type}% + \ifbmpsize@ok + \let\@found=\@type + \fi + \fi + \ifx\@found\@empty + \@nameuse{bmpsize@read@\@type}{#2}% + \ifbmpsize@ok + \let\@found=\@type + \fi + \fi + }% + \ifx\@found\@empty + \Gin@ii@old[#1]{#2}% + \else + \Gin@ii@old[natwidth=\bmpsize@width bp,natheight=\bmpsize@height bp,#1]{#2}% + \fi + \endgroup +}% +} +} +\makeatother diff --git a/categories.tex b/categories.tex new file mode 100644 index 0000000000000000000000000000000000000000..2b5931b5d5eb7359d0cc9358c2d08f44434c1351 --- /dev/null +++ b/categories.tex @@ -0,0 +1,1854 @@ +\chapter{Category theory} +\label{cha:category-theory} + +Of the branches of mathematics, category theory is one which perhaps fits the least comfortably in set theoretic foundations. +One problem is that most of category theory is invariant under weaker notions of ``sameness'' than equality, such as isomorphism in a category or equivalence of categories, in a way which set theory fails to capture. +But this is the same sort of problem that the univalence axiom solves for types, by identifying equality with equivalence. +Thus, in univalent foundations it makes sense to consider a notion of ``category'' in which equality of objects is identified with isomorphism in a similar way. + +Ignoring size issues, in set-based mathematics a category consists of a \emph{set} $A_0$ of objects and, for each $x,y\in A_0$, a \emph{set} $\hom_A(x,y)$ of morphisms. +Under univalent foundations, a ``naive'' definition of category would simply mimic this with a \emph{type} of objects and \emph{types} of morphisms. +If we allowed these types to contain arbitrary higher homotopy, then we ought to impose higher coherence conditions, leading to some notion of $(\infty,1)$-category, +\index{.infinity1-category@$(\infty,1)$-category}% +but at present our goal is more modest. +We consider only 1-categories, and therefore we restrict the types $\hom_A(x,y)$ to be sets, i.e.\ 0-types. +If we impose no further conditions, we will call this notion a \emph{precategory}. + +If we add the requirement that the type $A_0$ of objects is a set, then we end up with a definition that behaves much like the traditional set-theoretic one. +Following Toby Bartels, we call this notion a \emph{strict category}. +\index{strict!category}% +Alternatively, we can require a generalized version of the univalence axiom, identifying $(x=_{A_0} y)$ with the type $\mathsf{iso}(x,y)$ of isomorphisms from $x$ to $y$. +Since we regard the latter choice as usually the ``correct'' definition, we will call it simply a \emph{category}. + +A good example of the difference between the three notions of category is provided by the statement ``every fully faithful and essentially surjective functor is an equivalence of categories'', which in classical set-based category theory is equivalent to the axiom of choice. +\index{mathematics!classical}% +\index{axiom!of choice}% +\index{classical!category theory}% +\begin{enumerate} +\item For strict categories, this is still equivalent to the axiom of choice. +\item For precategories, there is no consistent axiom of choice which can make it true. +\item For categories, it is provable \emph{without} any axiom of choice. +\end{enumerate} +We will prove the latter statement in this chapter, as well as other pleasant properties of categories, e.g.\ that equivalent categories are equal (as elements of the type of categories). +We will also describe a universal way of ``saturating'' a precategory $A$ into a category $\widehat A$, which we call its \emph{Rezk completion}, +\index{completion!Rezk}% +although it could also reasonably be called the \emph{stack completion} (see the Notes). + +The Rezk completion also sheds further light on the notion of equivalence of categories. +For instance, the functor $A \to \widehat{A}$ is always fully faithful and essentially surjective, hence a ``weak equivalence''. +It follows that a precategory is a category exactly when it ``sees'' all fully faithful and essentially surjective functors as equivalences; thus our notion of ``category'' is already inherent in the notion of ``fully faithful and essentially surjective functor''. + +We assume the reader has some basic familiarity with classical category theory.\index{classical!category theory} +Recall that whenever we write \type it denotes some universe of types, but perhaps a different one at different times; everything we say remains true for any consistent choice of universe levels\index{universe level}. +We will use the basic notions of homotopy type theory from \cref{cha:typetheory,cha:basics} and the propositional truncation from \cref{cha:logic}, but not much else from \cref{part:foundations}, except that our second construction of the Rezk completion will use a higher inductive type. + + +\section{Categories and precategories} +\label{sec:cats} + +In classical mathematics, there are many equivalent definitions of a category. +In our case, since we have dependent types, it is natural to choose the arrows to be a type family indexed by the objects. +This matches the way hom-types are always used in category theory: we never even consider comparing two arrows unless we know their domains and codomains agree. +Furthermore, it seems clear that for a theory of 1-categories, the hom-types should all be sets. +This leads us to the following definition. + +\begin{defn}\label{ct:precategory} + A \define{precategory} + \indexdef{precategory} + $A$ consists of the following. + \begin{enumerate} + \item A type $A_0$, whose elements are called \define{objects}.% + \indexdef{object!in a (pre)category} + We write $a:A$ for $a:A_0$. + \item For each $a,b:A$, a set $\hom_A(a,b)$, whose elements are called \define{arrows} or \define{morphisms}.% + \indexsee{arrow}{morphism}% + \indexdef{morphism!in a (pre)category}% + \indexdef{hom-set}% + \item For each $a:A$, a morphism $1_a:\hom_A(a,a)$, called the \define{identity morphism}.% + \indexdef{identity!morphism in a (pre)category} + \item For each $a,b,c:A$, a function% + \indexdef{composition!of morphisms in a (pre)category} + \[ \hom_A(b,c) \to \hom_A(a,b) \to \hom_A(a,c) \] + called \define{composition}, and denoted infix by $g\mapsto f\mapsto g\circ f$, or sometimes simply by $gf$. + \item For each $a,b:A$ and $f:\hom_A(a,b)$, we have $\id f {1_b\circ f}$ and $\id f {f\circ 1_a}$. + \item For each $a,b,c,d:A$ and + \begin{equation*} + f:\hom_A(a,b), \qquad + g:\hom_A(b,c), \qquad + h:\hom_A(c,d), + \end{equation*} + we have $\id {h\circ (g\circ f)}{(h\circ g)\circ f}$. + \end{enumerate} +\end{defn} + +The problem with the notion of precategory is that for objects $a,b:A$, we have two possibly-different notions of ``sameness''. +On the one hand, we have the type $(\id[A_0]{a}{b})$. +But on the other hand, there is the standard categorical notion of \emph{isomorphism}. + +\begin{defn}\label{ct:isomorphism} + A morphism $f:\hom_A(a,b)$ is an \define{isomorphism} + \indexdef{isomorphism!in a (pre)category}% + if there is a morphism $g:\hom_A(b,a)$ such that $\id{g\circ f}{1_a}$ and $\id{f\circ g}{1_b}$. + We write $a\cong b$ for the type of such isomorphisms. +\end{defn} + +\begin{lem}\label{ct:isoprop} + For any $f:\hom_A(a,b)$, the type ``$f$ is an isomorphism'' is a mere proposition. + Therefore, for any $a,b:A$ the type $a\cong b$ is a set. +\end{lem} +\begin{proof} + Suppose given $g:\hom_A(b,a)$ and $\eta:(\id{1_a}{g\circ f})$ and $\epsilon:(\id{f\circ g}{1_b})$, and similarly $g'$, $\eta'$, and $\epsilon'$. +We must show $\id{(g,\eta,\epsilon)}{(g',\eta',\epsilon')}$. + But since all hom-sets are sets, their identity types are mere propositions, so it suffices to show $\id g {g'}$. + For this we have + \[g' = 1_a\circ g' = (g\circ f)\circ g' = g\circ (f\circ g') = g\circ 1_b = g\] + using $\eta$ and $\epsilon'$. +\end{proof} + +\symlabel{ct:inv} +\index{inverse!in a (pre)category}% +If $f:a\cong b$, then we write $\inv f$ for its inverse, which by \cref{ct:isoprop} is uniquely determined. + +The only relationship between these two notions of sameness that we have in a precategory is the following. + +\begin{lem}[\textsf{idtoiso}]\label{ct:idtoiso} + If $A$ is a precategory and $a,b:A$, then + \[(\id a b)\to (a \cong b).\] +\end{lem} +\begin{proof} + By induction on identity, we may assume $a$ and $b$ are the same. + But then we have $1_a:\hom_A(a,a)$, which is clearly an isomorphism. +\end{proof} + +Evidently, this situation is analogous to the issue that motivated us to introduce the univalence axiom. +In fact, we have the following: + +\begin{eg}\label{ct:precatset} + \index{set}% + There is a precategory \uset, whose type of objects is \set, and with $\hom_{\uset}(A,B) \defeq (A\to B)$. + The identity morphisms are identity functions and the composition is function composition. + For this precategory, \cref{ct:idtoiso} is equal to (the restriction to sets of) the map $\idtoeqv$ from \cref{sec:compute-universe}. + + Of course, to be more precise we should call this category $\uset_\UU$, since its objects are only the \emph{small sets} + \index{small!set}% + relative to a universe \UU. +\end{eg} + +Thus, it is natural to make the following definition. + +\begin{defn}\label{ct:category} + A \define{category} + \indexdef{category} + is a precategory such that for all $a,b:A$, the function $\idtoiso_{a,b}$ from \cref{ct:idtoiso} is an equivalence. +\end{defn} + +In particular, in a category, if $a\cong b$, then $a=b$. + +\begin{eg}\label{ct:eg:set} + \index{univalence axiom}% + The univalence axiom implies immediately that \uset is a category. + One can also show, using univalence, that any precategory of set-level structures such as groups, rings, topological spaces, etc.\ is a category; see \cref{sec:sip}. +\end{eg} + +We also note the following. + +\begin{lem}\label{ct:obj-1type} + In a category, the type of objects is a 1-type. +\end{lem} +\begin{proof} + It suffices to show that for any $a,b:A$, the type $\id a b$ is a set. + But $\id a b$ is equivalent to $a \cong b$, which is a set. +\end{proof} + +\symlabel{isotoid} +We write $\isotoid$ for the inverse $(a\cong b) \to (\id a b)$ of the map $\idtoiso$ from \cref{ct:idtoiso}. +The following relationship between the two is important. + +\begin{lem}\label{ct:idtoiso-trans} + For $p:\id a a'$ and $q:\id b b'$ and $f:\hom_A(a,b)$, we have + \begin{equation}\label{ct:idtoisocompute} + \id{\trans{(p,q)}{f}} + {\idtoiso(q)\circ f \circ \inv{\idtoiso(p)}}. + \end{equation} +\end{lem} +\begin{proof} + By induction, we may assume $p$ and $q$ are $\refl a$ and $\refl b$ respectively. +Then the left-hand side of~\eqref{ct:idtoisocompute} is simply $f$. + But by definition, $\idtoiso(\refl a)$ is $1_a$, and $\idtoiso(\refl b)$ is $1_b$, so the right-hand side of~\eqref{ct:idtoisocompute} is $1_b\circ f\circ 1_a$, which is equal to $f$. +\end{proof} + +Similarly, we can show +\begin{gather} + \id{\idtoiso(\rev p)}{\inv {(\idtoiso(p))}}\\ + \id{\idtoiso(p\ct q)}{\idtoiso(q)\circ \idtoiso(p)}\\ + \id{\isotoid(f\circ e)}{\isotoid(e)\ct \isotoid(f)} +\end{gather} +and so on. + +\begin{eg}\label{ct:orders} + A precategory in which each set $\hom_A(a,b)$ is a mere proposition is equivalently a type $A_0$ equipped with a mere relation ``$\le$'' that is reflexive ($a\le a$) and transitive (if $a\le b$ and $b\le c$, then $a\le c$). + We call this a \define{preorder}. + \indexdef{preorder} + + In a preorder, a witness $f: a\le b$ is an isomorphism just when there exists some witness $g: b\le a$. + Thus, $a\cong b$ is the mere proposition that $a\le b$ and $b\le a$. + Therefore, a preorder $A$ is a category just when (1) each type $a=b$ is a mere proposition, and (2) for any $a,b:A_0$ there exists a function $(a\cong b) \to (a=b)$. + In other words, $A_0$ must be a set, and $\le$ must be antisymmetric\index{relation!antisymmetric} (if $a\le b$ and $b\le a$, then $a=b$). + We call this a \define{(partial) order} or a \define{poset}. + \indexdef{partial order}% + \indexdef{poset}% +\end{eg} + +\begin{eg}\label{ct:gaunt} + If $A$ is a category, then $A_0$ is a set if and only if for any $a,b:A_0$, the type $a\cong b$ is a mere proposition. + Given that $A$ is a category, this is equivalent to saying that every automorphism in $A$ is an identity arrow. On the other hand, if $A$ is a precategory such that $A_0$ is a set, then $A$ is a category precisely if it is skeletal\index{mathematics!classical} (any two isomorphic objects are equal) \emph{and} every automorphism is an identity arrow. + Categories of this sort are sometimes called \define{gaunt}~\cite{bsp12infncats}. + \indexdef{category!gaunt}% + \indexdef{gaunt category}% + \index{skeletal category}% + \index{category!skeletal}% + There is not really any notion of ``skeletality'' for our categories, unless one considers \cref{ct:category} itself to be such. +\end{eg} + +\begin{eg}\label{ct:discrete} + For any 1-type $X$, there is a category with $X$ as its type of objects and with $\hom(x,y) \defeq (x=y)$. + If $X$ is a set, we call this the \define{discrete} + \indexdef{category!discrete}% + \indexdef{discrete!category}% + category on $X$. + In general, we call it a \define{groupoid} + \indexdef{groupoid} + (see \cref{ct:groupoids}). +\end{eg} + +\begin{eg}\label{ct:fundgpd} + For \emph{any} type $X$, there is a precategory with $X$ as its type of objects and with $\hom(x,y) \defeq \pizero{x=y}$. + The composition operation + \[ \pizero{y=z} \to \pizero{x=y} \to \pizero{x=z} \] + is defined by induction on truncation from concatenation $(y=z)\to(x=y)\to(x=z)$. + We call this the \define{fundamental pregroupoid} + \indexdef{fundamental!pregroupoid}% + \indexsee{pregroupoid, fundamental}{fundamental pregroupoid}% + of $X$. + (In fact, we have met it already in \cref{sec:van-kampen}; see also \cref{ex:rezk-vankampen}.) +\end{eg} + +\begin{eg}\label{ct:hoprecat} + There is a precategory whose type of objects is \type and with $\hom(X,Y) \defeq \pizero{X\to Y}$, and composition defined by induction on truncation from ordinary composition $(Y\to Z) \to (X\to Y) \to (X\to Z)$. + We call this the \define{homotopy precategory of types}. + \indexdef{precategory!of types}% + \index{homotopy!category of types@(pre)category of types}% +\end{eg} + +\begin{eg}\label{ct:rel} + Let \urel be the following precategory: + \begin{itemize} + \item Its objects are sets. + \item $\hom_{\urel}(X,Y) = X\to Y\to \prop$. + \item For a set $X$, we have $1_X(x,x') \defeq (x=x')$. + \item For $R:\hom_{\urel}(X,Y)$ and $S:\hom_{\urel}(Y,Z)$, their composite is defined by + \[ (S\circ R)(x,z) \defeq \Brck{\sm{y:Y} R(x,y) \times S(y,z)}.\] + \end{itemize} + Suppose $R:\hom_{\urel}(X,Y)$ is an isomorphism, with inverse $S$. + We observe the following. + \begin{enumerate} + \item If $R(x,y)$ and $S(y',x)$, then $(R\circ S)(y',y)$, and hence $y'=y$. + Similarly, if $R(x,y)$ and $S(y,x')$, then $x=x'$.\label{item:rel1} + \item For any $x$, we have $x=x$, hence $(S\circ R)(x,x)$. + Thus, there merely exists a $y:Y$ such that $R(x,y)$ and $S(y,x)$.\label{item:rel2} + \item Suppose $R(x,y)$. + By~\ref{item:rel2}, there merely exists a $y'$ with $R(x,y')$ and $S(y',x)$. + But then by~\ref{item:rel1}, merely $y'=y$, and hence $y'=y$ since $Y$ is a set. + Therefore, by transporting $S(y',x)$ along this equality, we have $S(y,x)$. + In conclusion, $R(x,y)\to S(y,x)$. + Similarly, $S(y,x) \to R(x,y)$.\label{item:rel3} + \item If $R(x,y)$ and $R(x,y')$, then by~\ref{item:rel3}, $S(y',x)$, so that by~\ref{item:rel1}, $y=y'$. + Thus, for any $x$ there is at most one $y$ such that $R(x,y)$. + And by~\ref{item:rel2}, there merely exists such a $y$, hence there exists such a $y$. + \end{enumerate} + In conclusion, if $R:\hom_{\urel}(X,Y)$ is an isomorphism, then for each $x:X$ there is exactly one $y:Y$ such that $R(x,y)$, and dually. + Thus, there is a function $f:X\to Y$ sending each $x$ to this $y$, which is an equivalence; hence $X=Y$. + With a little more work, we conclude that \urel is a category. +\end{eg} + +We might now restrict ourselves to considering categories rather than precategories. +Instead, we will develop many concepts for precategories as well as categories, in order to emphasize how much better-behaved categories are, as compared both to precategories and to ordinary categories in classical\index{mathematics!classical} mathematics. + +We will also see in \crefrange{sec:strict-categories}{sec:dagger-categories} that in slightly more exotic contexts, there are uses for certain kinds of precategories other than categories, each of which ``fixes'' the equality of objects in different ways. +This emphasizes the ``pre''-ness of precategories: they are the raw material out of which multiple important categorical structures can be defined. + + +\section{Functors and transformations} +\label{sec:transfors} + +The following definitions are fairly obvious, and need no modification. + +\begin{defn}\label{ct:functor} + Let $A$ and $B$ be precategories. + A \define{functor} + \indexdef{functor}% + $F:A\to B$ consists of + \begin{enumerate} + \item A function $F_0:A_0\to B_0$, generally also denoted $F$. + \item For each $a,b:A$, a function $F_{a,b}:\hom_A(a,b) \to \hom_B(Fa,Fb)$, generally also denoted $F$. + \item For each $a:A$, we have $\id{F(1_a)}{1_{Fa}}$. + \item For each $a,b,c:A$ and $f:\hom_A(a,b)$ and $g:\hom_A(b,c)$, we have + \[\id{F(g\circ f)}{Fg\circ Ff}.\]\label{ct:functor:comp} + \end{enumerate} +\end{defn} + +Note that by induction on identity, a functor also preserves \idtoiso. + +\begin{defn}\label{ct:nattrans} + For functors $F,G:A\to B$, a \define{natural transformation} + \indexdef{natural!transformation}% + \indexsee{transformation!natural}{natural transformation}% + $\gamma:F\to G$ consists of + \begin{enumerate} + \item For each $a:A$, a morphism $\gamma_a:\hom_B(Fa,Ga)$ (the ``components''). + \item For each $a,b:A$ and $f:\hom_A(a,b)$, we have $\id{Gf\circ \gamma_a}{\gamma_b\circ Ff}$ (the ``naturality axiom''). + \end{enumerate} +\end{defn} + +Since each type $\hom_B(Fa,Gb)$ is a set, its identity type is a mere proposition. +Thus, the naturality axiom is a mere proposition, so identity of natural transformations is determined by identity of their components. +In particular, for any $F$ and $G$, the type of natural transformations from $F$ to $G$ is again a set. + +Similarly, identity of functors is determined by identity of the functions $A_0\to B_0$ and (transported along this) of the corresponding functions on hom-sets. + +\begin{defn}\label{ct:functor-precat} + \indexdef{precategory!of functors}% + For precategories $A,B$, there is a precategory $B^A$, called the \define{functor precategory}, defined by + \begin{itemize} + \item $(B^A)_0$ is the type of functors from $A$ to $B$. + \item $\hom_{B^A}(F,G)$ is the type of natural transformations from $F$ to $G$. + \end{itemize} +\end{defn} +\begin{proof} + We define $(1_F)_a\defeq 1_{Fa}$. + Naturality follows by the unit axioms of a precategory. + For $\gamma:F\to G$ and $\delta:G\to H$, we define $(\delta\circ\gamma)_a\defeq \delta_a\circ \gamma_a$. + Naturality follows by associativity. + Similarly, the unit and associativity laws for $B^A$ follow from those for $B$. +\end{proof} + +\begin{lem}\label{ct:natiso} + \index{natural!isomorphism}% + \index{isomorphism!natural}% + A natural transformation $\gamma:F\to G$ is an isomorphism in $B^A$ if and only if each $\gamma_a$ is an isomorphism in $B$. +\end{lem} +\begin{proof} + If $\gamma$ is an isomorphism, then we have $\delta:G\to F$ that is its inverse. + By definition of composition in $B^A$, $(\delta\gamma)_a\jdeq \delta_a\gamma_a$ and similarly $(\gamma\delta)_a\jdeq \gamma_a\delta_a$. + Thus, $\id{\delta\gamma}{1_F}$ and $\id{\gamma\delta}{1_G}$ imply $\id{\delta_a\gamma_a}{1_{Fa}}$ and $\id{\gamma_a\delta_a}{1_{Ga}}$, so $\gamma_a$ is an isomorphism. + + Conversely, suppose each $\gamma_a$ is an isomorphism, with inverse called $\delta_a$, say. +We define a natural transformation $\delta:G\to F$ with components $\delta_a$; for the naturality axiom we have + \[ Ff\circ \delta_a = \delta_b\circ \gamma_b\circ Ff \circ \delta_a = \delta_b\circ Gf\circ \gamma_a\circ \delta_a = \delta_b\circ Gf. \] + Now since composition and identity of natural transformations is determined on their components, we have $\id{\gamma\delta}{1_G}$ and $\id{\delta\gamma}{1_F}$. +\end{proof} + +The following result is fundamental. + +\begin{thm}\label{ct:functor-cat} + \indexdef{category!of functors}% + \indexdef{functor!category of}% + If $A$ is a precategory and $B$ is a category, then $B^A$ is a category. +\end{thm} +\begin{proof} + Let $F,G:A\to B$; we must show that $\idtoiso:(\id{F}{G}) \to (F\cong G)$ is an equivalence. + + To give an inverse to it, suppose $\gamma:F\cong G$ is a natural isomorphism. + Then for any $a:A$, we have an isomorphism $\gamma_a:Fa \cong Ga$, hence an identity $\isotoid(\gamma_a):\id{Fa}{Ga}$. + By function extensionality, we have an identity $\bar{\gamma}:\id[(A_0\to B_0)]{F_0}{G_0}$. + + Now since the last two axioms of a functor are mere propositions, to show that $\id{F}{G}$ it will suffice to show that for any $a,b:A$, the functions + \begin{align*} + F_{a,b}&:\hom_A(a,b) \to \hom_B(Fa,Fb)\mathrlap{\qquad\text{and}}\\ + G_{a,b}&:\hom_A(a,b) \to \hom_B(Ga,Gb) + \end{align*} + become equal when transported along $\bar\gamma$. + By computation for function extensionality, when applied to $a$, $\bar\gamma$ becomes equal to $\isotoid(\gamma_a)$. + But by \cref{ct:idtoiso-trans}, transporting $Ff:\hom_B(Fa,Fb)$ along $\isotoid(\gamma_a)$ and $\isotoid(\gamma_b)$ is equal to the composite $\gamma_b\circ Ff\circ \inv{(\gamma_a)}$, which by naturality of $\gamma$ is equal to $Gf$. + + This completes the definition of a function $(F\cong G) \to (\id F G)$. + Now consider the composite + \[ (\id F G) \to (F\cong G) \to (\id F G). \] + Since hom-sets are sets, their identity types are mere propositions, so to show that two identities $p,q:\id F G$ are equal, it suffices to show that $\id[\id{F_0}{G_0}]{p}{q}$. + But in the definition of $\bar\gamma$, if $\gamma$ were of the form $\idtoiso(p)$, then $\gamma_a$ would be equal to $\idtoiso(p_a)$ (this can easily be proved by induction on $p$). + Thus, $\isotoid(\gamma_a)$ would be equal to $p_a$, and so by function extensionality we would have $\id{\bar\gamma}{p}$, which is what we need. + + Finally, consider the composite + \[(F\cong G)\to (\id F G) \to (F\cong G). \] + Since identity of natural transformations can be tested componentwise, it suffices to show that for each $a$ we have $\id{\idtoiso(\bar\gamma)_a}{\gamma_a}$. + But as observed above, we have $\id{\idtoiso(\bar\gamma)_a}{\idtoiso((\bar\gamma)_a)}$, while $\id{(\bar\gamma)_a}{\isotoid(\gamma_a)}$ by computation for function extensionality. + Since $\isotoid$ and $\idtoiso$ are inverses, we have $\id{\idtoiso(\bar\gamma)_a}{\gamma_a}$ as desired. +\end{proof} + +In particular, naturally isomorphic functors between categories (as opposed to precategories) are equal. + +\mentalpause + +We now define all the usual ways to compose functors and natural transformations. + +\begin{defn}\label{ct:functor-composition} + For functors $F:A\to B$ and $G:B\to C$, their composite $G\circ F:A\to C$ is given by + \begin{itemize} + \item The composite $(G_0\circ F_0) : A_0 \to C_0$ + \item For each $a,b:A$, the composite + \[(G_{Fa,Fb}\circ F_{a,b}):\hom_A(a,b) \to \hom_C(GFa,GFb).\] + \end{itemize} + It is easy to check the axioms. +\end{defn} + +\begin{defn}\label{ct:whisker} + For functors $F:A\to B$ and $G,H:B\to C$ and a natural transformation $\gamma:G\to H$, the composite $(\gamma F):GF\to HF$ is given by + \begin{itemize} + \item For each $a:A$, the component $\gamma_{Fa}$. + \end{itemize} + Naturality is easy to check. + Similarly, for $\gamma$ as above and $K:C\to D$, the composite $(K\gamma):KG\to KH$ is given by + \begin{itemize} + \item For each $b:B$, the component $K(\gamma_b)$. + \end{itemize} +\end{defn} + +\begin{lem}\label{ct:interchange} + \index{interchange law}% + For functors $F,G:A\to B$ and $H,K:B\to C$ and natural transformations $\gamma:F\to G$ and $\delta:H\to K$, we have + \[\id{(\delta G)(H\gamma)}{(K\gamma)(\delta F)}.\] +\end{lem} +\begin{proof} + It suffices to check componentwise: at $a:A$ we have + \begin{align*} + ((\delta G)(H\gamma))_a + &\jdeq (\delta G)_{a}(H\gamma)_a\\ + &\jdeq \delta_{Ga}\circ H(\gamma_a)\\ + &= K(\gamma_a) \circ \delta_{Fa} \tag{by naturality of $\delta$}\\ + &\jdeq (K \gamma)_a\circ (\delta F)_a\\ + &\jdeq ((K \gamma)(\delta F))_a.\qedhere + \end{align*} +\end{proof} + +\index{horizontal composition!of natural transformations}% +\index{classical!category theory}% +Classically, one defines the ``horizontal composite'' of $\gamma:F\to G$ and $\delta:H\to K$ to be the common value of ${(\delta G)(H\gamma)}$ and ${(K\gamma)(\delta F)}$. +We will refrain from doing this, because while equal, these two transformations are not \emph{definitionally} equal. +This also has the consequence that we can use the symbol $\circ$ (or juxtaposition) for all kinds of composition unambiguously: there is only one way to compose two natural transformations (as opposed to composing a natural transformation with a functor on either side). + +\begin{lem}\label{ct:functor-assoc} + \index{associativity!of functor composition} + Composition of functors is associative: $\id{H(GF)}{(HG)F}$. +\end{lem} +\begin{proof} + Since composition of functions is associative, this follows immediately for the actions on objects and on homs. + And since hom-sets are sets, the rest of the data is automatic. +\end{proof} + +The equality in \cref{ct:functor-assoc} is likewise not definitional. +(Composition of functions is definitionally associative, but the axioms that go into a functor must also be composed, and this breaks definitional associativity.) For this reason, we need also to know about \emph{coherence}\index{coherence} for associativity. + +\begin{lem}\label{ct:pentagon} + \index{associativity!of functor composition!coherence of}% + \cref{ct:functor-assoc} is coherent, i.e.\ the following pentagon\index{pentagon, Mac Lane} of equalities commutes: + \[ \xymatrix{ & K(H(GF)) \ar@{=}[dl] \ar@{=}[dr]\\ + (KH)(GF) \ar@{=}[d] && K((HG)F) \ar@{=}[d]\\ + ((KH)G)F && (K(HG))F \ar@{=}[ll].} + \] +\end{lem} +\begin{proof} + As in \cref{ct:functor-assoc}, this is evident for the actions on objects, and the rest is automatic. +\end{proof} + +We will henceforth abuse notation by writing $H\circ G\circ F$ or $HGF$ for either $H(GF)$ or $(HG)F$, transporting along \cref{ct:functor-assoc} whenever necessary. +We have a similar coherence result for units. + +\begin{lem}\label{ct:units} + For a functor $F:A\to B$, we have equalities $\id{(1_B\circ F)}{F}$ and $\id{(F\circ 1_A)}{F}$, such that given also $G:B\to C$, the following triangle of equalities commutes: + \[ \xymatrix{ + G\circ (1_B \circ F) \ar@{=}[rr] \ar@{=}[dr] && + (G\circ 1_B)\circ F \ar@{=}[dl] \\ + & G \circ F.} + \] +\end{lem} + +See \cref{ct:pre2cat,ct:2cat} for further development of these ideas. + + +\section{Adjunctions} +\label{sec:adjunctions} + +The definition of adjoint functors is straightforward; the main interesting aspect arises from proof-relevance. + +\begin{defn}\label{ct:adjoints} + A functor $F:A\to B$ is a \define{left adjoint} + \indexdef{left!adjoint}% + \indexdef{adjoint!functor}% + \indexdef{right!adjoint}% + \indexdef{adjoint!functor}% + \index{functor!adjoint}% + if there exists + \begin{itemize} + \item A functor $G:B\to A$. + \item A natural transformation $\eta:1_A \to GF$ (the \define{unit}\indexdef{unit!of an adjunction}). + \item A natural transformation $\epsilon:FG\to 1_B$ (the \define{counit}\indexdef{counit of an adjunction}). + \item $\id{(\epsilon F)(F\eta)}{1_F}$. + \item $\id{(G\epsilon)(\eta G)}{1_G}$. + \end{itemize} +\end{defn} + +The last two equations are called the \define{triangle identities}\indexdef{triangle!identity} or \define{zigzag identities}\indexdef{zigzag identity}. +\indexdef{identity!triangle}\indexdef{identity!zigzag} +We leave it to the reader to define right adjoints analogously. + +\begin{lem}\label{ct:adjprop} + If $A$ is a category (but $B$ may be only a precategory), then the type ``$F$ is a left adjoint'' is a mere proposition. +\end{lem} +\begin{proof} + Suppose we are given $(G,\eta,\epsilon)$ with the triangle identities and also $(G',\eta',\epsilon')$. + Define $\gamma:G\to G'$ to be $(G'\epsilon)(\eta' G)$, and $\delta:G'\to G$ to be $(G\epsilon')(\eta G')$. + Then + \begin{align*} + \delta\gamma &= + (G\epsilon')(\eta G')(G'\epsilon)(\eta'G)\\ + &= (G\epsilon')(G F G'\epsilon)(\eta G' F G)(\eta'G)\\ + &= (G\epsilon)(G\epsilon'FG)(G F \eta' G)(\eta G)\\ + &= (G\epsilon)(\eta G)\\ + &= 1_G + \end{align*} + using \cref{ct:interchange} and the triangle identities. + Similarly, we show $\id{\gamma\delta}{1_{G'}}$, so $\gamma$ is a natural isomorphism $G\cong G'$. + By \cref{ct:functor-cat}, we have an identity $\id G {G'}$. + + Now we need to know that when $\eta$ and $\epsilon$ are transported along this identity, they become equal to $\eta'$ and $\epsilon'$. + By \cref{ct:idtoiso-trans}, this transport is given by composing with $\gamma$ or $\delta$ as appropriate. + For $\eta$, this yields + \begin{equation*} + (G'\epsilon F)(\eta'GF)\eta + = (G'\epsilon F)(G'F\eta)\eta' + = \eta' + \end{equation*} + using \cref{ct:interchange} and the triangle identity. + The case of $\epsilon$ is similar. + Finally, the triangle identities transport correctly automatically, since hom-sets are sets. +\end{proof} + +In \cref{sec:yoneda} we will give another proof of \cref{ct:adjprop}. + + +\section{Equivalences} +\label{sec:equivalences} + +It is usual in category theory to define an \emph{equivalence of categories} to be a functor $F:A\to B$ such that there exists a functor $G:B\to A$ and natural isomorphisms $F G \cong 1_B$ and $G F \cong 1_A$. +Unlike the property of being an adjunction, however, this would not be a mere proposition without truncating it, for the same reasons that the type of quasi-inverses is ill-behaved (see \cref{sec:quasi-inverses}). +And as in \cref{sec:hae}, we can avoid this by using the usual notion of \emph{adjoint} equivalence. +\indexdef{adjoint!equivalence!of (pre)categories} + +\begin{defn}\label{ct:equiv} + A functor $F:A\to B$ is an \define{equivalence of (pre)categories} + \indexdef{equivalence!of (pre)categories}% + \indexdef{category!equivalence of}% + \indexdef{precategory!equivalence of}% + \index{functor!equivalence}% + if it is a left adjoint for which $\eta$ and $\epsilon$ are isomorphisms. + We write $\cteqv A B$ for the type of equivalences of (pre)categories from $A$ to $B$. +\end{defn} + +By \cref{ct:adjprop,ct:isoprop}, if $A$ is a category, then the type ``$F$ is an equivalence of precategories'' is a mere proposition. + +\begin{lem}\label{ct:adjointification} + If for $F:A\to B$ there exists $G:B\to A$ and isomorphisms $GF\cong 1_A$ and $FG\cong 1_B$, then $F$ is an equivalence of precategories. +\end{lem} +\begin{proof} + Just like the proof of \cref{thm:equiv-iso-adj} for equivalences of types. +\end{proof} + +\begin{defn}\label{ct:full-faithful} + We say a functor $F:A\to B$ is \define{faithful} + \indexdef{functor!faithful}% + \index{faithful functor}%a + if for all $a,b:A$, the function + \[F_{a,b}:\hom_A(a,b) \to \hom_B(Fa,Fb)\] + is injective, and \define{full} + \indexdef{functor!full}% + \indexdef{full functor}% + if for all $a,b:A$ this function is surjective. + If it is both (hence each $F_{a,b}$ is an equivalence) we say $F$ is \define{fully faithful}. + \indexdef{functor!fully faithful}% + \indexdef{fully faithful functor}% +\end{defn} + +\begin{defn}\label{ct:split-essentially-surjective} + We say a functor $F:A\to B$ is \define{split essentially surjective} + \indexdef{functor!split essentially surjective}% + \indexdef{split!essentially surjective functor}% + if for all $b:B$ there exists an $a:A$ such that $Fa\cong b$. +\end{defn} + +\begin{lem}\label{ct:ffeso} + For any precategories $A$ and $B$ and functor $F:A\to B$, the following types are equivalent. + \begin{enumerate} + \item $F$ is an equivalence of precategories.\label{item:ct:ffeso1} + \item $F$ is fully faithful and split essentially surjective.\label{item:ct:ffeso2} + \end{enumerate} +\end{lem} +\begin{proof} + Suppose $F$ is an equivalence of precategories, with $G,\eta,\epsilon$ specified. + Then we have the function + \begin{align*} + \hom_B(Fa,Fb) &\to \hom_A(a,b),\\ + g &\mapsto \inv{\eta_b}\circ G(g)\circ \eta_a. + \end{align*} + For $f:\hom_A(a,b)$, we have + \[ \inv{\eta_{b}}\circ G(F(f))\circ \eta_{a} = + \inv{\eta_{b}} \circ \eta_{b} \circ f= + f + \] + while for $g:\hom_B(Fa,Fb)$ we have + \begin{align*} + F(\inv{\eta_b} \circ G(g)\circ\eta_a) + &= F(\inv{\eta_b})\circ F(G(g))\circ F(\eta_a)\\ + &= \epsilon_{Fb}\circ F(G(g))\circ F(\eta_a)\\ + &= g\circ\epsilon_{Fa}\circ F(\eta_a)\\ + &= g + \end{align*} + using naturality of $\epsilon$, and the triangle identities twice. + Thus, $F_{a,b}$ is an equivalence, so $F$ is fully faithful. + Finally, for any $b:B$, we have $Gb:A$ and $\epsilon_b:FGb\cong b$. + + On the other hand, suppose $F$ is fully faithful and split essentially surjective. + Define $G_0:B_0\to A_0$ by sending $b:B$ to the $a:A$ given by the specified essential splitting, and write $\epsilon_b$ for the likewise specified isomorphism $FGb\cong b$. + + Now for any $g:\hom_B(b,b')$, define $G(g):\hom_A(Gb,Gb')$ to be the unique morphism such that $\id{F(G(g))}{\inv{(\epsilon_{b'})}\circ g \circ \epsilon_b }$ (which exists since $F$ is fully faithful). + Finally, for $a:A$ define $\eta_a:\hom_A(a,GFa)$ to be the unique morphism such that $\id{F\eta_a}{\inv{\epsilon_{Fa}}}$. + It is easy to verify that $G$ is a functor and that $(G,\eta,\epsilon)$ exhibit $F$ as an equivalence of precategories. + + Now consider the composite~\ref{item:ct:ffeso1}$\to$\ref{item:ct:ffeso2}$\to$\ref{item:ct:ffeso1}. + We clearly recover the same function $G_0:B_0 \to A_0$. + For the action of $G$ on hom-sets, we must show that for $g:\hom_B(b,b')$, $G(g)$ is the (necessarily unique) morphism such that $F(G(g)) = \inv{(\epsilon_{b'})}\circ g \circ \epsilon_b$. + But this equation holds by the assumed naturality of $\epsilon$. + We also clearly recover $\epsilon$, while $\eta$ is uniquely characterized by $\id{F\eta_a}{\inv{\epsilon_{Fa}}}$ (which is one of the triangle identities assumed to hold in the structure of an equivalence of precategories). + Thus, this composite is equal to the identity. + + Finally, consider the other composite~\ref{item:ct:ffeso2}$\to$\ref{item:ct:ffeso1}$\to$\ref{item:ct:ffeso2}. + Since being fully faithful is a mere proposition, it suffices to observe that we recover, for each $b:B$, the same $a:A$ and isomorphism $F a \cong b$. + But this is clear, since we used this function and isomorphism to define $G_0$ and $\epsilon$ in~\ref{item:ct:ffeso1}, which in turn are precisely what we used to recover~\ref{item:ct:ffeso2} again. + Thus, the composites in both directions are equal to identities, hence we have an equivalence \eqv{\text{\ref{item:ct:ffeso1}}}{\text{\ref{item:ct:ffeso2}}}. +\end{proof} + +However, if $A$ is not a category, then neither type in \cref{ct:ffeso} may necessarily be a mere proposition. +This suggests considering as well the following notions. + +\begin{defn}\label{ct:essentially-surjective} + A functor $F:A\to B$ is \define{essentially surjective} + \indexdef{functor!essentially surjective}% + \indexdef{essentially surjective functor}% + if for all $b:B$, there \emph{merely} exists an $a:A$ such that $Fa\cong b$. + We say $F$ is a \define{weak equivalence} + \indexsee{equivalence!of (pre)categories!weak}{weak equivalence}% + \indexdef{weak equivalence!of precategories}% + \indexsee{functor!weak equivalence}{weak equivalence}% + if it is fully faithful and essentially surjective. +\end{defn} + +Being a weak equivalence is \emph{always} a mere proposition. +For categories, however, there is no difference between equivalences and weak ones. + +\index{acceptance} +\begin{lem}\label{ct:catweq} + If $F:A\to B$ is fully faithful and $A$ is a category, then for any $b:B$ the type $\sm{a:A} (Fa\cong b)$ is a mere proposition. + Hence a functor between categories is an equivalence if and only if it is a weak equivalence. +\end{lem} +\begin{proof} + Suppose given $(a,f)$ and $(a',f')$ in $\sm{a:A} (Fa\cong b)$. + Then $\inv{f'}\circ f$ is an isomorphism $Fa \cong Fa'$. + Since $F$ is fully faithful, we have $g:a\cong a'$ with $Fg = \inv{f'}\circ f$. + And since $A$ is a category, we have $p:a=a'$ with $\idtoiso(p)=g$. + Now $Fg = \inv{f'}\circ f$ implies $\trans{(\map{(F_0)}{p})}{f} = f'$, hence (by the characterization of equalities in dependent pair types) $(a,f)=(a',f')$. + + Thus, for fully faithful functors whose domain is a category, essential surjectivity is equivalent to split essential surjectivity, and so being a weak equivalence is equivalent to being an equivalence. +\end{proof} + +This is an important advantage of our category theory over set-based approaches. +With a purely set-based definition of category, the statement ``every fully faithful and essentially surjective functor is an equivalence of categories'' is equivalent to the axiom of choice \choice{}. +Here we have it for free, as a category-theoretic version of the principle of unique choice (\cref{sec:unique-choice}). +(In fact, this property characterizes categories among precategories; see \cref{sec:rezk}.) + +On the other hand, the following characterization of equivalences of categories is perhaps even more useful. + +\begin{defn}\label{ct:isocat} + A functor $F:A\to B$ is an \define{isomorphism of (pre)cat\-ego\-ries} + \indexdef{isomorphism!of (pre)categories}% + \indexdef{category!isomorphism of}% + \indexdef{precategory!isomorphism of}% + if $F$ is fully faithful and $F_0:A_0\to B_0$ is an equivalence of types. +\end{defn} + +This definition is an exception to our general rule (see \cref{sec:basics-equivalences}) of only using the word ``isomorphism'' for sets and set-like objects. +However, it does carry an appropriate connotation here, because for general precategories, isomorphism is stronger than equivalence. + +Note that being an isomorphism of precategories is always a mere property. +Let $A\cong B$ denote the type of isomorphisms of (pre)categories from $A$ to $B$. + +\begin{lem}\label{ct:isoprecat} + For precategories $A$ and $B$ and $F:A\to B$, the following are equivalent. + \begin{enumerate} + \item $F$ is an isomorphism of precategories.\label{item:ct:ipc1} + \item There exist $G:B\to A$ and $\eta:1_A = GF$ and $\epsilon:FG=1_B$ such that\label{item:ct:ipc2} + \begin{equation} + \apfunc{(\lam{H} F H)}({\eta}) = \apfunc{(\lam{K} K F)}({\opp\epsilon}).\label{eq:ct:isoprecattri} + \end{equation} + \item There merely exist $G:B\to A$ and $\eta:1_A = GF$ and $\epsilon:FG=1_B$.\label{item:ct:ipc3} + \end{enumerate} +\end{lem} + +Note that if $B_0$ is not a 1-type, then~\eqref{eq:ct:isoprecattri} may not be a mere proposition. + +\begin{proof} + First note that since hom-sets are sets, equalities between equalities of functors are uniquely determined by their object-parts. + Thus, by function extensionality,~\eqref{eq:ct:isoprecattri} is equivalent to + \begin{equation} + \map{(F_0)}{\eta_0}_a = \opp{(\epsilon_0)}_{F_0 a}.\label{eq:ct:ipctri} + \end{equation} + for all $a:A_0$. + Note that this is precisely the triangle identity for $G_0$, $\eta_0$, and $\epsilon_0$ to be a proof that $F_0$ is a half adjoint equivalence of types. + + Now suppose~\ref{item:ct:ipc1}. + Let $G_0:B_0 \to A_0$ be the inverse of $F_0$, with $\eta_0: \idfunc[A_0] = G_0 F_0$ and $\epsilon_0:F_0G_0 = \idfunc[B_0]$ satisfying the triangle identity, which is precisely~\eqref{eq:ct:ipctri}. + Now define $G_{b,b'}:\hom_B(b,b') \to \hom_A(G_0b,G_0b')$ by + \[ G_{b,b'}(g) \defeq + \inv{(F_{G_0b,G_0b'})}\Big(\idtoiso(\opp{(\epsilon_0)}_{b'}) \circ g \circ \idtoiso((\epsilon_0)_b)\Big) + \] + (using the assumption that $F$ is fully faithful). + Since \idtoiso takes inverses to inverses and concatenation to composition, and $F$ is a functor, it follows that $G$ is a functor. + + By definition, we have $(GF)_0 \jdeq G_0 F_0$, which is equal to $\idfunc[A_0]$ by $\eta_0$. + To obtain $1_A = GF$, we need to show that when transported along $\eta_0$, the identity function of $\hom_A(a,a')$ becomes equal to the composite $G_{Fa,Fa'} \circ F_{a,a'}$. + In other words, for any $f:\hom_A(a,a')$ we must have + \begin{multline*} + \idtoiso((\eta_0)_{a'}) \circ f \circ \idtoiso(\opp{(\eta_0)}_a)\\ + = \inv{(F_{GFa,GFa'})}\Big(\idtoiso(\opp{(\epsilon_0)}_{Fa'}) + \circ F_{a,a'}(f) \circ \idtoiso((\epsilon_0)_{Fa})\Big). + \end{multline*} + But this is equivalent to + \begin{multline*} + (F_{GFa,GFa'})\Big(\idtoiso((\eta_0)_{a'}) \circ f \circ \idtoiso(\opp{(\eta_0)}_a)\Big)\\ + = \idtoiso(\opp{(\epsilon_0)}_{Fa'}) + \circ F_{a,a'}(f) \circ \idtoiso((\epsilon_0)_{Fa}). + \end{multline*} + which follows from functoriality of $F$, the fact that $F$ preserves \idtoiso, and~\eqref{eq:ct:ipctri}. + Thus we have $\eta:1_A = GF$. + + On the other side, we have $(FG)_0\jdeq F_0 G_0$, which is equal to $\idfunc[B_0]$ by $\epsilon_0$. + To obtain $FG=1_B$, we need to show that when transported along $\epsilon_0$, the identity function of $\hom_B(b,b')$ becomes equal to the composite $F_{Gb,Gb'} \circ G_{b,b'}$. + That is, for any $g:\hom_B(b,b')$ we must have + \begin{multline*} + F_{Gb,Gb'}\Big(\inv{(F_{Gb,Gb'})}\Big(\idtoiso(\opp{(\epsilon_0)}_{b'}) \circ g \circ \idtoiso((\epsilon_0)_b)\Big)\Big)\\ + = \idtoiso((\opp{\epsilon_0})_{b'}) \circ g \circ \idtoiso((\epsilon_0)_b). + \end{multline*} + But this is just the fact that $\inv{(F_{Gb,Gb'})}$ is the inverse of $F_{Gb,Gb'}$. + And we have remarked that~\eqref{eq:ct:isoprecattri} is equivalent to~\eqref{eq:ct:ipctri}, so~\ref{item:ct:ipc2} holds. + + Conversely, suppose given~\ref{item:ct:ipc2}; then the object-parts of $G$, $\eta$, and $\epsilon$ together with~\eqref{eq:ct:ipctri} show that $F_0$ is an equivalence of types. + And for $a,a':A_0$, we define $\overline{G}_{a,a'}: \hom_B(Fa,Fa') \to \hom_A(a,a')$ by + \begin{equation} + \overline{G}_{a,a'}(g) \defeq \idtoiso(\opp{\eta})_{a'} \circ G(g) \circ \idtoiso(\eta)_a.\label{eq:ct:gbar} + \end{equation} + By naturality of $\idtoiso(\eta)$, for any $f:\hom_A(a,a')$ we have + \begin{align*} + \overline{G}_{a,a'}(F_{a,a'}(f)) + &= \idtoiso(\opp{\eta})_{a'} \circ G(F(f)) \circ \idtoiso(\eta)_a\\ + &= \idtoiso(\opp{\eta})_{a'} \circ \idtoiso(\eta)_{a'} \circ f \\ + &= f. + \end{align*} + On the other hand, for $g:\hom_B(Fa,Fa')$ we have + \begin{align*} + F_{a,a'}(\overline{G}_{a,a'}(g)) + &= F(\idtoiso(\opp{\eta})_{a'}) \circ F(G(g)) \circ F(\idtoiso(\eta)_a)\\ + &= \idtoiso(\epsilon)_{Fa'} + \circ F(G(g)) + \circ \idtoiso(\opp{\epsilon})_{Fa}\\ + &= \idtoiso(\epsilon)_{Fa'} + \circ \idtoiso(\opp{\epsilon})_{Fa'} + \circ g\\ + &= g. + \end{align*} + (There are lemmas needed here regarding the compatibility of \idtoiso and whiskering, which we leave it to the reader to state and prove.) + Thus, $F_{a,a'}$ is an equivalence, so $F$ is fully faithful; i.e.~\ref{item:ct:ipc1} holds. + + Now the composite~\ref{item:ct:ipc1}$\to$\ref{item:ct:ipc2}$\to$\ref{item:ct:ipc1} is equal to the identity since~\ref{item:ct:ipc1} is a mere proposition. + On the other side, tracing through the above constructions we see that the composite~\ref{item:ct:ipc2}$\to$\ref{item:ct:ipc1}$\to$\ref{item:ct:ipc2} essentially preserves the object-parts $G_0$, $\eta_0$, $\epsilon_0$, and the object-part of~\eqref{eq:ct:isoprecattri}. + And in the latter three cases, the object-part is all there is, since hom-sets are sets. + + Thus, it suffices to show that we recover the action of $G$ on hom-sets. + In other words, we must show that if $g:\hom_B(b,b')$, then + \[ G_{b,b'}(g) = + \overline{G}_{G_0b,G_0b'}\Big(\idtoiso(\opp{(\epsilon_0)}_{b'}) \circ g \circ \idtoiso((\epsilon_0)_b)\Big) + \] + where $\overline{G}$ is defined by~\eqref{eq:ct:gbar}. + However, this follows from functoriality of $G$ and the \emph{other} triangle identity, which we have seen in \cref{cha:equivalences} is equivalent to~\eqref{eq:ct:ipctri}. + + Now since~\ref{item:ct:ipc1} is a mere proposition, so is~\ref{item:ct:ipc2}, so it suffices to show they are logically equivalent to~\ref{item:ct:ipc3}. + Of course,~\ref{item:ct:ipc2}$\to$\ref{item:ct:ipc3}, so let us assume~\ref{item:ct:ipc3}. + Since~\ref{item:ct:ipc1} is a mere proposition, we may assume given $G$, $\eta$, and $\epsilon$. + Then $G_0$ along with $\eta$ and $\epsilon$ imply that $F_0$ is an equivalence. + Moreover, we also have natural isomorphisms $\idtoiso(\eta):1_A\cong GF$ and $\idtoiso(\epsilon):FG\cong 1_B$, so by \cref{ct:adjointification}, $F$ is an equivalence of precategories, and in particular fully faithful. +\end{proof} + +From \cref{ct:isoprecat}\ref{item:ct:ipc2} and $\idtoiso$ in functor categories, we conclude immediately that any isomorphism of precategories is an equivalence. +For precategories, the converse can fail. + +\begin{eg}\label{ct:chaotic} + Let $X$ be a type and $x_0:X$ an element, and let $X_{\mathrm{ch}}$ denote the \emph{chaotic}\indexdef{chaotic precategory} or \emph{indiscrete}\indexdef{indiscrete precategory} precategory on $X$. + By definition, we have $(X_{\mathrm{ch}})_0\defeq X$, and $\hom_{X_{\mathrm{ch}}}(x,x') \defeq \unit$ for all $x,x'$. + Then the unique functor $X_{\mathrm{ch}}\to \unit$ is an equivalence of precategories, but not an isomorphism unless $X$ is contractible. + + This example also shows that a precategory can be equivalent to a category without itself being a category. + Of course, if a precategory is \emph{isomorphic} to a category, then it must itself be a category. +\end{eg} + +However, for categories, the two notions coincide. + +\begin{lem}\label{ct:eqv-levelwise} + For categories $A$ and $B$, a functor $F:A\to B$ is an equivalence of categories if and only if it is an isomorphism of categories. +\end{lem} +\begin{proof} + Since both are mere properties, it suffices to show they are logically equivalent. + So first suppose $F$ is an equivalence of categories, with $(G,\eta,\epsilon)$ given. + We have already seen that $F$ is fully faithful. + By \cref{ct:functor-cat}, the natural isomorphisms $\eta$ and $\epsilon$ yield identities $\id{1_A}{GF}$ and $\id{FG}{1_B}$, hence in particular identities $\id{\idfunc[A]}{G_0\circ F_0}$ and $\id{F_0\circ G_0}{\idfunc[B]}$. +Thus, $F_0$ is an equivalence of types. + + Conversely, suppose $F$ is fully faithful and $F_0$ is an equivalence of types, with inverse $G_0$, say. + Then for each $b:B$ we have $G_0 b:A$ and an identity $\id{FGb}{b}$, hence an isomorphism $FGb\cong b$. + Thus, by \cref{ct:ffeso}, $F$ is an equivalence of categories. +\end{proof} + +Of course, there is yet a third notion of sameness for (pre)categories: equality. +However, the univalence axiom implies that it coincides with isomorphism. + +\begin{lem}\label{ct:cat-eq-iso} + If $A$ and $B$ are precategories, then the function + \[(\id A B) \to (A\cong B)\] + (defined by induction from the identity functor) is an equivalence of types. +\end{lem} +\begin{proof} + As usual for dependent sum types, to give an element of $\id A B$ is equivalent to giving + \begin{itemize} + \item an identity $P_0:\id{A_0}{B_0}$, + \item for each $a,b:A_0$, an identity + \[P_{a,b}:\id{\hom_A(a,b)}{\hom_B(\trans {P_0} a,\trans {P_0} b)},\] + \item identities $\id{\trans {(P_{a,a})} {1_a}}{1_{\trans {P_0} a}}$ and + \narrowequation{\id{\trans {(P_{a,c})} {gf}}{\trans {(P_{b,c})} g \circ \trans {(P_{a,b})} f}.} + \end{itemize} + (Again, we use the fact that the identity types of hom-sets are mere propositions.) + However, by univalence, this is equivalent to giving + \begin{itemize} + \item an equivalence of types $F_0:\eqv{A_0}{B_0}$, + \item for each $a,b:A_0$, an equivalence of types + \[F_{a,b}:\eqv{\hom_A(a,b)}{\hom_B(F_0 (a),F_0 (b))},\] + \item and identities $\id{F_{a,a}(1_a)}{1_{F_0 (a)}}$ and $\id{F_{a,c}(gf)}{F_{b,c} (g)\circ F_{a,b} (f)}$. + \end{itemize} + But this consists exactly of a functor $F:A\to B$ that is an isomorphism of categories. + And by induction on identity, this equivalence $\eqv{(\id A B)}{(A\cong B)}$ is equal to the one obtained by induction. +\end{proof} + +Thus, for categories, equality also coincides with equivalence. +We can interpret this as saying that categories, functors, and natural transformations form, not just a pre-2-category, but a 2-category (see \cref{ct:pre2cat}). + +\begin{thm}\label{ct:cat-2cat} + If $A$ and $B$ are categories, then the function + \[(\id A B) \to (\cteqv A B)\] + (defined by induction from the identity functor) is an equivalence of types. +\end{thm} +\begin{proof} + By \cref{ct:cat-eq-iso,ct:eqv-levelwise}. +\end{proof} + +As a consequence, the type of categories is a 2-type. +For since $\cteqv A B$ is a subtype of the type of functors from $A$ to $B$, which are the objects of a category, it is a 1-type; hence the identity types $\id A B$ are also 1-types. + + +\section{The Yoneda lemma} +\label{sec:yoneda} +\index{Yoneda!lemma|(} + +Recall that we have a category \uset whose objects are sets and whose morphisms are functions. +We now show that every precategory has a \uset-valued hom-functor. +First we need to define opposites and products of (pre)categories. + +\begin{defn}\label{ct:opposite-category} + For a precategory $A$, its \define{opposite} + \indexdef{opposite of a (pre)category}% + \indexdef{precategory!opposite}% + \indexdef{category!opposite}% + $A\op$ is a precategory with the same type of objects, with $\hom_{A\op}(a,b) \defeq \hom_A(b,a)$, and with identities and composition inherited from $A$. +\end{defn} + +\begin{defn}\label{ct:prod-cat} + For precategories $A$ and $B$, their \define{product} + \index{precategory!product of}% + \index{category!product of}% + \index{product!of (pre)categories}% + $A\times B$ is a precategory with $(A\times B)_0 \defeq A_0 \times B_0$ and + \[\hom_{A\times B}((a,b),(a',b')) \defeq \hom_A(a,a') \times \hom_B(b,b').\] + Identities are defined by $1_{(a,b)}\defeq (1_a,1_b)$ and composition by + \narrowequation{(g,g')(f,f') \defeq ((gf),(g'f')).} +\end{defn} + +\begin{lem}\label{ct:functorexpadj} + For precategories $A,B,C$, the following types are equivalent. + \begin{enumerate} + \item Functors $A\times B\to C$. + \item Functors $A\to C^B$. + \end{enumerate} +\end{lem} +\begin{proof} + Given $F:A\times B\to C$, for any $a:A$ we obviously have a functor $F_a : B\to C$. + This gives a function $A_0 \to (C^B)_0$. + Next, for any $f:\hom_A(a,a')$, we have for any $b:B$ the morphism $F_{(a,b),(a',b)}(f,1_b):F_a(b) \to F_{a'}(b)$. + These are the components of a natural transformation $F_a \to F_{a'}$. + Functoriality in $a$ is easy to check, so we have a functor $\hat{F}:A\to C^B$. + + Conversely, suppose given $G:A\to C^B$. + Then for any $a:A$ and $b:B$ we have the object $G(a)(b):C$, giving a function $A_0 \times B_0 \to C_0$. + And for $f:\hom_A(a,a')$ and $g:\hom_B(b,b')$, we have the morphism + \begin{equation*} + G(a')_{b,b'}(g)\circ G_{a,a'}(f)_b = G_{a,a'}(f)_{b'} \circ G(a)_{b,b'}(g) + \end{equation*} + in $\hom_C(G(a)(b), G(a')(b'))$. + Functoriality is again easy to check, so we have a functor $\check{G}:A\times B \to C$. + + Finally, it is also clear that these operations are inverses. +\end{proof} + +Now for any precategory $A$, we have a hom-functor +\indexdef{hom-functor}% +\[\hom_A : A\op \times A \to \uset.\] +It takes a pair $(a,b): (A\op)_0 \times A_0 \jdeq A_0 \times A_0$ to the set $\hom_A(a,b)$. +For a morphism $(f,f') : \hom_{A\op\times A}((a,b),(a',b'))$, by definition we have $f:\hom_A(a',a)$ and $f':\hom_A(b,b')$, so we can define +\begin{align*} + (\hom_A)_{(a,b),(a',b')}(f,f') + &\defeq (g \mapsto (f'gf))\\ + &: \hom_A(a,b) \to \hom_A(a',b'). +\end{align*} +Functoriality is easy to check. + +By \cref{ct:functorexpadj}, therefore, we have an induced functor $\y:A\to \uset^{A\op}$, which we call the \define{Yoneda embedding}. +\indexdef{Yoneda!embedding}% +\indexdef{embedding!Yoneda}% + +\begin{thm}[The Yoneda lemma]\label{ct:yoneda} + \indexdef{Yoneda!lemma} + For any precategory $A$, any $a:A$, and any functor $F:\uset^{A\op}$, we have an isomorphism + \begin{equation}\label{eq:yoneda} + \hom_{\uset^{A\op}}(\y a, F) \cong Fa. + \end{equation} + Moreover, this is natural in both $a$ and $F$. +\end{thm} +\begin{proof} + Given a natural transformation $\alpha:\y a \to F$, we can consider the component $\alpha_a : \y a(a) \to F a$. + Since $\y a(a)\jdeq \hom_A(a,a)$, we have $1_a : \y a(a)$, so that $\alpha_a(1_a) : F a$. + This gives a function $(\alpha \mapsto \alpha_a(1_a))$ from left to right in~\eqref{eq:yoneda}. + + In the other direction, given $x:F a$, we define $\alpha:\y a \to F$ by + \[\alpha_{a'}(f) \defeq F_{a,a'}(f)(x). \] + Naturality is easy to check, so this gives a function from right to left in~\eqref{eq:yoneda}. + + To show that these are inverses, first suppose given $x:F a$. + Then with $\alpha$ defined as above, we have $\alpha_a(1_a) = F_{a,a}(1_a)(x) = 1_{F a}(x) = x$. + On the other hand, if we suppose given $\alpha:\y a \to F$ and define $x$ as above, then for any $f:\hom_A(a',a)$ we have + \begin{align*} + \alpha_{a'}(f) + &= \alpha_{a'} (\y a_{a,a'}(f)(1_a))\\ + &= (\alpha_{a'}\circ \y a_{a,a'}(f))(1_a)\\ + &= (F_{a,a'}(f)\circ \alpha_a)(1_a)\\ + &= F_{a,a'}(f)(\alpha_a(1_a))\\ + &= F_{a,a'}(f)(x). + \end{align*} + Thus, both composites are equal to identities. + We leave the proof of naturality to the reader. +\end{proof} + +\begin{cor}\label{ct:yoneda-embedding} + The Yoneda embedding $\y :A\to \uset^{A\op}$ is fully faithful. +\end{cor} +\begin{proof} + By \cref{ct:yoneda}, we have + \[ \hom_{\uset^{A\op}}(\y a, \y b) \cong \y b(a) \jdeq \hom_A(a,b). \] + It is easy to check that this isomorphism is in fact the action of \y on hom-sets. +\end{proof} + +\begin{cor}\label{ct:yoneda-mono} + If $A$ is a category, then $\y_0 : A_0 \to (\uset^{A\op})_0$ is an embedding. + In particular, if $\y a = \y b$, then $a=b$. +\end{cor} +\begin{proof} + By \cref{ct:yoneda-embedding}, \y induces an isomorphism on sets of isomorphisms. + But as $A$ and $\uset^{A\op}$ are categories and \y is a functor, this is equivalently an isomorphism on identity types, which is the definition of being an embedding. +\end{proof} + +\begin{defn}\label{ct:representable} + A functor $F:\uset^{A\op}$ is said to be \define{representable} + \indexdef{functor!representable}% + \indexdef{representable functor}% + if there exists $a:A$ and an isomorphism $\y a \cong F$. +\end{defn} + +\begin{thm}\label{ct:representable-prop} + If $A$ is a category, then the type ``$F$ is representable'' is a mere proposition. +\end{thm} +\begin{proof} + By definition ``$F$ is representable'' is just the fiber of $\y_0$ over $F$. + Since $\y_0$ is an embedding by \cref{ct:yoneda-mono}, this fiber is a mere proposition. +\end{proof} + +In particular, in a category, any two representations of the same functor are equal. +We can use this to give a different proof of \cref{ct:adjprop}. +First we give a characterization of adjunctions in terms of representability. + +\begin{lem}\label{ct:adj-repr} + For any precategories $A$ and $B$ and a functor $F:A\to B$, the following types are equivalent. + \begin{enumerate} + \item $F$ is a left adjoint\index{adjoint!functor}.\label{item:ct:ar1} + \item For each $b:B$, the functor $(a \mapsto \hom_B(Fa,b))$ from $A\op$ to \uset is representable\index{representable functor}.\label{item:ct:ar2} + \end{enumerate} +\end{lem} +\begin{proof} + An element of the type~\ref{item:ct:ar2} consists of a function $G_0:B_0 \to A_0$ together with, for every $a:A$ and $b:B$ an isomorphism + \[ \gamma_{a,b}:\hom_B(Fa,b) \cong \hom_A(a,G_0 b) \] + such that $\gamma_{a,b}(g \circ Ff) = \gamma_{a',b}(g)\circ f$ for $f:\hom_{A}(a,a')$. + + Given this, for $a:A$ we define $\eta_a \defeq \gamma_{a,Fa}(1_{Fa})$, and for $b:B$ we define $\epsilon_b \defeq \inv{(\gamma_{Gb,b})}(1_{Gb})$. + Now for $g:\hom_B(b,b')$ we define + \[ G_{b,b'}(g) \defeq \gamma_{G b, b'}(g \circ \epsilon_b) \] + The verifications that $G$ is a functor and $\eta$ and $\epsilon$ are natural transformations satisfying the triangle identities are exactly as in the classical case, and as they are all mere propositions we will not care about their values. + Thus, we have a function~\ref{item:ct:ar2}$\to$\ref{item:ct:ar1}. + + In the other direction, if $F$ is a left adjoint, we of course have $G_0$ specified, and we can take $\gamma_{a,b}$ to be the composite + \[ \hom_B(Fa,b) + \xrightarrow{G_{Fa,b}} \hom_A(GFa,Gb) + \xrightarrow{(\blank\circ \eta_a)} \hom_A(a,Gb). + \] + This is clearly natural since $\eta$ is, and it has an inverse given by + \[ \hom_A(a,Gb) + \xrightarrow{F_{a,Gb}} \hom_B(Fa,FGb) + \xrightarrow{(\epsilon_b \circ \blank )} \hom_A(Fa,b) + \] + (by the triangle identities). + Thus we also have~\ref{item:ct:ar1}$\to$~\ref{item:ct:ar2}. + + For the composite~\ref{item:ct:ar2}$\to$\ref{item:ct:ar1}$\to$~\ref{item:ct:ar2}, clearly the function $G_0$ is preserved, so it suffices to check that we get back $\gamma$. + But the new $\gamma$ is defined to take $f:\hom_B(Fa,b)$ to + \begin{align*} + G(f) \circ \eta_a + &\jdeq \gamma_{G Fa, b}(f \circ \epsilon_{Fa}) \circ \eta_a\\ + &= \gamma_{G Fa, b}(f \circ \epsilon_{Fa} \circ F\eta_a)\\ + &= \gamma_{G Fa, b}(f) + \end{align*} + so it agrees with the old one. + + Finally, for~\ref{item:ct:ar1}$\to$\ref{item:ct:ar2}$\to$~\ref{item:ct:ar1}, we certainly get back the functor $G$ on objects. + The new $G_{b,b'}:\hom_B(b,b') \to \hom_A(Gb,Gb')$ is defined to take $g$ to + \begin{align*} + \gamma_{G b, b'}(g \circ \epsilon_b) + &\jdeq G(g \circ \epsilon_b) \circ \eta_{Gb}\\ + &= G(g) \circ G\epsilon_b \circ \eta_{Gb}\\ + &= G(g) + \end{align*} + so it agrees with the old one. + The new $\eta_a$ is defined to be $\gamma_{a,Fa}(1_{Fa}) \jdeq G(1_{Fa}) \circ \eta_a$, so it equals the old $\eta_a$. + And finally, the new $\epsilon_b$ is defined to be $\inv{(\gamma_{Gb,b})}(1_{Gb}) \jdeq \epsilon_b \circ F(1_{Gb})$, which also equals the old $\epsilon_b$. +\end{proof} + +\begin{cor}\label{ct:adjprop2}[\cref{ct:adjprop}] + If $A$ is a category and $F:A\to B$, then the type ``$F$ is a left adjoint'' is a mere proposition. +\end{cor} +\begin{proof} + By \cref{ct:representable-prop}, if $A$ is a category then the type in \cref{ct:adj-repr}\ref{item:ct:ar2} is a mere proposition. +\end{proof} +\index{Yoneda!lemma|)} + + +\section{Strict categories} +\label{sec:strict-categories} + +\index{bargaining|(}% + +\begin{defn}\label{ct:strict-category} + A \define{strict category} + \indexdef{category!strict}% + \indexdef{strict!category}% + is a precategory whose type of objects is a set. +\end{defn} + +In accordance with the mathematical red herring principle,\index{red herring principle} a strict category is not necessarily a category. +In fact, a category is a strict category precisely when it is gaunt (\cref{ct:gaunt}). +\index{gaunt category}% +\index{category!gaunt}% +Most of the time, category theory is about categories, not strict ones, but sometimes one wants to consider strict categories. +The main advantage of this is that strict categories have a stricter notion of ``sameness'' than equivalence, namely isomorphism (or equivalently, by \cref{ct:cat-eq-iso}, equality). + +Here is one origin of strict categories. + +\begin{eg}\label{ct:mono-cat} + Let $A$ be a precategory and $x:A$ an object. + Then there is a precategory $\mathsf{mono}(A,x)$ as follows: + \index{monomorphism} + \indexsee{mono}{monomorphism} + \indexsee{monic}{monomorphism} + \begin{itemize} + \item Its objects consist of an object $y:A$ and a monomorphism $m:\hom_A(y,x)$. + (As usual, $m:\hom_A(y,x)$ is a \define{monomorphism} (or is \define{monic}) if $(m\circ f = m\circ g) \Rightarrow (f=g)$.) + \item Its morphisms from $(y,m)$ to $(z,n)$ are arbitrary morphisms from $y$ to $z$ in $A$ (not necessarily respecting $m$ and $n$). + \end{itemize} + An equality $(y,m)=(z,n)$ of objects in $\mathsf{mono}(A,x)$ consists of an equality $p:y=z$ and an equality $\trans{p}{m}=n$, which by \cref{ct:idtoiso-trans} is equivalently an equality $m=n\circ \idtoiso(p)$. + Since hom-sets are sets, the type of such equalities is a mere proposition. + But since $m$ and $n$ are monomorphisms, the type of morphisms $f$ such that $m = n\circ f$ is also a mere proposition. + Thus, if $A$ is a category, then $(y,m)=(z,n)$ is a mere proposition, and hence $\mathsf{mono}(A,x)$ is a strict category. +\end{eg} + +This example can be dualized, and generalized in various ways. +Here is an interesting application of strict categories. + +\begin{eg}\label{ct:galois} + Let $E/F$ be a finite Galois extension + \index{Galois!extension}% + of fields, and $G$ its Galois group. + \index{Galois!group}% + Then there is a strict category whose objects are intermediate fields $F\subseteq K\subseteq E$, and whose morphisms are field homomorphisms\index{homomorphism!field} which fix $F$ pointwise (but need not commute with the inclusions into $E$). + There is another strict category whose objects are subgroups $H\subseteq G$, and whose morphisms are morphisms of $G$-sets $G/H \to G/K$. + The fundamental theorem of Galois theory + \index{fundamental!theorem of Galois theory}% + says that these two precategories are isomorphic (not merely equivalent). +\end{eg} + +\index{bargaining|)}% + +\section{\texorpdfstring{$\dagger$}{†}-categories} +\label{sec:dagger-categories} + +It is also worth mentioning a useful kind of precategory whose type of objects is not a set, but which is not a category either. + +\begin{defn}\label{ct:dagger-precategory} + A \define{$\dagger$-precategory} + \indexdef{.dagger-precategory@$\dagger$-precategory}% + \indexdef{precategory!.dagger-@$\dagger$-}% + is a precategory $A$ together with the following. + \begin{enumerate} + \item For each $x,y:A$, a function $\dgr{(-)}:\hom_A(x,y) \to \hom_A(y,x)$. + \item For all $x:A$, we have $\dgr{(1_x)} = 1_x$. + \item For all $f,g$ we have $\dgr{(g\circ f)} = \dgr f \circ \dgr g$. + \item For all $f$ we have $\dgr{(\dgr f)} = f$. + \end{enumerate} +\end{defn} + +\begin{defn}\label{ct:unitary} + A morphism $f:\hom_A(x,y)$ in a $\dagger$-precategory is \define{unitary} + \indexdef{.dagger-precategory@$\dagger$-precategory!unitary morphism in}% + \indexdef{unitary morphism}% + \indexdef{morphism!unitary}% + \indexdef{isomorphism!unitary}% + if $\dgr f \circ f = 1_x$ and $f\circ \dgr f = 1_y$. +\end{defn} + +Of course, every unitary morphism is an isomorphism, and being unitary is a mere proposition. +Thus for each $x,y:A$ we have a set of unitary isomorphisms from $x$ to $y$, which we denote $(x\unitaryiso y)$. + +\begin{lem}\label{ct:idtounitary} + If $p:(x=y)$, then $\idtoiso(p)$ is unitary. +\end{lem} +\begin{proof} + By induction, we may assume $p$ is $\refl x$. + But then $\dgr{(1_x)} \circ 1_x = 1_x\circ 1_x = 1_x$ and similarly. +\end{proof} + +\begin{defn}\label{ct:dagger-category} + A \define{$\dagger$-category} + \indexdef{.dagger-category@$\dagger$-category}% + is a $\dagger$-precategory such that for all $x,y:A$, the function + \[ (x=y) \to (x \unitaryiso y) \] + from \cref{ct:idtounitary} is an equivalence. +\end{defn} + +\begin{eg}\label{ct:rel-dagger-cat} + The category \urel from \cref{ct:rel} becomes a $\dagger$-pre\-cat\-e\-go\-ry if we define $(\dgr R)(y,x) \defeq R(x,y)$. + The proof that \urel is a category actually shows that every isomorphism is unitary; hence \urel is also a $\dagger$-category. +\end{eg} + +\begin{eg}\label{ct:groupoid-dagger-cat} + Any groupoid becomes a $\dagger$-category if we define $\dgr f \defeq \inv{f}$. +\end{eg} + +\begin{eg}\label{ct:hilb} + Let \uhilb be the following precategory. + \begin{itemize} + \item Its objects are finite-dimensional \index{finite!-dimensional vector space} vector spaces\index{vector!space} equipped with an inner product $\langle \blank,\blank\rangle$. + \item Its morphisms are arbitrary linear maps. + \index{function!linear}% + \indexsee{linear map}{function, linear}% + \end{itemize} + By standard linear algebra, any linear map $f:V\to W$ between finite + dimensional inner product spaces has a uniquely defined adjoint\index{adjoint!linear map} $\dgr f:W\to V$, characterized by $\langle f v,w\rangle = \langle v,\dgr f w\rangle$. + In this way, \uhilb becomes a $\dagger$-precategory. + Moreover, a linear isomorphism is unitary precisely when it is an \define{isometry}, + \indexdef{isometry}% + i.e.\ $\langle fv,fw\rangle = \langle v,w\rangle$. + It follows from this that \uhilb is a $\dagger$-category, though it is not a category (not every linear isomorphism is unitary). +\end{eg} + +There has been a good deal of general theory developed for $\dagger$-cat\-e\-gor\-ies under classical\index{mathematics!classical}\index{classical!category theory} foundations. +It was observed early on that the unitary isomorphisms, not arbitrary isomorphisms, are the correct notion of ``sameness'' for objects of a $\dagger$-category, which has caused some consternation among category theorists. +Homotopy type theory resolves this issue by identifying $\dagger$-categories, like strict categories, as simply a different kind of precategory. + + +\section{The structure identity principle} +\label{sec:sip} + \index{structure!identity principle|(} + +The \emph{structure identity principle} is an informal principle +that expresses that isomorphic structures are identical. We aim to +prove a general abstract result which can be applied to a wide family +of notions of structure, where structures may be many-sorted or even +dependently-sorted, infinitary, or even higher order. + +The simplest kind of single-sorted structure consists of a type with +no additional structure. The univalence axiom expresses the structure identity principle for that +notion of structure in a strong form: for types $A,B$, the +canonical function $(A=B)\to (\eqv A B)$ is an equivalence. + +We start with a precategory $X$. In our application to +single-sorted first order structures, $X$ will be the category %\uset% +of $\bbU$-small sets, where $\bbU$ is a univalent type universe. + +\begin{defn}\label{ct:sig} + A \define{notion of structure} + \indexdef{structure!notion of}% + $(P,H)$ over $X$ consists of the following. + \begin{enumerate} + \item A type family $P:X_0 \to \type$. + For each $x:X_0$ the elements of $Px$ are called \define{$(P,H)$-structures} + \indexsee{PH-structure@$(P,H)$-structure}{structure}% + \indexdef{structure!PH@$(P,H)$-}% + on $x$. + \item For $x,y:X_0$, $f:\hom_X(x,y)$ and $\alpha:Px$, $\;\beta:Py$, a mere proposition + \[ H_{\alpha\beta}(f).\] + If $H_{\alpha\beta}(f)$ is true, we say that $f$ is a \define{$(P,H)$-homomorphism} + \indexdef{homomorphism!of structures}% + \indexdef{structure!homomorphism of}% + from $\alpha$ to $\beta$. + \item For $x:X_0$ and $\alpha:Px$, we have $H_{\alpha\alpha}(1_x)$.\label{item:sigid} + \item For $x,y,z:X_0$ and $\alpha:Px$, $\;\beta:Py$, $\;\gamma:Pz$, +if $f:\hom_X(x,y)$ and $g:\hom_X(y,z)$, we have\label{item:sigcmp} + \[ H_{\alpha\beta}(f)\to H_{\beta\gamma}(g)\to H_{\alpha\gamma}(g\circ f).\] + \end{enumerate} + When $(P,H)$ is a notion of structure, for $\alpha,\beta:Px$ we define + \[ (\alpha\leq_x\beta) \defeq H_{\alpha\beta}(1_x).\] + By~\ref{item:sigid} and~\ref{item:sigcmp}, this is a preorder (\cref{ct:orders}) with $Px$ its type of objects. + We say that $(P,H)$ is a \define{standard notion of structure} + \indexdef{structure!standard notion of}% + if this preorder is in fact a partial order, for all $x:X$. +\end{defn} + +Note that for a standard notion of structure, each type $Px$ must actually be a set. +We now define, for any notion of structure $(P,H)$, a \define{precategory of $(P,H)$-structures}, +\indexdef{precategory!of PH-structures@of $(P,H)$-structures}% +\indexdef{structure!precategory of PH@precategory of $(P,H)$-}% +$A = \mathsf{Str}_{(P,H)}(X)$. +\begin{itemize} +\item The type of objects of $A$ is the type $A_0 \defeq \sm{x:X_0} Px$. + If $a\jdeq (x,\alpha):A_0$, we may write $|a| \defeq x$. +\item For $(x,\alpha):A_0$ and $(y,\beta):A_0$, we define + \[\hom_A((x,\alpha),(y,\beta)) \defeq \setof{ f:x \to y | H_{\alpha\beta}(f)}.\] +\end{itemize} +The composition and identities are inherited from $X$; conditions~\ref{item:sigid} and \ref{item:sigcmp} ensure that these lift to $A$. + +\begin{thm}[Structure identity principle]\label{thm:sip} + \indexdef{structure!identity principle}% + If $X$ is a category and $(P,H)$ is a standard notion of structure over $X$, then the precategory $\mathsf{Str}_{(P,H)}(X)$ is a category. +\end{thm} +\begin{proof} + By the definition of equality in dependent pair types, to give an equality $(x,\alpha)=(y,\beta)$ consists of + \begin{itemize} + \item An equality $p:x=y$, and + \item An equality $\trans{p}{\alpha}=\beta$. + \end{itemize} + Since $P$ is set-valued, the latter is a mere proposition. + On the other hand, it is easy to see that an isomorphism $(x,\alpha)\cong (y,\beta)$ in $\mathsf{Str}_{(P,H)}(X)$ consists of + \begin{itemize} + \item An isomorphism $f:x\cong y$ in $X$, such that + \item $H_{\alpha\beta}(f)$ and $H_{\beta\alpha}(\inv f)$. + \end{itemize} + Of course, the second of these is also a mere proposition. + And since $X$ is a category, the function $(x=y) \to (x\cong y)$ is an equivalence. + Thus, it will suffice to show that for any $p:x=y$ and for any $(\alpha:Px)$, $(\beta:Py)$, we have $\trans{p}{\alpha}=\beta$ if and only if both $H_{\alpha\beta}(\idtoiso (p))$ and $H_{\beta\alpha}(\inv{\idtoiso(p)})$. + + The ``only if'' direction is just the existence of the function $\idtoiso$ for the category $\mathsf{Str}_{(P,H)}(X)$. + For the ``if'' direction, by induction on $p$ we may assume that $y\jdeq x$ and $p\jdeq\refl x$. + However, in this case $\idtoiso (p)\jdeq 1_x$ and therefore $\inv{\idtoiso(p)}=1_x$. + Thus, $\alpha\leq_x \beta$ and $\beta\leq_x \alpha$, which implies $\alpha=\beta$ since $(P,H)$ is a standard notion of structure. +\end{proof} + +As an example, this methodology gives an alternative way to express the proof of \cref{ct:functor-cat}. + +\begin{eg}\label{ct:sip-functor-cat} + Let $A$ be a precategory and $B$ a category. + There is a precategory $B^{A_0}$ whose objects are functions $A_0 \to B_0$, and whose set of morphisms from $F_0:A_0 \to B_0$ to $G_0:A_0 \to B_0$ is $\prd{a:A_0} \hom_B(F_0 a, G_0 a)$. + Composition and identities are inherited directly from those in $B$. + It is easy to show that $\gamma:\hom_{B^{A_0}}(F_0, G_0)$ is an isomorphism exactly when each component $\gamma_a$ is an isomorphism, so that we have $\eqv{(F_0 \cong G_0)}{\prd{a:A_0} (F_0 a \cong G_0 a)}$. + Moreover, the map $\idtoiso : (F_0 = G_0) \to (F_0 \cong G_0)$ of $B^{A_0}$ is equal to the composite + \[ (F_0 = G_0) \longrightarrow \prd{a:A_0} (F_0 a = G_0 a) \longrightarrow \prd{a:A_0} (F_0 a \cong G_0 a) \longrightarrow (F_0 \cong G_0) \] + in which the first map is an equivalence by function extensionality, the second because it is a dependent product of equivalences (since $B$ is a category), and the third as remarked above. + Thus, $B^{A_0}$ is a category. + + Now we define a notion of structure on $B^{A_0}$ for which $P(F_0)$ is the type of operations $F:\prd{a,a':A_0} \hom_A(a,a') \to \hom_B(F_0 a,F_0 a')$ which extend $F_0$ to a functor (i.e.\ preserve composition and identities). + This is a set since each $\hom_B(\blank,\blank)$ is so. + Given such $F$ and $G$, we define $\gamma:\hom_{B^{A_0}}(F_0, G_0)$ to be a homomorphism if it forms a natural transformation.\index{natural!transformation} + In \cref{ct:functor-precat} we essentially verified that this is a notion of structure. + Moreover, if $F$ and $F'$ are both structures on $F_0$ and the identity is a natural transformation from $F$ to $F'$, then for any $f:\hom_A(a,a')$ we have $F'f = F'f \circ 1_{F_0 a} = 1_{F_0 a}\circ F f = F f$. + Applying function extensionality, we conclude $F = F'$. + Thus, we have a \emph{standard} notion of structure, and so by \cref{thm:sip}, the precategory $B^A$ is a category. +\end{eg} + +As another example, we consider categories of structures for a first-order signature. +We define a \define{first-order signature}, +\indexdef{first-order!signature}% +\indexdef{signature!first-order}% +$\Omega$, to consist of sets $\Omega_0$ and $\Omega_1$ of function symbols, $\omega:\Omega_0$, and relation symbols, $\omega:\Omega_1$, each having an arity\index{arity} $|\omega|$ that is a set. +An \define{$\Omega$-structure} +\indexdef{structure!Omega@$\Omega$-}% +\indexsee{omega-structure@$\Omega$-structure}{structure}% +$a$ consists of a set $|a|$ together with an assignment of an $|\omega|$-ary function $\omega^a:|a|^{|\omega|}\to |a|$ on $|a|$ to each function symbol, $\omega$, and an assignment of an $|\omega|$-ary relation $\omega^a$ on $|a|$, assigning a mere proposition $\omega^ax$ to each $x:|a|^{|\omega|}$, to each relation symbol. +And given $\Omega$-structures $a,b$, a function $f:|a|\to |b|$ is a \define{homomorphism $a\to b$} +\indexdef{homomorphism!of Omega-structures@of $\Omega$-structures}% +\indexdef{structure!homomorphism of Omega@homomorphism of $\Omega$-}% +if it preserves the structure; i.e.\ if for each symbol $\omega$ of the signature and each $x:|a|^{|\omega|}$, +\begin{enumerate} +\item $f(\omega^ax) = \omega^b(f\circ x)$ if $\omega:\Omega_0$, and +\item $\omega^ax\to\omega^b(f\circ x)$ if $\omega:\Omega_1$. +\end{enumerate} +Note that each $x:|a|^{|\omega|}$ is a function $x:|\omega|\to |a|$ so that $f\circ x : b^\omega$. + +Now we assume given a (univalent) universe $\bbU$ and a $\bbU$-small signature $\Omega$; i.e. $|\Omega|$ is a $\bbU$-small set and, for each $\omega:|\Omega|$, the set $|\omega|$ is $\bbU$-small. +Then we have the category $\uset_\bbU$ of $\bbU$-small sets. We want to define the precategory of $\bbU$-small $\Omega$-structures over $\uset_\bbU$ and use \cref{thm:sip} to show that it is a category. + +We use the first order signature $\Omega$ to give us a standard notion of structure $(P,H)$ over $\uset_\bbU$. + +\begin{defn}\label{defn:fo-notion-of-structure} +\mbox{} +\begin{enumerate} +\item For each $\bbU$-small set $x$ define + \[ Px \defeq P_0x\times P_1x.\] + Here + % + \begin{align*} + P_0x &\defeq \prd{\omega:\Omega_0} x^{|\omega|}\to x, \mbox{ and } \\ + P_1x &\defeq \prd{\omega:\Omega_1} x^{|\omega|}\to \propU, + \end{align*} +\item For $\bbU$-small sets $x,y$ and + $\alpha:P^\omega x,\;\beta:P^\omega y,\; f:x\to y$, define + \[ H_{\alpha\beta}(f) \defeq H_{0,\alpha\beta}(f)\wedge H_{1,\alpha\beta}(f).\] + Here + \begin{align*} + H_{0,\alpha\beta}(f) &\defeq + \fall{\omega:\Omega_0}{u:x^{|\omega|}} f(\alpha u)=\;\beta(f\circ u), + \mbox{ and }\\ + H_{1,\alpha\beta}(f) &\defeq + \fall{\omega:\Omega_1}{u:x^{|\omega|}} \alpha u\to\beta(f\circ u). + \end{align*} +\end{enumerate} +\end{defn} + +It is now routine to check that $(P,H)$ is a standard notion of structure over $\uset_\bbU$ and hence we may use \cref{thm:sip} to get that the precategory $Str_{(P,H)}(\uset_\bbU)$ is a category. It only remains to observe that this is essentially the same as the precategory of $\bbU$-small $\Omega$-structures over $\uset_\bbU$. + \index{structure!identity principle|)} + + +\section{The Rezk completion} +\label{sec:rezk} + +In this section we will give a universal way to replace a precategory by a category. +In fact, we will give two. +Both rely on the fact that ``categories see weak equivalences as equivalences''. + +To prove this, we begin with a couple of lemmas which are completely standard category theory, phrased carefully so as to make sure we are using the eliminator for $\truncf{-1}$ correctly. +One would have to be similarly careful in classical\index{mathematics!classical}\index{classical!category theory} category theory if one wanted to avoid the axiom of choice: any time we want to define a function, we need to characterize its values uniquely somehow. + +\begin{lem}\label{ct:esosurj-postcomp-faithful} + If $A,B,C$ are precategories and $H:A\to B$ is an essentially surjective functor, then $(\blank\circ H):C^B \to C^A$ is faithful. +\end{lem} +\begin{proof} + Let $F,G:B\to C$, and $\gamma,\delta:F\to G$ be such that $\gamma H = \delta H$; we must show $\gamma=\delta$. + Thus let $b:B$; we want to show $\gamma_b=\delta_b$. + This is a mere proposition, so since $H$ is essentially surjective, we may assume given an $a:A$ and an isomorphism $f:Ha\cong b$. + But now we have + \[ \gamma_b = G(f) \circ \gamma_{Ha} \circ F(\inv{f}) + = G(f) \circ \delta_{Ha} \circ F(\inv{f}) + = \delta_b.\qedhere + \] +\end{proof} + +\begin{lem}\label{ct:esofull-precomp-ff} + If $A,B,C$ are precategories and $H:A\to B$ is essentially surjective and full, then $(\blank\circ H):C^B \to C^A$ is fully faithful. +\end{lem} +\begin{proof} + It remains to show fullness. + Thus, let $F,G:B\to C$ and $\gamma:FH \to GH$. + We claim that for any $b:B$, the type + \begin{equation}\label{eq:fullprop} + \sm{g:\hom_C(Fb,Gb)} \prd{a:A}{f:Ha\cong b} (\gamma_a = \inv{Gf}\circ g\circ Ff) + \end{equation} + is contractible. + Since contractibility is a mere property, and $H$ is essentially surjective, we may assume given $a_0:A$ and $h:Ha_0\cong b$. + + Now take $g\defeq Gh \circ \gamma_{a_0} \circ \inv{Fh}$. + Then given any other $a:A$ and $f:Ha\cong b$, we must show $\gamma_a = \inv{Gf}\circ g\circ Ff$. + Since $H$ is full, there merely exists a morphism $k:\hom_A(a,a_0)$ such that $Hk = \inv{h}\circ f$. + And since our goal is a mere proposition, we may assume given some such $k$. + Then we have + \begin{align*} + \gamma_a &= \inv{GHk}\circ \gamma_{a_0} \circ FHk\\ + &= \inv{Gf} \circ Gh \circ \gamma_{a_0} \circ \inv{Fh} \circ Ff\\ + &= \inv{Gf}\circ g\circ Ff. + \end{align*} + Thus,~\eqref{eq:fullprop} is inhabited. + It remains to show it is a mere proposition. + Let $g,g':\hom_C(Fb, Gb)$ be such that for all $a:A$ and $f:Ha\cong b$, we have both $(\gamma_a = \inv{Gf}\circ g\circ Ff)$ and $(\gamma_a = \inv{Gf}\circ g'\circ Ff)$. + The dependent product types are mere propositions, so all we have to prove is $g=g'$. + But this is a mere proposition, so we may assume $a_0:A$ and $h:Ha_0\cong b$, in which case we have + \[ g = Gh \circ \gamma_{a_0} \circ \inv{Fh} = g'.\] + % + This proves that~\eqref{eq:fullprop} is contractible for all $b:B$. + Now we define $\delta:F\to G$ by taking $\delta_b$ to be the unique $g$ in~\eqref{eq:fullprop} for that $b$. + To see that this is natural, suppose given $f:\hom_B(b,b')$; we must show $Gf \circ \delta_b = \delta_{b'}\circ Ff$. + As before, we may assume $a:A$ and $h:Ha\cong b$, and likewise $a':A$ and $h':Ha'\cong b'$. + Since $H$ is full as well as essentially surjective, we may also assume $k:\hom_A(a,a')$ with $Hk = \inv{h'}\circ f\circ h$. + + Since $\gamma$ is natural, $GHk\circ \gamma_a = \gamma_{a'} \circ FHk$. + Using the definition of $\delta$, we have + \begin{align*} + Gf \circ \delta_b + &= Gf \circ Gh \circ \gamma_a \circ \inv{Fh}\\ + &= Gh' \circ GHk\circ \gamma_a \circ \inv{Fh}\\ + &= Gh' \circ \gamma_{a'} \circ FHk \circ \inv{Fh}\\ + &= Gh' \circ \gamma_{a'} \circ \inv{Fh'} \circ Ff\\ + &= \delta_{b'} \circ Ff. + \end{align*} + Thus, $\delta$ is natural. + Finally, for any $a:A$, applying the definition of $\delta_{Ha}$ to $a$ and $1_a$, we obtain $\gamma_a = \delta_{Ha}$. + Hence, $\delta \circ H = \gamma$. +\end{proof} + +The rest of the theorem follows almost exactly the same lines, with the category-ness of $C$ inserted in one crucial step, which we have italicized below for emphasis. +This is the point at which we are trying to define a function into \emph{objects} without using choice, and so we must be careful about what it means for an object to be ``uniquely specified''. +In classical\index{mathematics!classical}\index{classical!category theory} category theory, all one can say is that this object is specified up to unique isomorphism, but in set-theoretic foundations this is not a sufficient amount of uniqueness to give us a function without invoking \choice{}. +In univalent foundations, however, if $C$ is a category, then isomorphism is equality, and we have the appropriate sort of uniqueness (namely, living in a contractible space). + +\index{weak equivalence!of precategories|(}% + +\begin{thm}\label{ct:cat-weq-eq} + If $A,B$ are precategories, $C$ is a category, and $H:A\to B$ is a weak equivalence, then $(\blank\circ H):C^B \to C^A$ is an isomorphism. +\end{thm} +\begin{proof} + By \cref{ct:functor-cat}, $C^B$ and $C^A$ are categories. + Thus, by \cref{ct:eqv-levelwise} it will suffice to show that $(\blank\circ H)$ is an equivalence. + But since we know from the preceding two lemmas that it is fully faithful, by \cref{ct:catweq} it will suffice to show that it is essentially surjective. + Thus, suppose $F:A\to C$; we want there to merely exist a $G:B\to C$ such that $GH\cong F$. + + For each $b:B$, let $X_b$ be the type whose elements consist of: + \begin{enumerate} + \item An element $c:C$; and + \item For each $a:A$ and $h:Ha\cong b$, an isomorphism $k_{a,h}:Fa\cong c$; such that\label{item:eqvprop2} + \item For each $(a,h)$ and $(a',h')$ as in~\ref{item:eqvprop2} and each $f:\hom_A(a,a')$ such that $h'\circ Hf = h$, we have $k_{a',h'}\circ Ff = k_{a,h}$.\label{item:eqvprop3} + \end{enumerate} + We claim that for any $b:B$, the type $X_b$ is contractible. + As this is a mere proposition, we may assume given $a_0:A$ and $h_0:Ha_0 \cong b$. + Let $c^0\defeq Fa_0$. + Next, given $a:A$ and $h:Ha\cong b$, since $H$ is fully faithful there is a unique isomorphism $g_{a,h}:a\to a_0$ with $Hg_{a,h} = \inv{h_0}\circ h$; define $k^0_{a,h} \defeq Fg_{a,h}$. + Finally, if $h'\circ Hf = h$, then $\inv{h_0}\circ h'\circ Hf = \inv{h_0}\circ h$, hence $g_{a',h'} \circ f = g_{a,h}$ and thus $k^0_{a',h'}\circ Ff = k^0_{a,h}$. + Therefore, $X_b$ is inhabited. + + Now suppose given another $(c^1,k^1): X_b$. + Then $k^1_{a_0,h_0}:c^0 \jdeq Fa_0 \cong c^1$. + \emph{Since $C$ is a category, we have $p:c^0=c^1$ with $\idtoiso(p) = k^1_{a_0,h_0}$.} + And for any $a:A$ and $h:Ha\cong b$, by~\ref{item:eqvprop3} for $(c^1,k^1)$ with $f\defeq g_{a,h}$, we have + \[k^1_{a,h} = k^1_{a_0,h_0} \circ k^0_{a,h} = \trans{p}{k^0_{a,h}}\] + This gives the requisite data for an equality $(c^0,k^0)=(c^1,k^1)$, completing the proof that $X_b$ is contractible. + + Now since $X_b$ is contractible for each $b$, the type $\prd{b:B} X_b$ is also contractible. + In particular, it is inhabited, so we have a function assigning to each $b:B$ a $c$ and a $k$. + Define $G_0(b)$ to be this $c$; this gives a function $G_0 :B_0 \to C_0$. + + Next we need to define the action of $G$ on morphisms. + For each $b,b':B$ and $f:\hom_B(b,b')$, let $Y_f$ be the type whose elements consist of: + \begin{enumerate}[resume] + \item A morphism $g:\hom_C(Gb,Gb')$, such that + \item For each $a:A$ and $h:Ha\cong b$, and each $a':A$ and $h':Ha'\cong b'$, and any $\ell:\hom_A(a,a')$, we have\label{item:eqvprop5} + \[ (h' \circ H\ell = f \circ h) + \to + (k_{a',h'} \circ F\ell = g\circ k_{a,h}). \] + \end{enumerate} + We claim that for any $b,b'$ and $f$, the type $Y_f$ is contractible. + As this is a mere proposition, we may assume given $a_0:A$ and $h_0:Ha_0\cong b$, and each $a'_0:A$ and $h'_0:Ha'_0\cong b'$. + Then since $H$ is fully faithful, there is a unique $\ell_0:\hom_A(a_0,a_0')$ such that $h'_0 \circ H\ell_0 = f \circ h_0$. + Define $g_0 \defeq k_{a_0',h_0'} \circ F \ell_0 \circ \inv{(k_{a_0,h_0})}$. + + Now for any $a,h,a',h'$, and $\ell$ such that $(h' \circ H\ell = f \circ h)$, we have $\inv{h}\circ h_0:Ha_0\cong Ha$, hence there is a unique $m:a_0\cong a$ with $Hm = \inv{h}\circ h_0$ and hence $h\circ Hm = h_0$. + Similarly, we have a unique $m':a_0'\cong a'$ with $h'\circ Hm' = h_0'$. + Now by~\ref{item:eqvprop3}, we have $k_{a,h}\circ Fm = k_{a_0,h_0}$ and $k_{a',h'}\circ Fm' = k_{a_0',h_0'}$. + We also have + \begin{align*} + Hm' \circ H\ell_0 + &= \inv{(h')} \circ h_0' \circ H\ell_0\\ + &= \inv{(h')} \circ f \circ h_0\\ + &= \inv{(h')} \circ f \circ h \circ \inv{h} \circ h_0\\ + &= H\ell \circ Hm + \end{align*} + and hence $m'\circ \ell_0 = \ell\circ m$ since $H$ is fully faithful. + Finally, we can compute + \begin{align*} + g_0 \circ k_{a,h} + &= k_{a_0',h_0'} \circ F \ell_0 \circ \inv{(k_{a_0,h_0})} \circ k_{a,h}\\ + &= k_{a_0',h_0'} \circ F \ell_0 \circ \inv{Fm}\\ + &= k_{a_0',h_0'} \circ \inv{(Fm')} \circ F\ell\\ + &= k_{a',h'}\circ F\ell. + \end{align*} + This completes the proof that $Y_f$ is inhabited. + To show it is contractible, since hom-sets are sets, it suffices to take another $g_1:\hom_C(Gb,Gb')$ satisfying~\ref{item:eqvprop5} and show $g_0=g_1$. + However, we still have our specified $a_0,h_0,a_0',h_0',\ell_0$ around, and~\ref{item:eqvprop5} implies both $g_0$ and $g_1$ must be equal to $k_{a_0',h_0'} \circ F \ell_0 \circ \inv{(k_{a_0,h_0})}$. + + This completes the proof that $Y_f$ is contractible for each $b,b':B$ and $f:\hom_B(b,b')$. + Therefore, there is a function assigning to each such $f$ its unique inhabitant; denote this function $G_{b,b'}:\hom_B(b,b') \to \hom_C(Gb,Gb')$. + The proof that $G$ is a functor is straightforward; in each case we can choose $a,h$ and apply~\ref{item:eqvprop5}. + + Finally, for any $a_0:A$, defining $c\defeq Fa_0$ and $k_{a,h}\defeq F g$, where $g:\hom_A(a,a_0)$ is the unique isomorphism with $Hg = h$, gives an element of $X_{Ha_0}$. + Thus, it is equal to the specified one; hence $GHa=Fa$. + Similarly, for $f:\hom_A(a_0,a_0')$ we can define an element of $Y_{Hf}$ by transporting along these equalities, which must therefore be equal to the specified one. + Hence, we have $GH=F$, and thus $GH\cong F$ as desired. +\end{proof} + +\index{universal!property!of Rezk completion}% +Therefore, if a precategory $A$ admits a weak equivalence functor $A\to \widehat{A}$ into a category, then that is its ``reflection'' into categories: any functor from $A$ into a category will factor essentially uniquely through $\widehat{A}$. +We now give two constructions of such a weak equivalence. + +\indexsee{Rezk completion}{completion, Rezk}% +\index{completion!Rezk|(defstyle}% + +\begin{thm}\label{thm:rezk-completion} + For any precategory $A$, there is a category $\widehat A$ and a weak equivalence $A\to\widehat{A}$. +\end{thm} + +\begin{proof}[First proof] + Let $\widehat{A}_0 \defeq \setof{ F:\uset^{A\op} | \exis{a:A} (\y a \cong F)}$, with hom-sets inherited from $\uset^{A\op}$. + Then the inclusion $\widehat{A} \to \uset^{A\op}$ is fully faithful and an embedding on objects. + Since $\uset^{A\op}$ is a category (by \cref{ct:functor-cat}, since \uset is so by univalence), $\widehat A$ is also a category. + + Let $A\to\widehat A$ be the Yoneda embedding. + This is fully faithful by \cref{ct:yoneda-embedding}, and essentially surjective by definition of $\widehat{A}_0$. + Thus it is a weak equivalence. +\end{proof} + +This proof is very slick, but it has the drawback that it increases universe level. +If $A$ is a category in a universe \bbU, then in this proof \uset must be at least as large as $\uset_\bbU$. +Then $\uset_\bbU$ and $(\uset_\bbU)^{A\op}$ are not themselves categories in \bbU, but only in a higher universe, and \emph{a priori} the same is true of $\widehat A$. +One could imagine a resizing axiom that could deal with this, but it is also possible to give a direct construction using higher inductive types. + +\begin{proof}[Second proof] + We define a higher inductive type $\widehat A_0$ with the following constructors: + \begin{itemize} + \item A function $i:A_0 \to \widehat A_0$. + \item For each $a,b:A$ and $e:a\cong b$, an equality $je:\id{ia}{ib}$. + \item For each $a:A$, an equality $\id{j(1_a)}{\refl{ia}}$. + \item For each $(a,b,c:A)$, $(f:a\cong b)$, and $(g:b\cong c)$, an equality $\id{j(g \circ f)}{j(f)\ct j(g)}$. + \item 1-truncation: for all $x,y:\widehat A_0$ and $p,q:\id x y$ and $r,s:\id p q$, an equality $\id r s$. + \end{itemize} + Note that for any $a,b:A$ and $p:\id a b$, we have $\id{j(\idtoiso(p))}{\map i p}$. + This follows by path induction on $p$ and the third constructor. + + The type $\widehat A_0$ will be the type of objects of $\widehat A$; we now build all the rest of the structure. + (The following proof is of the sort that can benefit a lot from the help of a computer proof assistant:\index{proof!assistant} it is wide and shallow with many short cases to consider, and a large part of the work consists of writing down what needs to be checked.) + + \mentalpause + + \emph{Step 1:} We define a family $\hom_{\widehat A}:\widehat A_0\to \widehat A_0 \to \set$ by double induction on $\widehat A_0$. + Since \set is a 1-type, we can ignore the 1-truncation constructor. + When $x$ and $y$ are of the form $ia$ and $ib$, we take $\hom_{\widehat A}(ia,ib) \defeq \hom_A(a,b)$. + It remains to consider all the other possible pairs of constructors. + + Let us keep $x=ia$ fixed at first. + If $y$ varies along the identity $je:\id{ib}{ib'}$, for some $e:b\cong b'$, we require an identity $\id{\hom_A(a,b)}{\hom_A(a,b')}$. + By univalence, it suffices to give an equivalence $\eqv{\hom_A(a,b)}{\hom_A(a,b')}$. + We take this to be the function $(e\circ \blank ):\hom_A(a,b)\to \hom_A(a,b')$. + To see that this is an equivalence, we give its inverse as $(\inv e\circ \blank )$, with witnesses to inversion coming from the fact that $\inv e$ is the inverse of $e$ in $A$. + + As $y$ varies along the identity $\id{j(1_b)}{\refl{ib}}$, we require an identity $\id{(1_b\circ \blank )}{\refl{\hom_A(a,b)}}$; this follows from the identity axiom $\id{1_b\circ g}{g}$ of a precategory. + Similarly, as $y$ varies along the identity $\id{j(g\circ f)}{j(f)\ct j(g)}$, we require an identity $\id{((g\circ f)\circ \blank )}{(g\circ (f\circ \blank ))}$, which follows from associativity. + % Finally, as $y$ varies along the 1-truncation constructor, we need only to observe that \set is 1-truncated. + + Now we consider the other constructors for $x$. + Say that $x$ varies along the identity $j(e):\id{ia}{ia'}$, for some $e:a \cong a'$; we again must deal with all the constructors for $y$. + If $y$ is $ib$, then we require an identity $\id{\hom_A(a,b)}{\hom_A(a',b)}$. + By univalence, this may come from an equivalence, and for this we can use $(\blank\circ \inv e)$, with inverse $(\blank\circ e)$. + + Still with $x$ varying along $j(e)$, suppose now that $y$ also varies along $j(f)$ for some $f:b\cong b'$. + Then we need to know that the two concatenated identities + \begin{gather*} + \hom_A(a,b) = \hom_A(a',b) = \hom_A(a',b') \mathrlap{\qquad\text{and}}\\ + \hom_A(a,b) = \hom_A(a,b') = \hom_A(a',b') + \end{gather*} + are identical. + This follows from associativity: $(f\circ \blank)\circ \inv e = f\circ (\blank\circ \inv e)$. + The other two constructors for $y$ are trivial, since they are 2-fold equalities in sets. + + For the next two constructors of $x$, all but the first constructor for $y$ is likewise trivial. + When $x$ varies along $j(1_a)=\refl{ia}$ and $y$ is $ib$, we use the identity axiom again. + Similarly, when $x$ varies along $\id{j(g\circ f)}{j(f)\ct j(g)}$, we use associativity again. + This completes the construction of $\hom_{\widehat A}:\widehat A_0 \to \widehat A_0 \to \set$. + + \mentalpause + + \emph{Step 2:} We give the precategory structure on $\widehat A$, always by induction on $\widehat A_0$. + % The reader is probably getting bored at this point, so we skip the details. + We are now eliminating into sets (the hom-sets of $\widehat A$), so all but the first two constructors are trivial to deal with. + + For identities, if $x$ is $ia$ then we have $\hom_{\widehat A}(x,x) \jdeq \hom_A(a,a)$ and we define $1_x \defeq 1_{ia}$. + If $x$ varies along $je$ for $e:a\cong a'$, we must show that $\transfib{x\mapsto \hom_{\widehat A}(x,x)}{je}{1_{ia}} = 1_{ia'}$. + But by definition of $\hom_{\widehat A}$, transporting along $je$ is given by composing with $e$ and $\inv e$, and we have $e\circ 1_{ia} \circ \inv{e} = 1_{ia'}$. + + For composition, if $x,y,z$ are $ia,ib,ic$ respectively, then $\hom_{\widehat A}$ reduces to $\hom_A$ and we can define composition in $\widehat A$ to be composition in $A$. + And when $x$, $y$, or $z$ varies along $je$, then we verify the following equalities: + \begin{align*} + e \circ (g\circ f) &= (e\circ g) \circ f,\\ + g\circ f &= (g\circ \inv e) \circ (e\circ f),\\ + (g\circ f) \circ \inv e &= g \circ (f\circ \inv e). + \end{align*} + Finally, the associativity and unitality axioms are mere propositions, so all constructors except the first are trivial. + But in that case, we have the corresponding axioms in $A$. + + \mentalpause + + \emph{Step 3}: We show that $\widehat A$ is a category. + That is, we must show that for all $x,y:\widehat A$, the function $\idtoiso:(x=y) \to (x\cong y)$ is an equivalence. + First we define, for all $x,y:\widehat A$, a function $k_{x,y}:(x\cong y) \to (x=y)$ by induction. + As before, since our goal is a set, it suffices to deal with the first two constructors. + + When $x$ and $y$ are $ia$ and $ib$ respectively, we have $\hom_{\widehat A}(ia,ib)\jdeq \hom_A(a,b)$, with composition and identities inherited as well, so that $(ia\cong ib)$ is equivalent to $(a\cong b)$. + But now we have the constructor $j:(a\cong b) \to (ia=ib)$. + + Next, if $y$ varies along $j(e)$ for some $e:b\cong b'$, we must show that for $f:a\cong b$ we have $j(\trans{j(e)}{f}) = j(f) \ct j(e)$. + But by definition of $\hom_{\widehat A}$ on equalities, transporting along $j(e)$ is equivalent to post-composing with $e$, so this equality follows from the last constructor of $\widehat A_0$. + The remaining case when $x$ varies along $j(e)$ for $e:a\cong a'$ is similar. + This completes the definition of $k:\prd{x,y:\widehat A_0} (x\cong y) \to (x=y)$. + + Now one thing we must show is that if $p:x=y$, then $k(\idtoiso(p))=p$. + By induction on $p$, we may assume it is $\refl x$, and hence $\idtoiso(p)\jdeq 1_x$. + Now we argue by induction on $x:\widehat A_0$, and since our goal is a mere proposition (since $\widehat A_0$ is a 1-type), all constructors except the first are trivial. + But if $x$ is $ia$, then $k(1_{ia}) \jdeq j(1_a)$, which is equal to $\refl{ia}$ by the third constructor of $\widehat A_0$. + + To complete the proof that $\widehat A$ is a category, we must show that if $f:x\cong y$, then $\idtoiso(k(f))=f$. + By induction we may assume that $x$ and $y$ are $ia$ and $ib$ respectively, in which case $f$ must arise from an isomorphism $g:a\cong b$ and we have $k(f)\jdeq j(g)$. + However, for any $p$ we have $\idtoiso(p) = \trans{p}{1}$, so in particular $\idtoiso (j(g)) = \trans{j(g)}{1_{ia}}$. + And by definition of $\hom_{\widehat A}$ on equalities, this is given by composing $1_{ia}$ with the equivalence $g$, hence is equal to $g$. + + \index{encode-decode method}% + Note the similarity of this step to the encode-decode method\index{encode-decode method} used in \cref{sec:compute-coprod,sec:compute-nat,cha:homotopy}. + Once again we are characterizing the identity types of a higher inductive type (here, $\widehat A_0$) by defining recursively a family of codes (here, $(x,y)\mapsto (x\cong y)$) and encoding and decoding functions by induction on $\widehat A_0$ and on paths. + + \mentalpause + + \emph{Step 4}: We define a weak equivalence $I:A \to \widehat A$. + We take $I_0 \defeq i : A_0 \to \widehat A_0$, and by construction of $\hom_{\widehat A}$ we have functions $I_{a,b}:\hom_A(a,b) \to \hom_{\widehat A}(Ia,Ib)$ forming a functor $I:A \to \widehat A$. + This functor is fully faithful by construction, so it remains to show it is essentially surjective. + That is, for all $x:\widehat A$ we want there to merely exist an $a:A$ such that $Ia\cong x$. + As always, we argue by induction on $x$, and since the goal is a mere proposition, all but the first constructor are trivial. + But if $x$ is $ia$, then of course we have $a:A$ and $Ia\jdeq ia$, hence $Ia \cong ia$. + (Note that if we were trying to prove $I$ to be \emph{split} essentially surjective, we would be stuck, because we know nothing about equalities in $A_0$ and thus have no way to deal with any further constructors.) +\end{proof} + +We call the construction $A\mapsto \widehat A$ the \define{Rezk completion}, +although there is also an argument (coming from higher topos semantics) +\index{.infinity1-topos@$(\infty,1)$-topos}% +for calling it the \define{stack completion}. +\index{stack}% +\index{completion!Rezk|)}% + +We have seen that most precategories arising in practice are categories, since they are constructed from \uset, which is a category by the univalence axiom. +However, there are a few cases in which the Rezk completion is necessary to obtain a category. + +\begin{eg}\label{ct:rezk-fundgpd-trunc1} + Recall from \cref{ct:fundgpd} that for any type $X$ there is a pregroupoid with $X$ as its type of objects and $\hom(x,y) \defeq \pizero{x=y}$. + \indexdef{fundamental!groupoid}% + \index{fundamental!pregroupoid}% + \indexsee{groupoid!fundamental}{fundamental group\-oid}% + Its Rezk completion is the \emph{fundamental groupoid} of $X$. + Recalling that group\-oids are equivalent to 1-types, it is not hard to identify this groupoid with $\trunc1X$. +\end{eg} + +\begin{eg}\label{ct:hocat} + Recall from \cref{ct:hoprecat} that there is a precategory whose type of objects is \type and with $\hom(X,Y) \defeq \pizero{X\to Y}$. + Its Rezk completion may be called the \define{homotopy category of types}. + \index{category!of types}% + \index{homotopy!category of types@(pre)category of types}% + Its type of objects can be identified with $\trunc1\type$ (see \cref{ct:ex:hocat}). +\end{eg} + +The Rezk completion also allows us to show that the notion of ``category'' is determined by the notion of ``weak equivalence of precategories''. +Thus, insofar as the latter is inevitable, so is the former. + +\begin{thm}\label{ct:weq-iso-precat-cat} + A precategory $C$ is a category if and only if for every weak equivalence of precategories $H:A\to B$, the induced functor $(\blank\circ H):C^B \to C^A$ is an isomorphism of precategories. +\end{thm} +\begin{proof} + ``Only if'' is \cref{ct:cat-weq-eq}. + In the other direction, let $H$ be $I:A\to\widehat A$. + Then since $(\blank\circ I)_0$ is an equivalence, there exists $R:\widehat A\to A$ such that $RI=1_A$. + Hence $IRI=I$, but again since $(\blank\circ I)_0$ is an equivalence, this implies $IR =1_{\widehat A}$. + By \cref{ct:isoprecat}\ref{item:ct:ipc3}, $I$ is an isomorphism of precategories. + But then since $\widehat A$ is a category, so is $A$. +\end{proof} + +\index{weak equivalence!of precategories|)}% + + +\newpage + +\sectionNotes + +The original definition of categories, of course, was in set-theoretic foundations, so that the collection of objects of a category formed a set (or, for large categories, a class). +Over time, it became clear that all ``category-theoretic'' properties of objects were invariant under isomorphism, and that equality of objects in a category was not usually a very useful notion. +Numerous authors~\cite{blanc:eqv-log,freyd:invar-eqv,makkai:folds,makkai:comparing} discovered that a dependently typed logic enabled formulating the definition of category without invoking any notion of equality for objects, and that the statements provable in this logic are precisely the ``category-theoretic'' ones that are invariant under isomorphism. +\index{evil}% + +Although most of category theory appears to be invariant under isomorphism of objects and under equivalence of categories, there are some interesting exceptions, which have led to philosophical discussions about what it means to be ``category-theoretic''. +For instance, \cref{ct:galois} was brought up by Peter May on the categories mailing list in May 2010, as a case where it matters that two categories (defined as usual in set theory) are isomorphic rather than only equivalent. +The case of $\dagger$-categories was also somewhat confounding to those advocating an isomorphism-invariant version of category theory, since the ``correct'' notion of sameness between objects of a $\dagger$-category is not ordinary isomorphism but \emph{unitary} isomorphism. +\index{isomorphism!invariance under}% + +Categories satisfying the ``saturation'' or ``univalence'' principle as in \cref{ct:category} were first considered by Hofmann and Streicher~\cite{hs:gpd-typethy}. +The condition then occurred independently to Voevodsky, Shulman, and perhaps others around the same time several years later, and was formalized by Ahrens and Kapulkin~\cite{aks:rezk}. +This framework puts all the above examples in a unified context: some precategories are categories, others are strict categories, and so on. +A general theorem that ``isomorphism implies equality'' for a large class of algebraic structures (assuming the univalence axiom) was proven by Coquand and Danielsson; the formulation of the structure identity principle in \cref{sec:sip} is due to Aczel. + +Independently of philosophical considerations about category theory, Rezk~\cite{rezk01css} discovered that when defining a notion of $(\infty,1)$-cat\-e\-go\-ry, +\index{.infinity1-category@$(\infty,1)$-category}% +it was very convenient to use not merely a \emph{set} of objects with spaces of morphisms between them, but a \emph{space} of objects incorporating all the equivalences and homotopies between them. +This yields a very well-behaved sort of model for $(\infty,1)$-categories as particular simplicial spaces, which Rezk called \emph{complete Segal spaces}. +\index{complete!Segal space}% +\index{Segal!space}% +One especially good aspect of this model is the analogue of \cref{ct:eqv-levelwise}: a map of complete Segal spaces is an equivalence just when it is a levelwise equivalence of simplicial spaces. + +When interpreted in Voevodsky's simplicial\index{simplicial!sets} set model of univalent foundations, our precategories are similar to a truncated analogue of Rezk's ``Segal spaces'', while our categories correspond to his ``complete Segal spaces''. +\index{Segal!category}% +Strict categories correspond instead to (a weakened and truncated version of) what are called ``Segal categories''. +It is known that Segal categories and complete Segal spaces are equivalent models for $(\infty,1)$-categories (see e.g.~\cite{bergner:infty-one}), so that in the simplicial set model, categories and strict categories yield ``equivalent'' category theories --- although as we have seen, the former still have many advantages. +However, in the more general categorical semantics of a higher topos, +\index{.infinity1-topos@$(\infty,1)$-topos}% +a strict category corresponds to an internal category (in the traditional sense) in the corresponding 1-topos\index{topos} of sheaves, while a category corresponds to a \emph{stack}. +\index{stack}% +The latter are generally a more appropriate sort of ``category'' relative to a topos. + +In Rezk's context, what we have called the ``Rezk completion'' corresponds to fibrant replacement +\index{fibrant replacement} +in the model category for complete Segal spaces. +Since this is built using a transfinite induction argument, it most closely matches our second construction as a higher inductive type. +However, in higher topos models of homotopy type theory, the Rezk completion corresponds to \emph{stack completion},\index{completion!stack}\index{stack!completion} which can be constructed either with a transfinite induction~\cite{jt:strong-stacks} or using a Yoneda embedding \cite{bunge:stacks-morita-internal}. + + +\sectionExercises + +\begin{ex}\label{ex:slice-precategory} + For a precategory $A$ and $a:A$, define the \define{slice precategory} $A/a$. + \indexsee{precategory!slice}{category, slice}% + \indexsee{slice (pre)category}{category, slice}% + Show that if $A$ is a category, so is $A/a$. + \indexdef{category!slice}% +\end{ex} + +\begin{ex}\label{ex:set-slice-over-equiv-functor-category} + For any set $X$, prove that the slice category $\uset/X$ is equivalent to the functor category $\uset^X$, where in the latter case we regard $X$ as a discrete category. +\end{ex} + +\begin{ex}\label{ex:functor-equiv-right-adjoint} + \index{adjoint!functor}% + \index{adjoint!equivalence}% + Prove that a functor is an equivalence of categories if and only if it is a \emph{right} adjoint whose unit and counit are isomorphisms. +\end{ex} + +\begin{ex}\label{ct:pre2cat} + Define the notion of \define{pre-2-category}. + \indexdef{pre-2-category}% + Show that precategories, functors, and natural transformations as defined in \cref{sec:transfors} form a pre-2-category. + Similarly, define a \define{pre-bicategory} + \indexdef{pre-bicategory}% + by replacing the equalities (such as those in \cref{ct:functor-assoc,ct:units}) with natural isomorphisms satisfying analogous coherence conditions. + Define a function from pre-2-categories to pre-bicategories, and show that it becomes an equivalence when restricted and corestricted to those whose hom-pre\-cat\-egories are categories. +\end{ex} + +\begin{ex}\label{ct:2cat} + Define a \define{2-category} + \indexdef{2-category}% + to be a pre-2-category satisfying a condition analogous to that of \cref{ct:category}. + Verify that the pre-2-category of categories \ucat is a 2-category. + How much of this chapter can be done internally to an arbitrary 2-category? +\end{ex} + +\begin{ex}\label{ct:groupoids} + Define a 2-category whose objects are 1-types, whose morphisms are functions, and whose 2-morphisms are homotopies. + Prove that it is equivalent, in an appropriate sense, to the full sub-2-category of \ucat spanned by the \emph{groupoids} (categories in which every arrow is an isomorphism). +\end{ex} + +\begin{ex}\label{ex:2strict-cat} + \index{strict!category}% + Recall that a \emph{strict category} is a precategory whose type of objects is a set. + Prove that the pre-2-category of strict categories is equivalent to the following pre-2-category. + \begin{itemize} + \item Its objects are categories $A$ equipped with a surjection + % \footnote{Recall that a function $f:X\to Y$ is a \emph{surjection} if for every $y:Y$, there \emph{merely exists} an $x:X$ such that $f(x)=y$. This is to be distinguished from a \emph{split surjection}, which has the property that for every $y:Y$ there \emph{exists} an $x:X$ such that $f(x)=y$.} + $p_A:A_0'\to A_0$, where $A_0'$ is a set. + \item Its morphisms are functors $F:A\to B$ equipped with a function $F_0':A_0' \to B_0'$ such that $p_B \circ F_0' = F_0 \circ p_A$. + \item Its 2-morphisms are simply natural transformations. + \end{itemize} +\end{ex} + +\begin{ex}\label{ex:pre2dagger-cat} + Define the pre-2-category of $\dagger$-categories, which has $\dagger$-struc\-tures on its hom-pre\-cat\-egories. + Show that two $\dagger$-categories are equal precisely when they are ``unitarily equivalent'' in a suitable sense. +\end{ex} + +\begin{ex}\label{ct:ex:hocat} + Prove that a function $X\to Y$ is an equivalence if and only if its image in the homotopy category of \cref{ct:hocat} is an isomorphism. + Show that the type of objects of this category is $\trunc1\type$. +\end{ex} + +\begin{ex}\label{ex:dagger-rezk} + Construct the $\dagger$-Rezk completion of a $\dagger$-precategory into a $\dagger$-category, and give it an appropriate universal property. +\end{ex} + +\begin{ex}\label{ex:rezk-vankampen} + \index{van Kampen theorem}% + \index{theorem!van Kampen}% + \index{fundamental!groupoid}% + \index{fundamental!pregroupoid}% + Using fundamental (pre)groupoids from \cref{ct:fundgpd,ct:rezk-fundgpd-trunc1} and the Rezk completion from \cref{sec:rezk}, give a different proof of van Kampen's theorem (\cref{sec:van-kampen}). +\end{ex} + +\begin{ex}\label{ex:stack} + Let $X$ and $Y$ be sets and $p:Y\to X$ a surjection. + \begin{enumerate} + \item Define, for any precategory $A$, the category $\mathrm{Desc}(A,p)$ of \define{descent data} + \indexdef{descent data}% + in $A$ relative to $p$. + \item Show that any precategory $A$ is a \define{prestack} + \indexdef{prestack}% + for $p$, i.e.\ the canonical functor $A^X \to \mathrm{Desc}(A,p)$ is fully faithful. + \item Show that if $A$ is a category, then it is a \define{stack} + \indexdef{stack}% + for $p$, i.e.\ $A^X \to \mathrm{Desc}(A,p)$ is an equivalence. + \item Show that the statement ``every strict category is a stack for every surjection of sets'' is equivalent to the axiom of choice. + \index{axiom!of choice}% + \index{strict!category}% + \end{enumerate} +\end{ex} + +% Local Variables: +% TeX-master: "hott-online" +% End: diff --git a/check-errata b/check-errata new file mode 100644 index 0000000000000000000000000000000000000000..812bd1c46ad3ebccfe9c9c6e590cc4b4840ffbb9 --- /dev/null +++ b/check-errata @@ -0,0 +1,3 @@ +#!/bin/bash + +! grep -o '% merge of.\+' errata.tex diff --git a/coq_introduction/.gitignore b/coq_introduction/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ab90588e71d88cd412f5660ff427792ed30e08e7 --- /dev/null +++ b/coq_introduction/.gitignore @@ -0,0 +1,7 @@ +*.vo +*.glob +N*.cmi +N*.cmx +N*.cmxs +N*.native +N*.o \ No newline at end of file diff --git a/coq_introduction/Makefile b/coq_introduction/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..84954ba8b68dc5a3a75b713244bfe56c08834064 --- /dev/null +++ b/coq_introduction/Makefile @@ -0,0 +1,32 @@ +.PHONY: all pdf html tex glob tidy clean + +all: pdf html tex glob + +glob: Reading_HoTT_in_Coq.v + coqc Reading_HoTT_in_Coq.v + +tex: glob + coqdoc --latex --no-lib-name --toc Reading_HoTT_in_Coq.v + +html: glob + coqdoc --html --no-lib-name --toc --no-index Reading_HoTT_in_Coq.v + +pdf: tex + pdflatex Reading_HoTT_in_Coq.tex + +tidy: + -rm Reading_HoTT_in_Coq.vo + -rm Reading_HoTT_in_Coq.out + -rm Reading_HoTT_in_Coq.log + -rm Reading_HoTT_in_Coq.aux + -rm NReading_HoTT_in_Coq* + -rm coqdoc.sty + +clean: tidy + -rm Reading_HoTT_in_Coq.tex + -rm Reading_HoTT_in_Coq.html + -rm Reading_HoTT_in_Coq.glob + -rm Reading_HoTT_in_Coq.pdf + -rm coqdoc.css + -rm index.html + diff --git a/coq_introduction/Reading_HoTT_in_Coq.v b/coq_introduction/Reading_HoTT_in_Coq.v new file mode 100644 index 0000000000000000000000000000000000000000..c94208e666d06048ddbb37084a89ef21a6446505 --- /dev/null +++ b/coq_introduction/Reading_HoTT_in_Coq.v @@ -0,0 +1,1602 @@ +(** * Reading Coq Files +*) + +(** +---------------------- +If you're reading a #HTML# %PDF% file, it was generated from a Coq +file using Coq's documentation tool, "coqdoc". + +If the file extension is ".v", you have the original Coq file and can +read it in any text editor ("Notepad" on Windows, "TextEdit" on Macs). +If you've installed CoqIDE, Coq's graphical editor, you can open it +there and verify the proofs. It can also be used on the web at +http://prover.cs.ru.nl/ +*) +(* When reading the Coq file, you will see the coqdoc commands. +These include special text #only for HTML# or %only for LaTeX% +(or $LaTeX's math mode$). *) +(* The following stop coqdoc from changing the operators for HTML/PDF *) +(** remove printing -> *) +(** remove printing * *) +(** remove printing => *) +(** remove printing forall *) +(** +---------------------- +*) + +(** +This document is a light-weight introduction to Coq using examples +from the first half of the book "Homotopy Type Theory". Our goal is +to give readers a taste of using a proof assistant. When you're done, +you will be able to read what other people have proven in Coq and +possibly prove some simple theorems of your own. + +If you are interested in going further with Coq, at the end of this +document are instructions on how to install Coq, links to full +tutorials, and links to the Coq Reference Manual. + +This file is written in "plain" Coq 8.4. This so it can be used with +the official distribution or on the web at http://prover.cs.ru.nl/. +This will prevent us from doing proofs that use "higher inductive +types", a feature that is only available with a special version of +Coq. + +While this file stands on its own, where possible, we use the same +theorem names as the "HoTT" library for Coq. When you're done reading +this file, you should be able to read most of what has been proven in +that library. +*) + +(** ** Background *) +(** +Coq is a good platform for homotopy type theory ("HoTT") work. Coq +has a long history - created in 1984 - and is supported by INRIA. Coq +has a number of features that have allowed it to be used for +significant proofs. Those proofs include the formalization of the +Four Color Theorem and the Feit-Thompson Theorem. + +Coq uses a dependent type theory derived from "The Calculus of +Constructions". It differs from Martin-Loef's intentional +type theory, but, as we'll see, its propositional equality has the +same higher-groupoid structure that allows us to do HoTT. +*) + +(** * Introduction *) +(** +Coq mostly works with two concepts: + - dependent functions (#Pi#$\Pi$-types) + - inductive types + +Inductive types are used to implement the common types of type theory: +dependent pairs (#Sigma#$\Sigma$-types), disjoint unions, etc.. We'll +use those types as many of our examples. + +We'll start with the familiar example of Peano's natural numbers. +*) + +(** ** Natural Numbers *) +(** +The book's description of natural numbers says: +- the type N:U of natural numbers. +whose elements are constructed using +- 0:N, and +- the successor operation succ:N->N. + +The equivalent in Coq is: +*) + +Inductive nat : Set := + | O : nat + | S : nat -> nat. + +(** +As you can see, Coq's default library uses different names: +- [nat] instead of "N", +- [Set] instead of "U", +- [O] (the capital letter "oh") instead of "0", and +- [S] instead of "succ". + +The command [Inductive] creates a new type. In this case, the type is +called [nat]. The type [nat] will live in the universe type called +[Set], which in Coq is the first universe or "the universe of small +types". + +After the [:=] symbol comes the constructors for the new type. The +first says [O] (the capital letter "oh") is a term of type [nat]. The +second says [S] is a function from [nat]s to [nat]s. + +After the last constructor is a period ("."). The command that +started with the word "Inductive" ends at the period. Every command +in Coq ends with a period. +*) + +(** *** Properties of Constructors *) +(** +The constructors of an inductive type have a number of properties. In +a rough description, the major properties are: + +- Constructors are axiomatic. The function [S] exists without any + definition - while it can be called, it cannot be evaluated. + +- The constructors are exhaustive. There is no other way to create a + term of type [nat]. + +- Constructors create well-founded terms. There is no way to create a + self-referential [nat], such as having an [S] that returns itself. + +- Terms created with different constructors are not equal. [O] is not + equal to [S] called with any other [nat]. + +If you know Peano's Axioms, these should all seem familiar. But these +conditions apply to every inductive type, not just [nat]. + +NOTE: Homotopy type theory changes some of these properties. The +univalence axiom and the path constructors of higher inductive types +create new elements of the identity type. Higher inductive types can +define terms created with different constructors as propositionally +equal. +*) + +(** *** Examples of Natural Numbers *) +(** +Coq's command [Check] will print out the type of a term. Obviously, +[O] is a valid term and the [Check] will print the type [nat]. +(Remember, [O] here is the capital letter "oh".) +*) +(* CoqIDE users: In CoqIDE, the Check command does nothing. Instead, +highlight the term, open the "Queries" menu, and select [Check]. *) + +Check O. + +(** +To get the number one, we have to call the function [S]. A function +call (or "function application") in Coq is done by juxtaposition, so +- gcd 4 6 +instead of +- gcd(4, 6) + +Thus, the number one is written: +*) + +Check S O. + +(** +For the number two, we have to add parentheses so that the second S is +interpreted as a function call rather than as a second argument to the +first S. +*) + +Check S (S O). + +(** +The number five is +*) + +Check S (S (S (S (S O)))). + + +(** +By default, Coq loads a plugin that interprets decimal numbers as [nat]s. +*) + +Require Import Datatypes. +Declare ML Module "nat_syntax_plugin". + +(** +Thus, we could have checked the number five simply by doing +*) + +Check 5. + +(** +Now that we have seen the basics of Coq's inductive types, let's see +its other main feature: dependent functions. +*) + +(** ** Identity function *) +(** +We'll start by defining the identity function on natural numbers and +then we'll write a dependently-typed identity function that works for +any type. + +The identity function (or identity map) for natural numbers is: +*) + +Definition idmap_nat : nat -> nat := + fun (n:nat) => n. + +(** +The [Definition] command assigns a value of a given type to a name. +Its format is: +- Definition : := . + +In our example, the name is "idmap_nat". The type is a function from +[nat] to [nat]. (Notice how the "->" operator approximates the arrow +used in the book for non-dependently typed functions.) The value for +"idmap_nat" is a function. + +In Coq, a function is written: +- fun => + +In the book, this would have been written as +- #\mapsto# $\mapsto$ +or +- #\lambda# $\lambda$ . + +In the example, the function has one parameter, "n", which has type +[nat]. The function's result is simply "n" itself, since this is the +identity function. +*) + +(** *** Shorthand *) +(** +Coq has a shorthand for defining functions. Here is the identity +function for [nat]s again. +*) + +Definition idmap_nat_short (n:nat) : nat := + n. + +(** +Notice that the parameter is put immediately after the function's name +and we no longer need "fun ... =>". +*) + +(** *** Examples of idmap_nat *) +(** +The Coq command [Compute] will evaluate a function and print the result. +*) +(* !!! There is no equivalent in CoqIDE? *) + +Compute idmap_nat (S O). + +(** prints (S O), like an identity function should. *) + + +(** *** Dependant types *) +(** +"idmap_nat" is not dependently typed, so we were able to use the arrow +("->") to denote its type. We could have written the function's type +as if it was dependently typed. In the book, dependent types are +declared with a capital "#Pi#$\Pi$". Coq uses the keyword [forall]. +*) + +Definition idmap_nat_dep : forall nn:nat, nat := + fun n:nat => n. + +(** +In Coq, a dependent function type is written: +- forall , + +In the book, this would have used capital #Pi#$\Pi$ and a subscript: +- #\Pi#$\Pi$ () + +As you'd expect, the names in the param list of a [forall] expression +are only bound inside the "" part of the [forall]. In this +example, the parameter "nn" cannot be used when defining the function. +(Usually, we use the same name in the [forall] and the [fun] parts; +different ones were used here to demonstrate the point.) + +A [forall] can have multiple parameters. If a parameter is +dependently typed on another parameter, the dependent one must come +later in the list. (We'll see an example soon.) + + +Now that we know how to write a dependent function type, we can +write an identity function that works for any type. +*) + +Definition idmap : forall A:Type, A -> A := + fun (A:Type) (x:A) => x. + +(** +"idmap" is a dependently-typed function: its return type depends on the +type of its first parameter. Therefore, we had to use the [forall] +operator for that parameter. + +In Coq, the type "Type" refers to _some_ universe type. Coq will do +the work of figuring out which universe type, as long as we don't +implicitly cause impredicativity. + +We can, of course, rewrite the definition of "idmap" using Coq's +shorthand for functions. +*) + +Definition idmap_short (A:Type) (x:A) : A := + x. + +(** *** Examples of idmap *) + +Compute idmap nat (S (S O)). + +(** Prints (S (S O)), like an identity function should. *) + +(** +Coq has a number of features for making it easier to define and call functions. We've already seen the "shorthand" for definitions. In the rest of this section, we'll see: +- partial application, +- implicit arguments, and +- type inferencing. +*) + +(** *** Partial application *) +(** +Since we've defined the identity function for any type, we can now +define the identity function for [nat]s in terms of it. +*) + +Definition idmap_nat_from_idmap : nat -> nat := + idmap nat. + +(** +The value "idmap nat" is a function call. It calls the function +"idmap" with the type [nat]. Since "idmap" expected 2 arguments and +we only provided 1, this is called a "partial application". The +result of the partial application is a function that is still waiting +for 1 more argument. That function is the identity function on [nat]s +and this command assigns it a name. + + +We can check this new function by passing the second of the two arguments. +*) + +Compute idmap_nat_from_idmap (S (S (S O))). + + +(** *** Implicit Arguments *) +(** +Calling "idmap nat (S O)" seems repetitive because Coq can determine +that "(S O)" has type [nat]. (Remember, in type theory, an element +can belong to only one type.) We can use Coq's implicit arguments +feature to tell Coq to always infer some argument values. + +Curly braces are used to mark a parameter for implicit arguments. +*) + +Definition idmap_implicit {A:Type} (x:A) : A := + x. + +(** +Now, we can call the general identity function with just one argument. +*) + +Compute idmap_implicit (S O). + +(** +Implicit arguments are usually handy, but sometimes they get in the +way. Before, we declared a version of "idmap_nat" by calling "idmap". +We did it by passing "nat" as the first parameter to "idmap". + +If we call "idmap_implicit" with "nat", Coq will assume that [nat] is +"x" and use the type of [nat], which is [Set], for the implicit +parameter. Obviously, we don't want that. We can prevent Coq from +using implicit arguments by putting an "at sign" ("@") in front of the +function name. +*) + +Definition idmap_nat_from_idmap_implicit : nat -> nat := + @idmap_implicit nat. + +Compute idmap_nat_from_idmap_implicit (S O). + +(** +Another way to mark parameters for implicit arguments is with the +"Arguments" command. Because that command has a lot of features and +complex syntax, we won't go into its details in this document. +Nonetheless, we will use the command so that our examples look like +those of the HoTT Coq library. +*) + + +(** *** Type Inferencing *) +(** +In many cases, Coq can infer the type of a parameter or even a whole +function without us have to state it explicitly. +*) + +Definition idmap_inferred {A} (n:A) := + n. + +(** +Here, both the type of "A" (which is [Type]) and the returned type of +the function (which is "A") are both inferred. As you can see, this +allows very concise definitions. +*) + +Compute idmap_inferred (S (S O)). + + +(** ** Addition of Natural Numbers *) +(** +As the last part of our introduction, we define addition as a function +on natural numbers and show how to use the operator "+" to call it. +*) +(** *** Induction *) +(** +When we issued the command [Inductive] to create the type [nat], Coq +also created a function "nat_rect" for induction on natural numbers. +Its type is: +[[ + nat_rect + : forall P : nat -> Type, + P 0 -> + (forall n : nat, P n -> P (S n)) -> + forall n : nat, P n +]] +This is identical to the induction constant named "ind_N" in the HoTT +book. We can use this function to define addition. +*) + +Definition plus (m n: nat) : nat := + nat_rect (fun _ => nat) n (fun m' sum => S sum) m. + +(** +The function "plus" is defined by a call to "nat_rect" with 4 +arguments: + +The first argument determines the type of the result. Addition always +results in a [nat], so the first argument is a function that always +returns the type [nat]. When specifying the function, we used +underscore ("_") which is a special parameter name that indicate to +Coq that the parameter isn't used in the function. (Multiple +parameters can be named "_" if they are all not needed.) + +The second argument to "nat_rect" is "n". This is the base case; the +result when "m" is zero. + +The third argument is the inductive case. It takes "m"-prime and the +result (sum) upto "m"-prime and produces the result for the successor +of "m"-prime, which is just the sum plus one. + +The fourth argument is "m", the value to calculate the sum at. +*) + +Compute plus 4 2. + +(** +In this example, we directly called the induction constant "nat_rect". +This is one way to do induction in Coq. The other way is similar to +the "pattern matching" describing in the HoTT book. +*) + +(** *** Match Expressions *) +(** +Addition can also be defined using a "match" expression. +*) + +Fixpoint plus_using_match (m n: nat) : nat := + match m with + | 0 => n + | S m' => S (plus_using_match m' n) + end. + +(** +The [match] expression represents case analysis on an element of an +inductive type. Since every canonial element of an inductive type +must have been made with a constructor, the [match] expression gives a +value that depends on which constructor was used. The [match] +expression is very expressive, but a simplified understanding is: +[[ + match with + | => + | => + ... + end +]] +NOTE: In HoTT, not every element of the identity type is made with a +constructor. Nonetheless, this case analysis still works. See the +HoTT book for an explanation. + +In our example, "m" is treated as a canonical [nat]. If "m" was made +with the constructor constant [O] (capital-oh), the value of the +[match] expression is "n". If "m" was made with the constructor +function [S] called with some other [nat], called "m"-prime here, then +the value of the match expression is the successor of "m"-prime plus +"n". + +Notice that the function is defined in terms of itself. In order to +allow that, we had to use command [Fixpoint] instead of the usual +[Definition]. + +Coq will transform the match expression into a call to "nat_rect". If +it cannot, Coq will print an error message. +*) +(** *** Notations *) +(** +We could always represent addition with "plus 4 2", but it is more +natural to read and write "4 + 2". We tell Coq to use this format +through [Notation] command. +*) + +Notation "n + m" := (plus n m) : nat_scope. +Open Scope nat_scope. + +(** +Now we can write. +*) + +Compute 4 + 2. + +(** +We've actually already been using a notation. The "->" operator is +defined as: +*) + +Reserved Notation "x -> y" (at level 99, right associativity, y at level 200). +Notation "A -> B" := (forall (_ : A), B) : type_scope. + +(** +Because [Notation]s could conflict, every [Notation] goes into a +scope. Here, the scopes are called "nat_scope" and "type_scope". +When a scope is opened, all of its notations become available to be +used. If two notations in open scopes conflict, the one opened more +recently is used. Here, "nat_scope" was opened by the command "Open +Scope nat_scope". The other, "type_scope", is special and is open +anywhere a type is expected. + +If we ever wanted to stop using the plus [Notation], we could issue the +command "Close Scope nat_scope". + + +A more complex example is: +*) + +Definition compose {A B C : Type} (g : B -> C) (f : A -> B) := + fun x => g (f x). + +Notation "g 'o' f" := (compose g f) (at level 40, left associativity). + +(** +The single quotes are used to turn the letter "o" (small-oh) into an +operator. + +"at level 40" indicates the precedence of the operator. A lower +precedence level means that an operator "binds more tightly". That +is, that a [Notation] is selected over another. Thus, for natural +numbers, multiplication is at level 40, while addition is at 50. +(Those operators have default precedences set by a "Reserved Notation" +command.) + +"left associativity" is what you would expect. +*) + +(** +That covers the basics of reading Coq theorems. The rest of this +document goes over the types, functions, and operators that are +commonly used in type theory and in HoTT. +*) + +(** * Common Types of Type Theory *) +(** +After a short discussion about universe types in Coq, we go through +how each of the types that are commonly used in type theory are +implemented as inductive types. +*) + +(** ** Universes *) +(** +The HoTT book describes an infinite hierarchy of universes U_0, U_1, +U_2, ... that are cumulative. That is, that every type in a universe +is also in every higher universe. + +Coq's universes have a similar structure, except that the lowest +universe is split into two: "Prop" and "Set". + +The "Prop" universe contains propositions - statements that can be +proven or disproven. In practice, that means types that are shown to +be either inhabited or uninhabited. Types in "Prop" must be "proof +irrelevant": it cannot matter which term inhabits the type, just that +it is inhabited. + +The "Set" universe contains all other "small types". (Small types are +ones that do not contain references to a universe.) Since in homotopy +type theory every equality proof is relevant, all of our inductive +types will reside in the "Set" universe. + +The infinite number of universes above "Prop" and "Set" are known as +"Type(1)", "Type(2)", "Type(3)", etc. However, the user only ever has +to enter "Type". Coq will, behind the scenes, assigned a numbered +universe to every usage of "Type", as long as there is no +impedicativity. (If you implicitly cause impredicativity, you'll see +an error message.) +*) + +(** ** Dependent Function Types *) +(** +The most commonly used type in type theory is the function. This type +in Coq was covered in detail earlier. A summary of its usage is: + +The dependent type: +- Book: #\Pi#$\Pi$ () +- Coq: forall , + +The non-dependent type: +- Book: #->#$\to$ +- Coq: -> + +An unnamed function: +- Book: #\mapsto#$\mapsto$ +- Book: #\lambda#$\lambda$ . +- Coq: fun => + +A function call (or "function application"): +- Book: (, ) +- Coq: + +Function composition: +- Book: #o#$\circ$ +- Coq: o + +*) +(** ** Non-Dependent Pair Types *) +(** +In the HoTT book, the non-dependent pair type can be considered a +special case of a dependent pair. For example, the projection +functions work the same on both the non-dependent and dependent types. +In Coq, however, it is more convenient to have two separate types. + +In the book, the non-dependent pair type, or cartesian product, requires +- a type A : U, and +- a type B : U +and is written +- A #\times# $\times$ B + +In Coq, the inductive type is written: +*) + +Inductive prod {A B:Type} : Type := + pair : A -> B -> @prod A B. + +(** +Here, "pair" is a constructor that takes two arguments, an element +of type "A" and an element of type "B", and produces an element of +type "prod A B". So, "prod A B" is the type of non-dependent pairs +and "pair a b" creates a pair. + +This inductive type definition uses a shortcut. The types "A" and "B" +are used in the constructor "pair", but are not listed as parameters. +This is because any parameters listed immediately after the type name +("prod") are treated as parameters to both the type of "prod" and to +all constructors. + + +An equivalent (but longer) definition of "prod" would be +*) + +Inductive prod_long : Type -> Type -> Type := + pair_long : forall {A B: Type}, A -> B -> prod_long A B. + +(** +When Coq creates "prod", it also creates the induction function +"prod_rect". This is the inductive constant, similar to "nat_rect" we +mentioned earlier. What we didn't say earlier is that there are _two_ +other induction functions: "prod_rec" and "prod_ind" (as well as +"nat_rec" and "nat_ind"). + +The reason for three induction constants is that there are three kinds +of universes: "Prop", "Set", and "Type". The function "prod_rect" and +"nat_rect" puts the types they create in the "Type" universe. +Likewise, "prod_rec" and "nat_rec" put the resulting type in "Set" and +"prod_ind" and "nat_ind" put it in "Prop". When doing HoTT, it is +usually safe to just use the "rect" function. + +When we use a [match] expression for induction, Coq uses type +inferencing to chose the correct induction function. + +Speaking of duplication, Coq has a second non-dependent pair type +called "and". This type takes arguments from the "Prop" universe and +puts the resulting type in "Prop". But, since we're not using "Prop", +we won't cover it here. +*) + + +(** *** Pair Notation *) +(** +From the definition of "pair_long", it is clear that the constructor +takes 4 parameters: two types and an element of each type. But given +the two elements, Coq can always infer their types. Thus, we can +create a pair using just the two elements. For example: +*) + +Check (pair 4 2). + +(** +In the book, we use "A #\times# $\times$ B" to denote the type and +"(a,b)" to denote a pair. Coq allows us to use a similar syntax by +using the [Notation] command. +*) + +Notation "x * y" := (@prod x y) : type_scope. +Notation "( x , y , .. , z )" := (pair .. (pair x y) .. z) : core_scope. + +(** +Now when Coq sees "nat * nat", it will translate it into "(prod nat +nat)" and, likewise, translate "(4, 2)" into "(pair 4 2)". The second +[Notation] command will also convert tuples of any length into +pairs-within-pairs. + +Now, we can write the type and elements of dependent pairs like we're +accustomed. +*) + +Check (nat * nat)%type. +Check (4,2). + +(** +The "%%type" forces Coq to use the "type_scope" to interpret the +expression. It is needed because [Check] does not expecting a type. +*) + +(** *** Projection functions *) +(** +The projection functions extract the first or second part of a pair. +For non-dependent pairs in Coq, these are called "fst" and "snd". +*) + +Section projections. + Context {A : Type} {B : Type}. + + Definition fst (p:A * B) := + match p with + | (x, y) => x + end. + + Definition snd (p:A * B) := + match p with + | (x, y) => y + end. + +End projections. + +(** +The section feature is used here to simplify the list of parameters. +The section starts with "Section projections" and ends at "End +projections". The statement "Context ..." signals that "A" and "B" +are parameters to every subsequent definition that uses them inside +the section. Thus, both "fst" and "snd" have two type parameters and, +because curly braces ("{", "}") were used, those parameters are +implicit. + +In the [match] expressions, the constructor function "pair" is written +using the notation "(x, y)". +*) + +Compute fst (4,2). +Compute snd (4,2). + + +(** ** Dependent Pair Types *) +(** +In the HoTT book, the dependent pair type, also called #Sigma#$\Sigma$-type, +requires +- a type A : U, and +- a type family P : A -> U +and is written +- #\Sigma#$\Sigma$ (x:A) P(x) + +In Coq, it is defined by: +*) + +Inductive sigT {A:Type} (P:A -> Type) : Type := + existT : forall x:A, P x -> sigT P. + +(** +Here, "existT" is the constructor that takes two arguments, an element +"x" of type "A" and an element (unnamed) of type "P x", and produces +an element of "sigT A P". So, "sigT A P" is the type of pairs and +"existT x p" creates a pair (when "p" has type "P x"). + +If you read closely, you'll see that the type produced by "existT" is +"sigT P" not "sigT A P". The "A" can always be inferred from "P". + +To repeat (for the last time), every time Coq creates a new inductive +type, like "sigT" here, Coq also creates three induction functions, +"sigT_ind", "sigT_rec" and "sigT_rect". These functions put their +results into the "Prop", "Set", and "Type" universes (respectively). +Most of the time, we don't care, since we'll use a [match] expression +that infers which induction function to use. + +Like "prod" with "and", Coq has dependent pair types besides "sigT". +The types "ex" (short for "there exists") and "sig" both act as +dependent pairs, but use the "Prop" universe. Again, we're not using +"Prop", we won't cover them here. +*) + +(** *** Pair Notation *) +(** +To create a dependent pair, we must supply a function taking an +element of the first type to a type for the second element. Since we +haven't defined propositional equality, we can't do much that is +interesting here. For now, we can create a pair of [nat]s by supplying +a function that always returns [nat]. +*) + +Check (existT (fun _:nat => nat) 4 2). + +(** +Obviously, that expression is long to write and difficult to read and +we want to use a [Notation] for it. Since Coq already uses "(a,b)" +for non-dependent pairs, the HoTT Coq library uses the semicolon here. +*) + +Notation "{ x : A & P }" := (sigT (fun x:A => P)) : type_scope. +Notation "( x ; y )" := (existT _ x y) : fibration_scope. +Open Scope fibration_scope. + +(** +When Coq sees "(4;2)", it will translate that into "(existT _ 4 2)". +The underscore ("_") in a function application indicates that Coq +should try to infer the argument or ask for help from the user. + +Here the dependent-pair [Notation] goes into the "fibration_scope". +Since that is a new scope, we must "Open" it to make the [Notation] +available. +*) + +(** +Below is an example using the dependent pair "(4;2)". It is necessary +to say what its type is, so that Coq can infer the hidden argument to +"existT". +*) + +Definition dep_pair_example_type := + { x:nat & nat }. +Definition dep_pair_example : dep_pair_example_type := + (4;2). +Check dep_pair_example. + +(** *** Projection functions *) +(** +The projection functions extract the first or second part of a pair. +For dependent pairs in Coq, these are called "projT1" and "projT2". +*) + +Section Projections. + + Context {A : Type}. + Context {P : A -> Type}. + + Definition projT1 (x:sigT P) : A := + match x with + | (a; _) => a + end. + + Definition projT2 (x:sigT P) : P (projT1 x) := + match x return P (projT1 x) with + | (_; h) => h + end. + +End Projections. + +(** +These are pretty much as you'd expect. There are two items worth +commenting on. + +The underscore ("_") in the constructor pattern is used to indicate an +unused parameter in the [match] expression. We've seen this before in +parameters to [fun] and [forall]. + +The other feature worth commenting on is the "return " in the +[match] expression of "projT2". This syntax is used when the [match] +expression has a type that depends on the element of the inductive +type being matched on. + +We will not go into all the details on the variations of the [match] +expression, because this document is about reading what has been +proven - that is, the _type_ of an expression - and not about +understanding the proof - which is the value of the expression. + + +The [Notation]s for the projectors are: +*) + +Notation "x .1" := (projT1 x) (at level 3) : fibration_scope. +Notation "x .2" := (projT2 x) (at level 3) : fibration_scope. + +(** +And some examples of it are: +*) + +Check (dep_pair_example .1). +Check (dep_pair_example .2). + + +(** ** Disjoint Union Type*) +(** +In the HoTT book, the disjoint union type, also called coproduct, +requires +- a type A : U, and +- a type B : U +and is written +- A + B. + +In Coq, it is defined by: +*) + +Inductive sum (A B:Type) : Type := + | inl : A -> sum A B + | inr : B -> sum A B. + +Arguments inl {A B} _ , [A] B _. +Arguments inr {A B} _ , A [B] _. + +Notation "x + y" := (sum x y) : type_scope. + +(** +Ignoring the "Arguments" command, which we aren't covering in this +document, the rest should be familiar by now. + +Since the type "sum" has two constructors, "inl" and "inr", we can +have two examples that build an element of a type. +*) + +Definition dijoint_union_example_type := + (nat + (nat * nat))%type. +Definition dijoint_union_example1 : dijoint_union_example_type := + inl 4. +Definition dijoint_union_example2 : dijoint_union_example_type := + inr (4,2). + +(** +Likewise, any [match] expression needs to handle both constructors. +*) + +Definition left_or_first (a : dijoint_union_example_type) : nat := + match a with + | inl x => x + | inr p => fst p + end. + +(** ** Zero, One, and Two Types *) +(** +The finite types with 0, 1, and 2 elements play special roles in type +theory. In standard Coq those types are: +*) + +Inductive Empty_set : Set :=. + +Inductive unit : Set := + tt : unit. + +Inductive bool : Set := + | true : bool + | false : bool. + +(** +The HoTT Coq library uses slightly different names for the types. +(Although the constructors have the same names.) +*) + +Definition Empty := Empty_set. +Definition Unit := unit. +Definition Bool := bool. + +(** +Standard Coq also has finite types that live in the "Prop" universe. +The type "True" has one constructor and the type "False" has zero. +*) +(** *** Not operator *) +(** +In HoTT, the not operator indicates that elements of a type can be +mapped to the elements of the empty (zero) type. +*) + +Definition not (A:Type) : Type := A -> Empty. +Notation "~ x" := (not x) : type_scope. + +(** +In Standard Coq, logic is usually done in the "Prop" universe, so this +operator maps to the type "False" that lives there (instead of "Empty" +which lives in "Set"). +*) + +(** *** Absurdity Implies Anything *) +(** +Obviously, a [match] expression for the [Unit] type handles one +constructor and the match expression for the [Bool] type handles two +constructors. But what about the [Empty] type? It has no +constructors, so its [match] expression is empty. In logic, this is the +equivalent of "ex falso quodlibet" or "from contradiction, anything". +*) + +Definition contradiction_implies_anything (a:Empty) (C:Type) : C := + match a with + end. + +(** +The induction constant for Empty is +[[ + Empty_rect : forall (P : Empty -> Type) (e : Empty), P e +]] +*) + + +(** ** Identity Type *) +(** +The identity type is defined as: +*) + +Inductive paths {A : Type} (a : A) : A -> Type := + idpath : paths a a. + +(** +Where "paths" equates to "Id" in the HoTT book and "idpath" to "refl". + +The standard Coq library defines equality using a type "eq" with +constructor "refl". This type is different from "paths" because "eq" +is in the "Prop" universe and its elements are _not_ proof-relevant. +To do homotopy type theory, we need an equality that is proof-relevant +and exists in the "Type" universe. + +The operator for the identity type is the equal sign. There is also a +[Notation] that allows the user to explicitly state the type. +*) + +Notation "x = y :> A" := (@paths A x y) : type_scope. +Notation "x = y" := (x = y :>_) : type_scope. + +Arguments idpath {A a} , [A] a. +Arguments paths_ind [A] a P f y p. +Arguments paths_rec [A] a P f y p. +Arguments paths_rect [A] a P f y p. + +Notation "1" := idpath : path_scope. +Local Open Scope path_scope. + + +(** * Homotopy Type Theory *) +(** +Now that we have seen the common types of type theory, we can use them +to do homotopy type theory. This section will demonstrate some +theorems of HoTT and introduce the types used to do HoTT in Coq. +Because this file is using "standard" Coq, we cannot demonstrate +higher inductive types. +*) + +(** ** Properties of Paths *) +(** +For every element of a type, there is a constant path. This is the +same notion as equality being reflexive. This property is witnessed +by "idpath", which has type: +[[ + @idpath + : forall {A : Type} (a : A), a = a +]] + +The "theorem" of reflexivity can be stated "for every type and for +every element of that type, there is an equality with that element +equal to itself". In Coq, that theorem is "proven" by function that +takes a type, an element of that type, and returns an element +witnessing the equality. + +For example, if we wanted to demonstrate that "4=4", we could do: +*) + +Check @idpath nat 4. + +(** +which is an element that has type "4=4". Obviously, with implicit +arguments, we do not need "nat" and can use just "idpath 4". Not so +obviously, we can go a step further. If type inferencing can determine +the type returned by "idpath", such as "4=4" in our example, then +implicit arguments can fill in the "4" as well! So most of the time +you will just see "idpath" or its [Notation], "1" (in the "path_scope" +scope). +*) + +Check idpath : 4 = 4. +Check 1 : 4 = 4. + +(** +Next, we prove that every path has an inverse. (Or, "equality is +symmetric".) In Coq, this proof looks like a function that takes any +path and returns its inverse. +*) + +Definition inverse {A : Type} {x y : A} (p : x = y) : y = x + := match p with + | idpath => idpath + end. + +Arguments inverse {A x y} p : simpl nomatch. + +Notation "p ^" := (inverse p) (at level 3) : path_scope. + +(** +This [match] expression hides a number of type inferences and implicit +arguments. The type of "p" is "paths A x y", which had to be +constructed using "idpath A x" with "y" being the same as "x". The +value returned by the match has type "paths A y x", so Coq can infer +that the arguments to "idpath" are "A" and "x" and, because "y" is the +same as "x", intrepret the resulting "A x x" as "A y x". + +Notice how this proof is similar to the HoTT book's proof where "y" +is assumed to be the same as "x" and "refl_x" is mapped to "refl_x". + + +Next, we prove that paths concatenate. (Equality is transitive.) +Like before, this is a function that takes any path from "x" to "y" +and any path from "y" to "z" and returns a path from "x" to "z". +*) + +Definition concat {A : Type} {x y z : A} (p : x = y) (q : y = z) : x = z := + match p, q with + | idpath, idpath => idpath + end. + +Arguments concat {A x y z} p q : simpl nomatch. + +Notation "p @ q" := (concat p q) (at level 20) : path_scope. + +(** +The comma in the [match] expression is part of the [match] syntax. It +is _not_ a non-dependent pair. It is a shortcut that allows two +inductions to be done using a single [match] expression. When the +[match] gets translated into two calls to "paths_rect", we don't care +in which order the calls happen; the results are the same. As the +HoTT book explains, this proof could be done with just one call to +"path_rect", but the result from a single induction would not behave +symmetrically. + +The following proofs show the relationship of "idpath", "inverse" and +"concat". +*) + +Definition concat_p1 {A : Type} {x y : A} (p : x = y) : p @ 1 = p := + match p with idpath => 1 end. +Definition concat_1p {A : Type} {x y : A} (p : x = y) : 1 @ p = p := + match p with idpath => 1 end. + +Definition concat_pV {A : Type} {x y : A} (p : x = y) : p @ p^ = 1 := + match p with idpath => 1 end. +Definition concat_Vp {A : Type} {x y : A} (p : x = y) : p^ @ p = 1 := + match p with idpath => 1 end. + +Definition inv_V {A : Type} {x y : A} (p : x = y) : p^^ = p := + match p with idpath => 1 end. + +Definition concat_p_pp {A : Type} {x y z t : A} (p : x = y) (q : y = z) (r : z = t) : + p @ (q @ r) = (p @ q) @ r := + match r with idpath => + match q with idpath => + match p with idpath => 1 + end end end. +Definition concat_pp_p {A : Type} {x y z t : A} (p : x = y) (q : y = z) (r : z = t) : + (p @ q) @ r = p @ (q @ r) := + match r with idpath => + match q with idpath => + match p with idpath => 1 + end end end. + +(** +All of those should be understandable. Some may have alternate +proofs. It is worth noting that many of these proofs are shorter than +even the "second proofs" of the HoTT book. + +The names seem unusual at first, but they follow the naming scheme of +the HoTT Coq library: +- [1] means the identity path +- [p] means 'the path' +- [V] means 'the inverse path' +- [A] means '[ap]' +- [M] means the thing we are moving across equality +- [x] means 'the point' which is not a path, e.g. in [transport p x] +- [2] means relating to 2-dimensional paths +- [3] means relating to 3-dimensional paths, and so on + +We'll see more functions named in this style as we proceed. +*) + +(** ** Functions are functors *) +(** +Next, we define the function "transport" with its [Notation]. +*) + +Definition transport {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x) : P y := + match p with idpath => u end. + +Notation "p # x" := (transport _ p x) (right associativity, at level 65, only parsing) : path_scope. + +(** +Next comes the non-dependent and dependent versions of "ap". +("application of a function to a path" or "action across paths"). The +HoTT Coq library calls the dependent version "apD" rather than "apd". +*) + +Definition ap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y + := match p with idpath => idpath end. + +Arguments ap {A B} f {x y} p : simpl nomatch. + +Definition apD {A:Type} {B:A->Type} (f:forall a:A, B a) {x y:A} (p:x=y): + p # (f x) = f y + := + match p with idpath => idpath end. + +Arguments apD {A B} f {x y} p : simpl nomatch. + +(** +In the HoTT book, the use of "ap" and "apd" is often implicit. The +reader can determine when "f(p)" means "ap(f,p)" because "p" is a path +and "f" called on a path just doesn't "fit" in the proof. In Coq, we +have to be explicit about the use of "ap" and "apD". +*) + +(** ** Homotopy *) +(** +So far, we've been covering types and functions in the same sequence +as the HoTT book. At this point in the book there is the definition +of "homotopy". But, if you've read further in the book, you know that +homotopy and identity are equivalent. Thus, the HoTT Coq library has +no need to define "homotopy" and neither do we. + +We go straight to equivalences. +*) + +(** ** Equivalences *) +(** +For equivalences, we need a definition of a "section" or the one-sided +inverse to a function. +*) + +Definition Sect {A B : Type} (s : A -> B) (r : B -> A) := + forall x : A, r (s x) = x. + +(** +The actual definition of equivalence requires some new commands. +*) + +Class IsEquiv {A B : Type} (f : A -> B) := BuildIsEquiv { + equiv_inv : B -> A ; + eisretr : Sect equiv_inv f; + eissect : Sect f equiv_inv; + eisadj : forall x : A, eisretr (f x) = ap f (eissect x) +}. + +Arguments eisretr {A B} f {_} _. +Arguments eissect {A B} f {_} _. +Arguments eisadj {A B} f {_} _. + +Record Equiv A B := BuildEquiv { + equiv_fun :> A -> B ; + equiv_isequiv :> IsEquiv equiv_fun +}. + +(** +I'm going to address these commands from easiest to hardest, not first +to last. + +The easiest is the "Arguments" commands. Ignore them. They just +define implicit arguments and we aren't covering the "Arguments" +command in this tutorial. + +Next, the [Record] command creates an inductive type with a single +constructor. So, the type "Equiv" is very close to the dependent pair +type "sigT". The constructor for the new type is "BuildEquiv". The +[Record] command also creates projection functions for extracting the +two elements stored in an "Equiv". These are called "equiv_fun" and +"equiv_isequiv" (and are very similar to "projT1" and "projT2"). + +Lastly, we come to the [Class] command. [Class] operates similar to a +[Record], but it has special implicit argument rules. Thus, when Coq +searches for an argument of type "IsEquiv f", it will look at all +elements of that type declared with the "Instance" command. As a +result, the second argument to "BuildEquiv" can often be left +implicit. + +The HoTT Coq library declares one default [Instance], which is the +second part of the "Equiv" record. +*) + +Existing Instance equiv_isequiv. + +(** +And, of course, there is a [Notation] for equivalence. There is also +one for the inverse function inside it. +*) + +Notation "A <~> B" := (Equiv A B) (at level 85) : equiv_scope. +Notation "f ^-1" := (@equiv_inv _ _ f _) (at level 3) : equiv_scope. +Local Open Scope equiv_scope. + +(** +The definition used by "Equiv" is the "Half Adjoint Equivalence" of +the HoTT book. + +In the book, the parts of "ishae(f)" are (using Coq's notation): +- f : A -> B +- g : B -> A +- #\eta#$\eta$ : f o g ~~ idmap A +- #\epsilon#$\epsilon$ : g o f ~~ idmap B +- #\tau#$\tau$ : forall x:A, f (eta x) = epsilon (f x) +where "~~" represents homotopy, which is never defined in Coq. (We +used two tildes since the single tilde ("~") in Coq is the "not" +operator.) + +In Coq, if we have a variable "e" of type "A <~> B", the parts are: +- equiv_fun e : A -> B +- equiv_inv (equiv_isequiv e) : B -> A + - Also written: (equiv_fun e) ^-1 : B -> A +- eisretr (equiv_isequiv e): Sect equiv_inv f +- eissect (equiv_isequiv e): Sect f equiv_inv +- eisadj (equiv_isequiv e): forall x : A, eisretr (f x) = ap f (eissect x) + +Notice that the final expression contains a call to "ap" that is +implicit in the HoTT book's notation. + +Now that we have a definition for equivalence, let's try to prove that +it is an equivalence relation. +*) + + +(** *** Properties of Equivalences *) + +(** +Our first example is proving reflexivity: that for all types "A", +"ismap A" creates an equivalence between "A" and itself. Creating an +equivalence usually takes three parts: +- creating an element of type Class "IsEquiv", +- registering it as an Instance (for implicit arguments), and +- creating the Record "Equiv". + +The following command does the first two parts for reflexivity. +"@BuildIsEquiv" creates the element of "IsEquiv" and the "Instance" +command registers the element. +*) + +Instance isequiv_idmap (A : Type) : IsEquiv (idmap A) := + @BuildIsEquiv A A (idmap A) (idmap A) (fun _ => 1) (fun _ => 1) (fun _ => 1). + +(** +This next command creates the element of "Equiv" (written "A <~> A") +by calling the constructor "BuildEquiv". As you can see, the final +argument is inferred using the Instance registered by the previous +command. +*) + +Definition equiv_idmap (A : Type) : A <~> A := @BuildEquiv A A (idmap A) _. + +(** +This looks like a lot of work to prove something that is obvious. And +it is. However, the library is designed for proving more complex +instances of equivalence. One aspect of that is once an "Instance" of +"IsEquiv" is registered, it can be used as an inferred argument in +many places. That won't happen for "isequiv_idmap", which is only use +in a few places, but does happen. + + +After proving that equivalences are reflexive, we should prove that +every equivalence has an inverse. However, that proof is rather long +and complicated. (That has to do with the choice of half-adjoint +equivalences; the proof for bi-invertible maps is just 8 lines.) +Since this document is about reading what has been proven, and not the +proofs themselves, we will cheat. We'll skip the proof and use the +"admit" command so that you can read what has been proven. +*) + +Definition equiv_inverse : forall {A B : Type} (e : A <~> B), (B <~> A). +Admitted. + +(** +And here is what transitivity ("composition") looks like. +*) + +Definition equiv_compose' : forall {A B C : Type} (g : B <~> C) (f : A <~> B) + , A <~> C. +Admitted. +(** +It is called "equiv_compose"-prime, because there is a second function +that instead takes functions from "A" to "B" and from "B" to "C" and +uses the implicit arguments provided by [Instance] to build the +equivalence. +*) +(** ** Univalence *) +(** + +Since we've decided to cheat and add theorems without proof, it seems +like the opportune time to add an axiom. Homotopy type theory's +univalence axiom states that there exists an equivalence between two +types being equivalent and those same two types being equal. + +*) + +Definition equiv_path (A B : Type) (p : A = B) : A <~> B := + match p with + | idpath => equiv_idmap A + end. +(*??? Why is my version of this so short compared to the library's?! *) + +Class Univalence := { + isequiv_equiv_path :> forall (A B : Type), IsEquiv (equiv_path A B) +}. + +Instance univalence_axiom : Univalence. +Admitted. + +(** +The function "equiv_path" says that for every equality between types, +there is an equivalence between them. + +The [Class] "Univalence" says that for any two types, "equiv_path" +determines an equivalence between the types. So, not only you can get +a function that maps an equivalence to an equality, you know that that +function is the inverse (with some qualifications) of "equiv_path". +*) +(* ??? How is "Class" functioning in this usage? It's not the usual one.*) +(** *** Univalence Example *) +(** +To end this document, we'll do a small proof. We'll declare a type +that is the duplicate of "nat", prove they're equivalent, and then use +the Univalence Axiom to conclude that they are equal. + +First, we define our new type of [nat]s. +*) + +Inductive nat2 : Set := + | O2 : nat2 + | S2 : nat2 -> nat2. + +(** +Next, we define invertible maps between them. This is easy: we match +zero to zero and successor to successor. +*) + +Fixpoint nat_to_nat2 (n : nat) : nat2 := + match n with + | O => O2 + | S n' => S2 (nat_to_nat2 n') + end. + +Fixpoint nat2_to_nat (n2 : nat2) : nat := + match n2 with + | O2 => O + | S2 n2' => S (nat2_to_nat n2') + end. + +(** +Next, we must prove that are maps are left- and right- inverses of +each other. We could have done each in a single function, if we used +"nat_rect" and "nat2_rect", but it is easier to read with the [match] +expression. +*) + +Fixpoint sect_nat2_helper (x : nat2) : (nat_to_nat2 (nat2_to_nat x)) = x := + match x return (nat_to_nat2 (nat2_to_nat x)) = x with + | O2 => idpath O2 + | S2 x' => ap S2 (sect_nat2_helper x') + end. +Definition sect_nat2 : Sect nat2_to_nat nat_to_nat2 := sect_nat2_helper. + +Fixpoint retr_nat2_helper (x : nat) : (nat2_to_nat (nat_to_nat2 x)) = x := + match x return (nat2_to_nat (nat_to_nat2 x)) = x with + | O => idpath O + | S x' => ap S (retr_nat2_helper x') + end. +Definition retr_nat2 : Sect nat_to_nat2 nat2_to_nat := retr_nat2_helper. + +(** +Then, since we're using the half-adjoint equivalence, we need one of +the coherences. + +Although this document is not trying to teach you how to prove, it is +worth pointing out that the following theorem is proved differently +than the other ones. It uses Coq's "tactic language". The tactic +language a large vocabulary of commands and multiple forms of +automation to help prove theorems. +*) + +Theorem adj_nat2 (x : nat) : sect_nat2 (nat_to_nat2 x) = ap nat_to_nat2 (retr_nat2 x). +Proof. + elim x. + exact idpath. + + intros x' inductive_hyp. + simpl. + rewrite inductive_hyp. + case (retr_nat2 x'). + exact idpath. +Qed. + +(** +Now that we have all 5 pieces needed for the equivalence, we make the +"IsEquiv" element, register it as an [Instance], and then make the +"Equiv" element that witness that "nat" and "nat2" are equivalent. +*) + +Instance isequiv_nat_nat2 : IsEquiv nat_to_nat2 := + BuildIsEquiv nat nat2 nat_to_nat2 nat2_to_nat sect_nat2 retr_nat2 adj_nat2. + +Definition equiv_nat_nat2 : nat <~> nat2 := BuildEquiv nat nat2 nat_to_nat2 _. + +(** +Next, we use the univalence axiom to build an equivalence between the +equality of [nat] and [nat2] and the equivalence of [nat] and [nat2]. +*) + +Definition big_equiv : (nat = nat2 :> Type) <~> (nat <~> nat2) := + BuildEquiv (nat = nat2 :> Type) (nat <~> nat2) (equiv_path nat nat2) _. + +(** +With that equivalence, we can extract the inverse map, which takes the +equivalence to the equality. Applying that function to the +equivalence, gives us the equality. Thus, [nat] is equal to [nat2]! +*) + +Definition nat2_is_nat : (nat = nat2 :> Type) := + (big_equiv ^-1) equiv_nat_nat2. + +(** +With that type equality, we can take any theorem we've proved on [nat] +and convert it into a theorem on [nat2]. In our final example, we'll +convert the identity function on [nat]s into one on [nat2]. +*) + +Definition idmap_nat2 : nat2 -> nat2 := + match nat2_is_nat in (_ = y) return (y -> y) with + | 1 => idmap_nat + end. + +(** * Going Further *) +(** ** Homotopy Type Theory in Coq *) +(** +The reference for HoTT in Coq is: +- http://homotopytypetheory.org/coq/ + +It contains links to the HoTT Coq library and proofs that use it. +Thanks to this document, you should now be able to read what has been +proven. + +Also, the site contains links to the version of Coq that supports +higher inductive types and is necessary to use the HoTT Coq library +and to write new proofs using it. +*) +(** ** General Coq references *) +(** +The website for Coq is: +- http://coq.inria.fr/ +*) +(** *** Installation *) +(** +The Coq website has links to compiled versions of standard Coq for +Windows and OSX. If you're running Linux, many distributions have Coq +available. Under Ubuntu and Debian, the command to install Coq and +CoqIDE is "sudo apt-get install coq coqide". + +CoqIDE is a graphical user interface for Coq. We strongly recommend +using either CoqIDE or "Proof General", which lets you use Coq inside +of the Emacs editor. (Available at http://proofgeneral.inf.ed.ac.uk/) + +"ProofWeb" is a website that lets you interface to Coq by using a web +browser. You will not need to install anything. It is available at +http://prover.cs.ru.nl/ +n*) +(** *** Documentation *) +(** +A good introduction to Coq is "Software Foundations". It is, however, +aimed at students studying programming languages. It does not get +quickly to "how to prove". + +- http://www.cis.upenn.edu/~bcpierce/sf/ + +The following is a good cheatsheet. Most importantly, it has a list +of "Basic Tactics" that guides new users on what command to use when +working with the powerful tactics language. Additionally, it has many +of the book-to-Coq translations that are in this document. + +- http://andrej.com/coq/cheatsheet.pdf + +The Coq Reference Manual, with its explanations of every feature in +standard Coq, is available at: + +- http://coq.inria.fr/documentation +*) + + +(* TODO: +- "Require Import/Export" +- "Contractibility" +- Martin-Lof Rule vs. Paulin-Mohring Rule +*) + + + + diff --git a/cover-a4.tex b/cover-a4.tex new file mode 100644 index 0000000000000000000000000000000000000000..9a29f8c9287817bcedaecf4bb005693093bb33f5 --- /dev/null +++ b/cover-a4.tex @@ -0,0 +1,61 @@ +% Cover for home-made copies. Print this with a color printer. +\input{opt-a4} +\input{opt-color} + +\documentclass[\OPTfontsize]{article} + +\usepackage[utf8]{inputenc} +\usepackage[dvips]{xcolor} +\usepackage{wallpaper} + +\definecolor{covercolor}{cmyk}{\OPTcovercolor} +\definecolor{covertext}{cmyk}{\OPTcovertextcolor} +\pagecolor{covercolor} + +%%% Set the fonts +\usepackage{mathpazo} +\usepackage[scaled=0.95]{helvet} +\usepackage{courier} +\linespread{1.05} % Palatino looks better with this + +\usepackage{graphicx} +\DeclareGraphicsExtensions{.png} +\input{bmpsize-hack} % for bounding boxes in dvi mode + +\newlength{\coverheight} +\setlength{\coverheight}{297mm} % Reported as total cover height + +\newlength{\coverwidth} +\setlength{\coverwidth}{210mm} % Reported as "spine begins at" + +\usepackage[margin=0pt, + papersize={\OPTpagesize}, + noheadfoot]{geometry} +%\usepackage{layout} +\newcommand{\coverpage}[1]{\vbox to \coverheight{\hbox to \coverwidth{#1}}} + +\parindent=0pt +\parskip=0pt + +\input{frontpage} + +\newcommand{\backpage}{ +\begin{minipage}[b][\coverheight][t]{\coverwidth} +\begin{center} +\begin{minipage}[t]{0.80\coverwidth} + \color{covertext} + \vspace{\OPTtopskip} + \input{blurb.tex} +\end{minipage} +\end{center} +\end{minipage} +} + +\begin{document} +%\layout +\ThisLRCornerWallPaper{1.1}{\OPThifrontimage} +\coverpage{\frontpage} +\newpage +\ThisLRCornerWallPaper{0.7}{\OPThibackimage} +\coverpage{\backpage} +\end{document} diff --git a/cover-hires-back-bw.png b/cover-hires-back-bw.png new file mode 100644 index 0000000000000000000000000000000000000000..f31049250d6d81bc34f5ac067ca1c6a02d7b73b1 --- /dev/null +++ b/cover-hires-back-bw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6927666a93f584c7b158afee42a99602e1243bf91b13f46f2098f46f567210b2 +size 2377980 diff --git a/cover-hires-back.png b/cover-hires-back.png new file mode 100644 index 0000000000000000000000000000000000000000..2abb49a517bd5caca27120fb9859e9d1b1f08dac --- /dev/null +++ b/cover-hires-back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19534427011ba88e96ba97de2f6189101783c7bce11d24af25e401fe2ff4c4e4 +size 2175224 diff --git a/cover-hires-bw.png b/cover-hires-bw.png new file mode 100644 index 0000000000000000000000000000000000000000..7abd0739e3d5ed5053351c889e08e6fb3e30a1ef --- /dev/null +++ b/cover-hires-bw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1eebc3f75f0869e8634a43710e02df398d2f9e79c97db69cd4c2656820917ada +size 13394522 diff --git a/cover-hires-front-bw.png b/cover-hires-front-bw.png new file mode 100644 index 0000000000000000000000000000000000000000..545f0c1765a9fce74ffb3c42889af0c42f764b95 --- /dev/null +++ b/cover-hires-front-bw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5243ddef3f0ee211a24ea6f48e708f58c8b80ad649404854127c48ca3ebdbf9 +size 5678784 diff --git a/cover-hires-front.png b/cover-hires-front.png new file mode 100644 index 0000000000000000000000000000000000000000..a8371e5df9f98535723166cf96854cc63e8436ce --- /dev/null +++ b/cover-hires-front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b48756c15408393530c98acee6ad5cad05228cde2eb40ab28fd41f14982637b +size 5566584 diff --git a/cover-hires.png b/cover-hires.png new file mode 100644 index 0000000000000000000000000000000000000000..cdb46f087d7989f9f9c78d7700168bcea349a755 --- /dev/null +++ b/cover-hires.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:535364d6d7eef01925917d2f71fe1e8ec4201da47c6223b86c9f2e2344fb41ab +size 13947896 diff --git a/cover-letter.tex b/cover-letter.tex new file mode 100644 index 0000000000000000000000000000000000000000..4b6008926dea3a7ab129f1f503e496884a3dea19 --- /dev/null +++ b/cover-letter.tex @@ -0,0 +1,61 @@ +% Cover for home-made copies. Print this with a color printer. +\input{opt-letter} +\input{opt-color} + +\documentclass[\OPTfontsize]{article} + +\usepackage[utf8]{inputenc} +\usepackage[dvips]{xcolor} +\usepackage{wallpaper} + +\definecolor{covercolor}{cmyk}{\OPTcovercolor} +\definecolor{covertext}{cmyk}{\OPTcovertextcolor} +\pagecolor{covercolor} + +%%% Set the fonts +\usepackage{mathpazo} +\usepackage[scaled=0.95]{helvet} +\usepackage{courier} +\linespread{1.05} % Palatino looks better with this + +\usepackage{graphicx} +\DeclareGraphicsExtensions{.png} +\input{bmpsize-hack} % for bounding boxes in dvi mode + +\newlength{\coverheight} +\setlength{\coverheight}{11in} % Reported as total cover height + +\newlength{\coverwidth} +\setlength{\coverwidth}{8.5in} % Reported as "spine begins at" + +\usepackage[margin=0pt, + papersize={\OPTpagesize}, + noheadfoot]{geometry} +%\usepackage{layout} +\newcommand{\coverpage}[1]{\vbox to \coverheight{\hbox to \coverwidth{#1}}} + +\parindent=0pt +\parskip=0pt + +\input{frontpage} + +\newcommand{\backpage}{ +\begin{minipage}[b][\coverheight][t]{\coverwidth} +\begin{center} +\begin{minipage}[t]{0.80\coverwidth} + \color{covertext} + \vspace{\OPTtopskip} + \input{blurb.tex} +\end{minipage} +\end{center} +\end{minipage} +} + +\begin{document} +%\layout +\ThisLRCornerWallPaper{1.1}{\OPThifrontimage} +\coverpage{\frontpage} +\newpage +\ThisLRCornerWallPaper{0.7}{\OPThibackimage} +\coverpage{\backpage} +\end{document} diff --git a/cover-lores-back-bw.png b/cover-lores-back-bw.png new file mode 100644 index 0000000000000000000000000000000000000000..d595961853542ef50a1933e5ddbe67793e488ad5 --- /dev/null +++ b/cover-lores-back-bw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:deeedfe1c87c22bdaaead69c1b7b10b51dda8299ade16a688253ba120ad9d3a5 +size 296304 diff --git a/cover-lores-back.png b/cover-lores-back.png new file mode 100644 index 0000000000000000000000000000000000000000..81d198de460cc518db69d72ac391e5d7bf923ec5 --- /dev/null +++ b/cover-lores-back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad002afcea7f8cc9460287ef166dbf76047e8b79cc28aa8106723a42a6f5efd4 +size 330336 diff --git a/cover-lores-front-bw.png b/cover-lores-front-bw.png new file mode 100644 index 0000000000000000000000000000000000000000..662499ce9d8340cd3265ddc16e4acf28df10db44 --- /dev/null +++ b/cover-lores-front-bw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1266fcbfd72687d696a5c96debc6410bc39557eb313570b76812c3342bb9061a +size 622117 diff --git a/cover-lores-front.png b/cover-lores-front.png new file mode 100644 index 0000000000000000000000000000000000000000..03ec917f74b4b29fce42aaac03f843380c59e3b2 --- /dev/null +++ b/cover-lores-front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:351d52be09490195fa053fee46b3fed7c353e3bf5239bc514f23febbd5367506 +size 531512 diff --git a/cover-lores.png b/cover-lores.png new file mode 100644 index 0000000000000000000000000000000000000000..4f011c9bff25a4580d0dcf885ea0c23c2d564d25 --- /dev/null +++ b/cover-lores.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d774d8892e6c3e405638597db387352bcbb3d015f981a9e6d5f7352e26626c5 +size 647508 diff --git a/cover-lulu-hardcover.png b/cover-lulu-hardcover.png new file mode 100644 index 0000000000000000000000000000000000000000..df70e6b4cc126b245d1cbdb99d9ec06d938588cc --- /dev/null +++ b/cover-lulu-hardcover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e433c896371e764e168b84c77aa24a59050c7a5f628ede8c63d56e2f71bb0b4 +size 3703087 diff --git a/cover-lulu-hardcover.tex b/cover-lulu-hardcover.tex new file mode 100644 index 0000000000000000000000000000000000000000..4f3d40f1341ba32bf55c9087aca7d8da2e983505 --- /dev/null +++ b/cover-lulu-hardcover.tex @@ -0,0 +1,101 @@ +% Cover for Lulu.com +\input{opt-ustrade} + +\documentclass[\OPTfontsize]{article} +\input{opt-color} + +\usepackage[utf8]{inputenc} +\usepackage{rotating} +\usepackage{xcolor} +\usepackage{wallpaper} + +\definecolor{covercolor}{cmyk}{\OPTcovercolor} +\definecolor{covertext}{cmyk}{\OPTcovertextcolor} +\pagecolor{covercolor} + +\usepackage{soul} % Inter-letter spacing +\sodef\ugg{}{0pt plus 1fill}{1em plus 1fill}{0pt} + +%%% Set the fonts +\usepackage{mathpazo} +\usepackage[scaled=0.95]{helvet} +\usepackage{courier} +\linespread{1.05} % Palatino looks better with this + +\usepackage{graphicx} +\DeclareGraphicsExtensions{.png} +\input{bmpsize-hack} % for bounding boxes in dvi mode + +% Some of these dimensions are reported by Lulu.com *after* you +% upload the inner PDF file. +% For casewrap hardcover see http://static.lulu.com/static/images/help_casewrap_6x9.gif + +% Dimensions as reported by Lulu.com (download cover template to see) + +% Total document size +\newlength{\totalwidth} +\setlength{\totalwidth}{392.112mm} % width + +\newlength{\totalheight} +\setlength{\totalheight}{273.05mm} % height + +% Spine width +\newlength{\spinewidth} +\setlength{\spinewidth}{42.862mm} + +% Book trim size (trade) +\newlength{\coverwidth} +\setlength{\coverwidth}{155.575mm} % width + +\newlength{\coverheight} +\setlength{\coverheight}{234.95mm} % height + +\usepackage[margin=0pt, + papersize={\totalwidth,\totalheight}, + noheadfoot]{geometry} +%\usepackage{layout} +\newcommand{\coverpage}[1]{\vbox to \coverheight{\hbox to \coverwidth{#1}}} +\newcommand{\spine}[1]{\vbox to \coverheight{\hbox to \spinewidth{#1}}} + +\parindent=0pt +\parskip=0pt + +\input{frontpage} + +\newcommand{\spinetext}{ +\begin{minipage}[b][\coverheight][t]{\spinewidth} +\begin{center} + \begin{rotate}{270} + \color{covertext} + \hspace{\OPTtopskip} + \begin{minipage}{\coverheight} + {\fontsize{\OPTcoverspinefont}{\OPTcoverspinefont}\fontseries{b}\selectfont% + Homotopy Type Theory} + \end{minipage} + \end{rotate} +\end{center} +\end{minipage} +} + +\newcommand{\backpage}{ +\begin{minipage}[b][\coverheight][t]{\coverwidth} +\begin{center} +\begin{minipage}[t]{0.80\coverwidth} + \color{covertext} + \vspace{\OPTtopskip} + \input{blurb.tex} +\end{minipage} +\end{center} +\end{minipage} +} + +\begin{document} +%\layout +\LRCornerWallPaper{1.0}{cover-lulu-hardcover} +\begin{center} + \vbox{} + \vfill + \mbox{\coverpage{\backpage}\spine{\spinetext}\coverpage{\frontpage}} + \vfill +\end{center} +\end{document} diff --git a/cover-lulu-paperback.png b/cover-lulu-paperback.png new file mode 100644 index 0000000000000000000000000000000000000000..056461245a7aa182cfda343a12b75f10fa6676b9 --- /dev/null +++ b/cover-lulu-paperback.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1710992c554b985e94284755334bd5a2851db9a7b314f63ff7fa4ee2de2d5bd6 +size 3716672 diff --git a/cover-lulu-paperback.tex b/cover-lulu-paperback.tex new file mode 100644 index 0000000000000000000000000000000000000000..790ab82ac670d47eeac736170570d404af1d6d4f --- /dev/null +++ b/cover-lulu-paperback.tex @@ -0,0 +1,97 @@ +% Cover for Lulu.com +\input{opt-ustrade} + +\documentclass[\OPTfontsize]{article} +\input{opt-color} + +\usepackage[utf8]{inputenc} +\usepackage{rotating} +\usepackage{xcolor} +\usepackage{wallpaper} + +\definecolor{covercolor}{cmyk}{\OPTcovercolor} +\definecolor{covertext}{cmyk}{\OPTcovertextcolor} +\pagecolor{covercolor} + +\usepackage{soul} % Inter-letter spacing +\sodef\ugg{}{0pt plus 1fill}{1em plus 1fill}{0pt} + +%%% Set the fonts +\usepackage{mathpazo} +\usepackage[scaled=0.95]{helvet} +\usepackage{courier} +\linespread{1.05} % Palatino looks better with this + +\usepackage{graphicx} +\DeclareGraphicsExtensions{.png} +\input{bmpsize-hack} % for bounding boxes in dvi mode + +% Some of these dimensions are reported by Lulu.com *after* you +% upload the inner PDF file. +% For casewrap hardcover see http://static.lulu.com/static/images/help_casewrap_6x9.gif + +% Dimensions as reported by Lulu.com (download cover template to see) + +% Total document size +\newlength{\totalwidth} +\setlength{\totalwidth}{348.085mm} % width + +\newlength{\totalheight} +\setlength{\totalheight}{234.95mm} % height + +% Spine width +\newlength{\spinewidth} +\setlength{\spinewidth}{36.935mm} + +% Book trim size (trade) +\newlength{\coverwidth} +\setlength{\coverwidth}{152.4mm} % width + +\newlength{\coverheight} +\setlength{\coverheight}{228.6mm} % height + + +\usepackage[margin=0pt, + papersize={\totalwidth,\totalheight}, + noheadfoot]{geometry} +%\usepackage{layout} +\newcommand{\coverpage}[1]{\vbox to \coverheight{\hbox to \coverwidth{#1}}} +\newcommand{\spine}[1]{\vbox to \coverheight{\hbox to \spinewidth{#1}}} + +\parindent=0pt +\parskip=0pt + +\input{frontpage} + +\newcommand{\spinetext}{ +\begin{minipage}[b][\coverheight][t]{\spinewidth} +\begin{center} + \begin{rotate}{270} + \color{covertext} + \hspace{\OPTtopskip} + \begin{minipage}{\coverheight} + {\fontsize{\OPTcoverspinefont}{\OPTcoverspinefont}\fontseries{b}\selectfont% + Homotopy Type Theory} + \end{minipage} + \end{rotate} +\end{center} +\end{minipage} +} + +\newcommand{\backpage}{ +\begin{minipage}[b][\coverheight][t]{\coverwidth} +\begin{center} +\begin{minipage}[t]{0.80\coverwidth} + \color{covertext} + \vspace{\OPTtopskip} + \input{blurb.tex} +\end{minipage} +\end{center} +\end{minipage} +} + +\begin{document} +%\layout +\LRCornerWallPaper{1.0}{cover-lulu-paperback}% +\mbox{\coverpage{\backpage}\spine{\spinetext}\coverpage{\frontpage}}% +\end{document} diff --git a/cover/torus/README.md b/cover/torus/README.md new file mode 100644 index 0000000000000000000000000000000000000000..28abe19559fd0a109ac423cda70b203e97a3fddf --- /dev/null +++ b/cover/torus/README.md @@ -0,0 +1,11 @@ +The torus image on the front cover was generated with +scripts from this directory. Here is how: + +1. An image `torus.jpg` of torus is generated with Mathematica, see `Torus.nb`. +2. Images of symbols are generated with `symbols.py`. +3. Metapixel is used to create the torus image, maybe like this: + + rm -rf srcimg/* dstimg/* && metapixel-prepare srcimg dstimg + metapixel -d 1 -s 3 -w 128 -h 128 -l dstimg --metapixel torus.jpg mosaic-torus.png + +4. The resulting mosaic-torus.png is then cropped and given color with Gimp. diff --git a/cover/torus/Torus.nb b/cover/torus/Torus.nb new file mode 100644 index 0000000000000000000000000000000000000000..ff5002fd915eb282c95d6051663956d42aae6147 --- /dev/null +++ b/cover/torus/Torus.nb @@ -0,0 +1,354 @@ +(*CacheID: 234*) +(* Internal cache information: +NotebookFileLineBreakTest +NotebookFileLineBreakTest +NotebookDataPosition[ 0, 0] +NotebookDataLength[ 13170, 353] +NotebookOptionsPosition[ 12041, 310] +NotebookOutlinePosition[ 12475, 327] +CellTagsIndexPosition[ 12432, 324] +WindowFrame->Normal*) + +(* Beginning of Notebook Content *) +Notebook[{ +Cell[BoxData[{ + RowBox[{"ClearAll", "[", "torus", "]"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"torus", "[", + RowBox[{"m_", ",", "t_", ",", "r_", ",", "q_"}], "]"}], ":=", + "\[IndentingNewLine]", + RowBox[{"Function", "[", + RowBox[{ + RowBox[{"{", + RowBox[{"u", ",", "v"}], "}"}], ",", + RowBox[{"t", "+", + RowBox[{"m", ".", + RowBox[{"{", + RowBox[{ + RowBox[{ + RowBox[{"Cos", "[", "u", "]"}], + RowBox[{"(", + RowBox[{"r", "+", + RowBox[{"q", "*", + RowBox[{"Cos", "[", "v", "]"}]}]}], ")"}]}], ",", + RowBox[{ + RowBox[{"Sin", "[", "u", "]"}], "*", + RowBox[{"(", + RowBox[{"r", "+", + RowBox[{"q", "*", + RowBox[{"Cos", "[", "v", "]"}]}]}], ")"}]}], ",", + RowBox[{"q", "*", + RowBox[{"Sin", "[", "v", "]"}]}]}], "}"}]}]}]}], "]"}]}]}], "Input", + CellChangeTimes->{{3.575007497914714*^9, 3.575007513979257*^9}, { + 3.5750075520216627`*^9, 3.575007597035688*^9}, {3.575007629355833*^9, + 3.575007658325391*^9}, {3.5750077008755217`*^9, 3.575007731479414*^9}, { + 3.5750077855906487`*^9, 3.5750077861611347`*^9}, {3.575007994438464*^9, + 3.575007998817588*^9}, {3.5750080778742123`*^9, 3.575008103454809*^9}, { + 3.575008174228361*^9, 3.5750081851282454`*^9}}], + +Cell[BoxData[ + RowBox[{"pic", "=", + RowBox[{"ParametricPlot3D", "[", "\[IndentingNewLine]", + RowBox[{ + RowBox[{"{", "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{"torus", "[", + RowBox[{ + RowBox[{"RotationMatrix", "[", + RowBox[{"0", ",", + RowBox[{"{", + RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "]"}], ",", + RowBox[{"{", + RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", "3", ",", "1"}], + "]"}], "[", + RowBox[{"u", ",", "v"}], "]"}], ",", "\[IndentingNewLine]", + RowBox[{ + RowBox[{"torus", "[", + RowBox[{ + RowBox[{"RotationMatrix", "[", + RowBox[{ + RowBox[{"Pi", "/", "2"}], ",", + RowBox[{"{", + RowBox[{"1", ",", "1", ",", "0"}], "}"}]}], "]"}], ",", + RowBox[{"{", + RowBox[{ + RowBox[{"Sqrt", "[", "3", "]"}], ",", + RowBox[{"Sqrt", "[", "3", "]"}], ",", "0"}], "}"}], ",", "3", ",", + "1"}], "]"}], "[", + RowBox[{"u", ",", "v"}], "]"}]}], "\[IndentingNewLine]", "}"}], ",", + "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"u", ",", "0", ",", + RowBox[{"2", "Pi"}]}], "}"}], ",", + RowBox[{"{", + RowBox[{"v", ",", "0", ",", + RowBox[{"2", "Pi"}]}], "}"}], ",", "\[IndentingNewLine]", + RowBox[{"Boxed", "\[Rule]", "False"}], ",", + RowBox[{"Axes", "\[Rule]", "False"}], ",", + RowBox[{"Mesh", "\[Rule]", "False"}], ",", + RowBox[{"Lighting", "\[Rule]", + RowBox[{"{", + RowBox[{ + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "0.8", "]"}], ",", + RowBox[{"{", + RowBox[{"5", ",", "5", ",", "5"}], "}"}]}], "}"}], ",", + "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "0.5", "]"}], ",", + RowBox[{"{", + RowBox[{"5", ",", + RowBox[{"-", "5"}], ",", "5"}], "}"}]}], "}"}]}], "}"}]}]}], + "]"}]}]], "Input", + CellChangeTimes->{{3.5750074603736773`*^9, 3.5750074766898947`*^9}, { + 3.575007734777616*^9, 3.575007759592752*^9}, {3.57500779709807*^9, + 3.57500784079035*^9}, {3.575007876454563*^9, 3.575008048438395*^9}, { + 3.5750081293708982`*^9, 3.5750081588892612`*^9}, {3.57500821320293*^9, + 3.575008270497423*^9}, {3.575008301621005*^9, 3.575008408265143*^9}, { + 3.5750084601523647`*^9, 3.575008463607183*^9}, {3.575008525986937*^9, + 3.575008733406006*^9}, {3.575008774951048*^9, 3.575008777059445*^9}, { + 3.575008828312248*^9, 3.575008828654634*^9}}], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{"Export", "[", + RowBox[{"\"\\"", ",", "pic", ",", + RowBox[{"ImageResolution", "\[Rule]", "300"}]}], "]"}]], "Input", + CellChangeTimes->{{3.5750088552959757`*^9, 3.575008856332591*^9}, { + 3.5750101012422523`*^9, 3.575010109343607*^9}, {3.575010142918709*^9, + 3.575010144023197*^9}, {3.575024999760702*^9, 3.575025006137784*^9}}], + +Cell[BoxData["\<\"tori.jpg\"\>"], "Output", + CellChangeTimes->{{3.575010110907318*^9, 3.57501014569147*^9}, + 3.575024904160636*^9, 3.575049070535226*^9}] +}, Open ]], + +Cell[BoxData[ + RowBox[{"pic", "=", + RowBox[{"ParametricPlot3D", "[", "\[IndentingNewLine]", + RowBox[{ + RowBox[{"{", "\[IndentingNewLine]", + RowBox[{ + RowBox[{"torus", "[", + RowBox[{ + RowBox[{"RotationMatrix", "[", + RowBox[{"0", ",", + RowBox[{"{", + RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "]"}], ",", + RowBox[{"{", + RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", "3", ",", "1"}], + "]"}], "[", + RowBox[{"u", ",", "v"}], "]"}], "\[IndentingNewLine]", "}"}], ",", + "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"u", ",", "0", ",", + RowBox[{"2", "Pi"}]}], "}"}], ",", + RowBox[{"{", + RowBox[{"v", ",", "0", ",", + RowBox[{"2", "Pi"}]}], "}"}], ",", "\[IndentingNewLine]", + RowBox[{"Boxed", "\[Rule]", "False"}], ",", + RowBox[{"Axes", "\[Rule]", "False"}], ",", + RowBox[{"Mesh", "\[Rule]", "False"}], ",", + RowBox[{"Background", "\[Rule]", + RowBox[{"GrayLevel", "[", "0.98", "]"}]}], ",", + RowBox[{"Lighting", "\[Rule]", "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{ + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "0.6", "]"}], ",", + RowBox[{"{", + RowBox[{"5", ",", "5", ",", "5"}], "}"}]}], "}"}], ",", + "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "0.3", "]"}]}], "}"}]}], "}"}]}]}], + "]"}]}]], "Input", + CellChangeTimes->{{3.575025285038136*^9, 3.5750252861185703`*^9}, { + 3.5750253543096848`*^9, 3.575025490287694*^9}, {3.575025559882556*^9, + 3.5750256024958982`*^9}, {3.575025649196397*^9, 3.575025684027916*^9}, { + 3.575025832499338*^9, 3.575025864236339*^9}, {3.5750266396533318`*^9, + 3.575026642525339*^9}, {3.5750267210806217`*^9, 3.575026751234239*^9}, { + 3.575026926171913*^9, 3.575026941428458*^9}, {3.575026979154292*^9, + 3.575027011530059*^9}, {3.575027069164358*^9, 3.575027070858553*^9}, { + 3.575027108620347*^9, 3.575027109296626*^9}, {3.575027948340992*^9, + 3.5750279702321167`*^9}}], + +Cell[BoxData[""], "Input", + CellChangeTimes->{{3.575025437034926*^9, 3.575025438002881*^9}}], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{"Export", "[", + RowBox[{"\"\\"", ",", " ", "pic", ",", " ", + RowBox[{"ImageResolution", "\[Rule]", "300"}]}], "]"}]], "Input", + CellChangeTimes->{{3.575025296296578*^9, 3.575025305455855*^9}, { + 3.575027986751356*^9, 3.5750279880097303`*^9}}], + +Cell[BoxData["\<\"torus.jpg\"\>"], "Output", + CellChangeTimes->{ + 3.5750253064427834`*^9, 3.5750255010662518`*^9, 3.57502560902934*^9, + 3.5750256926724033`*^9, 3.575025871884837*^9, 3.575026756781699*^9, + 3.575026947337076*^9, {3.5750270475830803`*^9, 3.5750270762412357`*^9}, + 3.5750271178765087`*^9, 3.575027989420265*^9, 3.575049073357514*^9}] +}, Open ]], + +Cell[BoxData[ + RowBox[{"pic", "=", + RowBox[{"Graphics3D", "[", + RowBox[{ + RowBox[{"Sphere", "[", "]"}], ",", "\[IndentingNewLine]", + RowBox[{"Boxed", "\[Rule]", "False"}], ",", + RowBox[{"Background", "\[Rule]", + RowBox[{"GrayLevel", "[", "0.98", "]"}]}], ",", + RowBox[{"Lighting", "\[Rule]", "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{ + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "0.6", "]"}], ",", + RowBox[{"{", + RowBox[{"0", ",", + RowBox[{"-", "2"}], ",", "2"}], "}"}]}], "}"}], ",", + "\[IndentingNewLine]", "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "0.3", "]"}]}], "}"}]}], "}"}]}]}], + "]"}]}]], "Input", + CellChangeTimes->{{3.5750273586505203`*^9, 3.575027553672594*^9}, { + 3.575027601822229*^9, 3.575027617537323*^9}, {3.575027695761964*^9, + 3.575027695945859*^9}}], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{"Export", "[", + RowBox[{"\"\\"", ",", " ", "pic", ",", + RowBox[{"ImageResolution", "\[Rule]", "300"}]}], "]"}]], "Input", + CellChangeTimes->{{3.5750275448969307`*^9, 3.5750275604751*^9}}], + +Cell[BoxData["\<\"sphere.jpg\"\>"], "Output", + CellChangeTimes->{3.57502756152036*^9, 3.5750276239271603`*^9, + 3.575027700190448*^9, 3.575049074683049*^9}] +}, Open ]], + +Cell[BoxData[ + RowBox[{"pic", "=", + RowBox[{"ParametricPlot3D", "[", "\[IndentingNewLine]", + RowBox[{ + RowBox[{"{", + RowBox[{ + RowBox[{"torus", "[", + RowBox[{ + RowBox[{"RotationMatrix", "[", + RowBox[{"0", ",", + RowBox[{"{", + RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "]"}], ",", + RowBox[{"{", + RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", "9", ",", "4"}], + "]"}], "[", + RowBox[{"u", ",", "v"}], "]"}], "\[IndentingNewLine]", "}"}], ",", + "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"u", ",", "0", ",", + RowBox[{"2", "Pi"}]}], "}"}], ",", + RowBox[{"{", + RowBox[{"v", ",", "0", ",", + RowBox[{"2", "Pi"}]}], "}"}], ",", "\[IndentingNewLine]", + RowBox[{"Boxed", "\[Rule]", "False"}], ",", + RowBox[{"Axes", "\[Rule]", "False"}], ",", + RowBox[{"Mesh", "\[Rule]", + RowBox[{"{", + RowBox[{"20", ",", "20"}], "}"}]}], ",", + RowBox[{"MeshStyle", "\[Rule]", + RowBox[{"Thickness", "[", "0.006", "]"}]}], ",", + RowBox[{"Lighting", "\[Rule]", "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{ + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "0.6", "]"}], ",", + RowBox[{"{", + RowBox[{"5", ",", "5", ",", "5"}], "}"}]}], "}"}], ",", + "\[IndentingNewLine]", + RowBox[{"{", + RowBox[{"\"\\"", ",", + RowBox[{"GrayLevel", "[", "1.0", "]"}]}], "}"}]}], "}"}]}]}], + "]"}]}]], "Input", + CellChangeTimes->{{3.5750280287621403`*^9, 3.5750280399278927`*^9}, { + 3.5750281206545887`*^9, 3.575028140262444*^9}, {3.5750282095211277`*^9, + 3.575028411340498*^9}, {3.575028513746626*^9, 3.5750285149808273`*^9}, { + 3.575028565153102*^9, 3.575028576435603*^9}, {3.575028614268888*^9, + 3.57502861663518*^9}, {3.5750286502604856`*^9, 3.575028667957321*^9}, { + 3.575028702423554*^9, 3.575028738837942*^9}, {3.575028775720426*^9, + 3.575028776057373*^9}, {3.575028869874096*^9, 3.575028873948093*^9}, { + 3.575049051550745*^9, 3.575049053326434*^9}, {3.575049095852672*^9, + 3.575049104580035*^9}}], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{"Export", "[", + RowBox[{"\"\\"", ",", "pic", ",", + RowBox[{"ImageResolution", "\[Rule]", "900"}]}], "]"}]], "Input", + CellChangeTimes->{{3.5750284389216022`*^9, 3.575028451068201*^9}, { + 3.575028890584002*^9, 3.575028893093935*^9}, {3.575049114609*^9, + 3.575049115913175*^9}}], + +Cell[BoxData["\<\"torus.png\"\>"], "Output", + CellChangeTimes->{ + 3.575028453439415*^9, 3.575028526269167*^9, 3.575028584785966*^9, + 3.575028622186308*^9, 3.575028677156248*^9, 3.575028785220005*^9, { + 3.575028880042776*^9, 3.575028897213284*^9}, 3.5750490811049767`*^9, + 3.575049130061048*^9}] +}, Open ]] +}, +WindowSize->{740, 855}, +WindowMargins->{{170, Automatic}, {Automatic, 6}}, +PrivateNotebookOptions->{"VersionedStylesheet"->{"Default.nb"[8.] -> False}}, +FrontEndVersion->"9.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (January 25, \ +2013)", +StyleDefinitions->"Default.nb" +] +(* End of Notebook Content *) + +(* Internal cache information *) +(*CellTagsOutline +CellTagsIndex->{} +*) +(*CellTagsIndex +CellTagsIndex->{} +*) +(*NotebookFileOutline +Notebook[{ +Cell[400, 13, 1324, 33, 63, "Input"], +Cell[1727, 48, 2616, 64, 165, "Input"], +Cell[CellGroupData[{ +Cell[4368, 116, 369, 6, 28, "Input"], +Cell[4740, 124, 156, 2, 28, "Output"] +}, Open ]], +Cell[4911, 129, 2125, 49, 165, "Input"], +Cell[7039, 180, 92, 1, 28, "Input"], +Cell[CellGroupData[{ +Cell[7156, 185, 283, 5, 28, "Input"], +Cell[7442, 192, 356, 5, 28, "Output"] +}, Open ]], +Cell[7813, 200, 982, 24, 97, "Input"], +Cell[CellGroupData[{ +Cell[8820, 228, 228, 4, 28, "Input"], +Cell[9051, 234, 157, 2, 28, "Output"] +}, Open ]], +Cell[9223, 239, 2152, 51, 148, "Input"], +Cell[CellGroupData[{ +Cell[11400, 294, 319, 6, 28, "Input"], +Cell[11722, 302, 303, 5, 28, "Output"] +}, Open ]] +} +] +*) + diff --git a/cover/torus/mosaic-torus.png b/cover/torus/mosaic-torus.png new file mode 100644 index 0000000000000000000000000000000000000000..3ca90b2b3768b75e63494cd69a324e5567d8eac8 --- /dev/null +++ b/cover/torus/mosaic-torus.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:457a237b3633633f5fac6895b8ccf238b189727de5ac302c69a847c6f3ea7a35 +size 2502671 diff --git a/cover/torus/symbols.py b/cover/torus/symbols.py new file mode 100644 index 0000000000000000000000000000000000000000..2b1d054f4a92fb211bbad369c6e30558a2f704bd --- /dev/null +++ b/cover/torus/symbols.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +# This script generates symbol images from which the +# torus picture is then assembled. + +import subprocess +import os +import os.path + +symbols = [ + r"$$\sum$$", + r"$$\prod$$", + r"$$\lambda$$", + r"$$\times$$", + r"$$\simeq$$" +] + +ncols = 1 + +colors = [("gray", str(float(i)/ncols)) for i in range(0, ncols+1)] + +## Generate LaTeX + +template = r""" +\documentclass{article} +\usepackage{palatino} +\usepackage{amsmath,amssymb,amsfonts} +\usepackage{xcolor} +\pagestyle{empty} +\begin{document} +%s +\end{document}""" + +tex = "" +for (i, s) in enumerate(symbols): + for (j, (m,c)) in enumerate(colors): + tex = tex + (r"\definecolor{mycolor}{%s}{%s}\textcolor{mycolor}{%s}\newpage" % (m, c, s)) + "\n" + +# Write LaTeX to file + +with open("temp.tex", "w") as f: + f.write(template % tex) + +# Process LaTeX and generate png files + +subprocess.call(["latex", "temp.tex"]) +subprocess.call(["dvipng", "-D", "1200", "-o", "preimg/image_%02d.png", "-T", "tight", "temp.dvi"]) + +# Convert png files to jpg + +filelist = [f for f in os.listdir('preimg') if f.endswith(".png")] +for f in filelist: + fin = os.path.join("preimg", f) + fout = os.path.join("srcimg", os.path.splitext(f)[0] + ".jpg") + subprocess.call(["convert", "-bordercolor", "white", "-border", "20x20", "-quality", "100", fin, fout]) + +# Remove auxiliary files + +for f in filelist: + os.remove(os.path.join("preimg", f)) + +for f in [f for f in os.listdir('.') if f.startswith("temp.")]: + os.remove(f) diff --git a/cover/torus/torus-clipped.xcf b/cover/torus/torus-clipped.xcf new file mode 100644 index 0000000000000000000000000000000000000000..e2a076d6c5b1d0903b121c938485755d7d92984b --- /dev/null +++ b/cover/torus/torus-clipped.xcf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af227261cd1a7295a2e4f6daea5cdc0f7fd61a41144785001205f53ad1157139 +size 49466994 diff --git a/equivalences.tex b/equivalences.tex new file mode 100644 index 0000000000000000000000000000000000000000..2b3235b27003e3591264be728815836da2a5c28d --- /dev/null +++ b/equivalences.tex @@ -0,0 +1,1118 @@ +\chapter{Equivalences} +\label{cha:equivalences} + +We now study in more detail the notion of \emph{equivalence of types} that was introduced briefly in \cref{sec:basics-equivalences}. +Specifically, we will give several different ways to define a type $\isequiv(f)$ having the properties mentioned there. +Recall that we wanted $\isequiv(f)$ to have the following properties, which we restate here: +\begin{enumerate} +\item $\qinv(f) \to \isequiv (f)$.\label{item:beb1} +\item $\isequiv (f) \to \qinv(f)$.\label{item:beb2} +\item $\isequiv(f)$ is a mere proposition.\label{item:beb3} +\end{enumerate} +Here $\qinv(f)$ denotes the type of quasi-inverses to $f$: +\begin{equation*} + \sm{g:B\to A} \big((f \circ g \htpy \idfunc[B]) \times (g\circ f \htpy \idfunc[A])\big). +\end{equation*} +By function extensionality, it follows that $\qinv(f)$ is equivalent to the type +\begin{equation*} + \sm{g:B\to A} \big((f \circ g = \idfunc[B]) \times (g\circ f = \idfunc[A])\big). +\end{equation*} +We will define three different types having properties~\ref{item:beb1}--\ref{item:beb3}, which we call +\begin{itemize} +\item half adjoint equivalences, +\item bi-invertible maps, + \index{function!bi-invertible} + and +\item contractible functions. +\end{itemize} +We will also show that all these types are equivalent. +These names are intentionally somewhat cumbersome, because after we know that they are all equivalent and have properties~\ref{item:beb1}--\ref{item:beb3}, we will revert to saying simply ``equivalence'' without needing to specify which particular definition we choose. +But for purposes of the comparisons in this chapter, we need different names for each definition. + +Before we examine the different notions of equivalence, however, we give a little more explanation of why a different concept than quasi-invertibility is needed. + +\section{Quasi-inverses} +\label{sec:quasi-inverses} + +\index{quasi-inverse|(}% +We have said that $\qinv(f)$ is unsatisfactory because it is not a mere proposition, whereas we would rather that a given function could ``be an equivalence'' in at most one way. +However, we have given no evidence that $\qinv(f)$ is not a mere proposition. +In this section we exhibit a specific counterexample. + +\begin{lem}\label{lem:qinv-autohtpy} + If $f:A\to B$ is such that $\qinv (f)$ is inhabited, then + \[\eqv{\qinv(f)}{\Parens{\prd{x:A}(x=x)}}.\] +\end{lem} +\begin{proof} + By assumption, $f$ is an equivalence; that is, we have $e:\isequiv(f)$ and so $(f,e):\eqv A B$. + By univalence, $\idtoeqv:(A=B) \to (\eqv A B)$ is an equivalence, so we may assume that $(f,e)$ is of the form $\idtoeqv(p)$ for some $p:A=B$. + Then by path induction, we may assume $p$ is $\refl{A}$, in which case $f$ is $\idfunc[A]$. + Thus we are reduced to proving $\eqv{\qinv(\idfunc[A])}{(\prd{x:A}(x=x))}$. + Now by definition we have + \[ \qinv(\idfunc[A]) \jdeq + \sm{g:A\to A} \big((g \htpy \idfunc[A]) \times (g \htpy \idfunc[A])\big). + \] + By function extensionality, this is equivalent to + \[ \sm{g:A\to A} \big((g = \idfunc[A]) \times (g = \idfunc[A])\big). + \] + And by \cref{ex:sigma-assoc}, this is equivalent to + \[ \sm{h:\sm{g:A\to A} (g = \idfunc[A])} (\proj1(h) = \idfunc[A]) + \] + However, by \cref{thm:contr-paths}, $\sm{g:A\to A} (g = \idfunc[A])$ is contractible with center $(\idfunc[A],\refl{\idfunc[A]})$; therefore by \cref{thm:omit-contr} this type is equivalent to $\idfunc[A] = \idfunc[A]$. + And by function extensionality, $\idfunc[A] = \idfunc[A]$ is equivalent to $\prd{x:A} x=x$. +\end{proof} + +\noindent +We remark that \cref{ex:qinv-autohtpy-no-univalence} asks for a proof of the above lemma which avoids univalence. + +Thus, what we need is some $A$ which admits a nontrivial element of $\prd{x:A}(x=x)$. +Thinking of $A$ as a higher groupoid, an inhabitant of $\prd{x:A}(x=x)$ is a natural transformation\index{natural!transformation} from the identity functor of $A$ to itself. +Such transformations are said to form the \define{center of a category}, +\index{center!of a category}% +\index{category!center of}% +since the naturality axiom requires that they commute with all morphisms. +Classically, if $A$ is simply a group regarded as a one-object groupoid, then this yields precisely its center in the usual group-theoretic sense. +This provides some motivation for the following. + +\begin{lem}\label{lem:autohtpy} + Suppose we have a type $A$ with $a:A$ and $q:a=a$ such that + \begin{enumerate} + \item The type $a=a$ is a set.\label{item:autohtpy1} + \item For all $x:A$ we have $\brck{a=x}$.\label{item:autohtpy2} + \item For all $p:a=a$ we have $p\ct q = q \ct p$.\label{item:autohtpy3} + \end{enumerate} + Then there exists $f:\prd{x:A} (x=x)$ with $f(a)=q$. +\end{lem} +\begin{proof} + Let $g:\prd{x:A} \brck{a=x}$ be as given by~\ref{item:autohtpy2}. First we + observe that each type $\id[A]xy$ is a set. For since being a set is a mere + proposition, we may apply the induction principle of propositional truncation, and assume that $g(x)=\bproj + p$ and $g(y)=\bproj{p'}$ for $p:a=x$ and $p':a=y$. In this case, composing with + $p$ and $\opp{p'}$ yields an equivalence $\eqv{(x=y)}{(a=a)}$. But $(a=a)$ is + a set by~\ref{item:autohtpy1}, so $(x=y)$ is also a set. + + Now, we would like to define $f$ by assigning to each $x$ the path $\opp{g(x)} + \ct q \ct g(x)$, but this does not work because $g(x)$ does not inhabit $a=x$ + but rather $\brck{a=x}$, and the type $(x=x)$ may not be a mere proposition, + so we cannot use induction on propositional truncation. Instead we can apply + the technique mentioned in \cref{sec:unique-choice}: we characterize + uniquely the object we wish to construct. Let us define, for each $x:A$, the + type + \[ B(x) \defeq \sm{r:x=x} \prd{s:a=x} (r = \opp s \ct q\ct s).\] + We claim that $B(x)$ is a mere proposition for each $x:A$. + Since this claim is itself a mere proposition, we may again apply induction on + truncation and assume that $g(x) = \bproj p$ for some $p:a=x$. + Now suppose given $(r,h)$ and $(r',h')$ in $B(x)$; then we have + \[ h(p) \ct \opp{h'(p)} : r = r'. \] + It remains to show that $h$ is identified with $h'$ when transported along this equality, which by transport in identity types and function types (\cref{sec:compute-paths,sec:compute-pi}), reduces to showing + \[ h(s) = h(p) \ct \opp{h'(p)} \ct h'(s) \] + for any $s:a=x$. + But each side of this is an equality between elements of $(x=x)$, so it follows from our above observation that $(x=x)$ is a set. + + Thus, each $B(x)$ is a mere proposition; we claim that $\prd{x:A} B(x)$. + Given $x:A$, we may now invoke the induction principle of propositional truncation to assume that $g(x) = \bproj p$ for $p:a=x$. + We define $r \defeq \opp p \ct q \ct p$; to inhabit $B(x)$ it remains to show that for any $s:a=x$ we have + $r = \opp s \ct q \ct s$. + Manipulating paths, this reduces to showing that $q\ct (p\ct \opp s) = (p\ct \opp s) \ct q$. + But this is just an instance of~\ref{item:autohtpy3}. +\end{proof} + +\begin{thm}\label{thm:qinv-notprop} + There exist types $A$ and $B$ and a function $f:A\to B$ such that $\qinv(f)$ is not a mere proposition. +\end{thm} +\begin{proof} + It suffices to exhibit a type $X$ such that $\prd{x:X} (x=x)$ is not a mere proposition. + Define $X\defeq \sm{A:\type} \brck{\bool=A}$, as in the proof of \cref{thm:no-higher-ac}. + It will suffice to exhibit an $f:\prd{x:X} (x=x)$ which is unequal to $\lam{x} \refl{x}$. + + Let $a \defeq (\bool,\bproj{\refl{\bool}}) : X$, and let $q:a=a$ be the path corresponding to the nonidentity equivalence $e:\eqv\bool\bool$ defined by $e(\bfalse)\defeq\btrue$ and $e(\btrue)\defeq\bfalse$. + We would like to apply \cref{lem:autohtpy} to build an $f$. + By definition of $X$, equalities in subset types (\cref{subsec:prop-subsets}), and univalence, we have $\eqv{(a=a)}{(\eqv{\bool}{\bool})}$, which is a set, so~\ref{item:autohtpy1} holds. + Similarly, by definition of $X$ and equalities in subset types we have~\ref{item:autohtpy2}. + Finally, \cref{ex:eqvboolbool} implies that every equivalence $\eqv\bool\bool$ is equal to either $\idfunc[\bool]$ or $e$, so we can show~\ref{item:autohtpy3} by a four-way case analysis. + + Thus, we have $f:\prd{x:X} (x=x)$ such that $f(a) = q$. + Since $e$ is not equal to $\idfunc[\bool]$, $q$ is not equal to $\refl{a}$, and thus $f$ is not equal to $\lam{x} \refl{x}$. + Therefore, $\prd{x:X} (x=x)$ is not a mere proposition. +\end{proof} + +More generally, \cref{lem:autohtpy} implies that any ``Eilenberg--Mac Lane space'' $K(G,1)$, where $G$ is a nontrivial abelian\index{group!abelian} group, will provide a counterexample; see \cref{cha:homotopy}. +The type $X$ we used turns out to be equivalent to $K(\mathbb{Z}_2,1)$. +In \cref{cha:hits} we will see that the circle $\Sn^1 = K(\mathbb{Z},1)$ is another easy-to-describe example. + +We now move on to describing better notions of equivalence. + +\index{quasi-inverse|)}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Half adjoint equivalences} +\label{sec:hae} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\index{equivalence!half adjoint|(defstyle}% +\index{half adjoint equivalence|(defstyle}% +\index{adjoint!equivalence!of types, half|(defstyle}% + +In \cref{sec:quasi-inverses} we concluded that $\qinv(f)$ is equivalent to $\prd{x:A} (x=x)$ by discarding a contractible type. +Roughly, the type $\qinv(f)$ contains three data $g$, $\eta$, and $\epsilon$, of which two ($g$ and $\eta$) could together be seen to be contractible when $f$ is an equivalence. +The problem is that removing these data left one remaining ($\epsilon$). +In order to solve this problem, the idea is to add one \emph{additional} datum which, together with $\epsilon$, forms a contractible type. + +\begin{defn}\label{defn:ishae} + A function $f:A\to B$ is a \define{half adjoint equivalence} + if there are $g:B\to A$ and homotopies $\eta: g \circ f \htpy \idfunc[A]$ and $\epsilon:f \circ g \htpy \idfunc[B]$ such that there exists a homotopy + \[\tau : \prd{x:A} \map{f}{\eta x} = \epsilon(fx).\] +\end{defn} + +Thus we have a type $\ishae(f)$, defined to be +\begin{equation*} + \sm{g:B\to A}{\eta: g \circ f \htpy \idfunc[A]}{\epsilon:f \circ g \htpy \idfunc[B]} \prd{x:A} \map{f}{\eta x} = \epsilon(fx). +\end{equation*} +Note that in the above definition, the coherence\index{coherence} condition relating $\eta$ and $\epsilon$ only involves $f$. +We might consider instead an analogous coherence condition involving $g$: +\[\upsilon : \prd{y:B} \map{g}{\epsilon y} = \eta(gy)\] +and a resulting analogous definition $\ishae'(f)$. + +Fortunately, it turns out each of the conditions implies the other one: + +\begin{lem}\label{lem:coh-equiv} +For functions $f : A \to B$ and $g:B\to A$ and homotopies $\eta: g \circ f \htpy \idfunc[A]$ and $\epsilon:f \circ g \htpy \idfunc[B]$, the following conditions are logically equivalent: +\begin{itemize} +\item $\prd{x:A} \map{f}{\eta x} = \epsilon(fx)$ +\item $\prd{y:B} \map{g}{\epsilon y} = \eta(gy)$ +\end{itemize} +\end{lem} +\begin{proof} + It suffices to show one direction; the other one is obtained by replacing $A$, $f$, and $\eta$ by $B$, $g$, and $\epsilon$ respectively. + Let $\tau : \prd{x:A}\;\map{f}{\eta x} = \epsilon(fx)$. + Fix $y : B$. + Using naturality of $\epsilon$ and applying $g$, we get the following commuting diagram of paths: +\[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} + \xymatrix@C=3pc{gfgfgy \ar@{=}^-{gfg(\epsilon y)}[r] \ar@{=}_{g(\epsilon (fgy))}[d] & gfgy \ar@{=}^{g(\epsilon y)}[d] \\ gfgy \ar@{=}_{g(\epsilon y)}[r] & gy + }\] +Using $\tau(gy)$ on the left side of the diagram gives us +\[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} + \xymatrix@C=3pc{gfgfgy \ar@{=}^-{gfg(\epsilon y)}[r] \ar@{=}_{gf(\eta (gy))}[d] & gfgy \ar@{=}^{g(\epsilon y)}[d] \\ gfgy \ar@{=}_{g(\epsilon y)}[r] & gy + }\] +Using the commutativity of $\eta$ with $g \circ f$ (\cref{cor:hom-fg}), we have +\[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} + \xymatrix@C=3pc{gfgfgy \ar@{=}^-{gfg(\epsilon y)}[r] \ar@{=}_{\eta (gfgy)}[d] & gfgy \ar@{=}^{g(\epsilon y)}[d] \\ gfgy \ar@{=}_{g(\epsilon y)}[r] & gy + }\] +However, by naturality of $\eta$ we also have +\[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} + \xymatrix@C=3pc{gfgfgy \ar@{=}^-{gfg(\epsilon y)}[r] \ar@{=}_{\eta (gfgy)}[d] & gfgy \ar@{=}^{\eta(gy)}[d] \\ gfgy \ar@{=}_{g(\epsilon y)}[r] & gy + }\] +Thus, canceling all but the right-hand homotopy, we have $g(\epsilon y) = \eta(g y)$ as desired. +\end{proof} + +However, it is important that we do not include \emph{both} $\tau$ and $\upsilon$ in the definition of $\ishae (f)$ (whence the name ``\emph{half} adjoint equivalence''). +If we did, then after canceling contractible types we would still have one remaining datum --- unless we added another higher coherence condition. +In general, we expect to get a well-behaved type if we cut off after an odd number of coherences. + +Of course, it is obvious that $\ishae(f) \to\qinv(f)$: simply forget the coherence datum. +The other direction is a version of a standard argument from homotopy theory and category theory. + +\begin{thm}\label{thm:equiv-iso-adj} + For any $f:A\to B$ we have $\qinv(f)\to\ishae(f)$. +\end{thm} +\begin{proof} +Suppose that $(g,\eta,\epsilon)$ is a quasi-inverse for $f$. We have to provide +a quadruple $(g',\eta',\epsilon',\tau)$ witnessing that $f$ is a half adjoint equivalence. To +define $g'$ and $\eta'$, we can just make the obvious choice by setting $g' +\defeq g$ and $\eta'\defeq \eta$. However, in the definition of $\epsilon'$ we +need start worrying about the construction of $\tau$, so we cannot just follow our nose +and take $\epsilon'$ to be $\epsilon$. Instead, we take +\begin{equation*} +\epsilon'(b) \defeq \opp{\epsilon(f(g(b)))}\ct (\ap{f}{\eta(g(b))}\ct \epsilon(b)). +\end{equation*} +Now we need to find +\begin{equation*} +\tau(a): \ap{f}{\eta(a)}=\opp{\epsilon(f(g(f(a))))}\ct (\ap{f}{\eta(g(f(a)))}\ct \epsilon(f(a))). +\end{equation*} +Note first that by \cref{cor:hom-fg}, we have +%$\eta(g(f(a)))\ct\eta(a)=\ap{g}{\ap{f}{\eta(a)}}\ct\eta(a)$ and hence it follows that +$\eta(g(f(a)))=\ap{g}{\ap{f}{\eta(a)}}$. Therefore, we can apply +\cref{lem:htpy-natural} to compute +\begin{align*} +\ap{f}{\eta(g(f(a)))}\ct \epsilon(f(a)) +& = \ap{f}{\ap{g}{\ap{f}{\eta(a)}}}\ct \epsilon(f(a))\\ +& = \epsilon(f(g(f(a))))\ct \ap{f}{\eta(a)} +\end{align*} +from which we get the desired path $\tau(a)$. +\end{proof} + +Combining this with \cref{lem:coh-equiv} (or symmetrizing the proof), we also have $\qinv(f)\to\ishae'(f)$. + +It remains to show that $\ishae(f)$ is a mere proposition. +For this, we will need to know that the fibers of an equivalence are contractible. + +\begin{defn}\label{defn:homotopy-fiber} + The \define{fiber} + \indexdef{fiber}% + \indexsee{function!fiber of}{fiber}% + of a map $f:A\to B$ over a point $y:B$ is + \[ \hfib f y \defeq \sm{x:A} (f(x) = y).\] +\end{defn} + +In homotopy theory, this is what would be called the \emph{homotopy fiber} of $f$. +The path lemmas in \cref{sec:computational} yield the following characterization of paths in fibers: + +\begin{lem}\label{lem:hfib} + For any $f : A \to B$, $y : B$, and $(x,p),(x',p') : \hfib{f}{y}$, we have + \[ \big((x,p) = (x',p')\big) \eqvsym \Parens{\sm{\gamma : x = x'} f(\gamma) \ct p' = p} \qedhere\] +\end{lem} + +\begin{thm}\label{thm:contr-hae} + If $f:A\to B$ is a half adjoint equivalence, then for any $y:B$ the fiber $\hfib f y$ is contractible. +\end{thm} +\begin{proof} + Let $(g,\eta,\epsilon,\tau) : \ishae(f)$, and fix $y : B$. + As our center of contraction for $\hfib{f}{y}$ we choose $(gy, \epsilon y)$. + Now take any $(x,p) : \hfib{f}{y}$; we want to construct a path from $(gy, \epsilon y)$ to $(x,p)$. + By \cref{lem:hfib}, it suffices to give a path $\gamma : \id{gy}{x}$ such that $\ap f\gamma \ct p = \epsilon y$. + We put $\gamma \defeq \opp{g(p)} \ct \eta x$. + Then we have + \begin{align*} + f(\gamma) \ct p & = \opp{fg(p)} \ct f (\eta x) \ct p \\ + & = \opp{fg(p)} \ct \epsilon(fx) \ct p \\ + & = \epsilon y + \end{align*} + where the second equality follows by $\tau x$ and the third equality is naturality of $\epsilon$. +\end{proof} + +We now define the types which encapsulate contractible pairs of data. +The following types put together the quasi-inverse $g$ with one of the homotopies. + +\begin{defn}\label{defn:linv-rinv} + Given a function $f:A\to B$, we define the types + \begin{align*} + \linv(f) &\defeq \sm{g:B\to A} (g\circ f\htpy \idfunc[A])\\ + \rinv(f) &\defeq \sm{g:B\to A} (f\circ g\htpy \idfunc[B]) + \end{align*} + of \define{left inverses} + \indexdef{left!inverse}% + \indexdef{inverse!left}% + and \define{right inverses} + \indexdef{right!inverse}% + \indexdef{inverse!right}% + to $f$, respectively. + We call $f$ \define{left invertible} + \indexdef{function!left invertible}% + \indexdef{function!right invertible}% + if $\linv(f)$ is inhabited, and similarly \define{right invertible} + \indexdef{left!invertible function}% + \indexdef{right!invertible function}% + if $\rinv(f)$ is inhabited. +\end{defn} + +\begin{lem}\label{thm:equiv-compose-equiv} + If $f:A\to B$ has a quasi-inverse, then so do + \begin{align*} + (f\circ \blank) &: (C\to A) \to (C\to B)\\ + (\blank\circ f) &: (B\to C) \to (A\to C). + \end{align*} +\end{lem} +\begin{proof} + If $g$ is a quasi-inverse of $f$, then $(g\circ \blank)$ and $(\blank\circ g)$ are quasi-inverses of $(f\circ \blank)$ and $(\blank\circ f)$ respectively. +\end{proof} + +\begin{lem}\label{lem:inv-hprop} + If $f : A \to B$ has a quasi-inverse, then the types $\rinv(f)$ and $\linv(f)$ are contractible. +\end{lem} +\begin{proof} + By function extensionality, we have + \[\eqv{\linv(f)}{\sm{g:B\to A} (g\circ f = \idfunc[A])}.\] + But this is the fiber of $(\blank\circ f)$ over $\idfunc[A]$, and so + by \cref{thm:equiv-compose-equiv,thm:equiv-iso-adj,thm:contr-hae}, it is contractible. + Similarly, $\rinv(f)$ is equivalent to the fiber of $(f\circ \blank)$ over $\idfunc[B]$ and hence contractible. +\end{proof} + +Next we define the types which put together the other homotopy with the additional coherence datum.\index{coherence}% + +\begin{defn}\label{defn:lcoh-rcoh} +For $f : A \to B$, a left inverse $(g,\eta) : \linv(f)$, and a right inverse $(g,\epsilon) : \rinv(f)$, we denote +\begin{align*} +\lcoh{f}{g}{\eta} & \defeq \sm{\epsilon : f\circ g \htpy \idfunc[B]} \prd{y:B} g(\epsilon y) = \eta (gy), \\ +\rcoh{f}{g}{\epsilon} & \defeq \sm{\eta : g\circ f \htpy \idfunc[A]} \prd{x:A} f(\eta x) = \epsilon (fx). +\end{align*} +\end{defn} + +\begin{lem}\label{lem:coh-hfib} +For any $f,g,\epsilon,\eta$, we have +\begin{align*} +\lcoh{f}{g}{\eta} & \eqvsym {\prd{y:B} \id[\hfib{g}{gy}]{(fgy,\eta(gy))}{(y,\refl{gy})}}, \\ +\rcoh{f}{g}{\epsilon} & \eqvsym {\prd{x:A} \id[\hfib{f}{fx}]{(gfx,\epsilon(fx))}{(x,\refl{fx})}}. +\end{align*} +\end{lem} +\begin{proof} +Using \cref{lem:hfib}. +\end{proof} + +\begin{lem}\label{lem:coh-hprop} + If $f$ is a half adjoint equivalence, then for any $(g,\epsilon) : \rinv(f)$, the type $\rcoh{f}{g}{\epsilon}$ is contractible. +\end{lem} +\begin{proof} + By \cref{lem:coh-hfib} and the fact that dependent function types preserve contractible spaces, it suffices to show that for each $x:A$, the type $\id[\hfib{f}{fx}]{(gfx,\epsilon(fx))}{(x,\refl{fx})}$ is contractible. + But by \cref{thm:contr-hae}, $\hfib{f}{fx}$ is contractible, and any path space of a contractible space is itself contractible. +\end{proof} + +\begin{thm}\label{thm:hae-hprop} + For any $f : A \to B$, the type $\ishae(f)$ is a mere proposition. +\end{thm} +\begin{proof} + By \cref{ex:prop-inhabcontr} it suffices to assume $f$ to be a half adjoint equivalence and show that $\ishae(f)$ is contractible. + Now by associativity of $\Sigma$ (\cref{ex:sigma-assoc}), the type $\ishae(f)$ is equivalent to + \[\sm{u : \rinv(f)} \rcoh{f}{\proj{1}(u)}{\proj{2}(u)}.\] + But by \cref{lem:inv-hprop,lem:coh-hprop} and the fact that $\Sigma$ preserves contractibility, the latter type is also contractible. +\end{proof} + +Thus, we have shown that $\ishae(f)$ has all three desiderata for the type $\isequiv(f)$. +In the next two sections we consider a couple of other possibilities. + +\index{equivalence!half adjoint|)}% +\index{half adjoint equivalence|)}% +\index{adjoint!equivalence!of types, half|)}% + +\section{Bi-invertible maps} +\label{sec:biinv} + +\index{function!bi-invertible|(defstyle}% +\index{bi-invertible function|(defstyle}% +\index{equivalence!as bi-invertible function|(defstyle}% + +Using the language introduced in \cref{sec:hae}, we can restate the definition proposed in \cref{sec:basics-equivalences} as follows. + +\begin{defn}\label{defn:biinv} + We say $f:A\to B$ is \define{bi-invertible} + if it has both a left inverse and a right inverse: + \[ \biinv (f) \defeq \linv(f) \times \rinv(f). \] +\end{defn} + +In \cref{sec:basics-equivalences} we proved that $\qinv(f)\to\biinv(f)$ and $\biinv(f)\to\qinv(f)$. +What remains is the following. + +\begin{thm}\label{thm:isprop-biinv} + For any $f:A\to B$, the type $\biinv(f)$ is a mere proposition. +\end{thm} +\begin{proof} + We may suppose $f$ to be bi-invertible and show that $\biinv(f)$ is contractible. + But since $\biinv(f)\to\qinv(f)$, by \cref{lem:inv-hprop} in this case both $\linv(f)$ and $\rinv(f)$ are contractible, and the product of contractible types is contractible. +\end{proof} + +Note that this also fits the proposal made at the beginning of \cref{sec:hae}: we combine $g$ and $\eta$ into a contractible type and add an additional datum which combines with $\epsilon$ into a contractible type. +The difference is that instead of adding a \emph{higher} datum (a 2-dimensional path) to combine with $\epsilon$, we add a \emph{lower} one (a right inverse that is separate from the left inverse). + +\begin{cor}\label{thm:equiv-biinv-isequiv} + For any $f:A\to B$ we have $\eqv{\biinv(f)}{\ishae(f)}$. +\end{cor} +\begin{proof} + We have $\biinv(f) \to \qinv(f) \to \ishae(f)$ and $\ishae(f) \to \qinv(f) \to \biinv(f)$. + Since both $\ishae(f)$ and $\biinv(f)$ are mere propositions, the equivalence follows from \cref{lem:equiv-iff-hprop}. +\end{proof} + +\index{function!bi-invertible|)}% +\index{bi-invertible function|)}% +\index{equivalence!as bi-invertible function|)}% + +\section{Contractible fibers} +\label{sec:contrf} + +\index{function!contractible|(defstyle}% +\index{contractible!function|(defstyle}% +\index{equivalence!as contractible function|(defstyle}% + +Note that our proofs about $\ishae(f)$ and $\biinv(f)$ made essential use of the fact that the fibers of an equivalence are contractible. +In fact, it turns out that this property is itself a sufficient definition of equivalence. + +\begin{defn}[Contractible maps] \label{defn:equivalence} + A map $f:A\to B$ is \define{contractible} + if for all $y:B$, the fiber $\hfib f y$ is contractible. +\end{defn} + +Thus, the type $\iscontr(f)$ is defined to be +\begin{align} + \iscontr(f) &\defeq \prd{y:B} \iscontr(\hfib f y)\label{eq:iscontrf} + % \\ + % &\defeq \prd{y:B} \iscontr (\setof{x:A | f(x) = y}). +\end{align} +Note that in \cref{sec:contractibility} we defined what it means for a \emph{type} to be contractible. +Here we are defining what it means for a \emph{map} to be contractible. +Our terminology follows the general homotopy-theoretic practice of saying that a map has a certain property if all of its (homotopy) fibers have that property. +Thus, a type $A$ is contractible just when the map $A\to\unit$ is contractible. +From \cref{cha:hlevels} onwards we will also call contractible maps and types \emph{$(-2)$-truncated}. + +We have already shown in \cref{thm:contr-hae} that $\ishae(f) \to \iscontr(f)$. +Conversely: + +\begin{thm}\label{thm:lequiv-contr-hae} +For any $f:A\to B$ we have ${\iscontr(f)} \to {\ishae(f)}$. +\end{thm} +\begin{proof} +Let $P : \iscontr(f)$. We define an inverse mapping $g : B \to A$ by sending each $y : B$ to the center of contraction of the fiber at $y$: +\[ g(y) \defeq \proj{1}(\proj{1}(Py)). \] +We can thus define the homotopy $\epsilon$ by mapping $y$ to the witness that $g(y)$ indeed belongs to the fiber at $y$: +\[ \epsilon(y) \defeq \proj{2}(\proj{1}(P y)). \] +It remains to define $\eta$ and $\tau$. This of course amounts to giving an element of $\rcoh{f}{g}{\epsilon}$. By \cref{lem:coh-hfib}, this is the same as giving for each $x:A$ a path from $(gfx,\epsilon(fx))$ to $(x,\refl{fx})$ in the fiber of $f$ over $fx$. But this is easy: for any $x : A$, the type $\hfib{f}{fx}$ +is contractible by assumption, hence such a path must exist. We can construct it explicitly as +\[\opp{\big(\proj{2}(P(fx))(gfx,\epsilon(fx))\big)} \ct \big(\proj{2}(P(fx)) (x,\refl{fx})\big). \qedhere \] +\end{proof} + +It is also easy to see: + +\begin{lem}\label{thm:contr-hprop} + For any $f$, the type $\iscontr(f)$ is a mere proposition. +\end{lem} +\begin{proof} + By \cref{thm:isprop-iscontr}, each type $\iscontr (\hfib f y)$ is a mere proposition. + Thus, by \cref{thm:isprop-forall}, so is~\eqref{eq:iscontrf}. +\end{proof} + +\begin{thm}\label{thm:equiv-contr-hae} + For any $f:A\to B$ we have $\eqv{\iscontr(f)}{\ishae(f)}$. +\end{thm} +\begin{proof} + We have already established a logical equivalence ${\iscontr(f)} \Leftrightarrow {\ishae(f)}$, and both are mere propositions (\cref{thm:contr-hprop,thm:hae-hprop}). + Thus, \cref{lem:equiv-iff-hprop} applies. +\end{proof} + +Usually, we prove that a function is an equivalence by exhibiting a quasi-inverse, but sometimes this definition is more convenient. +For instance, it implies that when proving a function to be an equivalence, we are free to assume that its codomain is inhabited. + +\begin{cor}\label{thm:equiv-inhabcod} + If $f:A\to B$ is such that $B\to \isequiv(f)$, then $f$ is an equivalence. +\end{cor} +\begin{proof} + To show $f$ is an equivalence, it suffices to show that $\hfib f y$ is contractible for any $y:B$. + But if $e:B\to \isequiv(f)$, then given any such $y$ we have $e(y):\isequiv(f)$, so that $f$ is an equivalence and hence $\hfib f y$ is contractible, as desired. +\end{proof} + +\index{function!contractible|)}% +\index{contractible!function|)}% +\index{equivalence!as contractible function|)}% + +\section{On the definition of equivalences} +\label{sec:concluding-remarks} + +\indexdef{equivalence} +We have shown that all three definitions of equivalence satisfy the three desirable properties and are pairwise equivalent: +\[ \iscontr(f) \eqvsym \ishae(f) \eqvsym \biinv(f). \] +(There are yet more possible definitions of equivalence, but we will stop with these three. +See \cref{ex:brck-qinv} and the exercises in this chapter for some more.) +Thus, we may choose any one of them as ``the'' definition of $\isequiv (f)$. +For definiteness, we choose to define +\[ \isequiv(f) \defeq \ishae(f).\] +\index{mathematics!formalized}% +This choice is advantageous for formalization, since $\ishae(f)$ contains the most directly useful data. +On the other hand, for other purposes, $\biinv(f)$ is often easier to deal with, since it contains no 2-dimensional paths and its two symmetrical halves can be treated independently. +However, for purposes of this book, the specific choice will make little difference. + +In the rest of this chapter, we study some other properties and characterizations of equivalences. +\index{equivalence!properties of}% + + +\section{Surjections and embeddings} +\label{sec:mono-surj} + +\index{set} +When $A$ and $B$ are sets and $f:A\to B$ is an equivalence, we also call it as \define{isomorphism} +\indexdef{isomorphism!of sets}% +or a \define{bijection}. +\indexdef{bijection}% +\indexsee{function!bijective}{bijection}% +(We avoid these words for types that are not sets, since in homotopy theory and higher category theory they often denote a stricter notion of ``sameness'' than homotopy equivalence.) +In set theory, a function is a bijection just when it is both injective and surjective. +The same is true in type theory, if we formulate these conditions appropriately. +For clarity, when dealing with types that are not sets, we will speak of \emph{embeddings} instead of injections. + +\begin{defn}\label{defn:surj-emb} + Let $f:A\to B$. + \begin{enumerate} + \item We say $f$ is \define{surjective} + \indexsee{surjective!function}{function, surjective}% + \indexdef{function!surjective}% + (or a \define{surjection}) + \indexsee{surjection}{function, surjective}% + if for every $b:B$ we have $\brck{\hfib f b}$. + \item We say $f$ is an \define{embedding} + \indexdef{function!embedding}% + \indexsee{embedding}{function, embedding}% + if for every $x,y:A$ the function $\apfunc f : (\id[A]xy) \to (\id[B]{f(x)}{f(y)})$ is an equivalence. + \end{enumerate} +\end{defn} + +In other words, $f$ is surjective if every fiber of $f$ is merely inhabited, or equivalently if for all $b:B$ there merely exists an $a:A$ such that $f(a)=b$. +In traditional logical notation, $f$ is surjective if $\fall{b:B}\exis{a:A} (f(a)=b)$. +This must be distinguished from the stronger assertion that $\prd{b:B}\sm{a:A} (f(a)=b)$; if this holds we say that $f$ is a \define{split surjection}. +\indexsee{split!surjection}{function, split surjective}% +\indexsee{surjection!split}{function, split surjective}% +\indexsee{surjective!function!split}{function, split surjective}% +\indexdef{function!split surjective}% +(Since this latter type is equivalent to $\sm{g:B\to A}\prd{b:B} (f(g(b))=b)$, being a split surjection is the same as being a \emph{retraction} as defined in \cref{sec:contractibility}.) +\index{retraction}% +\index{function!retraction}% + +The axiom of choice from \cref{sec:axiom-choice} says exactly that every surjection \emph{between sets} is split. +However, in the presence of the univalence axiom, it is simply false that \emph{all} surjections are split. +In \cref{thm:no-higher-ac} we constructed a type family $Y:X\to \type$ such that $\prd{x:X} \brck{Y(x)}$ but $\neg \prd{x:X} Y(x)$; +for any such family, the first projection $(\sm{x:X} Y(x)) \to X$ is a surjection that is not split. + +If $A$ and $B$ are sets, then by \cref{lem:equiv-iff-hprop}, $f$ is an embedding just when +\begin{equation} + \prd{x,y:A} (\id[B]{f(x)}{f(y)}) \to (\id[A]xy).\label{eq:injective} +\end{equation} +In this case we say that $f$ is \define{injective}, +\indexsee{injective function}{function, injective}% +\indexdef{function!injective}% +or an \define{injection}. +\indexsee{injection}{function, injective}% +We avoid these word for types that are not sets, because they might be interpreted as~\eqref{eq:injective}, which is an ill-behaved notion for non-sets. +It is also true that any function between sets is surjective if and only if it is an \emph{epimorphism} in a suitable sense, but this also fails for more general types, and surjectivity is generally the more important notion. + +\begin{thm}\label{thm:mono-surj-equiv} + A function $f:A\to B$ is an equivalence if and only if it is both surjective and an embedding. +\end{thm} +\begin{proof} + If $f$ is an equivalence, then each $\hfib f b$ is contractible, hence so is $\brck{\hfib f b}$, so $f$ is surjective. + And we showed in \cref{thm:paths-respects-equiv} that any equivalence is an embedding. + + Conversely, suppose $f$ is a surjective embedding. + Let $b:B$; we show that $\sm{x:A}(f(x)=b)$ is contractible. + Since $f$ is surjective, there merely exists an $a:A$ such that $f(a)=b$. + Thus, the fiber of $f$ over $b$ is inhabited; it remains to show it is a mere proposition. + For this, suppose given $x,y:A$ with $p:f(x)=b$ and $q:f(y)=b$. + Then since $\apfunc f$ is an equivalence, there exists $r:x=y$ with $\apfunc f (r) = p \ct \opp q$. + However, using the characterization of paths in $\Sigma$-types, the latter equality rearranges to $\trans{r}{p} = q$. + Thus, together with $r$ it exhibits $(x,p) = (y,q)$ in the fiber of $f$ over $b$. +\end{proof} + +\begin{cor} + For any $f:A\to B$ we have + \[ \isequiv(f) \eqvsym (\mathsf{isEmbedding}(f) \times \mathsf{isSurjective}(f)).\] +\end{cor} +\begin{proof} + Being a surjection and an embedding are both mere propositions; now apply \cref{lem:equiv-iff-hprop}. +\end{proof} + +Of course, this cannot be used as a definition of ``equivalence'', since the definition of embeddings refers to equivalences. +However, this characterization can still be useful; see \cref{sec:whitehead}. +We will generalize it in \cref{cha:hlevels}. + + +% \section{Fiberwise equivalences} +\section{Closure properties of equivalences} +\label{sec:equiv-closures} +\label{sec:fiberwise-equivalences} +\index{equivalence!properties of}% + + +% We end this chapter by observing some important closure properties of equivalences. +We have already seen in \cref{thm:equiv-eqrel} that equivalences are closed under composition. +Furthermore, we have: + +\begin{thm}[The 2-out-of-3 property]\label{thm:two-out-of-three} + \index{2-out-of-3 property}% + Suppose $f:A\to B$ and $g:B\to C$. + If any two of $f$, $g$, and $g\circ f$ are equivalences, so is the third. +\end{thm} +\begin{proof} + If $g\circ f$ and $g$ are equivalences, then $\opp{(g\circ f)} \circ g$ is a quasi-inverse to $f$. + On the one hand, we have $\opp{(g\circ f)} \circ g \circ f \htpy \idfunc[A]$, while on the other we have + \begin{align*} + f \circ \opp{(g\circ f)} \circ g + &\htpy \opp g \circ g \circ f \circ \opp{(g\circ f)} \circ g\\ + &\htpy \opp g \circ g\\ + &\htpy \idfunc[B]. + \end{align*} + Similarly, if $g\circ f$ and $f$ are equivalences, then $f\circ \opp{(g\circ f)}$ is a quasi-inverse to $g$. +\end{proof} + +This is a standard closure condition on equivalences from homotopy theory. +Also well-known is that they are closed under retracts, in the following sense. + +\index{retract!of a function|(defstyle}% + +\begin{defn}\label{defn:retract} +A function $g:A\to B$ is said to be a \define{retract} +of a function $f:X\to Y$ if there is a diagram +\begin{equation*} + \xymatrix{ + {A} \ar[r]^{s} \ar[d]_{g} + & + {X} \ar[r]^{r} \ar[d]_{f} + & + {A} \ar[d]^{g} + \\ + {B} \ar[r]_{s'} + & + {Y} \ar[r]_{r'} + & + {B} + } +\end{equation*} +for which there are +\begin{enumerate} +\item a homotopy $R:r\circ s \htpy \idfunc[A]$. +\item a homotopy $R':r'\circ s' \htpy\idfunc[B]$. +\item a homotopy $L:f\circ s\htpy s'\circ g$. +\item a homotopy $K:g\circ r\htpy r'\circ f$. +\item for every $a:A$, a path $H(a)$ witnessing the commutativity of the square +\begin{equation*} + \xymatrix@C=3pc{ + {g(r(s(a)))} \ar@{=}[r]^-{K(s(a))} \ar@{=}[d]_{\ap g{R(a)}} + & + {r'(f(s(a)))} \ar@{=}[d]^{\ap{r'}{L(a)}} + \\ + {g(a)} \ar@{=}[r]_-{\opp{R'(g(a))}} + & + {r'(s'(g(a)))} + } +\end{equation*} +\end{enumerate} +\end{defn} + +Recall that in \cref{sec:contractibility} we defined what it means for a type to be a retract of another. +This is a special case of the above definition where $B$ and $Y$ are $\unit$. +Conversely, just as with contractibility, retractions of maps induce retractions of their fibers. + +\begin{lem}\label{lem:func_retract_to_fiber_retract} +If a function $g:A\to B$ is a retract of a function $f:X\to Y$, then $\hfib{g}b$ is a retract of $\hfib{f}{s'(b)}$ +for every $b:B$, where $s':B\to Y$ is as in \cref{defn:retract}. +\end{lem} + +\begin{proof} +Suppose that $g:A\to B$ is a retract of $f:X\to Y$. Then for any $b:B$ we have the functions +\begin{align*} +\varphi_b &:\hfiber{g}b\to\hfib{f}{s'(b)}, & +\varphi_b(a,p) & \defeq \pairr{s(a),L(a)\ct s'(p)},\\ +\psi_b &:\hfib{f}{s'(b)}\to\hfib{g}b, & +\psi_b(x,q) &\defeq \pairr{r(x),K(x)\ct r'(q)\ct R'(b)}. +\end{align*} +Then we have $\psi_b(\varphi_b({a,p}))\equiv\pairr{r(s(a)),K(s(a))\ct r'(L(a)\ct s'(p))\ct R'(b)}$. +We claim $\psi_b$ is a retraction with section $\varphi_b$ for all $b:B$, which is to say that for all $(a,p):\hfib g b$ we have $\psi_b(\varphi_b({a,p}))= \pairr{a,p}$. +In other words, we want to show +\begin{equation*} +\prd{b:B}{a:A}{p:g(a)=b} \psi_b(\varphi_b({a,p}))= \pairr{a,p}. +\end{equation*} +By reordering the first two $\Pi$s and applying a version of \cref{thm:omit-contr}, this is equivalent to +\begin{equation*} +\prd{a:A}\psi_{g(a)}(\varphi_{g(a)}({a,\refl{g(a)}}))=\pairr{a,\refl{g(a)}}. +\end{equation*} +For any $a$, by \cref{thm:path-sigma}, this equality of pairs is equivalent to a pair of equalities. The first components are equal by $R(a):r(s(a))= a$, so we need only show +\begin{equation*} +\trans{R(a)}{K(s(a))\ct r'(L(a))\ct R'(g(a))} = \refl{g(a)}. +\end{equation*} +But this transportation computes as $\opp{g(R(a))}\ct K(s(a))\ct r'(L(a))\ct R'(g(a))$, so the required path is given by $H(a)$. +\end{proof} + +\begin{thm}\label{thm:retract-equiv} + If $g$ is a retract of an equivalence $f$, then $g$ is also an equivalence. +\end{thm} +\begin{proof} + By \cref{lem:func_retract_to_fiber_retract}, every fiber of $g$ is a retract of a fiber of $f$. + Thus, by \cref{thm:retract-contr}, if the latter are all contractible, so are the former. +\end{proof} + +\index{retract!of a function|)}% + +\index{fibration}% +\index{total!space}% +Finally, we show that fiberwise equivalences can be characterized in terms of equivalences of total spaces. +To explain the terminology, recall from \cref{sec:fibrations} that a type family $P:A\to\type$ can be viewed as a fibration over $A$ with total space $\sm{x:A} P(x)$, the fibration being the projection $\proj1:\sm{x:A} P(x) \to A$. +From this point of view, given two type families $P,Q:A\to\type$, we may refer to a function $f:\prd{x:A} (P(x)\to Q(x))$ as a \define{fiberwise map} or a \define{fiberwise transformation}. +\indexsee{transformation!fiberwise}{fiberwise transformation}% +\indexsee{function!fiberwise}{fiberwise transformation}% +\index{fiberwise!transformation|(defstyle}% +\indexsee{fiberwise!map}{fiberwise transformation}% +\indexsee{map!fiberwise}{fiberwise transformation} +Such a map induces a function on total spaces: + +\begin{defn}\label{defn:total-map} + Given type families $P,Q:A\to\type$ and a map $f:\prd{x:A} P(x)\to Q(x)$, we define + \begin{equation*} + \total f \defeq \lam{w}\pairr{\proj{1}w,f(\proj{1}w,\proj{2}w)} : \sm{x:A}P(x)\to\sm{x:A}Q(x). + \end{equation*} +\end{defn} + +\begin{thm}\label{fibwise-fiber-total-fiber-equiv} +Suppose that $f$ is a fiberwise transformation between families $P$ and +$Q$ over a type $A$ and let $x:A$ and $v:Q(x)$. Then we have an equivalence +\begin{equation*} +\eqv{\hfib{\total{f}}{\pairr{x,v}}}{\hfib{f(x)}{v}}. +\end{equation*} +\end{thm} +\begin{proof} + We calculate: +\begin{align} + \hfib{\total{f}}{\pairr{x,v}} + & \jdeq \sm{w:\sm{x:A}P(x)}\pairr{\proj{1}w,f(\proj{1}w,\proj{2}w)}=\pairr{x,v} + \notag \\ + & \eqv{}{} \sm{a:A}{u:P(a)}\pairr{a,f(a,u)}=\pairr{x,v} + \tag{by~\cref{ex:sigma-assoc}} \\ + & \eqv{}{} \sm{a:A}{u:P(a)}{p:a=x}\trans{p}{f(a,u)}=v + \tag{by \cref{thm:path-sigma}} \\ + & \eqv{}{} \sm{a:A}{p:a=x}{u:P(a)}\trans{p}{f(a,u)}=v + \notag \\ + & \eqv{}{} \sm{u:P(x)}f(x,u)=v + \tag{$*$}\label{eq:uses-sum-over-paths} \\ + & \jdeq \hfib{f(x)}{v}. \notag +\end{align} +The equivalence~\eqref{eq:uses-sum-over-paths} follows from \cref{thm:omit-contr,thm:contr-paths,ex:sigma-assoc}. +\end{proof} + +We say that a fiberwise transformation $f:\prd{x:A} P(x)\to Q(x)$ is a \define{fiberwise equivalence}% +\indexdef{fiberwise!equivalence}% +\indexdef{equivalence!fiberwise} +if each $f(x):P(x) \to Q(x)$ is an equivalence. + +\begin{thm}\label{thm:total-fiber-equiv} +Suppose that $f$ is a fiberwise transformation between families +$P$ and $Q$ over a type $A$. +Then $f$ is a fiberwise equivalence if and only if $\total{f}$ is an equivalence. +\end{thm} + +\begin{proof} +Let $f$, $P$, $Q$ and $A$ be as in the statement of the theorem. +By \cref{fibwise-fiber-total-fiber-equiv} it follows for all +$x:A$ and $v:Q(x)$ that +$\hfib{\total{f}}{\pairr{x,v}}$ is contractible if and only if +$\hfib{f(x)}{v}$ is contractible. +Thus, $\hfib{\total{f}}{w}$ is contractible for all $w:\sm{x:A}Q(x)$ if and only if $\hfib{f(x)}{v}$ is contractible for all $x:A$ and $v:Q(x)$. +\end{proof} + +\index{fiberwise!transformation|)}% + + +\section{The object classifier} +\label{sec:object-classification} + +In type theory we have a basic notion of \emph{family of types}, namely a function $B:A\to\type$. +We have seen that such families behave somewhat like \emph{fibrations} in homotopy theory, with the fibration being the projection $\proj1:\sm{a:A} B(a) \to A$. +A basic fact in homotopy theory is that every map is equivalent to a fibration. +With univalence at our disposal, we can prove the same thing in type theory. + +\begin{lem}\label{thm:fiber-of-a-fibration} + For any type family $B:A\to\type$, the fiber of $\proj1:\sm{x:A} B(x) \to A$ over $a:A$ is equivalent to $B(a)$: + \[ \eqv{\hfib{\proj1}{a}}{B(a)} \] +\end{lem} +\begin{proof} + We have + \begin{align*} + \hfib{\proj1}{a} &\defeq \sm{u:\sm{x:A} B(x)} \proj1(u)=a\\ + &\eqvsym \sm{x:A}{b:B(x)} (x=a)\\ + &\eqvsym \sm{x:A}{p:x=a} B(x)\\ + &\eqvsym B(a) + \end{align*} + using the left universal property of identity types. +\end{proof} + +\begin{lem}\label{thm:total-space-of-the-fibers} + For any function $f:A\to B$, we have $\eqv{A}{\sm{b:B}\hfib{f}{b}}$. +\end{lem} +\begin{proof} + We have + \begin{align*} + \sm{b:B}\hfib{f}{b} &\defeq \sm{b:B}{a:A} (f(a)=b)\\ + &\eqvsym \sm{a:A}{b:B} (f(a)=b)\\ + &\eqvsym A + \end{align*} + using the fact that $\sm{b:B} (f(a)=b)$ is contractible. +\end{proof} + +\begin{thm}\label{thm:nobject-classifier-appetizer} +For any type $B$ there is an equivalence +\begin{equation*} +\chi:\Parens{\sm{A:\type} (A\to B)}\eqvsym (B\to\type). +\end{equation*} +\end{thm} +\begin{proof} +We have to construct quasi-inverses +\begin{align*} +\chi & : \Parens{\sm{A:\type} (A\to B)}\to B\to\type\\ +\psi & : (B\to\type)\to\Parens{\sm{A:\type} (A\to B)}. +\end{align*} +We define $\chi$ by $\chi((A,f),b)\defeq\hfiber{f}b$, and $\psi$ by $\psi(P)\defeq\Pairr{(\sm{b:B} P(b)),\proj1}$. +Now we have to verify that $\chi\circ\psi\htpy\idfunc{}$ and that $\psi\circ\chi \htpy\idfunc{}$. +\begin{enumerate} +\item Let $P:B\to\type$. + By \cref{thm:fiber-of-a-fibration}, +$\hfiber{\proj1}{b}\eqvsym P(b)$ for any $b:B$, so it follows immediately +that $P\htpy\chi(\psi(P))$. +\item Let $f:A\to B$ be a function. We have to find a path +\begin{equation*} +\Pairr{\tsm{b:B} \hfiber{f}b,\,\proj1}=\pairr{A,f}. +\end{equation*} +First note that by \cref{thm:total-space-of-the-fibers}, we have +$e:\sm{b:B} \hfiber{f}b\eqvsym A$ with $e(b,a,p)\defeq a$ and $e^{-1}(a) +\defeq(f(a),a,\refl{f(a)})$. +By \cref{thm:path-sigma}, it remains to show $\trans{(\ua(e))}{\proj1} = f$. +But by the computation rule for univalence and~\eqref{eq:transport-arrow}, we have $\trans{(\ua(e))}{\proj1} = \proj1\circ e^{-1}$, and the definition of $e^{-1}$ immediately yields $\proj1 \circ e^{-1} \jdeq f$.\qedhere +\end{enumerate} +\end{proof} + +\noindent +\indexdef{object!classifier}% +\indexdef{classifier!object}% +\index{.infinity1-topos@$(\infty,1)$-topos}% +In particular, this implies that we have an \emph{object classifier} in the sense of higher topos theory. +Recall from \cref{def:pointedtype} that $\pointed\type$ denotes the type $\sm{A:\type} A$ of pointed types. + +\begin{thm}\label{thm:object-classifier} +Let $f:A\to B$ be a function. Then the diagram +\begin{equation*} + \vcenter{\xymatrix{ + A\ar[r]^-{\vartheta_f} \ar[d]_{f} & + \pointed{\type}\ar[d]^{\proj1}\\ + B\ar[r]_{\chi_f} & + \type + }} +\end{equation*} +is a pullback\index{pullback} square (see \cref{ex:pullback}). +Here the function $\vartheta_f$ is defined by +\begin{equation*} + \lam{a} \pairr{\hfiber{f}{f(a)},\pairr{a,\refl{f(a)}}}. +\end{equation*} +\end{thm} +\begin{proof} +Note that we have the equivalences +\begin{align*} +A & \eqvsym \sm{b:B} \hfiber{f}b\\ +& \eqvsym \sm{b:B}{X:\type}{p:\hfiber{f}b= X} X\\ +& \eqvsym \sm{b:B}{X:\type}{x:X} \hfiber{f}b= X\\ +& \eqvsym \sm{b:B}{Y:\pointed{\type}} \hfiber{f}b = \proj1 Y\\ +& \jdeq B\times_{\type}\pointed{\type} +\end{align*} +which gives us a composite equivalence $e:A\eqvsym B\times_\type\pointed{\type}$. +We may display the action of this composite equivalence step by step by +\begin{align*} +a & \mapsto \pairr{f(a),\; \pairr{a,\refl{f(a)}}}\\ +& \mapsto \pairr{f(a), \; \hfiber{f}{f(a)}, \; \refl{\hfiber{f}{f(a)}}, \; \pairr{a,\refl{f(a)}}}\\ +& \mapsto \pairr{f(a), \; \hfiber{f}{f(a)}, \; \pairr{a,\refl{f(a)}}, \; \refl{\hfiber{f}{f(a)}}}\\ +& \mapsto \pairr{f(a), \; \pairr{\hfiber{f}{f(a)}, \; \pairr{a,\refl{f(a)}}}, \; \refl{\hfiber{f}{f(a)}}}. +\end{align*} +Therefore, we get homotopies $f\htpy\proj1\circ e$ and $\vartheta_f\htpy \proj2\circ e$. +\end{proof} + + + +\section{Univalence implies function extensionality} +\label{sec:univalence-implies-funext} + +\index{function extensionality!proof from univalence}% +In the last section of this chapter we include a proof that the univalence axiom implies function +extensionality. Thus, in this section we work \emph{without} the function extensionality axiom. +The proof consists of two steps. First we show +in \cref{uatowfe} that the univalence +axiom implies a weak form of function extensionality, defined in \cref{weakfunext} below. The +principle of weak function extensionality in turn implies the usual function extensionality, +and it does so without the univalence axiom (\cref{wfetofe}). + +\index{univalence axiom}% +Let $\type$ be a universe; we will explicitly indicate where we assume that it is univalent. + +\begin{defn}\label{weakfunext} +The \define{weak function extensionality principle} +\indexdef{function extensionality!weak}% +asserts that there is a function +\begin{equation*} +\Parens{\prd{x:A}\iscontr(P(x))} \to\iscontr\Parens{\prd{x:A}P(x)} +\end{equation*} +for any family $P:A\to\type$ of types over any type $A$. +\end{defn} + +The following lemma is easy to prove using function extensionality; the point here is that it also follows from univalence without assuming function extensionality separately. + +\begin{lem} \label{UA-eqv-hom-eqv} +Assuming $\type$ is univalent, for any $A,B,X:\type$ and any $e:\eqv{A}{B}$, there is an equivalence +\begin{equation*} +\eqv{(X\to A)}{(X\to B)} +\end{equation*} +of which the underlying map is given by post-composition with the underlying function of $e$. +\end{lem} + +\begin{proof} + % Immediate by induction on $\eqv{}{}$ (see \cref{thm:equiv-induction}). + As in the proof of \cref{lem:qinv-autohtpy}, we may assume that $e = \idtoeqv(p)$ for some $p:A=B$. + Then by path induction, we may assume $p$ is $\refl{A}$, so that $e = \idfunc[A]$. + But in this case, post-composition with $e$ is the identity, hence an equivalence. +\end{proof} + +\begin{cor}\label{contrfamtotalpostcompequiv} +Let $P:A\to\type$ be a family of contractible types, i.e.\ \narrowequation{\prd{x:A}\iscontr(P(x)).} +Then the projection $\proj{1}:(\sm{x:A}P(x))\to A$ is an equivalence. Assuming $\type$ is univalent, it follows immediately that post-composition with $\proj{1}$ gives an equivalence +\begin{equation*} +\alpha : \eqv{\Parens{A\to\sm{x:A}P(x)}}{(A\to A)}. +\end{equation*} +\end{cor} + +\begin{proof} + By \cref{thm:fiber-of-a-fibration}, for $\proj{1}:(\sm{x:A}P(x))\to A$ and $x:A$ we have an equivalence + \begin{equation*} + \eqv{\hfiber{\proj{1}}{x}}{P(x)}. + \end{equation*} + Therefore $\proj{1}$ is an equivalence whenever each $P(x)$ is contractible. The assertion is now a consequence of \cref{UA-eqv-hom-eqv}. +\end{proof} + +In particular, the homotopy fiber of the above equivalence at $\idfunc[A]$ is contractible. Therefore, we can show that univalence implies weak function extensionality by showing that the dependent function type $\prd{x:A}P(x)$ is a retract of $\hfiber{\alpha}{\idfunc[A]}$. + +\begin{thm}\label{uatowfe} +In a univalent universe $\type$, suppose that $P:A\to\type$ is a family of contractible types +and let $\alpha$ be the function of \cref{contrfamtotalpostcompequiv}. +Then $\prd{x:A}P(x)$ is a retract of $\hfiber{\alpha}{\idfunc[A]}$. As a consequence, $\prd{x:A}P(x)$ is contractible. In other words, the univalence axiom implies the weak function extensionality principle. +\end{thm} + +\begin{proof} +Define the functions +\begin{align*} + \varphi &: (\tprd{x:A}P(x))\to\hfiber{\alpha}{\idfunc[A]},\\ + \varphi(f) &\defeq (\lam{x} (x,f(x)),\refl{\idfunc[A]}), +\intertext{and} + \psi &: \hfiber{\alpha}{\idfunc[A]}\to \tprd{x:A}P(x), \\ + \psi(g,p) &\defeq \lam{x} \trans {\happly (p,x)}{\proj{2} (g(x))}. +\end{align*} +Then $\psi(\varphi(f))=\lam{x} f(x)$, which is $f$, by the uniqueness principle for dependent function types. +\end{proof} + +We now show that weak function extensionality implies the usual function extensionality. +Recall from~\eqref{eq:happly} the function $\happly (f,g) : (f = g)\to(f\htpy g)$ which +converts equality of functions to homotopy. In the proof that follows, the univalence +axiom is not used. + +\begin{thm}\label{wfetofe} + \index{function extensionality}% +Weak function extensionality implies the function extensionality \cref{axiom:funext}. +\end{thm} + +\begin{proof} +We want to show that +\begin{equation*} +\prd{A:\type}{P:A\to\type}{f,g:\prd{x:A}P(x)}\isequiv(\happly (f,g)). +\end{equation*} +Since a fiberwise map induces an equivalence on total spaces if and only if it is fiberwise an equivalence by \cref{thm:total-fiber-equiv}, it suffices to show that the function of type +\begin{equation*} +\Parens{\sm{g:\prd{x:A}P(x)}(f= g)} \to \sm{g:\prd{x:A}P(x)}(f\htpy g) +\end{equation*} +induced by $\lam{g:\prd{x:A}P(x)} \happly (f,g)$ is an equivalence. +Since the type on the left is contractible by \cref{thm:contr-paths}, it suffices to show that the type on the right: +\begin{equation}\label{eq:uatofesp} +\sm{g:\prd{x:A}P(x)}\prd{x:A}f(x)= g(x) +\end{equation} +is contractible. +Now \cref{thm:ttac} says that this is equivalent to +\begin{equation}\label{eq:uatofeps} +\prd{x:A}\sm{u:P(x)}f(x)= u. +\end{equation} +The proof of \cref{thm:ttac} uses function extensionality, but only for one of the composites. +Thus, without assuming function extensionality, we can conclude that~\eqref{eq:uatofesp} is a retract\index{retract!of a type} of~\eqref{eq:uatofeps}. +And~\eqref{eq:uatofeps} is a product of contractible types, which is contractible by the weak function extensionality principle; hence~\eqref{eq:uatofesp} is also contractible. +\end{proof} + +\sectionNotes + +The fact that the space of continuous maps equipped with quasi-inverses has the wrong homotopy type to be the ``space of homotopy equivalences'' is well-known in algebraic topology. +In that context, the ``space of homotopy equivalences'' $(\eqv AB)$ is usually defined simply as the subspace of the function space $(A\to B)$ consisting of the functions that are homotopy equivalences. +In type theory, this would correspond most closely to $\sm{f:A\to B} \brck{\qinv(f)}$; see \cref{ex:brck-qinv}. + +The first definition of equivalence given in homotopy type theory was the one that we have called $\iscontr(f)$, which was due to Voevodsky. +The possibility of the other definitions was subsequently observed by various people. +The basic theorems about adjoint equivalences\index{adjoint!equivalence} such as \cref{lem:coh-equiv,thm:equiv-iso-adj} are adaptations of standard facts in higher category theory and homotopy theory. +Using bi-invertibility as a definition of equivalences was suggested by Andr\'e Joyal. + +The properties of equivalences discussed in \cref{sec:mono-surj,sec:equiv-closures} are well-known in homotopy theory. +Most of them were first proven in type theory by Voevodsky. + +The fact that every function is equivalent to a fibration is a standard fact in homotopy theory. +The notion of object classifier +\index{object!classifier}% +\index{classifier!object}% +in $(\infty,1)$-category +\index{.infinity1-category@$(\infty,1)$-category}% +theory (the categorical analogue of \cref{thm:nobject-classifier-appetizer}) is due to Rezk (see~\cite{Rezk05,lurie:higher-topoi}). + +Finally, the fact that univalence implies function extensionality (\cref{sec:univalence-implies-funext}) is due to Voevodsky. +Our proof is a simplification of his. +\cref{ex:funext-from-nondep} is also due to Voevodsky. + +\sectionExercises + +\begin{ex}\label{ex:two-sided-adjoint-equivalences} + Consider the type of ``two-sided adjoint equivalence\index{adjoint!equivalence} data'' for $f:A\to B$, + \begin{narrowmultline*} + \sm{g:B\to A}{\eta: g \circ f \htpy \idfunc[A]}{\epsilon:f \circ g \htpy \idfunc[B]} + \narrowbreak + \Parens{\prd{x:A} \map{f}{\eta x} = \epsilon(fx)} \times + \Parens{\prd{y:B} \map{g}{\epsilon y} = \eta(gy) }. + \end{narrowmultline*} + By \cref{lem:coh-equiv}, we know that if $f$ is an equivalence, then this type is inhabited. + Give a characterization of this type analogous to \cref{lem:qinv-autohtpy}. + + Can you give an example showing that this type is not generally a mere proposition? + (This will be easier after \cref{cha:hits}.) +\end{ex} + +\begin{ex}\label{ex:symmetric-equiv} + Show that for any $A,B:\UU$, the following type is equivalent to $\eqv A B$. + \begin{equation*} + \sm{R:A\to B\to \type} + \Parens{\prd{a:A} \iscontr\Parens{\sm{b:B} R(a,b)}} \times + \Parens{\prd{b:B} \iscontr\Parens{\sm{a:A} R(a,b)}}. + \end{equation*} + Can you extract from this a definition of a type satisfying the three desiderata of $\isequiv(f)$? +\end{ex} + +\begin{ex} \label{ex:qinv-autohtpy-no-univalence} + Reformulate the proof of \cref{lem:qinv-autohtpy} without using univalence. +\end{ex} + +\begin{ex}[The unstable octahedral axiom]\label{ex:unstable-octahedron} + \index{axiom!unstable octahedral}% + \index{octahedral axiom, unstable}% + Suppose $f:A\to B$ and $g:B\to C$ and $b:B$. + \begin{enumerate} + \item Show that there is a natural map $\hfib{g\circ f}{g(b)} \to \hfib{g}{g(b)}$ whose fiber over $(b,\refl{g(b)})$ is equivalent to $\hfib f b$. + \item Show that $\eqv{\hfib{g\circ f}{c}}{\sm{w:\hfib{g}{c}} \hfib f {\proj1 w}}$. + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:2-out-of-6} + \index{2-out-of-6 property}% + Prove that equivalences satisfy the \emph{2-out-of-6 property}: given $f:A\to B$ and $g:B\to C$ and $h:C\to D$, if $g\circ f$ and $h\circ g$ are equivalences, so are $f$, $g$, $h$, and $h\circ g\circ f$. + Use this to give a higher-level proof of \cref{thm:paths-respects-equiv}. +\end{ex} + +\begin{ex}\label{ex:qinv-univalence} + For $A,B:\UU$, define + \[ \mathsf{idtoqinv}_{A,B} :(A=B) \to \sm{f:A\to B}\qinv(f) \] + by path induction in the obvious way. + Let \textbf{\textsf{qinv}-univalence} denote the modified form of the univalence axiom which asserts that for all $A,B:\UU$ the function $\mathsf{idtoqinv}_{A,B}$ has a quasi-inverse. + \begin{enumerate} + \item Show that \qinv-univalence can be used instead of univalence in the proof of function extensionality in \cref{sec:univalence-implies-funext}. + \item Show that \qinv-univalence can be used instead of univalence in the proof of \cref{thm:qinv-notprop}. + \item Show that \qinv-univalence is inconsistent (i.e.\ allows construction of an inhabitant of $\emptyt$). + Thus, the use of a ``good'' version of $\isequiv$ is essential in the statement of univalence. + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:embedding-cancellable} + Show that a function $f:A\to B$ is an embedding if and only if the following two conditions hold: + \begin{enumerate} + \item $f$ is \emph{left cancellable}, i.e.\ for any $x,y:A$, if $f(x)=f(y)$ then $x=y$.\label{item:ex:ec1} + \item For any $x:A$, the map $\apfunc f: \Omega(A,x) \to \Omega(B,f(x))$ is an equivalence.\label{item:ex:ec2} + \end{enumerate} + (In particular, if $A$ is a set, then $f$ is an embedding if and only if it is left-cancellable and $\Omega(B,f(x))$ is contractible for all $x:A$.) + Give examples to show that neither of~\ref{item:ex:ec1} or~\ref{item:ex:ec2} implies the other. +\end{ex} + +\begin{ex}\label{ex:cancellable-from-bool} + Show that the type of left-cancellable functions $\bool\to B$ (see \cref{ex:embedding-cancellable}) is equivalent to $\sm{x,y:B}(x\neq y)$. + Give a similar explicit characterization of the type of embeddings $\bool\to B$. +\end{ex} + +\begin{ex}\label{ex:funext-from-nondep} + The \textbf{na\"{i}ve non-dependent function extensionality axiom} says that for $A,B:\type$ and $f,g:A\to B$ there is a function $(\prd{x:A} f(x)=g(x)) \to (f=g)$. + \indexdef{function extensionality!non-dependent}% + Modify the argument of \cref{sec:univalence-implies-funext} to show that this axiom implies the full function extensionality axiom (\cref{axiom:funext}). +\end{ex} + +% Local Variables: +% TeX-master: "hott-online" +% End: diff --git a/errata.tex b/errata.tex new file mode 100644 index 0000000000000000000000000000000000000000..d6eb4139e124ee17e49bb1b7dc0455f50da57232 --- /dev/null +++ b/errata.tex @@ -0,0 +1,987 @@ +% This is the errata document for the homotopy type theory book. + +% This file supports two book sizes: +% - Letter size (8.5" x 11") +% - US Trade size (6" x 9") +% +% To activate one or the other, uncomment the appropriate font size in +% the documentclass below, and then one of the two page geometry incantations +% +% NOTE: The 6" x 9" format is only experimental. It will break the +% title page, for example. + +\PassOptionsToPackage{table}{xcolor} + +% DOCUMENT CLASS +\documentclass[ +% +%10pt % for US Trade 6" x 9" book +% +11pt % for Letter size book +]{article} +\usepackage{etex} % We're running out of registers and dimensions, or some such + +\newcounter{chapter} % So that macros.tex doesn't choke + +% PAGE GEOMETRY +% +% Uncomment one of these + +% We make the page 40pt taller than the standard LaTeX book. + +% OPTION 1: Letter +\usepackage[papersize={8.5in,11in}, + twoside, + includehead, + top=1in, + bottom=1in, + inner=0.75in, + outer=1.0in, + bindingoffset=0.35in]{geometry} + +% OPTION 2: US Trade +% \usepackage[papersize={6in,9in}, +% twoside, +% includehead, +% top=0.75in, +% bottom=0.75in, +% inner=0.5in, +% outer=0.75in, +% bindingoffset=0.35in]{geometry} + +% HYPERLINKING AND PDF METADATA + +\usepackage[pagebackref, + colorlinks, + citecolor=darkgreen, + linkcolor=darkgreen, + unicode, + pdfauthor={Univalent Foundations Program}, + pdftitle={Homotopy Type Theory: Univalent Foundations of Mathematics}, + pdfsubject={Mathematics}, + pdfkeywords={type theory, homotopy theory, univalence axiom}]{hyperref} + +% OTHER PACKAGES + +% Use this package and stick \layout somewhere in the text to see +% page margins, text size and width etc. Useful for debugging page format. +%\usepackage{layout} + +%%% Because Germans have umlauts and Slavs have even stranger ways of mangling letters +\usepackage[utf8]{inputenc} + +%%% For table {tab:theorems} +\usepackage{pifont} + +%%% Multi-Columns for long lists of names +\usepackage{multicol} + +%%% Set the fonts +\usepackage{mathpazo} +\usepackage[scaled=0.95]{helvet} +\usepackage{courier} +\linespread{1.05} % Palatino looks better with this + +\usepackage{graphicx} +\DeclareGraphicsExtensions{.png} +\input{bmpsize-hack} % for bounding boxes in dvi mode +\usepackage{comment} + +\usepackage{wallpaper} % For the background image on the cover page + +\usepackage{fancyhdr} % To set headers and footers + +\usepackage{nextpage} % So we can jump to odd-numbered pages + +\usepackage{amssymb,amsmath,amsthm,stmaryrd,mathrsfs,wasysym} +\usepackage{enumitem,mathtools,xspace} +\usepackage{xcolor} % For colored cells in tables we need \cellcolor +\usepackage{booktabs} % For nice tables +\usepackage{array} % For nice tables +\usepackage{supertabular} % For index of symbols +\definecolor{darkgreen}{rgb}{0,0.45,0} +\usepackage{aliascnt} +\usepackage[capitalize]{cleveref} +\usepackage[all,2cell]{xy} +\UseAllTwocells +\usepackage{braket} % used for \setof{ ... } macro +\usepackage{tikz} +\usetikzlibrary{decorations.pathmorphing} + +\usepackage{etoolbox} % hacking commands for TOC + +\usepackage{mathpartir} % for formal.tex appendix, section 3 + +\usepackage[numbered]{bookmark} % add chapter/section numbers to the toc in the pdf metadata + +\input{macros} + +%%%% Indexing +\usepackage{makeidx} +\makeindex + +%%%% Header and footers +\pagestyle{fancyplain} +\setlength{\headheight}{15pt} +\renewcommand{\sectionmark}[1]{\markright{\textsc{\thesection\ #1}}} + +\lhead[\fancyplain{}{{\thepage}}]% + {\fancyplain{}{\nouppercase{\rightmark}}} +\rhead[\fancyplain{}{\nouppercase{\leftmark}}]% + {\fancyplain{}{\thepage}} +\cfoot[]{} +\lfoot[]{} +\rfoot[]{} + +%%%% Chapter & part style +\usepackage{titlesec} +\titleformat{\part}[display]{\fontsize{40}{40}\fontseries{m}\fontshape{sc}\selectfont}{\hfil\partname\ \Roman{part}}{20pt}{\fontsize{60}{60}\fontseries{b}\fontshape{sc}\selectfont\hfil} +\titleformat{\chapter}[display]{\fontsize{23}{25}\fontseries{m}\fontshape{it}\selectfont}{\chaptertitlename\ \thechapter}{20pt}{\fontsize{35}{35}\fontseries{b}\fontshape{n}\selectfont} + +\input{main.labels} +\input{version.tex} + +\usepackage{longtable} + +\title{Errata for the HoTT Book, first edition% +%% VERSION MARKER +} + +\begin{document} +\maketitle + +For the benefit of all readers, the available PDF and printed copies of the book are being updated on a rolling basis with minor corrections and clarifications as we receive them. Every copy has a version marker that can be found on the title page and is of the form "first-edition-XX-gYYYYYYY", where XX is a natural number and YYYYYYY is the git commit hash that uniquely identifies the exact version. Higher values of XX indicate more recent copies. + +Below is a list of corrections and clarifications that have been made +%% BEGIN STARTPOINT +so far +%% END STARTPOINT +(except for trivial formatting and spacing changes), along with the version marker in which they were first made. +This list is current as of \today\ and version marker ``\OPTversion''. + +While the page numbering may differ between copies with different version markers (and indeed, already differs between the letter/A4 and printed/ebook copies with the same version marker), we promise that the numbering of chapters, sections, theorems, and equations will remain constant, and no new mathematical content will be added, unless and until there is a second edition. + +\noindent +\begin{longtable}{llp{10.5cm}} + \textbf{Location} & \textbf{Fixed in} & \textbf{Change} \\ \hline \endhead +%% BEGIN ERRATA + % + % Chapter 1 + % + \cref{sec:types-vs-sets} + & 182-gb29ea2f + & Change notation $a\jdeq_A b$ to $a\jdeq b : A$, to match that used in \cref{cha:rules}. + (Neither are used anywhere else in the book.)\\ + % + \cref{sec:types-vs-sets} + & 154-g42698c2 + & Clarify that algorithmic decidability of judgmental equality is only meta-theoretic.\\ + % + \cref{sec:types-vs-sets} + & 154-gac9b226 + & Mention notation $a=b=c=d$ to mean ``$a=b$ and $b=c$ and $c=d$, hence $a=d$'', possibly including judgmental equalities.\\ + % + \cref{sec:universes} + & 42-g4bc5cc2 + & Cumulativity means some elements do not have unique types, the index $i$ on $\UU_i$ is not an internal natural number, and typical ambiguity must be justified by reinserting indices.\\ + % + \cref{sec:universes,sec:pi-types} + & 42-ga34b313 + & Explain that we can't define $\Fin$ and $\fmax$ yet where we first mention them.\\ + % + \cref{sec:pi-types} + & 165-g0ad2aba + & Add $\mathsf{swap}$ as another example of a polymorphic function, and discuss the use of subscripts and implicit arguments to dependent functions.\\ + % + \cref{rmk:introducing-new-concepts} + & 80-g8f95fa5 + & In the discussion of formation rules, the dependent function type example should be $\prd{x:A} B(x)$.\\ + % + \cref{sec:finite-product-types} + & 51-g67e86db + & Better explanation of recursion on product types, why it is justified, and how it relates to the uniqueness principle.\\ + % + \cref{sec:sigma-types} + & 2-gbe277a8 + & In the types of $g$ and $\ind{\sm{x:A}B(x)}$, there is a $\prd{a:A}{b:B(x)}$ in which $x$ should be $a$.\\ + % + \cref{sec:sigma-types} + & 27-gd0bfa0d + & At two places in the definition of $\ac$, $R(a,\fst(g(x)))$ should be $R(x,\fst(g(x)))$.\\ + % + \cref{sec:sigma-types} + & 125-g7fdadbf + & When substituting $\lam{x} \fst(g(x))$ for $f$ while verifying that $\ac$ is well-typed, the left side of the judgmental equality should be $\tprd{x:A} R(x,\fst(g(x)))$, not $\tprd{x:A} R(x,\fst(f(x)))$.\\ + % + \cref{sec:coproduct-types} + & 30-g264d934 + & In two displayed equations, $f(\inl(b))$ should be $f(\inr(b))$.\\ + % + Theorem \ref{thm:allbool-trueorfalse} % NB: We have to write out "Theorem" instead of using \cref here, since in the (post-erratum) version this label no longer denotes a Theorem. + & 391-g1ce619a + & This should not be called a ``Theorem'', since we have not yet introduced what that means. + Instead it should say ``We construct an element of\dots''.\\ + % + \cref{sec:type-booleans} + & 125-g433f87e + & In the definition of binary products in terms of $\bool$, the definitions of $\fst(p)$ and $\snd(p)$ should be switched to match the order of arguments to $\rec\bool$ and $\ind\bool$.\\ + \cref{sec:pat} + & 111-g1e868fa + & When translating English to type theory, ``unnamed variables'' are unnamed in English but must be named in type theory.\\ + % + \cref{sec:identity-types} + & 154-g4ef49f7 + & Emphasize that path induction, like all other induction principles, defines a \emph{specified} function.\\ + % + \cref{sec:identity-types} + & 1373-g142de42 + & In the second proof that based path induction implies path induction, the observation should be that $f$ can be obtained as an instance of $\indid{A}$, not $\indidb{A}$.\\ + % + \cref{sec:identity-types} + & 244-gd58529d + & In proof that path induction implies based path induction, $D(x,y,p)$ should be written $\prd{C : \prd{z:A} (\id[A]{x}{z}) \to \UU} \left( \cdots \right)$ so the type of $C$ matches the premise of based path induction. \\ + % + \cref{rmk:the-only-path-is-refl} + & 563-g3286941 + & The facts that any $(x,y,p): \sm{x,y:A}(\id{x}{y})$ is equal to $(x,x,\refl{x})$, and that any $(y,p):\sm{y:A}(\id[A]{a}{y})$ is equal to $(a,\refl{a})$, can be proven by path induction and based path induction respectively.\\ + % + \cref{ex:iterator} + & 78-gcce4dc0 + & The second defining equation of $\ite$ should have right-hand side $c_s(\ite(C,c_0,c_s,n))$.\\ + % + \cref{ex:iterator} + & 293-g4663bfe + & The defining equations of the recursor derived from the iterator only hold propositionally, and require the induction principle to prove.\\ + % + \cref{ex:prod-via-bool} + & 229-ged891f3 + & This exercise requires function extensionality (\cref{sec:compute-pi}).\\ + % + \cref{ex:nat-semiring} + & 450-g7f38c9a + & This exercise requires symmetry and transitivity of equality, \cref{lem:opp,lem:concat}.\\ + % + \cref{ex:ackermann} + & 110-gfe4641b + & To match the usual Ackermann--P\'eter function, the second displayed equation should be $\ack(\suc(m),0) \jdeq \ack(m,1)$.\\ + % + % Chapter 2 + % + \cref{cha:basics} + & 239-gaf3d682 + & In the chapter introduction, clarify that topological homotopies between paths must be endpoint-preserving.\\ + % + \cref{lem:opp} + & 166-g37b78ef + & Add remarks before and after the proof about how a theorem's statement and proof should be interpreted as exhibiting an element of some type.\\ + % + \cref{lem:concat} + & 374-g0bc0908 + & In the penultimate display in the first proof, $d(x,z,q)$ should be simply $d$.\\ + % + \cref{thm:omg} + & 750-g91b7348 + & In the first proofs of~\ref{item:omg1}--\ref{item:omg3}, $\indid{A}(D,d,p)$ should be $\indid{A}(D,d,x,y,p)$.\\ + % + \cref{sec:equality} + & 435-gee0b28a + & In the third paragraph after \cref{lem:concat}, $p\ct\refl{x}\jdeq p$ should be $p\ct\refl{y}\jdeq p$.\\ + % + \cref{sec:equality} + & 165-g18642ca + & Mention that the notation $a=b=c=d$, and its displayed variant, indicate concatenation of paths.\\ + % + \cref{sec:equality} + & 253-gdd47c75 + & \cref{thm:omg}\ref{item:omg4} justifies writing $p\ct q \ct r$ and so on.\\ + % + \cref{thm:EckmannHilton} + & 253-gdd47c75 + & The induction defining $\alpha\rightwhisker r$ has defining equation $\alpha \rightwhisker \refl{b} \jdeq \opp{\mathsf{ru}_p} \ct \alpha \ct \mathsf{ru}_q$, with $\mathsf{ru}_p$ the right unit law. + For $\alpha\hct\beta = \alpha\ct\beta$ to be well-typed, we assume $p\jdeq q \jdeq r \jdeq s\jdeq \refl{a}$ and use $\mathsf{ru}_{\refl{a}} = \refl{\refl{a}}$ and its dual. + Proving $\alpha\hct\beta = \alpha\hct'\beta$ requires induction not only on $\alpha$ and $\beta$ but then on the two remaining 1-paths. + After the proof, remark that we trust the reader to construct such operations from now on.\\ + % + \cref{def:loopspace} + & 233-gc3fb777 + & The three displays should be $\defeq$'s rather than $=$'s.\\ + % + \cref{sec:functors} + & 336-g8ff8a7f + & In the type of $\apfunc{f}$ towards the end of the first proof of \cref{lem:map}, $g(x)$ should be $f(y)$.\\ + % + \cref{sec:fibrations} + & 154-g4ef49f7 + & Emphasize that unlike fibrations in classical homotopy theory, type families come with a \emph{specified} path-lifting function.\\ + % + \cref{sec:fibrations} + & 343-g6efd724 + & The functions \cref{eq:ap-to-apd} and \cref{eq:apd-to-ap} are obtained by concatenating with $\transconst Bp{f(x)}$ and its inverse, respectively.\\ + % + \cref{cor:hom-fg} + & 253-gdd47c75 + & Canceling $H(x)$ may be done by whiskering with $\opp{(H(x))}$.\\ + % + \cref{sec:basics-equivalences} + & 1171-gab3c0aa + & In the proof that $\isequiv(f) \to \qinv (f)$, the definition of $\gamma$ should be $\gamma(x) \defeq \opp{\beta(g(x))} \ct \ap{h}{\alpha(x)}$.\\ + % + \cref{sec:compute-cartprod} + & 74-g9896e32 + & In the type of $\pairpath$ (just after the proof of \cref{thm:path-prod}), the second factor in the domain should be $\id{\proj{2}(x)}{\proj{2}(y)}$.\\ + % + \cref{sec:compute-cartprod} + & 895-g96db894 + & In the displayed equation just before \cref{thm:trans-prod}, $\pairct(p\ct q, r, p'\ct q', r)$ should be $\pairct(p\ct q, r, p'\ct q', r')$ and $\pairct(p, q\ct r, p', q'\ct r)$ should be $\pairct(p, q\ct r, p', q'\ct r')$ (two primes on $r$s are missing).\\ + % + \cref{thm:trans-prod} + & 349-gc7fd9d8 + & The path is in $A(w)\times B(w)$, not $A(y)\times B(y)$.\\ + % + \cref{thm:trans-prod} + & 76-ga42354c + & The third displayed judgmental equality in the proof should be $\transfib{B}{p}{\proj{2}x} \jdeq \proj2x$.\\ + % + \cref{thm:path-sigma} + & 507-g8f10eda + & In the proof, the equation $f(g(\refl{},\refl{}))=\refl{}$ should be $f (g(\refl{w_1},\refl{w_2})) = (\refl{w_1},\refl{w_2})$.\\ + % + \cref{sec:compute-pi} + & 269-g3880fe2 + & The paragraph preceding the definition of $\transfib{\Pi_A(B)}{p}{f}$ (before \cref{eq:transport-arrow-families}) misstated the (already given) type of $p$.\\ + % + \cref{axiom:univalence} + & 992-gc4a5314 + & The axiom should read ``For any $A,B:\type$, the function~\eqref{eq:uidtoeqv} is an equivalence. The display $\eqv{(\id[\type]{A}{B})}{(\eqv A B)}$ should be deduced afterwards, outside the axiom statement.\\ + % + \cref{thm:paths-respects-equiv} + & 310-gd5fa240 + & The second half of the proof is more involved than the first. + It follows abstractly using the 2-out-of-6 property (\cref{ex:2-out-of-6}), or more concretely by concatenating with $\opp{\alpha_{f(a)}} \ct {\alpha_{f(a)}}$ on each side and then repeatedly using naturality and functoriality.\\ + % + \cref{sec:compute-paths} + & 236-g32be999 + & The second display after the proof of \cref{thm:paths-respects-equiv} should be $\prd{x:A} (\id[f(x)=g(x)] {\happly(p)(x)}{\happly(q)(x)})$.\\ + % + \cref{thm:transport-path} + & 628-g1bd8602 + & The sentence preceding the theorem suggests that it follows from \cref{cor:transport-path-prepost,thm:transport-compose}, but actually it requires a separate path induction.\\ + % + \cref{thm:transport-path} + & 704-g70c069e + & The sentence after the theorem should say that $\apfunc{(x \mapsto c)}$ is $p \mapsto\refl{c}$, not $\refl{c}$.\\ + % + \cref{thm:transport-path2} + & 364-g3c47534 + & The right-hand side of the displayed equality should be $\opp{(\apdfunc{f}(p))} \ct \apfunc{(\transfibf{B}{p})}(q) \ct \apdfunc{g}(p)$.\\ + % + \cref{sec:compute-coprod} + & 101-g645f763 + & In \cref{thm:path-coprod} and the preceding paragraph, in the equivalence $\eqv{(\inl(a)=x)}{\code(x)}$, the variable $a$ should be $a_0$. \\ + % + \cref{sec:compute-coprod} + & 370-g114db82 + & In the two displays after the proof of \cref{thm:path-coprod}, the terms should be $\encode(\inl(a), {\blank})$ and $\encode(\inr(b), {\blank})$.\\ + % + \cref{sec:equality-semigroups} + & 261-g4ccda0a + & In the first displayed pair of equations, the type of $p_2$ should be $\transfib{\semigroupstrsym}{p_1}{(m,a)} = {(m',a')}$.\\ + % + \cref{sec:equality-semigroups} + & 402-g2297ecb + & The right hand side of the last displayed equation should be $m'(e(x_1),e(x_2))$.\\ + % + \cref{sec:universal-properties} + & 305-g64685f1 + & In the discussion of universal properties for product types and $\Sigma$-types surrounding \cref{eq:sigma-lump}, the phrases ``left-to-right'' and ``right-to-left'' should be switched.\\ + % + \cref{cha:basics} Notes + & 379-ga57eab2 + & It should be mentioned that Hofmann and Streicher (1998) proposed an axiom similar to univalence, which is correct (and equivalent to univalence) for a universe of 1-types.\\ + % + % Chapter 3 + % + \cref{eq:english-ac} + & 1193-g54b20e3 + & The domain of $g:\prd{x:A} A(x)$ should be $X$.\\ + % + \cref{subsec:prop-subsets} + & 86-g39feab1 + & The definition of subset containment should say $\prd{x:A}(P(x)\rightarrow Q(x))$, not $\fall{x:A}(P(x)\Rightarrow Q(x))$, as the latter notation has not been introduced yet.\\ + % + \cref{subsec:logic-hprop} + & 37-g0bd66c8 + & In the discussion for $\Sigma$-types in the last paragraph, $A$ is an arbitrary type.\\ + % + \cref{thm:retract-contr} + & 95-gce0131f + & In the proof, $p$ should be $r$ to match the preceding definition of retraction.\\ + % + \cref{ex:lem-brck} + & 1162-ga97cb70 + & Should be to show that $\neg\neg A$ satisfies the recursion principle of $\brck{A}$ but with only a propositional computation rule.\\ + % + % Chapter 4 + % + \cref{lem:qinv-autohtpy} + & 87-g693e9b9 + & At the end of the proof, \cref{thm:contr-paths} should be cited as the reason why $\sm{g:A\to A} (g = \idfunc[A])$ is contractible.\\ + % + \cref{thm:equiv-iso-adj} + & 275-g8ea9f71 + & In the proof, the path concatenations in the definitions of $\epsilon'$ and $\tau$ were written in reverse order.\\ + % + \cref{thm:equiv-iso-adj} + & 1043-gcfce4d7 + & In the proof, the type of $\tau(a)$ should be $\ap{f}{\eta(a)}=\opp{\epsilon(f(g(f(a))))}\ct (\ap{f}{\eta(g(f(a)))}\ct \epsilon(f(a)))$, instead of $\opp{\epsilon(f(g(f(a))))}\ct (\ap{f}{\eta(g(f(a)))}\ct \epsilon(f(a)))=\ap{f}{\eta(a)}$.\\ + % + \cref{lem:coh-hprop} + & 296-ge3dc076 + & In the proof, $\id[\hfib{f}{fx}]{(fgx,\epsilon(fx))}{(x,\refl{fx})}$ should be $\id[\hfib{f}{fx}]{(gfx,\epsilon(fx))}{(x,\refl{fx})}$.\\ + % + \cref{thm:equiv-biinv-isequiv} + & 272-gfd47093 + & At the end of the proof, the equivalence follows from the fact that $\ishae(f)$, not $\iscontr(f)$, is a mere proposition. \\ + % + \cref{thm:lequiv-contr-hae} + & 299-g85b729b + & In the proof, $\lcoh{f}{g}{\epsilon}$ should be $\rcoh{f}{g}{\epsilon}$, and the final displayed equation should have $\proj{2}$ applied to both occurrences of $P(fx)$.\\ + % + \cref{lem:func_retract_to_fiber_retract} + & 265-g64000fb + & The path concatenations in the definitions of $\varphi_b$ and $\psi_b$ (and subsequent equations) are reversed, and each $f(a)$ in the next two displayed equations should be $g(a)$.\\ + % + \cref{fibwise-fiber-total-fiber-equiv} + & 275-g84ab032 + & The first equivalence in the proof is not by~\eqref{eq:sigma-lump} but by \cref{ex:sigma-assoc}.\\ + % + \cref{fibwise-fiber-total-fiber-equiv} + & 202-g775a3f0 + & The last equivalence in the proof is not by~\eqref{eq:path-lump} but by \cref{thm:omit-contr,thm:contr-paths,ex:sigma-assoc}.\\ + % + \cref{thm:nobject-classifier-appetizer} + & 205-gf9fe386 + & In the proof, $e\cdot \proj1$ should be $\trans{(\ua(e))}{\proj1}$. Also, explain its computation better.\\ + % + \cref{sec:univalence-implies-funext} + & 114-gaba76c8 + & The point of \cref{UA-eqv-hom-eqv} is that it follows from univalence without assuming function extensionality separately.\\ + % + \cref{contrfamtotalpostcompequiv} + & 484-g2ce1249 + & In the statement, ``precomposition'' should be ``post-composition''.\\ + % + \cref{uatowfe} + & 746-g4d540d6 + & In the definition of $\psi$ in the proof, transport has to be along $\happly(p,x)$ instead of along $p$.\\ + % + \cref{ex:symmetric-equiv} + & 358-g9543064 + & The text should be ``Show that for any $A,B:\UU$, the following type is equivalent to $\eqv A B$. Can you extract from this a definition of a type satisfying the three desiderata of $\isequiv(f)$?''\\ + % + \cref{thm:object-classifier} + & 44-g14eb86b + & To maintain consistency, one line was added at the end of the computation of the composite equivalence in the proof.\\ + % + \cref{thm:fiber-of-a-fibration} + & 44-g14eb86b + & The type of $\proj{1}$ should be $(\sm{x:A}P(x))\to A$.\\ + % + % Chapter 5 + % + \cref{sec:appetizer-univalence} + & 706-ged2c765 + & In the proof that $\eqv{\nat}{\natp}$, the definitions of $f$ and $g$ should be $\rec\nat(\natp, \; \zerop, \; \lamu{n:\nat} \sucp)$ and $\rec\natp(\nat, \; 0, \; \lamu{n:\natp} \suc)$ respectively.\\ + % + \cref{sec:w-types} + & 125-g433f87e + & In the definition of $\natw$, use $\bfalse$ for $0$ and $\btrue$ for $\suc$, to match the ordering of $\bfalse$ and $\btrue$ in \cref{sec:type-booleans}.\\ + % + \cref{sec:w-types} + & 551-g82b74bf + & The definitions of $\natw$ and $\lst A$ as $\w$-types should be $\wtype{b:\bool} \rec\bool(\bbU,\emptyt,\unit,b)$ and $\wtype{x: \unit + A} \rec{\unit + A}(\bbU, \emptyt, \lamu{a:A} \unit, x)$.\\ + % + \cref{sec:w-types} + & 218-g42219cb + & In the description of the constructor $\supp$, its second argument is more clearly written as $f : B(a) \to \wtype{x:A} B(x)$.\\ + % + \cref{sec:w-types} + & 525-gb1957b8 + & In the computation rule, the recursive call to $\rec{}$ is missing an argument. + It should read $\rec{\wtype{x:A} B(x)}(E,e,\supp(a,f)) \jdeq e(a,f,\big(\lamu{b:B(a)} \rec{\wtype{x:A} B(x)}(E,e,f(b))\big))$.\\ + % + \cref{sec:w-types} + & 570-g6ec04c3 + & In the verification that $\dbl$ computes as expected, $e_t$ should be $e_0$ and $e_f$ should be $e_1$.\\ + % + \cref{sec:initial-alg} + & 554-g9b2a34b + & The definition of the type of $\w$-homomorphisms (just before \cref{thm:w-hinit}) should read $\whom_{A,B}((C, s_C),(D,s_D)) \defeq \sm{f : C \to D} \prd{a:A}{h:B(a)\to C} \id{f(s_C(a,h))}{s_D(a, f\circ h)}$.\\ + % + \cref{sec:htpy-inductive} + & 917-gd6960ad + & In the first paragraph, the definition of $\natw$ should be $\wtype{b:\bool} \rec\bool(\bbU,\emptyt,\unit,b)$.\\ + % + \cref{sec:htpy-inductive} + & 608-g6af101f + & In the computation rule for homotopy $\w$-types, the left-hand side should be $\rec{\wtypeh{x:A} B(x)}(E,e,\supp(a,f))$.\\ + % + \cref{sec:htpy-inductive} + & 1261-g4cdab82 + & In the commutative diagram preceding the definition of $\w_s(A, B)$, all occurrences of $x$ should be replaced with $a$.\\ + % + \cref{sec:htpy-inductive} + & 1261-g4cdab82 + & In the definition of $\w_s(A,B)$, $\alpha(\supp(x,f))$ should be $\alpha(\supp(a,f))$, and $\prd{a,f}$ should be inserted after $\sm\alpha$.\\ + % + \cref{eq:example-comp} + & 912-g04d3fb6 + & In the preceding sentence, $\delta:d$ should be $\delta:D$.\\ + % + \cref{sec:generalizations} + & 908-g4b2eb10 + & The second two constructors of $\mathsf{paritynat}$ should be $\mathsf{esucc} : \mathsf{paritynat}(\btrue) \to \mathsf{paritynat}(\bfalse)$ and $\mathsf{osucc} : \mathsf{paritynat}(\bfalse) \to \mathsf{paritynat}(\btrue)$.\\ + % + \cref{thm:identity-systems} + & 139-gd5c5d01 + & In the proof of \ref{item:identity-systems4}$\Rightarrow$\ref{item:identity-systems1}, the type of $D'$ should be $(\sm{b:A} R(b)) \to \type$.\\ + % + \cref{ex:same-recurrence-not-defeq} + & 622-ga0bd007 + & The two functions should satisfy the same recurrence judgmentally.\\ + % + \cref{ex:one-function-two-recurrences} + & 622-ga0bd007 + & The function should satisfy both recurrences judgmentally.\\ + % + \cref{sec:identity-systems} + & 171-gdc4966e + & The subscript of $\refl A : a=_A a$ should be $a$, i.e. $\refl a$.\\ + % + % Chapter 6 + % + \cref{sec:dependent-paths} + & 54-gd4a47c2 + & Soon after \cref{rmk:defid}, the phrase ``An element $b:P(\base)$ in the fiber over the constructor $\base:\nat$'' should say $\base:\Sn^1$.\\ + % + \cref{thm:uniqueness-for-functions-on-S1} + & 423-gf763ae1 + & \cref{thm:transport-path,thm:dpath-path} are needed to put $q$ in the form required by the induction principle.\\ + % + \cref{thm:interval-funext} + & 417-g4aa6a15 + & Added \cref{ex:funext-from-interval}: the function constructed in \cref{thm:interval-funext} is actually an inverse to $\happly$, so that the full function extensionality axiom follows from an interval type.\\ + % + \cref{thm:S1-autohtpy} + & 625-g950efa9 + & In the second paragraph of the proof, the appeal to function extensionality should be omitted.\\ + % + \cref{sec:circle} + & 327-g7cbe31c + & In the first sentence after the proof of \cref{thm:apd2}, ``$P:\Sn^2\to P$'' should be ``$P:\Sn^2\to\type$''.\\ + % + \cref{sec:circle} + & 1039-g30da4c6 + & In the sentence after the proof of \cref{thm:apd2}, the type family in which $s$ is a dependent path should be $\lam{p} \dpath P p b b$ instead of $P$.\\ + % + \cref{sec:cell-complexes} + & 289-gdefeb8c + & In the induction principle for the torus, the types of $p'$ and $q'$ should be $\dpath P p {b'} {b'}$ and $\dpath P q b b$ respectively.\\ + % + \cref{sec:hubs-spokes} + & 289-gdefeb8c + & In the induction principle for the torus, the types of $p'$ and $q'$ should be $\dpath P p {b'} {b'}$ and $\dpath P q b b$ respectively.\\ + % + \cref{sec:hittruncations} + & 468-g5472874 + & The induction principle for $\brck{A}$ should conclude $f(\bproj a)\jdeq g(a)$, not $f(\bproj a)\jdeq a$. And in the hypotheses of the induction principle for $\trunc0 A$ and in the proof of \cref{thm:trunc0-ind}, $v:\dpath{B}{u(x,y,p,q)}{p}{q}$ should instead be $v:\dpath{B}{u(x,y,p,q)}{r}{s}$.\\ + % + \cref{sec:hittruncations} + & 860-gc7d862c + & In the penultimate paragraph, the ``unobjectionable'' constructor for $\trunc0 A$ should begin ``For every $f:S\to \trunc0 A$'', not ``For every $f:S\to A$''.\\ + % + \cref{thm:quotient-ump} + & 961-gde36592 + & The first sentence of the second paragraph of the proof should end with $g(x) = \overline{g\circ q}(x)$.\\ + % + \cref{lem:quotient-when-canonical-representatives} + & 514-g18ade45 + & Instead of ``is the set-quotient of $A$ by $\eqr$'', the statement should say ``satisfies the universal property of the set-quotient of $A$ by~$\eqr$, and hence is equivalent to it''. + In the proof, the second displayed equation should be $e'(g, s) (x,p) \defeq g(x)$. + The fourth displayed equation should be $e(e'(g, s)) \jdeq e(g \circ \proj{1}) \jdeq (g \circ \proj{1} \circ q, {\nameless})$, the fifth should be $g(\proj{1}(q(x))) \jdeq g(r(x)) = g(x)$, and the proof should conclude with ``$g$ respects $\eqr$ by the assumption $s$''.\\ + % + \cref{thm:sign-induction} + & 535-g0a9abfe + & The ``computation rules'' satisfied by $f$ are only propositional equalities. + Also, the proof requires transport across a few unmentioned equivalences.\\ + % + \cref{thm:looptothe} + & 535-g0a9abfe + & The defining clauses should use $\defid$ rather than $\defeq$ (see the erratum for \cref{thm:sign-induction}). + Also, the first clause should say $\refl{a}$ rather than $\refl{\base}$.\\ + % + \cref{thm:transport-is-given} + & 682-g3af5dbe + & Three occurrences of $P$ in the statement should be $B$.\\ + % + \cref{thm:flattening-cp} + & 457-g411ec6d + & The right-hand side of the displayed equation in the proof should be $(\cc(g(b)),D(b)(y))$.\\ + % + \cref{thm:flattening-cp} + & 961-gde36592 + & After the display we should have $\pp(b):\cc(f(b))=\cc(g(b))$.\\ + % + \cref{sec:flattening} + & 519-gc99a54c + & $f$ denotes a map $B\to A$ in this section and should not be re-used for functions defined by induction on $\sm{w:W} P(w)$; we may use $k$ instead. + Thus $f$ should be $k$ in the last sentence of \cref{thm:flattening-rect}; the first sentence of its proof; the second and third sentences of the paragraph after its proof; the last sentence of \cref{thm:flattening-rectnd}; the first, second, and last sentences of its proof; throughout the statement and proof of \cref{thm:ap-sigma-rect-path-pair}; the statement of \cref{thm:flattening-rectnd-beta-ppt}; and the second sentence of its proof.\\ + % + \cref{thm:flattening-rect} + & 537-gdf3b51d + & In the display after the definition of $q$, the transport in the first line should be with respect to $x\mapsto Q(\cct'(g(b),x))$, and in the second line the subscript of $\apfunc{}$ should be $x\mapsto \cct'(g(b),x)$.\\ + % + \cref{thm:flattening-rect} + & 961-gde36592 + & The subscript of $\apfunc{}$ should also be $x\mapsto \cct'(g(b),x)$ in the third, fourth, and fifth displays. + In the fourth and fifth displays, the path-concatenations should be in the other order. + And in the fifth display, $\refl{g(b)}$ should be $\refl{\cc(g(b))}$.\\ + % + \cref{thm:flattening-rectnd-beta-ppt} + & 961-gde36592 + & Both occurrence of the function $f$ should be replaced with $g$ in the + final two steps of the calculation within the proof.\\ + % + \cref{thm:ap-sigma-rect-path-pair} + & 501-ge895f81 + & Both occurrences of $P$ in the statement should be $Y$, and both occurrences of $Q$ in the proof should be $Z$.\\ + % + % Chapter 7 + % + \cref{thm:h-level-retracts} + & 180-gb672a4d + & In the last displayed equation of the proof, $q$ should be $r$.\\ + % + \cref{thm:isaprop-isofhlevel} + & 101-g713f48c + & The base case in the proof is just \cref{thm:isprop-iscontr}.\\ + % + \cref{sec:truncations} + & 480-gdc84050 + & The third paragraph is wrong: in contrast to \cref{rmk:spokes-no-hub}, it \emph{would} actually work to define $\trunc nA$ omitting the hub point.\\ + % + \cref{thm:h-set-refrel-in-paths-sets} + & 1131-gc1748fa + & In the second paragraph of the first proof, the codomain of the function $f(x,x)$ should be $\id[X]xx$, not $\id[X]xy$.\\ + % + \cref{lem:hedberg-helper} + & 644-g627c0a8 + & In the proof of the lemma, ``If $x$ is $\inr(f)$'' should be ``If $x$ is $\inr(t)$''.\\ + % + \cref{thm:path-truncation} + & 412-gb9582fc + & In the proof, \encode and \decode should be switched.\\ + % + \cref{lem:nconnected_postcomp_variation} + & 801-g01922a8 + & The converse direction is false unless $Q$ is fiberwise merely inhabited. Also, the occurrences of $\ap f p$ and $\ap f {\proj 2 w}$ in the proof should be just $p$ and $\proj 2 w$, respectively.\\ + % + \cref{lem:connected-map-equiv-truncation} + & 367-g1c8c07e + & In the proof that the first composite is the identity, all occurrences of $y$ should be $f(x)$.\\ + % + \cref{thm:modal-char} + & 658-g016f3a4 + & In the second paragraph of the proof, the first two occurrences of $\proj2$ (but not the third) should be $\proj1$.\\ + % + \cref{ex:s2-colim-unit} + & 101-ga366be2 + & ``entires'' should be ``entirely''.\\ + % + \cref{ex:s2-colim-unit} + & 683-g8941e50 + & This exercise needs more precise definitions of ``diagram'' and ``colimit''.\\ + % + \cref{ex:acnm} + & 1074-gcd42187 + & $\choice{\infty,\infty}$ is not \cref{thm:ttac}, but the identity function.\\ + % + \cref{ex:acnm} + & 603-ge113e08 + & The penultimate sentence should ask ``Is $\choice{n,m}$ consistent with univalence for any $m\ge 0$ and any $n$?''.\\ + % + % Chapter 8 + % + \cref{lem:s1-encode-decode} + & 535-g0a9abfe + & The proof by induction on $n:\Z$ is justified by \cref{thm:sign-induction}, not \cref{thm:looptothe}.\\ + % + \cref{thm:iscontr-s1cover} + & 535-g0a9abfe + & The clauses defining $q_z$ should use $\defid$ rather than $\defeq$ (see the erratum for \cref{thm:sign-induction}).\\ + % + \cref{thm:suspension-increases-connectedness} + & 1062-gf3bfeae + & In the proof, $E$ is not $(n + 1)$-connected but $(n + 1)$-truncated.\\ + % + \cref{thm:fiber-of-the-fiber} + & 1181-g3e51973 + & In the proof, $(x:A)$ should be $(x:X)$.\\ + % + \cref{thm:les} + & 33-g628d81b + & In the proof, $\trunc0g\circ\trunc0f$ should be $\trunc0f\circ\trunc0g$, and similarly for $g\circ f$. + Also, $g(t)=w'$ should be $\tproj0{g(t)}=w'$. + Finally, $\tproj0{(w,p)}:\tproj0{\hfib{f}{z_0}}$ should be $\tproj0{(w,p)}:\trunc{0}{\hfib{f}{z_0}}$.\\ + % + \cref{thm:conn-pik} + & 1023-gf188aeb + & The proof requires a separate argument for $k=0$.\\ + % + \cref{thm:hopf-fibration} + & 256-g9e6fcb8 + & The phrase ``whose fibers are $\Sn^1$'' should be ``whose fiber over the basepoint is $\Sn ^1$''. + The same change should be made in \cref{ex:HopfJr,ex:SuperHopf}.\\ + % + \cref{lem:fibration-over-pushout} + & 1062-gf3bfeae + & In the definition of ${E^{\mathrm{tot}}}'$ in the proof, $e_C$ should be $e_X$.\\ + % + \cref{thm:conn-trunc-variable-ind} + & 396-g868335b + & In the proof, the function $k$ should have type $\prd{a:A} P(f(a))$. + It should also be named $\ell$, to avoid confusion with the integer $k$.\\ + % + \cref{thm:freudcode} + & 87-g3f977b2 + & In the second displayed equation in the proof, $\merid(x_1)$ should be $\opp{\merid(x_1)}$.\\ + % + \cref{thm:wedge-connectivity} + & 1203-g7464bf1 + & The type family $P$ defined in the proof should instead be called $Q$, to avoid clashes with the type family $P$ assumed in the statement.\\ + % + \cref{thm:wedge-connectivity} + & 399-g8897c94 + & In the last sentence of the proof, ``$(n-1)$-connected'' should be ``$(n-1)$-truncated''.\\ + % + \cref{thm:freudlemma} + & 88-g0c0be67 + & The type of $m$ should be $a_1=a_2$, the second display should begin with $C(a_1,\transfib{B}{\opp m}{b})$, and the proof should say ``we may assume $a_2$ is $a_1$ and $m$ is $\refl{a_1}$''.\\ + % + \cref{sec:freudenthal} + & 165-gd5584c6 + & In~\eqref{eq:freudcompute1}, $r''$ should be $r'$, the end point of $r$ should be $\transfib{B}{\opp{\merid(x_0)}}{q}$, and obtaining $r'$ requires also identifying this with $q \ct \opp{\merid(x_0)}$. + Similarly, in~\eqref{eq:freudcompute2}, the end point of $r$ should be $\transfib{B}{\opp{\merid(x_1)}}{q}$.\\ + % + \cref{sec:freudenthal} + & 474-g5289470 + & $\pi_3(\Sn^2)=\Z$ should be stated as \cref{thm:pi3s2}, following from \cref{cor:pis2-hopf,thm:pinsn}.\\ + % + \cref{thm:whiteheadn} + & 1092-ge3b8b71 + & After applying the induction hypothesis, it additionally needs to be checked that for every path $p : a = a$ the map $\pi_k(\apfunc f):\pi_k(x = x,p) \to \pi_k(f(x) = f(x),\apfunc f(p))$ is a bijection. \\ + % + \cref{sec:general-encode-decode} + & 1154-g301662b + & In the strengthening of condition (iii) from \cref{lem:encode-decode-loop}, the right side should read just ``$c$'' instead of ``$c.a$''.\\ + % + % Chapter 9 + % + \cref{ct:gaunt} + & 1307-gfe63517 + & Stating that every isomorphism is an identity is not very accurate (consider the discrete category on the interval type): a more accurate statement is that every automorphism is an identity arrow. Notice that for precategories, this property must be combined with skeletality for the equivalence to hold.\\ + % + \cref{ct:functor} + & 807-gebec78b + & In \cref{ct:functor:comp}, it should read ``$\hom_A(b,c)$'' instead of ``$\hom_B(b,c)$''.\\ + % + \cref{sec:equivalences} + & 1218-gcb6ba30 + & Just before \cref{ct:essentially-surjective}, it should say ``However, if $A$ is not a category'' instead of ``However, if $B$ is not a category''.\\ + % + \cref{ct:yoneda} + & 971-g6096085 + & The sequence of equations at the end of the proof should begin with $\alpha_{a'}(f) = \alpha_{a'} (\y a_{a,a'}(f)(1_a))$, and thereafter the subscripts should remain $a,a'$ rather than $a',a$.\\ + % + \cref{ct:sig} + & 897-g94fb722 + & In~\ref{item:sigcmp}, ``if $f:\hom_X(x,y)$'' should be ``if $f:\hom_X(x,y)$ and $g:\hom_X(y,z)$''.\\ + % + \cref{sec:sip} + & 1111-g3332a31 + & The type of objects $A_0$ of the precategory $A$ of $(P,H)$-structures should be defined as $\sm{x:X_0} Px$, not $\sm{x:X} Px$.\\ + % + \cref{cha:category-theory} + & 966-g04374f5 + & The first sentence after \cref{ct:cat-weq-eq} should begin ``Therefore, if a precategory $A$ admits a weak equivalence functor $A\to \widehat{A}$ \emph{into a category}\dots''.\\ + % + \cref{thm:rezk-completion} + & 313-g8ee79db + & In the second proof, the third constructor of $\widehat A_0$ is unneeded; it follows from the fourth constructor and path induction. + In the fifth constructor, $j(g)\ct j(f)$ should be $j(f)\ct j(g)$, and similarly throughout the proof. + Finally, for consistency, the 1-truncation constructor should be included explicitly (this was intended to be implied by "higher inductive 1-type").\\ + % + \cref{cha:category-theory} Notes + & 379-ga57eab2 + & It should be mentioned that Hofmann and Streicher (1998) also considered this definition of category.\\ + % + % Chapter 10 + % + \cref{card:semiring} + & 1303-ga530d97 + & The equation $\cd{B}\times\cd{A} \jdeq \cd{B\times A}$ in the proof should be $\cd{B}\cdot\cd{A} \jdeq \cd{B\times A}$.\\ + % + \cref{thm:wfmin} + & 1290-g4101ad3 + & In the proof, the second sentence of the second paragraph should have ``$s(a'):\acc(a')$'' rather than ``$s(a'):\acc(a)$''.\\ + % + \cref{thm:ordord} + & 140-g55de417 + & The second sentence of the proof should say ``By well-founded induction on $A$, suppose $\ordsl A b$ is accessible for all $b 0) \Rightarrow \exis{r : \Q} U_x(r) \land (q r < 1)$ and $U_{x^{-1}}(q) \defeq (q > 0) \land \exis{r : \Q} L_x(r) \land (q r > 1)$ for positive $x$, + and $L_{x^{-1}}(q) \defeq (q < 0) \land \exis{r : \Q} U_x(r) \land (q r > 1)$ and $U_{x^{-1}}(q) \defeq (q < 0) \Rightarrow \exis{r : \Q} L_x(r) \land (q r < 1)$ for negative $x$. \\ + % + \cref{sec:RD-cauchy-complete} + & 832-g0cb658e + & In the second paragraph, at ``From this we get'', the universal quantification should be over~$\delta$ as well.\\ + % + \cref{sec:constr-cauchy-reals} + & 53-g7d3a5fa + & In the last paragraph of this section, ``$\rclim(\rcrat \circ x \circ m)$'' should be ``$\rclim(\rcrat \circ x \circ M)$''.\\ + % + \cref{sec:induct-recurs-cauchy} + & 1209-g3e5ad94 + & In the statement of $(\RC,\closesym)$-recursion, ``$f(x) : A$'' should be ``$f(\rclim(x)) : A$''.\\ + % + \cref{defn:RC-approx} + & 1069-g3b333d5 + & In the description of openness of $\approx$, ``$\exis{\epsilon : \Qp}$'' should be ``$\exis{\delta : \Qp}$''.\\ + % + \cref{lem:untruncated-linearity-reals-coincide} + & 87-g82b27c3 + & \eqref{eq:untruncated-linearity} should be $c:\prd{q, r : \Q} (q < r) \to (q < x) + (x < r)$, and therefore the use of $c$ in the proof should be $c(s,t)$ rather than $c(x,s,t)$.\\ + % + \cref{analysis-interval-ctb} + & 1270-g3f17b85 + & In the proof, $n : \N$ should be $k : \N$. And the range of $i$ should be $0 \leq i \leq k$. Also in the last equation, $r(\lim x) = \ell$ should be $\lim x = \ell$.\\ + % + \cref{ctb-uniformly-continuous-sup} + & 61-gce4e391 + & In the proof, $|f(x) - f(y_i) < \epsilon$ should be $|f(x) - f(y_i)| < \epsilon$.\\ + % + \cref{defn:inductive-cover} + & 57-g671b000 + & In (\cref{defn:inductive-cover-interval-1}), the order of $r$ and $s$ should be flipped on the right-hand side: $(r, s)$ should be $(s, r)$.\\ + % + \cref{sec:surreals} + & 1189-ga9c35f0 + & The inductive case of $\iota_{\Q_D}$ should be defined as $\iota_{\Q_D}(a/2^n) \defeq \surr{\iota_{\Q_D}(a/2^n - 1/2^n)}{\iota_{\Q_D}(a/2^n + 1/2^n)}$.\\ + % + \cref{eg:surreal-addition} + & 636-g827e7ea + & In the first bullet point, to prove $x^L+z < x+z$ requires a $\NO$-induction on $z$, since only when $z$ is defined by a cut can we say that $x^L+z$ is a left option of $x+z$.\\ + % + \cref{ex:mean-value-theorem} + & 222-g3453cf1 + & This is the intermediate value theorem, not the mean value theorem.\\ + % + \cref{eg:surreal-addition} + & 980-ge9d0398 + & For the codomain of the outer recursion, the conditions should be $(x] (N0) -- node[above]{\footnotesize $i_n$} (N1); +\draw[->] (N0) -- node[left]{\footnotesize $j_n$} (N2); +\draw[->] (N1) -- node[right]{\footnotesize $j_{n+1}$} (N2); +\draw[double, double equal sign distance] (N3) -- node[left,above]{\footnotesize $glue_n$} (N4); +\end{tikzpicture} +\end{center} +we get a path $x \defeq j_n(y) = j_{n+1} (i_n(y))$. +But, as we will show, the inclusion $i_n$ of $\Sn^n$ in $\Sn^{n+1}$ is nullhomotopic, +every point in the image is equal to $\north_{n+1}$. Thus, we are able to show that +$j_{n+1}(i_n(y)) = j_{n+1}(\north_{n+1})$. Composing the proof of the first step +with the proof of the second step we conclude the exercise. + +To construct a $D_{\blank} : \prd{n:\nat} j_n(\north_n) = j_0(\north_0)$ we +proceed by induction on $n$. For the base case we can +use $\refl{j_0(\north_0)}$. For the inductive case, we have by inductive +hypothesis $j_n(\north_n) = j_0(\north_0)$. By our definition of $i_{\blank}$, +we have that $\north_{n+1} \equiv i_n(\north_n)$. So $j_{n+1} (\north_{n+1})$ +equals $j_{n+1}(i_n(\north_n))$. By concatenation with $\glue_n(\north_n)$, +we reduce our goal to the inductive hypothesis. + +Let's now show that the inclusion of $\Sn^n$ in $\Sn^{n+1}$ can be +continuously retracted to $\north_{n+1}$. +That is, let's construct a homotopy: +\[ H_{\blank} : \prd{n:\nat}{x:\Sn^n} i_n(x) = \north_{n+1} \] +For the case $n\equiv 0$ we know that $i_0(\btrue) \equiv \north_1$ and +$i_0(\bfalse) \equiv \south_1$. This is because we constructed the inclusion +that way. So we can prove the equalities +using $\refl{\north_1}$ and $\merid_1(\btrue) : \north_1 = \south_1$. + +For the inductive case we defined, previously, $i_n(\north_n) \equiv \north_{n+1}$ +and $i_n(\south_{n}) \equiv \south_{n+1}$. So we can prove the equalities using +$\refl{\north_{n+1}}$ and $(\merid_{n+1}(\north_n))^{-1}$. +Then we have to prove that the function respects $\merid_n$: +\[ \prd{x:\Sn^{n-1}} \dpath {x\mapsto (i_n(x) = \north_{n+1})} {\merid_n(x)} {\refl{\north_{n+1}}} {(\merid_{n+1}(\north_n))^{-1}} \] +By \cref{thm:transport-path} (and some straightforward computation) this reduces to: +\[ i_n(\merid_n(x)) = \merid_{n+1}(\north_{n}) \] +But, by our definition of $i_{\blank}$, and the computation rule of the +suspension induction $i_n(\merid_n(x))$ equals $\merid_{n+1} (i_{n-1}(x))$. +And, by inductive hypothesis, $i_{n-1}(x) = \north_n$, which gives us the +desired result. + +Composing the two proofs we just gave we get a function: +\[ J_n(x) \defeq \glue_n(x)\ct \apfunc{j_{n+1}}{H_n(x)}\ct D_{n+1} + : \prd{n:\nat}{x:\Sn^n} j_n(x) = j_0(\north_0). \] +We use this function and induction on $\Sn^{\infty}$ to derive +the contractibility of the space. +Now it remains to show that our function respects the gluing: +\[ \prd{n:\nat}{x:\Sn^n} \dpath {x\mapsto (x = j_0(\north_0))} + {\glue_n(x)} {J_n(x)} {J_{n+1}(i_n (x))} \] +By definition this is: +\[ \prd{n:\nat}{x:\Sn^n} + \transfib{x\mapsto (x = j_0(\north_0))}{\glue_n(x)}{J_n(x)} + = {J_{n+1}(i_n (x))} \] + +The LHS is equal to $\glue_{n}(x)^{-1}\ct J_n(x)$, which, by definition of +$J_n(x)$, is: +\[ \glue_n(x)^{-1}\ct\glue_n(x)\ct\apfunc{j_{n+1}}{H_n(x)}\ct D_{n+1} \] +Cancelling we get: +\[ \apfunc{j_{n+1}}{H_n(x)}\ct D_{n+1} \] + +We also use the definition of $J_{\blank}$ in the RHS, and then the computation +rule of $D_{\blank}$, giving us the equalities: +\begin{align*} + & J_{n+1}(i_n(x))\\ + &= \glue_{n+1}(i_n(x))\ct\apfunc{j_{n+2}}{H_{n+1}(i_n(x))}\ct D_{n+2}\\ + &= \glue_{n+1}(i_n(x))\ct\apfunc{j_{n+2}}{H_{n+1}(i_n(x))}\ct + \glue_{n+1}(\north_{n+1})^{-1}\ct D_{n+1}. +\end{align*} + +So it suffices to show: +\[ \apfunc{j_{n+1}}{H_n(x)} = \glue_{n+1}(i_n(x))\ct\apfunc{j_{n+2}}{H_{n+1}(i_n(x))} + \ct\glue_{n+1}(\north_{n+1})^{-1} \] +Or equivalently: +\[ \apfunc{j_{n+1}}{H_n(x)} \ct\glue_{n+1}(\north_{n+1}) = + \glue_{n+1}(i_n(x))\ct\apfunc{j_{n+2}}{H_{n+1}(i_n(x))} \] + +But we remember that we have the homotopy +$\glue_{n+1} : j_{n+1} = j_{n+2}\circ i_{n+1}$, so, by a simple application +of \cref{lem:htpy-natural} and the functoriality of $\apfunc{}{}$, we get +a proof of the equality: +\[ \apfunc{j_{n+1}}{H_n(x)} \ct\glue_{n+1}(\north_{n+1}) = + \glue_{n+1}(i_n(x))\ct\apfunc{j_{n+2}}{\apfunc{i_{n+1}}{H_n(x)}} \] +So we reduced the goal to showing: +\[ \apfunc{i_{n+1}}{H_n(x)} = H_{n+1}(i_n(x)) \] + +This can be done easily by induction in $\Sn^n$ using the definition of $H_{\blank}$. + + +\subsection*{Solution to \cref{ex:contr-infinity-sphere-susp}} + +First we write down the type of the induction principle explicitly: + +\[ \ind{\Sn^\infty} : \prd{C:\Sn^\infty \to \UU}{n:C(\north)}{s:C(\south)} + \Parens{\prd{x:\Sn^\infty} C(x) \to \dpath C {\merid(x)} {n}{s}} \to \prd{x:\Sn^\infty} C(x) . \] + + We take $\north$ as center of contraction. So we have to prove + $\prd{x:\Sn^\infty} \north = x$. For this we use induction on $\Sn^\infty$ taking: +\[C \defeq (\lambda x. \north = x) : \Sn^\infty \to \UU .\] + + When $x$ is $\north$ we just use $\refl{\north} : \north = \north$. When $x$ + is $\south$ we use $\merid(\north) : \north = \south$. + When $x$ varies along $\merid$ we have to give a function of type: +\[\prd{x:\Sn^\infty} \Parens{\north = x} \to \Parens{\dpath C {\merid(x)} {\refl{\north}}{\merid(\north)}}. \] + So, given $x : \Sn^\infty$ and $p : \north = x$, we have to prove: + \[\transfib{x \mapsto (\north = x)}{\merid(x)}{\refl{\north}} = \merid(\north).\] + +By \cref{cor:transport-path-prepost} it suffices to show +$\refl{\north}\ct \merid(x) = \merid(\north)$. Canceling $\refl{\north}$ and +applying $\merid$ to $p$ gets us the desired result. + +\subsection*{Solution to \cref{ex:unique-fiber}} + +We know that every two points $y_1,y_2 : Y$ are merely equal, because $Y$ is +is connected. That is, we have a function +$c : \prd{y_1,y_2:Y}\trunc {} {y_1 = y_2}$. To prove this we can use the remark +after \cref{thm:connected-pointed}. If we want to show that any pair of +points $y_1,y_2 : Y$ are merely equal we can use the first point $y_1$ to get +a pointed space $(Y,y_1)$, and then use the remark. + +We note that it suffices to show that for any $y_1,y_2:Y$ we have +$\trunc {} {\hfib{f}{y_1} = \hfib{f}{y_2}}$ because +$\hfib{f}{y_1} = \hfib{f}{y_2}$ implies (using $\idtoeqv$) +$\hfib{f}{y_1}\simeq \hfib{f}{y_2}$ +and thus, by recursion on the truncation of $\hfib{f}{y_1} = \hfib{f}{y_2}$, +we get that $\trunc {} {\hfib{f}{y_1} = \hfib{f}{y_2}}$ implies +$\trunc {} {\hfib{f}{y_1} \simeq \hfib{f}{y_2}}$. + +The type of $c(y_1,y_2)$ is a truncation, so we can use its recursion to +prove the desired result. +By recursion we can assume that $y_1 = y_2$, and in that case we obviously have +$\trunc {} {\hfib{f}{y_1} = \hfib{f}{y_2}}$. We also have to show that +the proposition we want to prove is $-1$-truncated, but that is straightforward +because it is a $-1$-truncation. + + +\section*{Exercises from \cref{cha:category-theory}} + +\subsection*{Solution to \cref{ex:stack}} + +Define $K$ to be the precategory with $K_0 \defeq Y$ and $\hom_K(y_1,y_2) \defeq (p(y_1)=p(y_2))$. +Then $\mathrm{Desc}(A,p)\defeq A^K$ is a good definition. +Moreover, the obvious functor $K\to X$ (where $X$ denotes the discrete category on itself) is a weak equivalence, so \cref{ct:esofull-precomp-ff,ct:cat-weq-eq} yield the second and third parts. +Finally, $K$ is a strict category, so if it is a stack, then $p$ has a section, while conversely if $p$ has a section then $K\to X$ is a (strong) equivalence. + +\section*{Exercises from \cref{cha:set-math}} + +\subsection*{Solution to \cref{ex:prop-ord}} + +Define $A currentnumber: + new += erratum + +# Finally, put the rest in. +while line: + new += line + line = errata.readline() + +errata.close() + +# New errata file +newfilename = "errata-since-" + currentversion + ".tex" + +print "Writing filtered errata to " + newfilename + "." + +newfile = open(newfilename,'w') +newfile.write(new) +newfile.close() diff --git a/formal.tex b/formal.tex new file mode 100644 index 0000000000000000000000000000000000000000..e82afa00e8c4af27951038fd8a0d03aba37f9007 --- /dev/null +++ b/formal.tex @@ -0,0 +1,1259 @@ +% !TeX root = hott-online.tex + +\titleformat{\chapter}[display]{\fontsize{23}{25}\fontseries{m}\fontshape{it}\selectfont}{\chaptertitlename}{20pt}{\fontsize{35}{35}\fontseries{b}\fontshape{n}\selectfont} +\chapter{Formal type theory} +\label{cha:rules} + +\index{formal!type theory|(}% +\index{type theory!formal|(}% +\index{rules of type theory|(}% + +Just as one can develop mathematics in set theory without explicitly using the axioms of Zermelo--Fraenkel set theory, +in this book we have developed mathematics in univalent foundations without explicitly referring to a formal +system of homotopy type theory. Nevertheless, it is important to \emph{have} a +precise description of homotopy type theory as a formal system in order to, for example, +% +\begin{itemize} +\item state and prove its metatheoretic properties, including logical +consistency, +\item construct models, e.g.\ in simplicial sets, model categories, higher toposes, +etc., and +\item implement it in proof assistants like \Coq or \Agda. + \index{proof!assistant} +\end{itemize} +% +Even the logical consistency\index{consistency} of homotopy type theory, namely that in the empty context there is no term $a:\emptyt$, is not obvious: if we had erroneously +chosen a definition of equivalence for which $\eqv{\emptyt}{\unit}$, then +univalence would imply that $\emptyt$ has an element, since $\unit$ does. +Nor is it obvious that, for example, our definition of $\Sn^1$ as a higher +inductive type yields a type which behaves like the ordinary circle. + +There are two aspects of type theory which we must pin down before addressing +such questions. Recall from the Introduction that type theory +comprises a set of rules specifying when the judgments $a:A$ and $a\jdeq a':A$ +hold --- for example, products are characterized by the rule that whenever $a:A$ +and $b:B$, $(a,b):A\times B$. To make this precise, we must first define +precisely the syntax of terms --- the objects $a,a',A,\dots$ which these judgments +relate; then, we must define precisely the judgments and their rules of +inference --- the manner in which judgments can be derived from other judgments. + +In this appendix, we present two formulations of Martin-L\"{o}f type +theory, and of the extensions that constitute homotopy type theory. +The first presentation (\cref{sec:syntax-informally}) describes the syntax of +terms and the forms of judgments as an extension of the untyped +$\lambda$-calculus, while leaving the rules of inference informal. +The second (\cref{sec:syntax-more-formally}) defines the terms, judgments, +and rules of inference inductively in the style of natural deduction, as +is customary in much type-theoretic literature. + +\section*{Preliminaries} +\label{sec:formal-prelim} + + +In \cref{cha:typetheory}, we presented the two basic \define{judgments} +\index{judgment} +of type theory. The first, $a:A$, asserts that a term $a$ has type $A$. The second, +$a\jdeq b:A$, states that the two terms $a$ and $b$ are \define{judgmentally +equal}% +\index{equality!judgmental} +\index{judgmental equality} +at type $A$. These judgments are inductively defined by a set of +inference rules described in \cref{sec:syntax-more-formally}. + +To construct an element $a$ of a type $A$ is to derive $a:A$; in the book, we +give informal arguments which describe the construction of $a$, but formally, +one must specify a precise term $a$ and a full derivation that $a:A$. + +However, the main difference between the presentation of type theory in the book +and in this appendix is that here judgments are explicitly +formulated in an ambient \define{context}, +\index{context} +or list of assumptions, of the form +\[ + x_1:A_1, x_2:A_2,\dots,x_n:A_n. +\] +An element $x_i : A_i$ of the context expresses the assumption that the +variable +\index{variable}% +$x_i$ has type $A_i$. The variables $x_1, \ldots, x_n$ appearing in +the context must be distinct. We abbreviate contexts with the letters $\Gamma$ +and $\Delta$. + +The judgment $a:A$ in context $\Gamma$ is written +\[ \oftp\Gamma aA \] +and means that $a:A$ under the assumptions listed in $\Gamma$. When the list of +assumptions is empty, we write simply +\[ \oftp{}aA \] +or +\[ \oftp\emptyctx aA \] +where $\emptyctx$ denotes the empty context. The same applies to the equality +judgment +\[ + \jdeqtp\Gamma{a}{b}{A} +\] + +However, such judgments are sensible only for \define{well-formed} contexts, +\index{context!well-formed}% +a notion captured by our third and final judgment +\[ + \wfctx{(x_1:A_1, x_2:A_2,\dots,x_n:A_n)} +\] +expressing that each $A_i$ is a type in the context $x_1:A_1, +x_2:A_2,\dots,x_{i-1}:A_{i-1}$. In particular, therefore, if $\oftp\Gamma aA$ and +$\wfctx\Gamma$, then we know that each $A_i$ contains only the variables +$x_1,\dots,x_{i-1}$, and that $a$ and $A$ contain only the variables +$x_1,\dots,x_n$. +\index{variable!in context} + +In informal mathematical presentations, the context is +implicit. At each point in a proof, the mathematician knows which +variables are available and what types they have, either by historical +convention ($n$ is usually a number, $f$ is a function, etc.) or +because variables are explicitly introduced with sentences such as +``let $x$ be a real number''. We discuss some benefits of using explicit +contexts in \cref{sec:more-formal-pi,sec:more-formal-sigma}. + +We write $B[a/x]$ for the \define{substitution} +\index{substitution}% +of a term $a$ for free occurrences of +the variable~$x$ in the term $B$, with possible capture-avoiding +renaming of bound variables, +\index{variable!and substitution}% +as discussed in +\cref{sec:function-types}. The general form of substitution +% +\[ + B[a_1,\dots,a_n/x_1,\dots,x_n] +\] +% +substitutes expressions $a_1,\dots,a_n$ for the variables +$x_1,\dots,x_n$ simultaneously. + +To \define{bind a variable $x$ in an expression $B$} +\indexdef{variable!bound}% +means to incorporate both of them into a larger expression, called an \define{abstraction}, +\indexdef{abstraction}% +whose purpose is to express the fact that $x$ is ``local'' to $B$, i.e., it +is not to be confused with other occurrences of $x$ appearing +elsewhere. Bound variables are familiar to programmers, but less so to mathematicians. +Various notations are used for binding, such as $x \mapsto B$, +$\lam x B$, and $x \,.\, B$, depending on the situation. We may write $C[a]$ for the +substitution of a term $a$ for the variable in the abstracted expression, i.e., +we may define $(x.B)[a]$ to be $B[a/x]$. As discussed in +\cref{sec:function-types}, changing the name of a bound variable everywhere within an expression (``$\alpha$-conversion'') +\index{alpha-conversion@$\alpha $-conversion}% +does not change the expression. Thus, to be very +precise, an expression is an equivalence class of syntactic forms +which differ in names of bound variables. + +One may also regard each variable $x_i$ of a judgment +\[ + x_1:A_1, x_2:A_2,\dots,x_n:A_n \vdash a : A +\] +to be bound in its \define{scope}, +\indexdef{variable!scope of}% +\index{scope}% +consisting of the expressions $A_{i+1}, +\ldots, A_n$, $a$, and $A$. + +\section{The first presentation} +\label{sec:syntax-informally} + +The objects and types of our type theory may be written as terms using +the following syntax, which is an extension of $\lambda$-calculus with +\emph{variables} $x, x',\dots$, +\index{variable}% +\emph{primitive constants} +\index{primitive!constant}% +\index{constant!primitive}% +$c,c',\dots$, \emph{defined constants}\index{constant!defined} $f,f',\dots$, and term forming +operations +% +\[ + t \production x \mid \lam{x} t \mid t(t') \mid c \mid f +\] +% +The notation used here means that a term $t$ is either a variable $x$, or it +has the form $\lam{x} t$ where $x$ is a variable and $t$ is a term, or it has +the form $t(t')$ where $t$ and $t'$ are terms, or it is a primitive constant +$c$, or it is a defined constant $f$. The syntactic markers '$\lambda$', '(', +')', and '.' are punctuation for guiding the human eye. + +We use $t(t_1,\dots,t_n)$ as an abbreviation for the repeated application +$t(t_1)(t_2)\dots (t_n)$. We may also use \emph{infix}\index{infix notation} notation, writing $t_1\; +\star\; t_2$ for $\star(t_1,t_2)$ when $\star$ is a primitive or defined +constant. + +Each defined constant has zero, one or more \define{defining equations}. +\index{equation, defining}% +\index{defining equation}% +There are two kinds of defined constant. An \emph{explicit} +\index{constant!explicit} +defined constant $f$ has a single defining equation + \[ f(x_1,\dots,x_n)\defeq t,\] +where $t$ does not involve $f$. +% +For example, we might introduce the explicit defined constant $\circ$ with defining equation + \[ \circ (x,y)(z) \defeq x(y(z)),\] +and use infix notation $x\circ y$ for $\circ(x,y)$. This of course is just composition of functions. + +The second kind of defined constant is used to specify a (parameterized) mapping +$f(x_1,\dots,x_n,x)$, where $x$ ranges over a type whose elements are generated +by zero or more primitive constants. For each such primitive constant $c$ there +is a defining equation of the form +\[ + f(x_1,\dots,x_n,c(y_1,\dots,y_m)) \defeq t, +\] +where $f$ may occur in $t$, but only in such a way that it is clear that the +equations determine a totally defined function. The paradigm examples of such +defined functions are the functions defined by primitive recursion on the +natural numbers. We may call this kind of definition of a function a \emph{total + recursive definition}. +\index{total!recursive definition}% +In computer science and logic this kind of definition +of a function on a recursive data type has been called a \define{definition by + structural recursion}. +\index{definition!by structural recursion}% +\index{structural!recursion}% +\index{recursion!structural}% + +\define{Convertibility} +\index{convertibility of terms}% +\index{term!convertibility of}% +$t \conv t'$ between terms $t$ +and $t'$ is the equivalence relation generated by the defining equations for constants, +the computation rule\index{computation rule!for function types} +% +\[ + (\lam{x} t)(u) \defeq t[u/x], +\] +% +and the rules which make it a \emph{congruence} with respect to application and $\lambda$-abstraction\index{lambda abstraction@$\lambda$-abstraction}: +% +\begin{itemize} +\item if $t \conv t'$ and $s \conv s'$ then $t(s) \conv t'(s')$, and +\item if $t \conv t'$ then $(\lam{x} t) \conv (\lam{x} t')$. +\end{itemize} +\noindent +The equality judgment $t \jdeq u : A$ is then derived by the following single rule: +% +\begin{itemize} +\item if $t:A$, $u:A$, and $t \conv u$, then $t \jdeq u : A$. +\end{itemize} +% +Judgmental equality is an equivalence relation. + +Note that the type theory of this presentation diverges from that used in the main body of the text in not including the judgmental uniqueness principle $f \jdeq (\lam{x} f(x))$ for functions. +Such an equality requires that judgmental equality be sensitive to the type of the terms involved, as this equality only makes sense when $f$ is known to be a function, whereas in this presentation the convertibility relation is type-independent. +The second presentation in \cref{sec:syntax-more-formally} includes the uniqueness principle. + + +\subsection{Type universes} + +We postulate a hierarchy of \define{universes} denoted by primitive constants +\index{type!universe} +% +\begin{equation*} + \UU_0, \quad \UU_1, \quad \UU_2, \quad \ldots +\end{equation*} +% +The first two rules for universes say that they form a cumulative hierarchy of types: +% +\begin{itemize} +\item $\UU_m : \UU_n$ for $m < n$, +\item if $A:\UU_m$ and $m \le n$, then $A:\UU_n$, +\end{itemize} +% +and the third expresses the idea that an object of a universe can serve as a type and stand to the +right of a colon in judgments: +% +\begin{itemize} +\item if $\Gamma \vdash A : \UU_n$, and $x$ is a new variable,% +\footnote{By ``new'' we mean that it does not appear in $\Gamma$ or $A$.} +then $\vdash (\Gamma, x:A)\; \ctx$. +\end{itemize} +% +In the body of the book, an equality judgment $A \jdeq B : \UU_n$ between types +$A$ and $B$ is usually abbreviated to $A \jdeq B$. This is an instance of +typical ambiguity\index{typical ambiguity}, as we can always switch to a larger universe, which however does not affect the validity of the judgment. + +The following conversion rule allows us to replace a type by one equal to it in a typing judgment: +% +\begin{itemize} +\item if $a:A$ and $A \jdeq B$ then $a:B$. +\end{itemize} + +\subsection{Dependent function types (\texorpdfstring{$\Pi$}{Π}-types)} + +We introduce a primitive constant $c_\Pi$, but write +$c_\Pi(A,\lam{x} B)$ as $\tprd{x:A}B$. Judgments concerning +such expressions and expressions of the form $\lam{x} b$ are introduced by the following rules: +% +\begin{itemize} +\item if $\Gamma \vdash A:\UU_n$ and $\Gamma,x:A \vdash B:\UU_n$, then $\Gamma \vdash \tprd{x:A}B : \UU_n$ +\item if $\Gamma, x:A \vdash b:B$ then $\Gamma \vdash (\lam{x} b) : (\tprd{x:A} B)$ +\item if $\Gamma\vdash g:\tprd{x:A} B$ and $\Gamma\vdash t:A$ then $\Gamma\vdash g(t):B[t/x]$ +\end{itemize} +% +If $x$ does not occur freely in $B$, we abbreviate $\tprd{x:A} B$ as the non-dependent function type +$A\rightarrow B$ and derive the following rule: +% +\begin{itemize} +\item if $\Gamma\vdash g:A \rightarrow B$ and $\Gamma\vdash t:A$ then $\Gamma\vdash g(t):B$ +\end{itemize} +Using non-dependent function types and leaving implicit the context $\Gamma$, the rules above can be written in the following alternative style that we use in the rest of this section of the appendix: +% +\begin{itemize} +\item if $A:\UU_n$ and $B:A\to\UU_n$, then $\tprd{x:A}B(x) : \UU_n$ +\item if $x:A \vdash b:B(x)$ then $ \lam{x} b : \tprd{x:A} B(x)$ +\item if $g:\tprd{x:A} B(x)$ and $t:A$ then $g(t):B(t)$ +\end{itemize} +% + +\subsection{Dependent pair types (\texorpdfstring{$\Sigma$}{Σ}-types)} + +We introduce primitive constants $c_\Sigma$ and $c_{\mathsf{pair}}$. An +expression of the form $c_\Sigma(A,\lam{a} B)$ is written as $\sm{a:A}B$, +and an expression of the form $c_{\mathsf{pair}}(a,b)$ is written as $\tup +a b$. We write $A\times B$ instead of $\sm{x:A} B$ if $x$ is not free in $B$. + +Judgments concerning such expressions are introduced by the following +rules: +% +\begin{itemize} +\item if $A:\UU_n$ and $B: A \rightarrow \UU_n$, then $\sm{x:A}B(x) : \UU_n$ +\item if, in addition, $a:A$ and $b:B(a)$, then $\tup a b:\sm{x:A}B(x)$ +\end{itemize} +% +If we have $A$ and $B$ as above, $C : (\sm{x:A}B(x)) \rightarrow \UU_m$, and +\[ + d:\tprd{x:A}{y:B(x)} C(\tup x y) +\] +we can introduce a defined constant +\[ + f:\tprd{p:\sm{x:A}B(x)} C(p) +\] +with the defining equation +\[ + f(\tup x y)\defeq d(x,y). +\] +% +Note that $C$, $d$, $x$, and $y$ may contain extra implicit parameters $x_1,\ldots,x_n$ if they were obtained in some non-empty context; therefore, the fully explicit recursion schema is +% +\begin{narrowmultline*} + f(x_1,\dots,x_n,\tup{x(x_1,\dots,x_n)}{y(x_1,\dots,x_n)}) \defeq + \narrowbreak + d(x_1,\dots,x_n,\tup{x(x_1,\dots,x_n)}{y(x_1,\dots,x_n)}). +\end{narrowmultline*} + +\subsection{Coproduct types} + +We introduce primitive constants $c_+$, $c_\inlsym$, and $c_\inrsym$. +We write $A+B$ instead of $c_+(A,B)$, $\inl(a)$ instead of +$c_\inlsym(a)$, and $\inr(a)$ instead of $c_\inrsym(a)$: +% +\begin{itemize} +\item if $A,B : \UU_n$ then $A + B : \UU_n$ +\item moreover, $\inl: A \rightarrow A+B$ and $\inr: B \rightarrow A+B$ +\end{itemize} +% +If we have $A$ and $B$ as above, $C : A+B \rightarrow \UU_m$, +$d:\tprd{x:A} C(\inl(x))$, and $e:\tprd{y:B} C(\inr(y))$, +then we can introduce a defined constant $f:\tprd{z:A+B}C(z)$ with the defining equations +% +\begin{equation*} + f(\inl(x)) \defeq d(x) + \qquad\text{and}\qquad + f(\inr(y)) \defeq e(y). +\end{equation*} + +\subsection{The finite types} + +We introduce primitive constants $\ttt$, $\emptyt$, $\unit$, satisfying the following rules: +% +\begin{itemize} +\item $\emptyt : \UU_0$, $\unit : \UU_0$ +\item $\ttt:\unit$ +\end{itemize} + +Given $C : \emptyt \rightarrow \UU_n$ we can introduce a defined constant $f:\tprd{x:\emptyt} C(x)$, with no defining equations. + +Given $C : \unit \rightarrow \UU_n$ and $d : C(\ttt)$ we can introduce a defined constant $f:\tprd{x:\unit} C(x)$, with defining equation $f(\ttt) \defeq d$. + +\subsection{Natural numbers} + +The type of natural numbers is obtained by introducing primitive constants +$\N$, $0$, and $\suc$ with the following rules: +% +\begin{itemize} + \item $\N : \UU_0$, + \item $0:\N$, + \item $\suc:\N\rightarrow \N$. +\end{itemize} +% +Furthermore, we can define functions by primitive recursion. If we have +$C : \N \rightarrow \UU_k $ we can introduce a defined constant $f:\tprd{x:\N}C(x)$ whenever we have +% +\begin{align*} + d & : C(0) \\ + e & : \tprd{x:\N}(C(x)\rightarrow C(\suc (x))) +\end{align*} +% +with the defining equations +% +\begin{equation*} + f(0) \defeq d + \qquad\text{and}\qquad + f(\suc (x)) \defeq e(x,f(x)). +\end{equation*} + +\subsection{\texorpdfstring{$W$}{W}-types} + +For $W$-types we introduce primitive constants $c_\wtypesym$ and $c_\suppsym$. +An expression of the form $c_\wtypesym(A,\lam{x} B)$ is written as +$\wtype{x:A}B$, and an expression of the form $c_\suppsym(x,u)$ is written +as $\supp(x,u)$: +% +\begin{itemize} +\item if $A:\UU_n$ and $B: A \rightarrow \UU_n$, then $\wtype{x:A}B(x) : \UU_n$ +\item if moreover, $a:A$ and $u:B(a)\rightarrow \wtype{x:A}B(x)$ then $\supp(a,u):\wtype{x:A}B(x)$. +\end{itemize} +% +Here also we can define functions by total recursion. If we have $A$ and $B$ +as above and $C : (\wtype{x:A}B(x)) \rightarrow \UU_m$, then we can introduce a defined constant +$f:\tprd{z:\wtype{x:A}B(x)} C(z)$ whenever we have +\[ + d:\tprd{a:A}{u:B(a) \rightarrow \wtype{x:A}B(x)}((\tprd{y:B(a)}C(u(y))) \rightarrow C(\supp(a,u))) +\] +with the defining equation +\[ + f(\supp(a,u)) \defeq d(a,u,f\circ u). +\] + +\subsection{Identity types} + +We introduce primitive constants $c_\idsym$ and $c_{\refl{}}$. We write +$\id[A] a b$ for $c_\idsym(A,a,b)$ and $\refl a$ for $c_{\refl{}}(A,a)$, when +$a:A$ is understood: +% +\begin{itemize} +\item If $A : \UU_n$, $a:A$, and $b:A$ then $\id[A] a b : \UU_n$. +\item If $a:A$ then $\refl a :\id[A] a a $. +\end{itemize} +% +Given $a:A$, if $y:A, z:\id[A] a y \vdash C : \UU_m$ and +$\vdash d:C[a,\refl{a}/y,z]$ then we can introduce a defined constant +\[ + f:\tprd{y:A}{z:\id[A] a y} C +\] +with defining equation +\[ + f(a,\refl{a})\defeq d. +\] + +\section{The second presentation} +\label{sec:syntax-more-formally} + +In this section, there are three kinds of judgments +\begin{mathpar} +\wfctx\Gamma +\and +\oftp\Gamma{a}{A} +\and +\jdeqtp\Gamma{a}{a'}{A} +\end{mathpar} +which we specify by providing inference rules for deriving them. A typical \define{inference rule} +\indexsee{inference rule}{rule}% +\indexdef{rule}% +has the form +% +\begin{equation*} + \inferrule*[right=\textsc{Name}] + {\mathcal{J}_1 \\ \cdots \\ \mathcal{J}_k} + {\mathcal{J}} +\end{equation*} +% +It says that we may derive the \define{conclusion} $\mathcal{J}$, provided that we have +already derived the \define{hypotheses} $\mathcal{J}_1, \ldots, \mathcal{J}_k$. +(Note that, being judgments rather than types, these are not hypotheses \emph{internal} to the type theory in the sense of \cref{sec:types-vs-sets}; they are instead hypotheses in the deductive system, i.e.\ the metatheory.) +On the +right we write the \textsc{Name} of the rule, and there may be extra side conditions that +need to be checked before the rule is applicable. + +A \define{derivation} +\index{derivation}% +of a judgment is a tree constructed from such inference +rules, with the judgment at the root of the tree. For example, with the rules given below, the following is a derivation of +$\oftp{\emptyctx}{\lamu{x:\unit} x}{\unit\to\unit}$. +% +\begin{mathpar} +\inferrule*[right=$\Pi$-\rintro] + {\inferrule*[right=$\Vble$] + {\inferrule*[right=\ctx-\textsc{ext}] + {\inferrule*[right=$\unit$-\rform] + {\inferrule*[right=\ctx-\textsc{emp}] + {\ } + {\wfctx {\emptyctx}}} + {\oftp{}{\unit}{\UU_0}}} + {\wfctx {\tmtp x\unit}}} + {\oftp{\tmtp x\unit}{x}{\unit}}} + {\oftp{\emptyctx}{\lamu{x:\unit} x}{\unit\to\unit}} +\end{mathpar} + +\subsection{Contexts} +\label{subsec:contexts} + +\index{context}% +A context is a list +% +\begin{equation*} + \tmtp{x_1}{A_1}, \tmtp{x_2}{A_2}, \ldots, \tmtp{x_n}{A_n} +\end{equation*} +% +which indicates that the distinct variables +\index{variable}% +$x_1, \ldots, x_n$ are assumed to have types $A_1, \ldots, A_n$, respectively. The list may be empty. We abbreviate contexts with the letters $\Gamma$ and $\Delta$, and we may juxtapose them to form larger contexts. + +The judgment $\wfctx{\Gamma}$ formally expresses the fact that $\Gamma$ is a well-formed context, and is governed by the rules of inference +% +\begin{mathpar} + \inferrule*[right=\ctx-\textsc{emp}] + {\ } + {\wfctx\emptyctx} +\and + \inferrule*[right=\ctx-\textsc{ext}] + {\oftp{\tmtp{x_1}{A_1}, \ldots, \tmtp{x_{n-1}}{A_{n-1}}}{A_n}{\UU_i}} + {\wfctx{(\tmtp{x_1}{A_1}, \ldots, \tmtp{x_n}{A_n})}} +\end{mathpar} +% +with a side condition for the second rule: the variable $x_n$ must be distinct from the variables $x_1, \ldots, x_{n-1}$. +Note that the hypothesis and conclusion of $\ctx$-\textsc{ext} are judgments of different forms: the hypothesis says that in the context of variables $x_1, \ldots, x_{n-1}$, the expression $A_n$ has type $\UU_i$; while the conclusion says that the extended context $(\tmtp{x_1}{A_1}, \ldots, \tmtp{x_n}{A_n})$ is well-formed. + +It is a meta-theoretic property of the system that if any judgment of the form $\oftp{\Gamma}{a}{A}$ or $\jdeqtp\Gamma{a}{a'}{A}$ is derivable, then so is the judgment $\wfctx\Gamma$ that the context $\Gamma$ is well-formed. +The premises of all the rules are chosen to include just enough well-formedness hypotheses to make this property provable, but no more. +For instance, it is not necessary for $\ctx$-\textsc{ext} to hypothesize well-formedness of $(\tmtp{x_1}{A_1}, \ldots, \tmtp{x_{n-1}}{A_{n-1}})$, as that will follow from the derivability of its premise; but it is necessary for the $\Vble$ rule in the next section to hypothesize well-formedness of its context. +This choice is only one of the many possible ways to formulate a type theory precisely, but a detailed investigation of such issues is beyond the scope of this appendix. + +\subsection{Structural rules} + +\index{structural!rules|(}% +\index{rule!structural|(}% + +The fact that the context holds assumptions is expressed by the rule which says that we may derive those typing judgments which are listed in the context: +% +\begin{mathpar} + \inferrule*[right=$\Vble$] + {\wfctx {(\tmtp{x_1}{A_1}, \ldots, \tmtp{x_n}{A_n})} } + {\oftp{\tmtp{x_1}{A_1}, \ldots, \tmtp{x_n}{A_n}}{x_i}{A_i}} +\end{mathpar} +% +As with $\ctx$-\textsc{ext}, the hypothesis and conclusion of the rule $\Vble$ are judgments of different forms, only now they are reversed: we start with a well-formed context and derive a typing judgment. + +The following important principles, called \define{substitution} +\indexdef{rule!of substitution}% +and +\define{weakening}, +\indexdef{rule!of weakening}% +need not be explicitly assumed. Rather, it is possible to +show, by induction on the structure of all possible derivations, that whenever +the hypotheses of these rules are derivable, their conclusion is also +derivable.\footnote{Such rules are called \define{admissible}\indexdef{rule!admissible}\indexsee{admissible!rule}{rule, admissible}.} +For the typing judgments these principles are manifested as +% +\begin{mathpar} + \inferrule*[right=$\Subst_1$] + {\oftp\Gamma{a}{A} \\ \oftp{\Gamma,\tmtp xA,\Delta}{b}{B}} + {\oftp{\Gamma,\Delta[a/x]}{b[a/x]}{B[a/x]}} +\and + \inferrule*[right=$\Weak_1$] + {\oftp\Gamma{A}{\UU_i} \\ \oftp{\Gamma,\Delta}{b}{B}} + {\oftp{\Gamma,\tmtp xA,\Delta}{b}{B}} +\end{mathpar} +and for judgmental equalities they become +\begin{mathpar} + \inferrule*[right=$\Subst_2$] + {\oftp\Gamma{a}{A} \\ \jdeqtp{\Gamma,\tmtp xA,\Delta}{b}{c}{B}} + {\jdeqtp{\Gamma,\Delta[a/x]}{b[a/x]}{c[a/x]}{B[a/x]}} +\and + \inferrule*[right=$\Subst_3$] + {\jdeqtp\Gamma{a}{b}{A} \\ \oftp{\Gamma,\tmtp xA,\Delta}{c}{C}} + {\jdeqtp{\Gamma,\Delta[a/x]}{c[a/x]}{c[b/x]}{C[a/x]}} +\and + \inferrule*[right=$\Weak_2$] + {\oftp\Gamma{A}{\UU_i} \\ \jdeqtp{\Gamma,\Delta}{b}{c}{B}} + {\jdeqtp{\Gamma,\tmtp xA,\Delta}{b}{c}{B}} +\end{mathpar} +% +In addition to the judgmental equality rules given for each type former, we also +assume that judgmental equality is an equivalence relation respected by typing. +\begin{mathparpagebreakable} + \inferrule*{\oftp\Gamma{a}{A}}{\jdeqtp\Gamma{a}{a}{A}} +\and + \inferrule*{\jdeqtp\Gamma{a}{b}{A}}{\jdeqtp\Gamma{b}{a}{A}} +\and + \inferrule*{\jdeqtp\Gamma{a}{b}{A} \\ \jdeqtp\Gamma{b}{c}{A}}{\jdeqtp\Gamma{a}{c}{A}} +\and + \inferrule*{\oftp\Gamma{a}{A} \\ \jdeqtp\Gamma{A}{B}{\UU_i}}{\oftp\Gamma{a}{B}} +\and + \inferrule*{\jdeqtp\Gamma{a}{b}{A} \\ \jdeqtp\Gamma{A}{B}{\UU_i}}{\jdeqtp\Gamma{a}{b}{B}} +\end{mathparpagebreakable} +% +Finally, we assume that judgmental equality is a congruence respected by typing, +i.e., that each type and term-former preserves judgmental equality in each of +its arguments. For instance, along with the $\Pi$-\rintro\ rule, we assume the +rule +\[ + \inferrule*[right=$\Pi$-\rintro-eq] + {\oftp\Gamma{A}{\UU_i} \\ + \oftp{\Gamma,\tmtp xA}{B}{\UU_i} \\ + \jdeqtp{\Gamma,\tmtp xA}{b}{b'}{B}} + {\jdeqtp\Gamma{\lamu{x:A} b}{\lamu{x:A'} b'}{\tprd{x:A} B}} +\] +Completing the case of dependent function types, two similar rules, +$\Pi$-\textsc{form-eq}\ and $\Pi$-\textsc{elim-eq}, are assumed. +Taken together, these local principles (at every type) imply the global congruence principles +$\Subst_2$ and $\Subst_3$ above. We will omit these local rules for brevity. + +\index{rule!structural|)}% +\index{structural!rules|)}% + +\subsection{Type universes} + +\index{type!universe}% + +We postulate an infinite hierarchy of type universes +% +\begin{equation*} + \UU_0, \quad \UU_1, \quad \UU_2, \quad \ldots +\end{equation*} +% +Each universe is contained in the next, and any type in $\UU_i$ is also in $\UU_{i+1}$: +% +\begin{mathpar} +\inferrule*[right=\UU-\textsc{intro}] + {\wfctx \Gamma } + {\oftp\Gamma{\UU_i}{\UU_{i+1}}} +\and +\inferrule*[right=\UU-\textsc{cumul}] + {\oftp\Gamma{A}{\UU_i}} + {\oftp\Gamma{A}{\UU_{i+1}}} +\end{mathpar} +% +We shall set up the rules of type theory in such a way that $\oftp\Gamma{a}{A}$ +implies $\oftp\Gamma{A}{\UU_i}$ for some $i$. In other words, if $A$ plays the role of a type then it is in some universe. Another property of our type system is that $\jdeqtp\Gamma{a}{b}{A}$ +implies $\oftp\Gamma{a}{A}$ and $\oftp\Gamma{b}{A}$. + +\subsection{Dependent function types (\texorpdfstring{$\Pi$}{Π}-types)} +\label{sec:more-formal-pi} + +\index{type!dependent function}% +\index{type!function}% + +In \cref{sec:function-types}, we introduced non-dependent functions $A\to B$ in +order to define a family of types as a function $\lam{x:A} B:A\to\UU_i$, which +then gives rise to a type of dependent functions $\tprd{x:A} B$. But with explicit contexts +we may replace $\lam{x:A} B:A\to\UU_i$ with the judgment +% +\begin{equation*} + \oftp{\tmtp xA}{B}{\UU_i}. +\end{equation*} +% +Consequently, we may define dependent functions directly, without reference to non-dependent ones. This way we follow the general principle that each type former, with its constants and rules, should be introduced independently of all other type formers. +% +In fact, henceforth each type former is introduced systematically by: +\begin{itemize} +\item a \define{formation rule}, stating when the type former can be applied;\index{formation rule}\index{rule!formation} +\item some \define{introduction rules}, stating how to inhabit the type;\index{introduction rule}\index{rule!introduction} +\item \define{elimination rules}, or an induction principle, stating how to use an + element of the type; + \index{induction principle}\index{eliminator} +\item \define{computation rules}, which are judgmental equalities explaining what happens when elimination rules are applied to results of introduction rules; + \index{computation rule} + \indexsee{rule!computation}{computation rule} +\item optional \define{uniqueness principles}, which are judgmental equalities explaining how every element of the type is uniquely determined by the results of elimination rules applied to it. + \index{uniqueness!principle} + \indexsee{principle!uniqueness}{uniqueness principle} +\end{itemize} +(See also \cref{rmk:introducing-new-concepts}.) + +For the dependent function type these rules are: +% +\begin{mathparpagebreakable} + \def\premise{\oftp{\Gamma}{A}{\UU_i} \and \oftp{\Gamma,\tmtp xA}{B}{\UU_i}} + \inferrule*[right=$\Pi$-\rform] + \premise + {\oftp\Gamma{\tprd{x:A}B}{\UU_i}} +\and + \inferrule*[right=$\Pi$-\rintro] + {\oftp{\Gamma,\tmtp xA}{b}{B}} + {\oftp\Gamma{\lam{x:A} b}{\tprd{x:A} B}} +\and + \inferrule*[right=$\Pi$-\relim] + {\oftp\Gamma{f}{\tprd{x:A} B} \\ \oftp\Gamma{a}{A}} + {\oftp\Gamma{f(a)}{B[a/x]}} +\and + \inferrule*[right=$\Pi$-\rcomp] + {\oftp{\Gamma,\tmtp xA}{b}{B} \\ \oftp\Gamma{a}{A}} + {\jdeqtp\Gamma{(\lam{x:A} b)(a)}{b[a/x]}{B[a/x]}} +\and + \inferrule*[right=$\Pi$-\runiq] + {\oftp\Gamma{f}{\tprd{x:A} B}} + {\jdeqtp\Gamma{f}{(\lamu{x:A}f(x))}{\tprd{x:A} B}} +\end{mathparpagebreakable} + +The expression $\lam{x:A} b$ binds free occurrences of $x$ in $b$, as does $\tprd{x:A} B$ for +$B$. + +When $x$ does not occur freely in $B$ so that $B$ does not depend on $A$, we obtain as a +special case the ordinary function type $A\to B \defeq \tprd{x:A} B$. We take this as the \emph{definition} of $\to$. + +We may abbreviate an expression $\lam{x:A} b$ as $\lamu{x:A} b$, with the understanding +that the omitted type $A$ should be filled in appropriately before type-checking. + +\subsection{Dependent pair types (\texorpdfstring{$\Sigma$}{Σ}-types)} +\label{sec:more-formal-sigma} + +\index{type!dependent pair}% +\index{type!product}% + +In \cref{sec:sigma-types}, we needed $\to$ and $\prdsym$ types in order to +define the introduction and elimination rules for $\smsym$; as with $\prdsym$, contexts allow us to state the rules for $\smsym$ independently. +Recall that the elimination rule for a positive type such as $\Sigma$ is called \emph{induction} and denoted by $\ind{}$. +% +\begin{mathparpagebreakable} + \def\premise{\oftp{\Gamma}{A}{\UU_i} \and \oftp{\Gamma,\tmtp xA}{B}{\UU_i}} + \inferrule*[right=$\Sigma$-\rform] + \premise + {\oftp\Gamma{\tsm{x:A} B}{\UU_i}} + \and + \inferrule*[right=$\Sigma$-\rintro] + {\oftp{\Gamma, \tmtp x A}{B}{\UU_i} \\ + \oftp\Gamma{a}{A} \\ \oftp\Gamma{b}{B[a/x]}} + {\oftp\Gamma{\tup ab}{\tsm{x:A} B}} + \and + \inferrule*[right=$\Sigma$-\relim] + {\oftp{\Gamma, \tmtp z {\tsm{x:A} B}}{C}{\UU_i} \\ + \oftp{\Gamma,\tmtp x A,\tmtp y B}{g}{C[\tup x y/z]} \\ + \oftp\Gamma{p}{\tsm{x:A} B}} + {\oftp\Gamma{\ind{\tsm{x:A} B}(z.C,x.y.g,p)}{C[p/z]}} + \and + \inferrule*[right=$\Sigma$-\rcomp] + {\oftp{\Gamma, \tmtp z {\tsm{x:A} B}}{C}{\UU_i} \\ + \oftp{\Gamma, \tmtp x A, \tmtp y B}{g}{C[\tup x y/z]} \\\\ + \oftp\Gamma{a}{A} \\ \oftp\Gamma{b}{B[a/x]}} + {\jdeqtp\Gamma{\ind{\tsm{x:A} B}(z.C,x.y.g,\tup{a}{b})}{g[a,b/x,y]}{C[\tup {a} {b}/z]}} +\end{mathparpagebreakable} +% +The expression $\tsm{x:A} B$ binds free occurrences of $x$ in $B$. Furthermore, because +$\ind{\tsm{x:A} B}$ has some arguments with free variables beyond those in $\Gamma$, +we bind (following the variable names above) $z$ in $C$, and $x$ and $y$ in $g$. +These bindings are written as $z.C$ and $x.y.g$, to indicate the names of the bound +variables. +\index{variable!bound}% +In particular, we treat $\ind{\tsm{x:A} B}$ as a primitive, +two of whose arguments contain binders; this is superficially similar to, but +different from, $\ind{\tsm{x:A} B}$ being a function that takes functions as +arguments. + +When $B$ does not contain free occurrences of $x$, we obtain as a special case +the cartesian product $A \times B \defeq \tsm{x:A} B$. We take this +as the \emph{definition} of the cartesian product. + +Notice that we don't postulate a judgmental uniqueness principle for $\Sigma$-types, even +though we could have; see \cref{thm:eta-sigma} for a proof of the corresponding +propositional uniqueness principle. + +\subsection{Coproduct types} + +\index{type!coproduct}% + +\begin{mathparpagebreakable} + \inferrule*[right=$+$-\rform] + {\oftp\Gamma{A}{\UU_i} \\ \oftp\Gamma{B}{\UU_i}} + {\oftp\Gamma{A+B}{\UU_i}} +\\ + \inferrule*[right=$+$-\rintro${}_1$] + {\oftp\Gamma{A}{\UU_i} \\ \oftp\Gamma{B}{\UU_i} \\\\ \oftp\Gamma{a}{A}} + {\oftp\Gamma{\inl(a)}{A+B}} +\and + \inferrule*[right=$+$-\rintro${}_2$] + {\oftp\Gamma{A}{\UU_i} \\ \oftp\Gamma{B}{\UU_i} \\\\ \oftp\Gamma{b}{B}} + {\oftp\Gamma{\inr(b)}{A+B}} +\\ + \inferrule*[right=$+$-\relim] + {\oftp{\Gamma,\tmtp z{(A+B)}}{C}{\UU_i} \\\\ + \oftp{\Gamma,\tmtp xA}{c}{C[\inl(x)/z]} \\ + \oftp{\Gamma,\tmtp yB}{d}{C[\inr(y)/z]} \\\\ + \oftp\Gamma{e}{A+B}} + {\oftp\Gamma{\ind{A+B}(z.C,x.c,y.d,e)}{C[e/z]}} +\and + \inferrule*[right=$+$-\rcomp${}_1$] + {\oftp{\Gamma,\tmtp z{(A+B)}}{C}{\UU_i} \\ + \oftp{\Gamma,\tmtp xA}{c}{C[\inl(x)/z]} \\ + \oftp{\Gamma,\tmtp yB}{d}{C[\inr(y)/z]} \\\\ + \oftp\Gamma{a}{A}} + {\jdeqtp\Gamma{\ind{A+B}(z.C,x.c,y.d,\inl(a))}{c[a/x]}{C[\inl(a)/z]}} +\and + \inferrule*[right=$+$-\rcomp${}_2$] + {\oftp{\Gamma,\tmtp z{(A+B)}}{C}{\UU_i} \\ + \oftp{\Gamma,\tmtp xA}{c}{C[\inl(x)/z]} \\ + \oftp{\Gamma,\tmtp yB}{d}{C[\inr(y)/z]} \\\\ + \oftp\Gamma{b}{B}} + {\jdeqtp\Gamma{\ind{A+B}(z.C,x.c,y.d,\inr(b))}{d[b/y]}{C[\inr(b)/z]}} +\end{mathparpagebreakable} +% +In $\ind{A+B}$, $z$ is bound in $C$, $x$ is bound in $c$, and $y$ is bound in +$d$. + +\subsection{The empty type \texorpdfstring{$\emptyt$}{0}} + +\index{type!empty|(}% + +\begin{mathparpagebreakable} + \inferrule*[right=$\emptyt$-\rform] + {\wfctx\Gamma} + {\oftp\Gamma\emptyt{\UU_i}} +\and + \inferrule*[right=$\emptyt$-\relim] + {\oftp{\Gamma,\tmtp x\emptyt}{C}{\UU_i} \\ \oftp\Gamma{a}{\emptyt}} + {\oftp\Gamma{\ind{\emptyt}(x.C,a)}{C[a/x]}} +\end{mathparpagebreakable} +% +In $\ind{\emptyt}$, $x$ is bound in $C$. The empty type has no introduction rule and no computation rule. + +\index{type!empty|)}% + +\subsection{The unit type \texorpdfstring{$\unit$}{1}} +\label{sec:more-formal-unit} + +\index{type!unit|(}% + +\begin{mathparpagebreakable} + \inferrule*[right=$\unit$-\rform] + {\wfctx\Gamma} + {\oftp\Gamma\unit{\UU_i}} +\and + \inferrule*[right=$\unit$-\rintro] + {\wfctx\Gamma} + {\oftp\Gamma{\ttt}{\unit}} +\and + \inferrule*[right=$\unit$-\relim] + {\oftp{\Gamma,\tmtp x\unit}{C}{\UU_i} \\ + \oftp{\Gamma}{c}{C[\ttt/x]} \\ + \oftp\Gamma{a}{\unit}} + {\oftp\Gamma{\ind{\unit}(x.C,c,a)}{C[a/x]}} +\and + \inferrule*[right=$\unit$-\rcomp] + {\oftp{\Gamma,\tmtp x\unit}{C}{\UU_i} \\ + \oftp{\Gamma}{c}{C[\ttt/x]}} + {\jdeqtp\Gamma{\ind{\unit}(x.C,c,\ttt)}{c}{C[\ttt/x]}} +\end{mathparpagebreakable} +% +In $\ind{\unit}$ the variable $x$ is bound in $C$. + +Notice that we do not postulate a judgmental uniqueness principle for the unit +type; see \cref{sec:finite-product-types} for a proof of the corresponding +propositional uniqueness statement. + +\index{type!unit|)}% + +\subsection{The natural number type} + +\index{natural numbers|(}% + +We give the rules for natural numbers, following \cref{sec:inductive-types}. + +\begin{mathparpagebreakable} + \def\premise{ + \oftp{\Gamma,\tmtp x{\N}}{C}{\UU_i} \\ + \oftp\Gamma{c_0}{C[0/x]} \\ + \oftp{\Gamma,\tmtp{x}\N,\tmtp y C}{c_s}{C[\suc(x)/x]}} + % + \inferrule*[right=$\N$-\rform] + {\wfctx\Gamma} + {\oftp\Gamma{\N}{\UU_i}} +\and + \inferrule*[right=$\N$-\rintro${}_1$] + {\wfctx\Gamma} + {\oftp\Gamma{0}{\N}} +\and + \inferrule*[right=$\N$-\rintro${}_2$] + {\oftp\Gamma{n}{\N}} + {\oftp\Gamma{\suc(n)}{\N}} +\and + \inferrule*[right=$\N$-\relim] + {\premise \\ \oftp\Gamma{n}{\N}} + {\oftp\Gamma{\ind{\N}(x.C,c_0,x.y.c_s,n)}{C[n/x]}} +\and + \inferrule*[right=$\N$-\rcomp${}_1$] + {\premise} + {\jdeqtp\Gamma{\ind{\N}(x.C,c_0,x.y.c_s,0)}{c_0}{C[0/x]}} +\and + \inferrule*[right=$\N$-\rcomp${}_2$] + {\premise \\ \oftp\Gamma{n}{\N}} + {\Gamma\vdash + {\begin{aligned}[t] + &\ind{\N}(x.C,c_0,x.y.c_s,\suc(n)) \\ + &\quad \jdeq c_s[n,\ind{\N}(x.C,c_0,x.y.c_s,n)/x,y] : C[\suc(n)/x] + \end{aligned}}} +\end{mathparpagebreakable} +% +In $\ind{\N}$, $x$ is bound in $C$, and $x$ and $y$ are bound in $c_s$. + +Other inductively defined types follow the same general scheme. + +\index{natural numbers|)}% + +\subsection{Identity types} + +\label{sec:more-formal-identity} + +\index{type!identity|(}% + +The presentation here corresponds to the (unbased) path induction principle for identity types in +\cref{sec:identity-types}. + +\begin{mathparpagebreakable} + \inferrule*[right=$\idsym$-\rform] + {\oftp\Gamma{A}{\UU_i} \\ \oftp\Gamma{a}{A} \\ \oftp\Gamma{b}{A}} + {\oftp\Gamma{\id[A]{a}{b}}{\UU_i}} +\and + \inferrule*[right=$\idsym$-\rintro] + {\oftp\Gamma{A}{\UU_i} \\ \oftp\Gamma{a}{A}} + {\oftp\Gamma{\refl a}{\id[A]aa}} +\and + \inferrule*[right=$\idsym$-\relim] + {\oftp{\Gamma,\tmtp xA,\tmtp yA,\tmtp p{\id[A]xy}}{C}{\UU_i} \\ + \oftp{\Gamma,\tmtp zA}{c}{C[z,z,\refl z/x,y,p]} \\ + \oftp\Gamma{a}{A} \\ \oftp\Gamma{b}{A} \\ \oftp\Gamma{p'}{\id[A]ab}} + {\oftp\Gamma{\indid{A}(x.y.p.C,z.c,a,b,p')}{C[a,b,p'/x,y,p]}} +\and + \inferrule*[right=$\idsym$-\rcomp] + {\oftp{\Gamma,\tmtp xA,\tmtp yA,\tmtp p{\id[A]xy}}{C}{\UU_i} \\ + \oftp{\Gamma,\tmtp zA}{c}{C[z,z,\refl z/x,y,p]} \\ + \oftp\Gamma{a}{A}} + {\jdeqtp\Gamma{\indid{A}(x.y.p.C,z.c,a,a,\refl a)}{c[a/z]}{C[a,a,\refl a/x,y,p]}} +\end{mathparpagebreakable} +% +In $\indid{A}$, $x$, $y$, and $p$ are bound in $C$, and $z$ is bound in +$c$. + +\index{type!identity|)}% + +\subsection{Definitions} + +\index{definition}% + +Although the rules we have listed so far allow us to construct everything we need directly, we +would still like to be able to use named constants, such as $\isequiv$, as a matter of +convenience. Informally, we can think of these constants simply as +abbreviations, but the situation is a bit subtler in the formalization. + +For example, consider function composition, which takes $f:A\to B$ and +$g:B\to C$ to $g\circ f:A\to C$. Somewhat unexpectedly, to make this work formally, $\circ$ must take as arguments not only $f$ and $g$, but also their types $A$, $B$, $C$: +% +\begin{narrowmultline*} + {\circ} \defeq \lam{A:\UU_i}{B:\UU_i}{C:\UU_i} + \narrowbreak + \lam{g:B\to C}{f:A\to B}{x:A} g(f(x)). +\end{narrowmultline*} +% +From a practical perspective, we do not want to annotate each application of +$\circ$ with $A$, $B$ and $C$, as they are usually quite easily guessed from surrounding information. We would like to simply write $g\circ f$. +Then, strictly speaking, $g \circ f$ is not an abbreviation for $\lam{x : A} g(f(x))$, +because it involves additional \define{implicit arguments} which we want to suppress. +\index{implicit argument} + +Inference of implicit arguments, typical ambiguity\index{typical ambiguity} (\cref{sec:universes}), +ensuring that symbols are only defined once, etc., are collectively called +\define{elaboration}. \index{elaboration, in type theory} +Elaboration must take place prior to checking a derivation, and is +thus not usually presented as part of the core type theory. However, it is +essentially impossible to use any implementation of type theory which does not +perform elaboration; see \cite{Coq,norell2007towards} for further discussion. + +\section{Homotopy type theory} +\label{sec:hott-features} + +In this section we state the additional axioms of homotopy type theory which distinguish it from standard Martin-L\"{o}f type theory: function extensionality, the +univalence axiom, and higher inductive types. We state them in the style +of the second presentation \cref{sec:syntax-more-formally}, although the first presentation \cref{sec:syntax-informally} could be used just as well. + +\subsection{Function extensionality and univalence} + +There are two basic ways of introducing axioms which do not introduce new syntax or judgmental equalities (function extensionality and univalence are of this form): +either add a primitive constant to inhabit the axiom, or prove all theorems which depend on the axiom by hypothesizing a variable that inhabits the axiom, cf.\ \cref{sec:axioms}. +While these are essentially equivalent, we opt for the former approach because we feel that the axioms of homotopy type theory are an essential part of the core theory. + +\index{function extensionality}% +\cref{axiom:funext} is formalized by introduction of a constant $\funext$ which +asserts that $\happly$ is an equivalence: +% +\begin{mathparpagebreakable} + \inferrule*[right=$\Pi$-\textsc{ext}] + {\oftp\Gamma{f}{\tprd{x:A} B} \\ + \oftp\Gamma{g}{\tprd{x:A} B}} + {\oftp\Gamma{\funext(f,g)}{\isequiv(\happly_{f,g})}} +\end{mathparpagebreakable} +% +The definitions of $\happly$ and $\isequiv$ can be found in~\eqref{eq:happly} and +\cref{sec:concluding-remarks}, respectively. + +\index{univalence axiom}% +\cref{axiom:univalence} is formalized in a similar fashion, too: +% +\begin{mathparpagebreakable} + \inferrule*[right=$\UU_i$-\textsc{univ}] + {\oftp\Gamma{A}{\UU_i} \\ + \oftp\Gamma{B}{\UU_i}} + {\oftp\Gamma{\univalence(A,B)}{\isequiv(\idtoeqv_{A,B})}} +\end{mathparpagebreakable} +% +The definition of $\idtoeqv$ can be found in~\eqref{eq:uidtoeqv}. + +\subsection{The circle} + +\index{type!circle}% + +Here we give an example of a basic higher inductive type; others follow the same +general scheme, albeit with elaborations. + +Note that the rules below do not precisely follow the pattern of the ordinary +inductive types in \cref{sec:syntax-more-formally}: the rules refer to the +notions of transport and functoriality of maps (\cref{sec:functors}), and the +second computation rule is a propositional, not judgmental, equality. These +differences are discussed in \cref{sec:dependent-paths}. + +\begin{mathparpagebreakable} + \inferrule*[right=$\Sn^1$-\rform] + {\wfctx\Gamma} + {\oftp\Gamma{\Sn^1}{\UU_i}} +\and + \inferrule*[right=$\Sn^1$-\rintro${}_1$] + {\wfctx\Gamma} + {\oftp\Gamma{\base}{\Sn^1}} +\and + \inferrule*[right=$\Sn^1$-\rintro${}_2$] + {\wfctx\Gamma} + {\oftp\Gamma{\lloop}{\id[\Sn^1]{\base}{\base}}} +\and + \inferrule*[right=$\Sn^1$-\relim] + {\oftp{\Gamma,\tmtp x{\Sn^1}}{C}{\UU_i} \\ + \oftp{\Gamma}{b}{C[\base/x]} \\ + \oftp{\Gamma}{\ell}{\dpath C \lloop b b} \\ + \oftp\Gamma{p}{\Sn^1}} + {\oftp\Gamma{\ind{\Sn^1}(x.C,b,\ell,p)}{C[p/x]}} +\and + \inferrule*[right=$\Sn^1$-\rcomp${}_1$] + {\oftp{\Gamma,\tmtp x{\Sn^1}}{C}{\UU_i} \\ + \oftp{\Gamma}{b}{C[\base/x]} \\ + \oftp{\Gamma}{\ell}{\dpath C \lloop b b}} + {\jdeqtp\Gamma{\ind{\Sn^1}(x.C,b,\ell,\base)}{b}{C[\base/x]}} +\and + \inferrule*[right=$\Sn^1$-\rcomp${}_2$] + {\oftp{\Gamma,\tmtp x{\Sn^1}}{C}{\UU_i} \\ + \oftp{\Gamma}{b}{C[\base/x]} \\ + \oftp{\Gamma}{\ell}{\dpath C \lloop b b}} + {\oftp\Gamma{\Sn^1\text{-}\mathsf{loopcomp}} + {\id {\apd{(\lamu{y:\Sn^1} \ind{\Sn^1}(x.C,b,\ell,y))}{\lloop}} {\ell}}} +\end{mathparpagebreakable} +% +In $\ind{\Sn^1}$, $x$ is bound in $C$. The notation ${\dpath C \lloop b b}$ for dependent paths was introduced in \cref{sec:dependent-paths}. +\index{rules of type theory|)}% + +\section{Basic metatheory} +\index{metatheory|(}% + +This section discusses the meta-theoretic properties of the type theory presented in +\cref{sec:syntax-informally}, and similar results hold for \cref{sec:syntax-more-formally}. Figuring out which of these still hold when we add the features from \cref{sec:hott-features} quickly leads to open questions,\index{open!problem} as discussed at the end of this section. + +Recall that \cref{sec:syntax-informally} defines the terms of type theory as +an extension of the untyped $\lambda$-calculus. The $\lambda$-calculus +has its own notion of computation, namely the computation rule\index{computation rule!for function types}: +\[ + (\lam{x} t)(u) \defeq t[u/x]. +\] +This rule, together with the defining equations for the defined constants form +\emph{rewriting rules}\index{rewriting rule}\index{rule!rewriting} that determine reduction steps for a rewriting +system. These steps yield a notion of computation in the sense that each rule +has a natural direction: one simplifies $(\lam{x} t)(u)$ by evaluating the +function at its argument. + +Moreover, this system is \emph{confluent}\index{confluence}, that is, if $a$ simplifies in some +number of steps to both $a'$ and $a''$, there is some $b$ to which both $a'$ and +$a''$ eventually simplify. Thus we can define $t\conv u$ to mean that $t$ and +$u$ simplify to the same term. + +(The situation is similar in \cref{sec:syntax-more-formally}: Although there +we presented the computation rules as undirected equalities $\jdeq$, we can give +an operational semantics by saying that the application of an eliminator to an +introductory form simplifies to its equal, not the other way around.) + +Using standard techniques from type theory, it is possible to show that the system in \cref{sec:syntax-informally} +has the following properties: + +\begin{thm}\label{thm:conversion-preserves-typing} +If $A : \UU$ and $A \conv A'$ then $A' : \UU$. +If $t:A$ and $t \conv t'$ then $t':A$. +\end{thm} + +We say that a term is \define{normalizable} +\indexdef{term!normalizable}% +\index{normalization}% +\indexdef{normalizable term}% +(respectively, \define{strongly +normalizable}) +\indexdef{term!strongly normalizable}% +\index{normalization!strong}% +\index{strong!normalization}% +if some (respectively, every), sequence of rewriting steps from the term +terminates. + +\begin{thm}\label{thm:strong-normalization} +If $A : \UU$ then $A$ is strongly normalizable. +If $t:A$ then $A$ and $t$ are strongly normalizable. +\end{thm} + +We say that a term is in \define{normal form} +\index{normal form}% +\index{term!normal form of}% +if it cannot be further +simplified, and that a term is \define{closed} +\index{closed!term}% +\index{term!closed}% +if no variable occurs freely in +it. A closed normal type has to be a primitive type, i.e., of the form +$c(\vec{v})$ for some primitive constant $c$ (where the list $\vec{v}$ of closed +normal terms may be omitted if empty, for instance, as with $\N$). In fact, we +can explicitly describe all normal forms: + +\begin{lem}\label{lem:normal-forms} + The terms in normal form can be described by the following syntax: + % + \begin{align*} + v & \production k \mid \lam{x} v \mid c(\vec{v}) \mid f(\vec{v}), \\ + k &\production x \mid k(v) \mid f(\vec{v})(k), + \end{align*} + % + where $f(\vec{v})$ represents a partial application of the defined function $f$. + In particular, a type in normal form is of the form $k$ or $c(\vec{v})$. +\end{lem} + +\begin{thm} + If $A$ is in normal form then the + judgment $A : \UU$ is decidable. If $A : \UU$ and $t$ is in normal form then the judgment + $t:A$ is decidable. +\end{thm} + +Logical consistency\index{consistency} (of the system in \cref{sec:syntax-informally}) follows +immediately: if we had $a:\emptyt$ in the empty context, then by +\cref{thm:conversion-preserves-typing,thm:strong-normalization}, $a$ +simplifies to a normal term $a':\emptyt$. But by +\cref{lem:normal-forms} no such term exists. + +\begin{cor} + The system in \cref{sec:syntax-informally} is logically consistent. +\end{cor} + +Similarly, we have the \emph{canonicity}\indexdef{canonicity} property that if $a:\N$ in the empty +context, then $a$ simplifies to a normal term $\suc^k(0)$ for some numeral $k$. + +\begin{cor} + The system in \cref{sec:syntax-informally} has the canonicity property. +\end{cor} + +Finally, if $a,A$ are in normal form, it is \emph{decidable} whether $a:A$; in +other words, because type-checking amounts to verifying the correctness of a +proof, this means we can always ``recognize a correct proof when we see one''. + +\begin{cor} +The property of being a proof in the system in \cref{sec:syntax-informally} is decidable. +\end{cor} + +\mentalpause + +The above results do not apply to the extended system of homotopy type +theory (i.e., the above system extended by \cref{sec:hott-features}), since +occurrences of the univalence axiom and constructors of higher inductive types +never simplify, breaking \cref{lem:normal-forms}. It is an open question\index{open!problem} +whether one can simplify applications of these constants in order to restore +canonicity. We also do not have a schema describing all permissible higher +inductive types, nor are we certain how to correctly formulate their rules +(e.g., whether the computation rules on higher constructors should be judgmental +equalities). + +The consistency\index{consistency} of Martin-L\"{o}f type theory extended with univalence and higher +inductive types could be shown by inventing an appropriate normalization procedure, but currently +the only proofs that these systems are consistent are via semantic models --- for +univalence, a model in Kan\index{Kan complex} complexes due to Voevodsky \cite{klv:ssetmodel}, and +for higher inductive types, a model due to Lumsdaine and Shulman \cite{ls:hits}. + +Other metatheoretic issues, and a summary of our current results, are discussed +in greater length in the ``Constructivity'' and ``Open problems'' sections of +the introduction to this book. + +\index{metatheory|)}% + +\sectionNotes\label{subsec:general-remarks} + +% This presentation is strongly inspired by two Martin-L\"of 1972 and 1973. + +The system of rules with introduction (primitive constants) and elimination +and computation rules (defined constant) is inspired by Gentzen natural +deduction. The possibility of strengthening the elimination rule for +existential quantification was indicated in \cite{howard:pat}. The +strengthening of the axioms for disjunction appears in \cite{Martin-Lof-1972}, +and for absurdity elimination and identity type in \cite{Martin-Lof-1973}. The +$W$-types were introduced in \cite{Martin-Lof-1979}. They generalize a notion +of trees introduced by \cite{Tait-1968}. +\index{Martin-L\"of}% + +%inspired from unpublished work of Spector. + +The generalized form of primitive recursion for natural numbers and ordinals +appear in \cite{Hilbert-1925}. This motivated G\"odel's system $T$, +\cite{Goedel-T-1958}, which was analyzed by \cite{Tait-1966}, who used, +following \cite{Goedel-T-1958}, the terminology ``definitional equality'' for +conversion: two terms are \emph{judgmentally equal} if they reduce to a +common term by means of a sequence of applications of the reduction +rules. This terminology was also used by de Bruijn \cite{deBruijn-1973} in his +presentation of \emph{AUTOMATH}.\index{AUTOMATH} + +Our second presentation comprises fairly standard presentation of +intensional Martin-L\"{o}f type theory, with some additional features needed in +homotopy type theory. Compared to a reference presentation of +\cite{hofmann:syntax-and-semantics}, the type theory of this book has a few +non-critical differences: +% +\begin{itemize} +\item universes \`{a} la Russell, in the sense of +\cite{martin-lof:bibliopolis}; and +\item judgmental $\eta$ and function extensionality for $\Pi$ types; +\end{itemize} +and a few features essential for homotopy type theory: +\begin{itemize} +\item the univalence axiom; and +\item higher inductive types. +\end{itemize} +% +As a matter of convenience, the book primarily defines functions by induction +using definition by \emph{pattern matching}. +\index{pattern matching}% +\index{definition!by pattern matching}% +It is possible to formalize the +notion of pattern matching, as done in \cref{sec:syntax-informally}. However, the +standard type-theoretic presentation, adopted in \cref{sec:syntax-more-formally}, is to introduce a single \emph{dependent +eliminator} for each type former, from which functions out of that type must be +defined. This approach is easier to formalize both syntactically and +semantically, as it amounts to the universal property of the type former. +The two approaches are equivalent; see \cref{sec:pattern-matching} for a +longer discussion. + +\index{type theory!formal|)}% +\index{formal!type theory|)}% + + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "hott-online" +%%% End: diff --git a/front.tex b/front.tex new file mode 100644 index 0000000000000000000000000000000000000000..73dad190825908cb08be815b9eb0fa17c3669e10 --- /dev/null +++ b/front.tex @@ -0,0 +1,168 @@ +%%%%%%%%%%%%%%%%%%%% Cover page %%%%%%%%%%%%%%%%%%%% + +\newgeometry{noheadfoot,bindingoffset=-5pt,top=0pt,bottom=0pt,inner=0pt,outer=0pt}% +\ifOPTcover +\setcounter{page}{-1} % Otherwise we end up having two pages numbered 1 +\newlength{\coverheight} +\setlength{\coverheight}{\OPTcoverheight} +\newlength{\coverwidth} +\setlength{\coverwidth}{\OPTcoverwidth} +\input{frontpage} +\ThisLLCornerWallPaper{1.1}{\OPTfrontimage} +\pagecolor{covercolor} +\frontpage +\newpage +% Reset page counter, cover page does not count +\ifpdf +\nopagecolor +\else +\pagecolor{white} +\fi +\cleartooddpage +\else +\fi + +%%%%%%%%%%%%%%%%%%%% Bastard page %%%%%%%%%%%%%%%%%%%% +\ifOPTbastard +\cleartooddpage +\hbox{} +\vspace{0.2\textwidth} +{\centering +\makebox[\OPTbastardwidth][s]{ +\fontsize{\OPTbastardtitlefont}{\OPTbastardtitlefont}\fontshape{n}\selectfont% +\textbf{Homotopy Type Theory}}\par +\vspace*{\OPTbastardtitleskip} +\makebox[\OPTbastardwidth][s]{ +\fontsize{\OPTbastardsubtitlefont}{\OPTbastardsubtitlefont}\fontshape{n}\selectfont% +\textit{Univalent Foundations of Mathematics}}\par +} +\else +\fi + +%%%%%%%%%%%%%%%%%%%% Title page %%%%%%%%%%%%%%%%%%%% +\cleartooddpage +\hbox{}\vfill +{\centering +\makebox[\OPTtitlewidth][s]{\fontsize{\OPTtitletitlefont}{\OPTtitletitlefont}\fontseries{b}\selectfont% +Homotopy Type Theory}\par +\vspace*{\OPTtitletitleskip} +\makebox[\OPTtitlewidth][s]{\fontsize{\OPTtitlesubtitlefont}{\OPTtitlesubtitlefont}\fontshape{it}\selectfont% +Univalent Foundations of Mathematics}\par +\vspace*{\OPTtitleskip} +{\fontsize{\OPTtitleauthorfont}{\OPTtitleauthorfont}\fontshape{n}\selectfont% +The Univalent Foundations Program\par +\vspace*{\OPTtitleauthorskip} +Institute for Advanced Study\par +} +\vspace*{\OPTtitleskip} +\vspace*{\OPTtitleskip} +\includegraphics[width=\OPTtitlewidth]{\OPThalftorus}\par +} + +\vfill +\hbox{} + +\clearpage +%%% Restore page style +\restoregeometry + +%%%%%%%%%%%%%%%%%%%% Copyright page %%%%%%%%%%%%%%%%%%%% +\hbox{} +\vfill +\input{version.tex} +{\small +\noindent +\emph{``Homotopy Type Theory: Univalent Foundations of Mathematics''}\\ +\copyright\ 2013 The Univalent Foundations Program + +\medskip +\noindent +Book version: \texttt{\OPTversion} + +\medskip +\noindent +MSC 2010 classification: +\texttt{03-02}, +\texttt{55-02}, +\texttt{03B15} + +\bigskip +\footnotesize + +\noindent +This work is licensed under the +\textbf{\emph{Creative Commons Attribution-ShareAlike 3.0 Unported License.}} +% +To view a copy of this license, visit +\url{http://creativecommons.org/licenses/by-sa/3.0/}. + +\bigskip + +\noindent +This book is freely available at \url{http://homotopytypetheory.org/book/}. + +\bigskip + +\noindent +\emph{\textbf{\small Acknowledgment}} + +\medskip + +\noindent +Apart from the generous support from the Institute for Advanced Study, some contributors +to the book were partially or fully supported by the following agencies and grants: +% +\begin{itemize} +\item Association of Members of the Institute for Advanced Study: a grant to the Institute for Advanced Study % Dan Grayson +% SLOVENIA +\item Agencija za raziskovalno dejavnost Republike Slovenije: % Andrej's Slovenian agency +\href{http://www.sicris.si/search/prg.aspx?id=6120}{P1--0294}, +\href{http://www.sicris.si/search/prj.aspx?id=7109}{N1--0011}. + +\item Air Force Office of Scientific Research: + FA9550-11-1-0143, and % Steve's ASFOR + FA9550-12-1-0370. % Bob's ASFOR + { + \setlength{\parskip}{0pt} + \begin{quote} + \noindent\scriptsize + This material is based in part upon work supported by the AFOSR under the above awards. + Any opinions, findings, and conclusions or recommendations expressed in this publication are those of the author(s) and do not necessarily reflect the views of the AFOSR. + \end{quote} + } + +\item Engineering and Physical Sciences Research Council: % Thorsten and students + \href{http://gow.epsrc.ac.uk/NGBOViewGrant.aspx?GrantRef=EP/G034109/1}{EP/G034109/1}, % Reusability and dependent types + \href{http://gow.epsrc.ac.uk/NGBOViewGrant.aspx?GrantRef=EP/G03298X/1}{EP/G03298X/1}. % Theory and Application of Induction Recursion + +\item European Union's 7th Framework Programme under grant agreement nr.\ 243847 (% +\href{http://wiki.portal.chalmers.se/cse/pmwiki.php/ForMath/ForMath/}{ForMath}). %% several Europeans, via Bas + +\item National Science Foundation: + \href{http://www.nsf.gov/awardsearch/showAward.do?AwardNumber=1001191}{DMS-1001191}, %% Steve's NSF, including Chris and Kristina + \href{http://www.nsf.gov/awardsearch/showAward.do?AwardNumber=1100938}{DMS-1100938}, %% Vladimir's NSF + \href{http://www.nsf.gov/awardsearch/showAward.do?AwardNumber=1116703}{CCF-1116703}, %% Foundations and Applications of Higher-Dimensional Directed Type Theory + and + \href{http://www.nsf.gov/awardsearch/showAward.do?AwardNumber=1128155}{DMS-1128155}. %% IAS support for Mike Shulman, copied from our %% paper by Dan Licata + { + \setlength{\itemsep}{0pt} + \begin{quote} + \noindent\scriptsize + This material is based in part upon work supported by the + National Science Foundation under the above awards. Any opinions, + findings, and conclusions or recommendations expressed in this + material are those of the author(s) and do not necessarily reflect the + views of the National Science Foundation. + \end{quote} + } +\item The Simonyi Fund: a grant to the Institute for Advanced Study %% Dan Grayson + \end{itemize} + + +} +\cleartooddpage + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "hott-online" +%%% End: diff --git a/frontpage.tex b/frontpage.tex new file mode 100644 index 0000000000000000000000000000000000000000..fa4d648e3d34b4cd0b4f36c079312b53ae83bf23 --- /dev/null +++ b/frontpage.tex @@ -0,0 +1,27 @@ +\newcommand{\frontpage}{ +\begin{minipage}[b][\coverheight][c]{\coverwidth} +\hbox{}\hfill +\begin{minipage}[b][\coverheight][t]{0.83\coverwidth} +\color{covertext} +\vspace{\OPTtopskip} +{\fontsize{\OPTcovertitlefont}{\OPTcovertitlefont}\fontseries{b}\selectfont% + \hfill Homotopy\par \hfill Type Theory}\par +\vspace*{\OPTcovertitleskip} +{\fontsize{\OPTcoversubtitlefont}{\OPTcoversubtitlefont}\fontshape{it}\selectfont +\hfill Univalent Foundations of Mathematics} + +\vfill + +{\fontsize{\OPTcoverauthorfont}{\OPTcoverauthorfont}\fontseries{b}\fontshape{sc}\selectfont + +\hfill The Univalent Foundations Program +\par +\vspace*{\OPTcoverauthorskip} +\hfill Institute for Advanced Study\par + +\vspace*{\OPTbotskip} +} + +\end{minipage}\hfill\hbox{} +\end{minipage} +} diff --git a/generate-nightlies b/generate-nightlies new file mode 100644 index 0000000000000000000000000000000000000000..184e83298780c736253126ebd413c24e340dc066 --- /dev/null +++ b/generate-nightlies @@ -0,0 +1,56 @@ +#!/bin/bash + +if [ $# -ne 2 ]; then + echo "Usage: ${0} www-dir wiki-dir" + exit 1 +fi + +WWW_DIR=$1 +WIKI_DIR=$2 + +VERSION_MARKER="$(git describe --always --long)" +VERSION="${VERSION_MARKER#first-edition-}" +DATE="$(date +"%B %-d, %Y")" + +function generate_www () { + rm -rf -- "${WWW_DIR}" && mkdir -p -- "${WWW_DIR}" || exit 1 + PDF_TARGETS=(hott-online hott-ebook hott-letter hott-a4 errata) + for TARGET in "${PDF_TARGETS[@]}"; do + echo "::group::Generating ${WWW_DIR}/$TARGET-$VERSION.pdf" + if [ ! -f "$TARGET.pdf" ]; then + make "${TARGET}.pdf" || exit 1 + fi + echo "Copying $TARGET.pdf to ${WWW_DIR}/$TARGET-$VERSION.pdf" + cp -f "$TARGET.pdf" "${WWW_DIR}/$TARGET-$VERSION.pdf" || exit 1 + echo "::endgroup::" + echo "::group::Generating ${WWW_DIR}/${TARGET}.pdf.html" + tee "${WWW_DIR}/${TARGET}.pdf.html" <$TARGET-$VERSION.pdf +EOF + echo "::endgroup::" + done +} + +function generate_wiki () { + rm -rf -- "${WIKI_DIR}" && mkdir -p -- "${WIKI_DIR}" || exit 1 + echo "::group::Generating ${WIKI_DIR}/Home.md" + tee "${WIKI_DIR}/Home.md" < +Below are links to "nightly builds" of the book, incorporating fixes and improvements that have not yet been incorporated into the "released version" that can be found on the [official book web site](http://homotopytypetheory.org/book/). The nightly builds are updated automatically; their most recent update was on $DATE and their version marker is "$VERSION_MARKER". + +* [PDF for on-screen viewing](//hott.github.io/book/hott-online-$VERSION.pdf) +* [PDF for e-book readers](//hott.github.io/book/hott-ebook-$VERSION.pdf) +* [PDF for printing on letter paper](//hott.github.io/book/hott-letter-$VERSION.pdf) +* [PDF for printing on A4 paper](//hott.github.io/book/hott-a4-$VERSION.pdf) +* [errata for previous versions](//hott.github.io/book/errata-$VERSION.pdf) +EOF + echo "::endgroup::" +} + +generate_www +generate_wiki diff --git a/halpha.bst b/halpha.bst new file mode 100644 index 0000000000000000000000000000000000000000..e21f893baeeb725642a8c4c4688e7c9cee27b7be --- /dev/null +++ b/halpha.bst @@ -0,0 +1,1281 @@ +% halpha: adds eprint field (www-admin@xxx.lanl.gov) +% an extension of: +% BibTeX standard bibliography style `alpha' + % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09. + % Copyright (C) 1985, all rights reserved. + % Copying of this file is authorized only if either + % (1) you make absolutely no changes to your copy, including name, or + % (2) if you do make changes, you name it something other than + % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst. + % This restriction helps ensure that all standard styles are identical. + % The file btxbst.doc has the documentation for this style. + +ENTRY + { address + author + booktitle + chapter + edition + editor + eprint + howpublished + institution + journal + key + month + note + number + organization + pages + publisher + school + series + title + type + volume + year + } + {} + { label extra.label sort.label } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label write$ + "]{" write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { "{\em " swap$ * "}" * } + if$ +} + +INTEGERS { nameptr namesleft numnames } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { ", " * t * } + { numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.authors} +{ author empty$ + { "" } + { author format.names } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names + editor num.names$ #1 > + { ", editors" * } + { ", editor" * } + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title "t" change.case$ } + if$ +} + +FUNCTION {format.eprint} +{ eprint empty$ + { "" } + { eprint } + if$ +} + + +FUNCTION {n.dashify} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.date} +{ year empty$ + { month empty$ + { "" } + { "there's a month but no year in " cite$ * warning$ + month + } + if$ + } + { month empty$ + 'year + { month " " * year * } + if$ + } + if$ +} + +FUNCTION {format.btitle} +{ title emphasize +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { "volume" volume tie.or.space.connect + series empty$ + 'skip$ + { " of " * series emphasize * } + if$ + "volume and number" number either.or.check + } + if$ +} + +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + { series field.or.null } + { output.state mid.sentence = + { "number" } + { "Number" } + if$ + number tie.or.space.connect + series empty$ + { "there's a number but no series in " cite$ * warning$ } + { " in " * series * } + if$ + } + if$ + } + { "" } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { edition "l" change.case$ " edition" * } + { edition "t" change.case$ " edition" * } + if$ + } + if$ +} + +INTEGERS { multiresult } + +FUNCTION {multi.page.check} +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { "pages" pages n.dashify tie.or.space.connect } + { "page" pages tie.or.space.connect } + if$ + } + if$ +} + +FUNCTION {format.vol.num.pages} +{ volume field.or.null + number empty$ + 'skip$ + { "(" number * ")" * * + volume empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + } + if$ + pages empty$ + 'skip$ + { duplicate$ empty$ + { pop$ format.pages } + { ":" * pages n.dashify * } + if$ + } + if$ +} + +FUNCTION {format.chapter.pages} +{ chapter empty$ + 'format.pages + { type empty$ + { "chapter" } + { type "l" change.case$ } + if$ + chapter tie.or.space.connect + pages empty$ + 'skip$ + { ", " * format.pages * } + if$ + } + if$ +} + +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { "In " booktitle emphasize * } + { "In " format.editors * ", " * booktitle emphasize * } + if$ + } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ + type "t" change.case$ + } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + 'type + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +FUNCTION {format.article.crossref} +{ key empty$ + { journal empty$ + { "need key or journal for " cite$ * " to crossref " * crossref * + warning$ + "" + } + { "In {\em " journal * "\/}" * } + if$ + } + { "In " key * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {format.crossref.editor} +{ editor #1 "{vv~}{ll}" format.name$ + editor num.names$ duplicate$ + #2 > + { pop$ " et~al." * } + { #2 < + 'skip$ + { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { " et~al." * } + { " and " * editor #2 "{vv~}{ll}" format.name$ * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.book.crossref} +{ volume empty$ + { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + "In " + } + { "Volume" volume tie.or.space.connect + " of " * + } + if$ + editor empty$ + editor field.or.null author field.or.null = + or + { key empty$ + { series empty$ + { "need editor, key, or series for " cite$ * " to crossref " * + crossref * warning$ + "" * + } + { "{\em " * series * "\/}" * } + if$ + } + { key * } + if$ + } + { format.crossref.editor * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {format.incoll.inproc.crossref} +{ editor empty$ + editor field.or.null author field.or.null = + or + { key empty$ + { booktitle empty$ + { "need editor, key, or booktitle for " cite$ * " to crossref " * + crossref * warning$ + "" + } + { "In {\em " booktitle * "\/}" * } + if$ + } + { "In " key * } + if$ + } + { "In " format.crossref.editor * } + if$ + " \cite{" * crossref * "}" * +} + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { journal emphasize "journal" output.check + format.vol.num.pages output + format.date "year" output.check + } + { format.article.crossref output.nonnull + format.pages output + } + if$ + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + new.block + format.btitle "title" output.check + crossref missing$ + { format.bvolume output + new.block + format.number.series output + new.sentence + publisher "publisher" output.check + address output + } + { new.block + format.book.crossref output.nonnull + } + if$ + format.edition output + format.date "year" output.check + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {booklet} +{ output.bibitem + format.authors output + new.block + format.title "title" output.check + howpublished address new.block.checkb + howpublished output + address output + format.date output + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check } + { format.authors output.nonnull + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + new.block + format.btitle "title" output.check + crossref missing$ + { format.bvolume output + format.chapter.pages "chapter and pages" output.check + new.block + format.number.series output + new.sentence + publisher "publisher" output.check + address output + } + { format.chapter.pages "chapter and pages" output.check + new.block + format.book.crossref output.nonnull + } + if$ + format.edition output + format.date "year" output.check + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.chapter.pages output + new.sentence + publisher "publisher" output.check + address output + format.edition output + format.date "year" output.check + } + { format.incoll.inproc.crossref output.nonnull + format.chapter.pages output + } + if$ + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + crossref missing$ + { format.in.ed.booktitle "booktitle" output.check + format.bvolume output + format.number.series output + format.pages output + address empty$ + { organization publisher new.sentence.checkb + organization output + publisher output + format.date "year" output.check + } + { address output.nonnull + format.date "year" output.check + new.sentence + organization output + publisher output + } + if$ + } + { format.incoll.inproc.crossref output.nonnull + format.pages output + } + if$ + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull + address output + } + if$ + } + { format.authors output.nonnull } + if$ + new.block + format.btitle "title" output.check + author empty$ + { organization empty$ + { address new.block.checka + address output + } + 'skip$ + if$ + } + { organization address new.block.checkb + organization output + address output + } + if$ + format.edition output + format.date output + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + "Master's thesis" format.thesis.type output.nonnull + school "school" output.check + address output + format.date "year" output.check + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {misc} +{ output.bibitem + format.authors output + title howpublished new.block.checkb + format.title output + howpublished new.block.checka + howpublished output + format.date output + format.eprint output + new.block + note output + fin.entry + empty.misc.check +} + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check + new.block + format.btitle "title" output.check + new.block + "PhD thesis" format.thesis.type output.nonnull + school "school" output.check + address output + format.date "year" output.check + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output } + { format.editors output.nonnull } + if$ + new.block + format.btitle "title" output.check + format.bvolume output + format.number.series output + address empty$ + { editor empty$ + { publisher new.sentence.checka } + { organization publisher new.sentence.checkb + organization output + } + if$ + publisher output + format.date "year" output.check + } + { address output.nonnull + format.date "year" output.check + new.sentence + editor empty$ + 'skip$ + { organization output } + if$ + publisher output + } + if$ + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + format.tr.number output.nonnull + institution "institution" output.check + address output + format.date "year" output.check + format.eprint output + new.block + note output + fin.entry +} + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check + new.block + format.title "title" output.check + new.block + note "note" output.check + format.date output + format.eprint output + fin.entry +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +READ + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +INTEGERS { len } + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +INTEGERS { et.al.char.used } + +FUNCTION {initialize.et.al.char.used} +{ #0 'et.al.char.used := +} + +EXECUTE {initialize.et.al.char.used} + +FUNCTION {format.lab.names} +{ 's := + s num.names$ 'numnames := + numnames #1 > + { numnames #4 > + { #3 'namesleft := } + { numnames 'namesleft := } + if$ + #1 'nameptr := + "" + { namesleft #0 > } + { nameptr numnames = + { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { "{\etalchar{+}}" * + #1 'et.al.char.used := + } + { s nameptr "{v{}}{l{}}" format.name$ * } + if$ + } + { s nameptr "{v{}}{l{}}" format.name$ * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #4 > + { "{\etalchar{+}}" * + #1 'et.al.char.used := + } + 'skip$ + if$ + } + { s #1 "{v{}}{l{}}" format.name$ + duplicate$ text.length$ #2 < + { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ } + 'skip$ + if$ + } + if$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.label} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label + { type$ "proceedings" = + 'editor.key.organization.label + { type$ "manual" = + 'author.key.organization.label + 'author.key.label + if$ + } + if$ + } + if$ + duplicate$ + year field.or.null purify$ #-1 #2 substring$ + * + 'label := + year field.or.null purify$ #-1 #4 substring$ + * + sortify 'sort.label := +} + +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { " " * } + 'skip$ + if$ + s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := + nameptr numnames = t "others" = and + { "et al" * } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +FUNCTION {presort} +{ calc.label + sort.label + " " + * + type$ "book" = + type$ "inbook" = + or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * + " " + * + year field.or.null sortify + * + " " + * + title field.or.null + sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := +} + +ITERATE {presort} + +SORT + +STRINGS { longest.label last.sort.label next.extra } + +INTEGERS { longest.label.width last.extra.num } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.sort.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'last.extra.num := +} + +FUNCTION {forward.pass} +{ last.sort.label sort.label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label 'last.sort.label := + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + label extra.label * 'label := + label width$ longest.label.width > + { label 'longest.label := + label width$ 'longest.label.width := + } + 'skip$ + if$ + extra.label 'next.extra := +} + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +FUNCTION {begin.bib} +{ et.al.char.used + { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ } + 'skip$ + if$ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" longest.label * "}" * write$ newline$ +} + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +EXECUTE {end.bib} diff --git a/hits.tex b/hits.tex new file mode 100644 index 0000000000000000000000000000000000000000..432a095921a444aea6199b420e098d6f3ccbae13 --- /dev/null +++ b/hits.tex @@ -0,0 +1,2192 @@ +\chapter{Higher inductive types} +\label{cha:hits} + +\index{type!higher inductive|(}% +\indexsee{inductive!type!higher}{type, higher inductive}% +\indexsee{higher inductive type}{type, higher inductive}% + +\section{Introduction} +\label{sec:intro-hits} + +\index{generation!of a type, inductive|(} + +Like the general inductive types we discussed in \cref{cha:induction}, \emph{higher inductive types} are a general schema for defining new types generated by some constructors. +But unlike ordinary inductive types, in defining a higher inductive type we may have ``constructors'' which generate not only \emph{points} of that type, but also \emph{paths} and higher paths in that type. +\index{type!circle}% +\indexsee{circle type}{type,circle}% +For instance, we can consider the higher inductive type $\Sn^1$ generated by +\begin{itemize} +\item A point $\base:\Sn^1$, and +\item A path $\lloop : {\id[\Sn^1]\base\base}$. +\end{itemize} +This should be regarded as entirely analogous to the definition of, for instance, $\bool$, as being generated by +\begin{itemize} +\item A point $\bfalse:\bool$ and +\item A point $\btrue:\bool$, +\end{itemize} +or the definition of $\nat$ as generated by +\begin{itemize} +\item A point $0:\nat$ and +\item A function $\suc:\nat\to\nat$. +\end{itemize} +When we think of types as higher groupoids, the more general notion of ``generation'' is very natural: +since a higher groupoid is a ``multi-sorted object'' with paths and higher paths as well as points, we should allow ``generators'' in all dimensions. + +We will refer to the ordinary sort of constructors (such as $\base$) as \define{point constructors} +\indexdef{constructor!point}% +\indexdef{point!constructor}% +or \emph{ordinary constructors}, and to the others (such as $\lloop$) as \define{path constructors} +\indexdef{constructor!path}% +\indexdef{path!constructor}% +or \emph{higher constructors}. +Each path constructor must specify the starting and ending point of the path, which we call its \define{source} +\indexdef{source!of a path constructor}% +and \define{target}; +\indexdef{target!of a path constructor}% +for $\lloop$, both source and target are $\base$. + +Note that a path constructor such as $\lloop$ generates a \emph{new} inhabitant of an identity type, which is not (at least, not \emph{a priori}) equal to any previously existing such inhabitant. +In particular, $\lloop$ is not \emph{a priori} equal to $\refl{\base}$ (although proving that they are definitely unequal takes a little thought; see \cref{thm:loop-nontrivial}). +This is what distinguishes $\Sn^1$ from the ordinary inductive type \unit. + +There are some important points to be made regarding this generalization. + +\index{free!generation of an inductive type}% +First of all, the word ``generation'' should be taken seriously, in the same sense that a group can be freely generated by some set. +In particular, because a higher groupoid comes with \emph{operations} on paths and higher paths, when such an object is ``generated'' by certain constructors, the operations create more paths that do not come directly from the constructors themselves. +For instance, in the higher inductive type $\Sn^1$, the constructor $\lloop$ is not the only nontrivial path from $\base$ to $\base$; we have also ``$\lloop\ct\lloop$'' and ``$\lloop\ct\lloop\ct\lloop$'' and so on, as well as $\opp{\lloop}$, etc., all of which are different. +This may seem so obvious as to be not worth mentioning, but it is a departure from the behavior of ``ordinary'' inductive types, where one can expect to see nothing in the inductive type except what was ``put in'' directly by the constructors. + +Secondly, this generation is really \emph{free} generation: higher inductive types do not technically allow us to impose ``axioms'', such as forcing ``$\lloop\ct\lloop$'' to equal $\refl{\base}$. +However, in the world of $\infty$-groupoids,% +\index{.infinity-groupoid@$\infty$-groupoid} +there is little difference between ``free generation'' and ``presentation'', +\index{presentation!of an infinity-groupoid@of an $\infty$-groupoid}% +\index{generation!of an infinity-groupoid@of an $\infty$-groupoid}% +since we can make two paths equal \emph{up to homotopy} by adding a new 2-di\-men\-sion\-al generator relating them (e.g.\ a path $\lloop\ct\lloop = \refl{\base}$ in $\base=\base$). +We do then, of course, have to worry about whether this new generator should satisfy its own ``axioms'', and so on, but in principle any ``presentation'' can be transformed into a ``free'' one by making axioms into constructors. +As we will see, by adding ``truncation constructors'' we can use higher inductive types to express classical notions such as group presentations as well. + +Thirdly, even though a higher inductive type contains ``constructors'' which generate \emph{paths in} that type, it is still an inductive definition of a \emph{single} type. +In particular, as we will see, it is the higher inductive type itself which is given a universal property (expressed, as usual, by an induction principle), and \emph{not} its identity types. +The identity type of a higher inductive type retains the usual induction principle of any identity type (i.e.\ path induction), and does not acquire any new induction principle. + +Thus, it may be nontrivial to identify the identity types of a higher inductive type in a concrete way, in contrast to how in \cref{cha:basics} we were able to give explicit descriptions of the behavior of identity types under all the traditional type forming operations. +For instance, are there any paths from $\base$ to $\base$ in $\Sn^1$ which are not simply composites of copies of $\lloop$ and its inverse? +Intuitively, it seems that the answer should be no (and it is), but proving this is not trivial. +Indeed, such questions bring us rapidly to problems such as calculating the homotopy groups of spheres, a long-standing problem in algebraic topology for which no simple formula is known. +Homotopy type theory brings a new and powerful viewpoint to bear on such questions, but it also requires type theory to become as complex as the answers to these questions. + +\index{dimension!of path constructors}% +Fourthly, the ``dimension'' of the constructors (i.e.\ whether they output points, paths, paths between paths, etc.)\ does not have a direct connection to which dimensions the resulting type has nontrivial homotopy in. +As a simple example, if an inductive type $B$ has a constructor of type $A\to B$, then any paths and higher paths in $A$ result in paths and higher paths in $B$, even though the constructor is not a ``higher'' constructor at all. +The same thing happens with higher constructors too: having a constructor of type $A\to (\id[B]xy)$ means not only that points of $A$ yield paths from $x$ to $y$ in $B$, but that paths in $A$ yield paths between these paths, and so on. +As we will see, this possibility is responsible for much of the power of higher inductive types. + +On the other hand, it is even possible for constructors \emph{without} higher types in their inputs to generate ``unexpected'' higher paths. +For instance, in the 2-dimensional sphere $\Sn^2$ generated by +\symlabel{s2a} +\index{type!2-sphere}% +\begin{itemize} +\item A point $\base:\Sn^2$, and +\item A 2-dimensional path $\surf:\refl{\base} = \refl{\base}$ in ${\base=\base}$, +\end{itemize} +there is a nontrivial \emph{3-dimensional path} from $\refl{\refl{\base}}$ to itself. +Topologists will recognize this path as an incarnation of the \emph{Hopf fibration}. +From a category-theoretic point of view, this is the same sort of phenomenon as the fact mentioned above that $\Sn^1$ contains not only $\lloop$ but also $\lloop\ct\lloop$ and so on: it's just that in a \emph{higher} groupoid, there are \emph{operations} which raise dimension. +Indeed, we saw many of these operations back in \cref{sec:equality}: the associativity and unit laws are not just properties, but operations, whose inputs are 1-paths and whose outputs are 2-paths. + +\index{generation!of a type, inductive|)}% + +% In US Trade format it wants a page break here but then it stretches the above itemize, +% so we give it some stretchable space to use if it wants to. +\vspace*{0pt plus 20ex} + +\section{Induction principles and dependent paths} +\label{sec:dependent-paths} + +When we describe a higher inductive type such as the circle as being generated by certain constructors, we have to explain what this means by giving rules analogous to those for the basic type constructors from \cref{cha:typetheory}. +The constructors themselves give the \emph{introduction} rules, but it requires a bit more thought to explain the \emph{elimination} rules, i.e.\ the induction and recursion principles. +In this book we do not attempt to give a general formulation of what constitutes a ``higher inductive definition'' and how to extract the elimination rule from such a definition --- indeed, this is a subtle question and the subject of current research. +Instead we will rely on some general informal discussion and numerous examples. + +\index{type!circle}% +\index{recursion principle!for S1@for $\Sn^1$}% +The recursion principle is usually easy to describe: given any type equipped with the same structure with which the constructors equip the higher inductive type in question, there is a function which maps the constructors to that structure. +For instance, in the case of $\Sn^1$, the recursion principle says that given any type $B$ equipped with a point $b:B$ and a path $\ell:b=b$, there is a function $f:\Sn^1\to B$ such that $f(\base)=b$ and $\apfunc f (\lloop) = \ell$. + +\index{computation rule!for S1@for $\Sn^1$}% +\index{equality!definitional}% +The latter two equalities are the \emph{computation rules}. +\index{computation rule!for higher inductive types|(}% +\index{computation rule!propositional|(}% +There is, however, a question of whether these computation rules are judgmental\index{judgmental equality} equalities or propositional equalities (paths). +For ordinary inductive types, we had no qualms about making them judgmental, although we saw in \cref{cha:induction} that making them propositional would still yield the same type up to equivalence. +In the ordinary case, one may argue that the computation rules are really \emph{definitional} equalities, in the intuitive sense described in the Introduction. + +\index{equality!judgmental}% +For higher inductive types, this is less clear. %, and it is likewise less clear to what extent these equalities can be made judgmental in the known set-theoretic models. +Moreover, since the operation $\apfunc f$ is not really a fundamental part of the type theory, but something that we \emph{defined} using the induction principle of identity types (and which we might have defined in some other, equivalent, way), it seems inappropriate to refer to it explicitly in a \emph{judgmental} equality. +Judgmental equalities are part of the deductive system, which should not depend on particular choices of definitions that we may make \emph{within} that system. +There are also semantic and implementation issues to consider; see the Notes. + +It does seem unproblematic to make the computational rules for the \emph{point} constructors of a higher inductive type judgmental. +In the example above, this means we have $f(\base)\jdeq b$, judgmentally. +This choice facilitates a computational view of higher inductive types. +Moreover, it also greatly simplifies our lives, since otherwise the second computation rule $\apfunc f (\lloop) = \ell$ would not even be well-typed as a propositional equality; we would have to compose one side or the other with the specified identification of $f(\base)$ with $b$. +(Such problems do arise eventually, of course, when we come to talk about paths of higher dimension, but that will not be of great concern to us here. +See also \cref{sec:hubs-spokes}.) +Thus, we take the computation rules for point constructors to be judgmental, and those for paths and higher paths to be propositional.% +\footnote{In particular, in the language of \cref{sec:types-vs-sets}, this means that our higher inductive types are a mix of \emph{rules} (specifying how we can introduce such types and their elements, their induction principle, and their computation rules for point constructors) and \emph{axioms} (the computation rules for path constructors, which assert that certain identity types are inhabited by otherwise unspecified terms). +We may hope that eventually, there will be a better type theory in which higher inductive types, like univalence, will be presented using only rules and no axioms.% +\indexfoot{axiom!versus rules}% +\indexfoot{rule!versus axioms}% +} + +\begin{rmk}\label{rmk:defid} +Recall that for ordinary inductive types, we regard the computation rules for a recursively defined function as not merely judgmental equalities, but \emph{definitional} ones, and thus we may use the notation $\defeq$ for them. +For instance, the truncated predecessor\index{predecessor!function, truncated} function $p:\nat\to\nat$ is defined by $p(0)\defeq 0$ and $p(\suc(n))\defeq n$. +In the case of higher inductive types, this sort of notation is reasonable for the point constructors (e.g.\ $f(\base)\defeq b$), but for the path constructors it could be misleading, since equalities such as $\ap f \lloop = \ell$ are not judgmental. +Thus, we hybridize the notations, writing instead $\ap f \lloop \defid \ell$ for this sort of ``propositional equality by definition''. +\end{rmk} +\index{computation rule!for higher inductive types|)}% +\index{computation rule!propositional|)}% + +\index{type!circle|(}% +\index{induction principle!for S1@for $\Sn^1$}% +Now, what about the induction principle (the dependent eliminator)? +Recall that for an ordinary inductive type $W$, to prove by induction that $\prd{x:W} P(x)$, we must specify, for each constructor of $W$, an operation on $P$ which acts on the ``fibers'' above that constructor in $W$. +For instance, if $W$ is the natural numbers \nat, then to prove by induction that $\prd{x:\nat} P(x)$, we must specify +\begin{itemize} +\item An element $b:P(0)$ in the fiber over the constructor $0:\nat$, and +\item For each $n:\nat$, a function $P(n) \to P(\suc(n))$. +\end{itemize} +The second can be viewed as a function ``$P\to P$'' lying \emph{over} the constructor $\suc:\nat\to\nat$, generalizing how $b:P(0)$ lies over the constructor $0:\nat$. + +By analogy, therefore, to prove that $\prd{x:\Sn^1} P(x)$, we should specify +\begin{itemize} +\item An element $b:P(\base)$ in the fiber over the constructor $\base:\Sn^1$, and +\item A path from $b$ to $b$ ``lying over the constructor $\lloop:\base=\base$''. +\end{itemize} +Note that even though $\Sn^1$ contains paths other than $\lloop$ (such as $\refl{\base}$ and $\lloop\ct\lloop$), we only need to specify a path lying over the constructor \emph{itself}. +This expresses the intuition that $\Sn^1$ is ``freely generated'' by its constructors. + +The question, however, is what it means to have a path ``lying over'' another path. +It definitely does \emph{not} mean simply a path $b=b$, since that would be a path in the fiber $P(\base)$ (topologically, a path lying over the \emph{constant} path at $\base$). +Actually, however, we have already answered this question in \cref{cha:basics}: in the discussion preceding \cref{lem:mapdep} we concluded that a path from $u:P(x)$ to $v:P(y)$ lying over $p:x=y$ can be represented by a path $\trans p u = v$ in the fiber $P(y)$. +Since we will have a lot of use for such \define{dependent paths} +\index{path!dependent}% +in this chapter, we introduce a special notation for them: +\begin{equation} + (\dpath P p u v) \defeq (\transfib{P} p u = v).\label{eq:dpath} +\end{equation} + +\begin{rmk} +There are other possible ways to define dependent paths. +For instance, instead of $\trans p u = v$ we could consider $u = \trans{(\opp p)}{v}$. +We could also obtain it as a special case of a more general ``heterogeneous equality'', +\index{heterogeneous equality}% +\index{equality!heterogeneous}% +or with a direct definition as an inductive type family. +All these definitions result in equivalent types, so in that sense it doesn't much matter which we pick. +However, choosing $\trans p u = v$ as the definition makes it easiest to conclude other things about dependent paths, such as the fact that $\apdfunc{f}$ produces them, or that we can compute them in particular type families using the transport lemmas in \cref{sec:computational}. +\end{rmk} + +With the notion of dependent paths in hand, we can now state more precisely the induction principle for $\Sn^1$: given $P:\Sn^1\to\type$ and +\begin{itemize} +\item an element $b:P(\base)$, and +\item a path $\ell : \dpath P \lloop b b$, +\end{itemize} +there is a function $f:\prd{x:\Sn^1} P(x)$ such that $f(\base)\jdeq b$ and $\apd f \lloop = \ell$. +As in the non-dependent case, we speak of defining $f$ by $f(\base)\defeq b$ and $\apd f \lloop \defid \ell$. + +\begin{rmk}\label{rmk:varies-along} + When describing an application of this induction principle informally, we regard it as a splitting of the goal ``$P(x)$ for all $x:\Sn^1$'' into two cases, which we will sometimes introduce with phrases such as ``when $x$ is $\base$'' and ``when $x$ varies along $\lloop$'', respectively. + \index{vary along a path constructor}% + There is no specific mathematical meaning assigned to ``varying along a path'': it is just a convenient way to indicate the beginning of the corresponding section of a proof; see \cref{thm:S1-autohtpy} for an example. +\end{rmk} + +Topologically, the induction principle for $\Sn^1$ can be visualized as shown in \cref{fig:topS1ind}. +Given a fibration over the circle (which in the picture is a torus), to define a section of this fibration is the same as to give a point $b$ in the fiber over $\base$ along with a path from $b$ to $b$ lying over $\lloop$. +The way we interpret this type-theoretically, using our definition of dependent paths, is shown in \cref{fig:ttS1ind}: the path from $b$ to $b$ over $\lloop$ is represented by a path from $\trans \lloop b$ to $b$ in the fiber over $\base$. + +\begin{figure} + \centering + \begin{tikzpicture} + \draw (0,0) ellipse (3 and .5); + \draw (0,3) ellipse (3.5 and 1.5); + \begin{scope}[yshift=4] + \clip (-3,3) -- (-1.8,3) -- (-1.8,3.7) -- (1.8,3.7) -- (1.8,3) -- (3,3) -- (3,0) -- (-3,0) -- cycle; + \draw[clip] (0,3.5) ellipse (2.25 and 1); + \draw (0,2.5) ellipse (1.7 and .7); + \end{scope} + \node (P) at (4.5,3) {$P$}; + \node (S1) at (4.5,0) {$\Sn^1$}; + \draw[->>,thick] (P) -- (S1); + \node[fill,circle,inner sep=1pt,label={below right:$\base$}] at (0,-.5) {}; + \node at (-2.6,.6) {$\lloop$}; + \node[fill,circle,\OPTblue,inner sep=1pt] (b) at (0,2.3) {}; + \node[\OPTblue] at (-.2,2.1) {$b$}; + \begin{scope} + \draw[\OPTblue] (b) to[out=180,in=-150] (-2.7,3.5) to[out=30,in=180] (0,3.35); + \draw[\OPTblue,dotted] (0,3.35) to[out=0,in=175] (1.4,4.35); + \draw[\OPTblue] (1.4,4.35) to[out=-5,in=90] (2.5,3) to[out=-90,in=0,looseness=.8] (b); + \end{scope} + \node[\OPTblue] at (-2.2, 3.3) {$\ell$}; + \end{tikzpicture} + \caption{The topological induction principle for $\Sn^1$} + \label{fig:topS1ind} +\end{figure} + +\begin{figure} + \centering + \begin{tikzpicture} + \draw (0,0) ellipse (3 and .5); + \draw (0,3) ellipse (3.5 and 1.5); + \begin{scope}[yshift=4] + \clip (-3,3) -- (-1.8,3) -- (-1.8,3.7) -- (1.8,3.7) -- (1.8,3) -- (3,3) -- (3,0) -- (-3,0) -- cycle; + \draw[clip] (0,3.5) ellipse (2.25 and 1); + \draw (0,2.5) ellipse (1.7 and .7); + \end{scope} + \node (P) at (4.5,3) {$P$}; + \node (S1) at (4.5,0) {$\Sn^1$}; + \draw[->>,thick] (P) -- (S1); + \node[fill,circle,inner sep=1pt,label={below right:$\base$}] at (0,-.5) {}; + \node at (-2.6,.6) {$\lloop$}; + \node[fill,circle,\OPTblue,inner sep=1pt] (b) at (0,2.3) {}; + \node[\OPTblue] at (-.3,2.3) {$b$}; + \node[fill,circle,\OPTpurple,inner sep=1pt] (tb) at (0,1.8) {}; + % \draw[\OPTpurple,dashed] (b) to[out=0,in=0,looseness=5] (0,4) to[out=180,in=180] (tb); + \draw[\OPTpurple,dashed] (b) arc (-90:90:2.9 and 0.85) arc (90:270:2.8 and 1.1); + \begin{scope} + \clip (b) -- ++(.1,0) -- (.1,1.8) -- ++(-.2,0) -- ++(0,-1) -- ++(3,2) -- ++(-3,0) -- (-.1,2.3) -- cycle; + \draw[\OPTred,dotted,thick] (.2,2.07) ellipse (.2 and .57); + \begin{scope} + % \draw[clip] (b) -- ++(.1,0) |- (tb) -- ++(-.2,0) -- ++(0,-1) -| ++(3,3) -| (b); + \clip (.2,0) rectangle (-2,3); + \draw[\OPTred,thick] (.2,2.07) ellipse (.2 and .57); + \end{scope} + \end{scope} + \node[\OPTred] at (1,1.2) {$\ell: \trans \lloop b=b$}; + \end{tikzpicture} + \caption{The type-theoretic induction principle for $\Sn^1$} + \label{fig:ttS1ind} +\end{figure} + +Of course, we expect to be able to prove the recursion principle from the induction principle, by taking $P$ to be a constant type family. +This is in fact the case, although deriving the non-dependent computation rule for $\lloop$ (which refers to $\apfunc f$) from the dependent one (which refers to $\apdfunc f$) is surprisingly a little tricky. + +\begin{lem}\label{thm:S1rec} + \index{recursion principle!for S1@for $\Sn^1$}% + \index{computation rule!for S1@for $\Sn^1$}% + If $A$ is a type together with $a:A$ and $p:\id[A]aa$, then there is a + function $f:\Sn^1\to{}A$ with + \begin{align*} + f(\base)&\defeq a \\ + \apfunc f(\lloop)&\defid p. + \end{align*} +\end{lem} +\begin{proof} + We would like to apply the induction principle of $\Sn^1$ to the constant type family, $(\lam{x} A): \Sn^1\to \UU$. + The required hypotheses for this are a point of $(\lam{x} A)(\base) \jdeq A$, which we have (namely $a:A$), and a dependent path in $\dpath {x \mapsto A}{\lloop} a a$, or equivalently $\transfib{x \mapsto A}{\lloop} a = a$. + This latter type is not the same as the type $\id[A]aa$ where $p$ lives, but it is equivalent to it, because by \cref{thm:trans-trivial} we have $\transconst{A}{\lloop}{a} : \transfib{x \mapsto A}{\lloop} a= a$. + Thus, given $a:A$ and $p:a=a$, we can consider the composite + \[\transconst{A}{\lloop}{a} \ct p:(\dpath {x \mapsto A}\lloop aa).\] + Applying the induction principle, we obtain $f:\Sn^1\to A$ such that + \begin{align} + f(\base) &\jdeq a \qquad\text{and}\label{eq:S1recindbase}\\ + \apdfunc f(\lloop) &= \transconst{A}{\lloop}{a} \ct p.\label{eq:S1recindloop} + \end{align} + It remains to derive the equality $\apfunc f(\lloop)=p$. + However, by \cref{thm:apd-const}, we have + \[\apdfunc f(\lloop) = \transconst{A}{\lloop}{f(\base)} \ct \apfunc f(\lloop).\] + Combining this with~\eqref{eq:S1recindloop} and canceling the occurrences of $\transconstf$ (which are the same by~\eqref{eq:S1recindbase}), we obtain $\apfunc f(\lloop)=p$. +\end{proof} + +% Similarly, in this case we speak of defining $f$ by $f(\base)\defeq a$ and $\ap f \lloop \defid p$. +We also have a corresponding uniqueness principle. + +\begin{lem}\label{thm:uniqueness-for-functions-on-S1} + \index{uniqueness!principle, propositional!for functions on the circle}% + If $A$ is a type and $f,g:\Sn^1\to{}A$ are two maps together with two + equalities $p,q$: + \begin{align*} + p:f(\base)&=_Ag(\base),\\ + q:\map{f}\lloop&=^{\lam{x} x=_Ax}_p\map{g}\lloop. + \end{align*} + Then for all $x:\Sn^1$ we have $f(x)=g(x)$. +\end{lem} +\begin{proof} + We apply the induction principle of $\Sn^1$ at the type family $P(x)\defeq(f(x)=g(x))$. + When $x$ is $\base$, $p$ is exactly what we need. + And when $x$ varies along $\lloop$, we need + \(p=^{\lam{x} f(x)=g(x)}_{\lloop} p,\) + which by \cref{thm:transport-path,thm:dpath-path} can be reduced to $q$. +\end{proof} + +\index{universal!property!of S1@of $\Sn^1$}% +These two lemmas imply the expected universal property of the circle: + +\begin{lem}\label{thm:S1ump} + For any type $A$ we have a natural equivalence + \[ (\Sn^1 \to A) \;\eqvsym\; + \sm{x:A} (x=x). + \] +\end{lem} +\begin{proof} + We have a canonical function $f:(\Sn^1 \to A) \to \sm{x:A} (x=x)$ defined by $f(g) \defeq (g(\base),\ap g \lloop)$. + In the other direction, we have $g:\sm{x:A} (x=x) \to (\Sn^1 \to A)$ defined by taking a pair $(b,\ell)$ to the function $\Sn^1 \to A$ given by the recursion principle of the circle. + + Now, by the computation rule of the recursion principle, $f \circ g \htpy \idfunc$. + Whereas $g \circ f \htpy \idfunc$ by the uniqueness principle, + since \((g \circ f)(\lloop) =^{\lam{x} x=_Ax}_{\refl{\base}} \lloop\), again, by the computation rule of the recursion principle of the circle. + Thus, f has a quasi-inverse, and is therefore an equivalence. +\end{proof} + +\index{type!circle|)}% + +As in \cref{sec:htpy-inductive}, we can show that the conclusion of \cref{thm:S1ump} is equivalent to having an induction principle with propositional computation rules. +Other higher inductive types also satisfy lemmas analogous to \cref{thm:S1rec,thm:S1ump}; we will generally leave their proofs to the reader. +We now proceed to consider many examples. + + +\section{The interval} +\label{sec:interval} + +\index{type!interval|(defstyle}% +\indexsee{interval!type}{type, interval}% +The \define{interval}, which we denote $\interval$, is perhaps an even simpler higher inductive type than the circle. +It is generated by: +\begin{itemize} +\item a point $\izero:\interval$, +\item a point $\ione:\interval$, and +\item a path $\seg : \id[\interval]\izero\ione$. +\end{itemize} +\index{recursion principle!for interval type}% +The recursion principle for the interval says that given a type $B$ along with +\begin{itemize} +\item a point $b_0:B$, +\item a point $b_1:B$, and +\item a path $s:b_0=b_1$, +\end{itemize} +there is a function $f:\interval\to B$ such that $f(\izero)\jdeq b_0$, $f(\ione)\jdeq b_1$, and $\ap f \seg = s$. +\index{induction principle!for interval type}% +The induction principle says that given $P:\interval\to\type$ along with +\begin{itemize} +\item a point $b_0:P(\izero)$, +\item a point $b_1:P(\ione)$, and +\item a path $s:\dpath{P}{\seg}{b_0}{b_1}$, +\end{itemize} +there is a function $f:\prd{x:\interval} P(x)$ such that $f(\izero)\jdeq b_0$, $f(\ione)\jdeq b_1$, and $\apd f \seg = s$. + +Regarded purely up to homotopy, the interval is not really interesting: + +\begin{lem}\label{thm:contr-interval} + The type $\interval$ is contractible. +\end{lem} + +\begin{proof} + We prove that for all $x:\interval$ we have $x=_\interval\ione$. In other words we want a + function $f$ of type $\prd{x:\interval}(x=_\interval\ione)$. We begin to define $f$ in the following way: + \begin{alignat*}{2} + f(\izero)&\defeq \seg &:\izero&=_\interval\ione,\\ + f(\ione)&\defeq \refl\ione &:\ione &=_\interval\ione. + \end{alignat*} + It remains to define $\apd{f}\seg$, which must have type $\seg =_\seg^{\lam{x} x=_\interval\ione}\refl \ione$. + By definition this type is $\trans\seg\seg=_{\ione=_\interval\ione}\refl\ione$, which in turn is equivalent to $\rev\seg\ct\seg=\refl\ione$. + But there is a canonical element of that type, namely the proof that path inverses are in fact inverses. +\end{proof} + +However, type-theoretically the interval does still have some interesting features, just like the topological interval in classical homotopy theory. +For instance, it enables us to give an easy proof of function extensionality. +(Of course, as in \cref{sec:univalence-implies-funext}, for the duration of the following proof we suspend our overall assumption of the function extensionality axiom.) + +\begin{lem}\label{thm:interval-funext} + \index{function extensionality!proof from interval type}% + If $f,g:A\to{}B$ are two functions such that $f(x)=g(x)$ for every $x:A$, then + $f=g$ in the type $A\to{}B$. +\end{lem} + +\begin{proof} + Let's call the proof we have $p:\prd{x:A}(f(x)=g(x))$. For all $x:A$ we define + a function $\widetilde{p}_x:\interval\to{}B$ by + \begin{align*} + \widetilde{p}_x(\izero) &\defeq f(x), \\ + \widetilde{p}_x(\ione) &\defeq g(x), \\ + \map{\widetilde{p}_x}\seg &\defid p(x). + \end{align*} + We now define $q:\interval\to(A\to{}B)$ by + \[q(i)\defeq(\lam{x} \widetilde{p}_x(i))\] + Then $q(\izero)$ is the function $\lam{x} \widetilde{p}_x(\izero)$, which is equal to $f$ because $\widetilde{p}_x(\izero)$ is defined by $f(x)$. + Similarly, we have $q(\ione)=g$, and hence + \[\map{q}\seg:f=_{(A\to{}B)}g \qedhere\] +\end{proof} + +In \cref{ex:funext-from-interval} we ask the reader to complete the proof of the full function extensionality axiom from \cref{thm:interval-funext}. + +\index{type!interval|)}% + +\section{Circles and spheres} +\label{sec:circle} + +\index{type!circle|(}% +We have already discussed the circle $\Sn^1$ as the higher inductive type generated by +\begin{itemize} +\item A point $\base:\Sn^1$, and +\item A path $\lloop : {\id[\Sn^1]\base\base}$. +\end{itemize} +\index{induction principle!for S1@for $\Sn^1$}% +Its induction principle says that given $P:\Sn^1\to\type$ along with $b:P(\base)$ and $\ell :\dpath P \lloop b b$, we have $f:\prd{x:\Sn^1} P(x)$ with $f(\base)\jdeq b$ and $\apd f \lloop = \ell$. +Its non-dependent recursion principle says that given $B$ with $b:B$ and $\ell:b=b$, we have $f:\Sn^1\to B$ with $f(\base)\jdeq b$ and $\ap f \lloop = \ell$. + +We observe that the circle is nontrivial. + +\begin{lem}\label{thm:loop-nontrivial} + $\lloop\neq\refl{\base}$. +\end{lem} +\begin{proof} + Suppose that $\lloop=\refl{\base}$. + Then since for any type $A$ with $x:A$ and $p:x=x$, there is a function $f:\Sn^1\to A$ defined by $f(\base)\defeq x$ and $\ap f \lloop \defid p$, we have + \[p = f(\lloop) = f(\refl{\base}) = \refl{x}.\] + But this implies that every type is a set, which as we have seen is not the case (see \cref{thm:type-is-not-a-set}). +\end{proof} + +The circle also has the following interesting property, which is useful as a source of counterexamples. + +\begin{lem}\label{thm:S1-autohtpy} + There exists an element of $\prd{x:\Sn^1} (x=x)$ which is not equal to $x\mapsto \refl{x}$. +\end{lem} +\begin{proof} + We define $f:\prd{x:\Sn^1} (x=x)$ by $\Sn^1$-induction. + When $x$ is $\base$, we let $f(\base)\defeq \lloop$. + Now when $x$ varies along $\lloop$ (see \cref{rmk:varies-along}), we must show that $\transfib{x\mapsto x=x}{\lloop}{\lloop} = \lloop$. + However, in \cref{sec:compute-paths} we observed that $\transfib{x\mapsto x=x}{p}{q} = \opp{p} \ct q \ct p$, so what we have to show is that $\opp{\lloop} \ct \lloop \ct \lloop = \lloop$. + But this is clear by canceling an inverse. + + To show that $f\neq (x\mapsto \refl{x})$, it suffices to show that $f(\base) \neq \refl{\base}$. + But $f(\base)=\lloop$, so this is just the previous lemma. +\end{proof} + +For instance, this enables us to extend \cref{thm:type-is-not-a-set} by showing that any universe which contains the circle cannot be a 1-type. + +\begin{cor} + If the type $\Sn^1$ belongs to some universe \type, then \type is not a 1-type. +\end{cor} +\begin{proof} + The type $\Sn^1=\Sn^1$ in \type is, by univalence, equivalent to the type $\eqv{\Sn^1}{\Sn^1}$ of auto\-equivalences of $\Sn^1$, so it suffices to show that $\eqv{\Sn^1}{\Sn^1}$ is not a set. + \index{automorphism!of S1@of $\Sn^1$}% + For this, it suffices to show that its equality type $\id[(\eqv{\Sn^1}{\Sn^1})]{\idfunc[\Sn^1]}{\idfunc[\Sn^1]}$ is not a mere proposition. + Since being an equivalence is a mere proposition, this type is equivalent to $\id[(\Sn^1\to\Sn^1)]{\idfunc[\Sn^1]}{\idfunc[\Sn^1]}$. + But by function extensionality, this is equivalent to $\prd{x:\Sn^1} (x=x)$, which as we have seen in \cref{thm:S1-autohtpy} contains two unequal elements. +\end{proof} + +\index{type!circle|)}% + +\index{type!2-sphere|(}% +\indexsee{sphere type}{type, sphere}% +We have also mentioned that the 2-sphere $\Sn^2$ should be the higher inductive type generated by +\symlabel{s2b} +\begin{itemize} +\item A point $\base:\Sn^2$, and +\item A 2-dimensional path $\surf:\refl{\base} = \refl{\base}$ in ${\base=\base}$. +\end{itemize} +\index{recursion principle!for S2@for $\Sn^2$}% +The recursion principle for $\Sn^2$ is not hard: it says that given $B$ with $b:B$ and $s:\refl b = \refl b$, we have $f:\Sn^2\to B$ with $f(\base)\jdeq b$ and $\aptwo f \surf = s$. +Here by ``$\aptwo f \surf$'' we mean an extension of the functorial action of $f$ to two-dimensional paths, which can be stated precisely as follows. + +\begin{lem}\label{thm:ap2} + Given $f:A\to B$ and $x,y:A$ and $p,q:x=y$, and $r:p=q$, we have a path $\aptwo f r : \ap f p = \ap f q$. +\end{lem} +\begin{proof} + By path induction, we may assume $p\jdeq q$ and $r$ is reflexivity. + But then we may define $\aptwo f {\refl p} \defeq \refl{\ap f p}$. +\end{proof} + +In order to state the general induction principle, we need a version of this lemma for dependent functions, which in turn requires a notion of dependent two-dimensional paths. +As before, there are many ways to define such a thing; one is by way of a two-dimensional version of transport. + +\begin{lem}\label{thm:transport2} + Given $P:A\to\type$ and $x,y:A$ and $p,q:x=y$ and $r:p=q$, for any $u:P(x)$ we have $\transtwo r u : \trans p u = \trans q u$. +\end{lem} +\begin{proof} + By path induction. +\end{proof} + +Now suppose given $x,y:A$ and $p,q:x=y$ and $r:p=q$ and also points $u:P(x)$ and $v:P(y)$ and dependent paths $h:\dpath P p u v$ and $k:\dpath P q u v$. +By our definition of dependent paths, this means $h:\trans p u = v$ and $k:\trans q u = v$. +Thus, it is reasonable to define the type of dependent 2-paths over $r$ to be +\[ (\dpath P r h k )\defeq (h = \transtwo r u \ct k). \] +We can now state the dependent version of \cref{thm:ap2}. + +\begin{lem}\label{thm:apd2} + Given $P:A\to\type$ and $x,y:A$ and $p,q:x=y$ and $r:p=q$ and a function $f:\prd{x:A} P(x)$, we have + $\apdtwo f r : \dpath P r {\apd f p}{\apd f q}$. +\end{lem} +\begin{proof} + Path induction. +\end{proof} + +\index{induction principle!for S2@for $\Sn^2$}% +Now we can state the induction principle for $\Sn^2$: suppose we are given $P:\Sn^2\to\type$ with $b:P(\base)$ and $s:\dpath Q \surf {\refl b}{\refl b}$ where $Q\defeq\lam{p} \dpath P p b b$. Then there is a function $f:\prd{x:\Sn^2} P(x)$ such that $f(\base)\jdeq b$ and $\apdtwo f \surf = s$. + +\index{type!2-sphere|)}% + +Of course, this explicit approach gets more and more complicated as we go up in dimension. +Thus, if we want to define $n$-spheres for all $n$, we need some more systematic idea. +One approach is to work with $n$-dimensional loops\index{loop!n-@$n$-} directly, rather than general $n$-dimensional paths.\index{path!n-@$n$-} + +\index{type!pointed}% +Recall from \cref{sec:equality} the definitions of \emph{pointed types} $\type_*$, and the $n$-fold loop space\index{loop space!iterated} $\Omega^n : \type_* \to \type_*$ +(\cref{def:pointedtype,def:loopspace}). Now we can define the +$n$-sphere $\Sn^n$ to be the higher inductive type generated by +\index{type!n-sphere@$n$-sphere}% +\begin{itemize} +\item A point $\base:\Sn^n$, and +\item An $n$-loop $\lloop_n : \Omega^n(\Sn^n,\base)$. +\end{itemize} +In order to write down the induction principle for this presentation, we would need to define a notion of ``dependent $n$-loop\indexdef{loop!dependent n-@dependent $n$-}'', along with the action of dependent functions on $n$-loops. +We leave this to the reader (see \cref{ex:nspheres}); in the next section we will discuss a different way to define the spheres that is sometimes more tractable. + + +\section{Suspensions} +\label{sec:suspension} + +\indexsee{type!suspension of}{suspension}% +\index{suspension|(defstyle}% +The \define{suspension} of a type $A$ is the universal way of making the points of $A$ into paths (and hence the paths in $A$ into 2-paths, and so on). +It is a type $\susp A$ defined by the following generators:\footnote{There is an unfortunate clash of notation with dependent pair types, which of course are also written with a $\Sigma$. + However, context usually disambiguates.} +\begin{itemize} +\item a point $\north:\susp A$, +\item a point $\south:\susp A$, and +\item a function $\merid:A \to (\id[\susp A]\north\south)$. +\end{itemize} +The names are intended to suggest a ``globe'' of sorts, with a north pole, a south pole, and an $A$'s worth of meridians +\indexdef{pole}% +\indexdef{meridian}% +from one to the other. +Indeed, as we will see, if $A=\Sn^1$, then its suspension is equivalent to the surface of an ordinary sphere, $\Sn^2$. + +\index{recursion principle!for suspension}% +The recursion principle for $\susp A$ says that given a type $B$ together with +\begin{itemize} +\item points $n,s:B$ and +\item a function $m:A \to (n=s)$, +\end{itemize} +we have a function $f:\susp A \to B$ such that $f(\north)\jdeq n$ and $f(\south)\jdeq s$, and for all $a:A$ we have $\ap f {\merid(a)} = m(a)$. +\index{induction principle!for suspension}% +Similarly, the induction principle says that given $P:\susp A \to \type$ together with +\begin{itemize} +\item a point $n:P(\north)$, +\item a point $s:P(\south)$, and +\item for each $a:A$, a path $m(a):\dpath P{\merid(a)}ns$, +\end{itemize} +there exists a function $f:\prd{x:\susp A} P(x)$ such that $f(\north)\jdeq n$ and $f(\south)\jdeq s$ and for each $a:A$ we have $\apd f {\merid(a)} = m(a)$. + +Our first observation about suspension is that it gives another way to define the circle. + +\begin{lem}\label{thm:suspbool} + \index{type!circle}% + $\eqv{\susp\bool}{\Sn^1}$. +\end{lem} +\begin{proof} + Define $f:\susp\bool\to\Sn^1$ by recursion such that $f(\north)\defeq \base$ and $f(\south)\defeq\base$, while $\ap f{\merid(\bfalse)}\defid\lloop$ but $\ap f{\merid(\btrue)} \defid \refl{\base}$. + Define $g:\Sn^1\to\susp\bool$ by recursion such that $g(\base)\defeq \north$ and $\ap g \lloop \defid \merid(\bfalse) \ct \opp{\merid(\btrue)}$. + We now show that $f$ and $g$ are quasi-inverses. + + First we show by induction that $g(f(x))=x$ for all $x:\susp \bool$. + If $x\jdeq\north$, then $g(f(\north)) \jdeq g(\base)\jdeq \north$, so we have $\refl{\north} : g(f(\north))=\north$. + If $x\jdeq\south$, then $g(f(\south)) \jdeq g(\base)\jdeq \north$, and we choose the equality $\merid(\btrue) : g(f(\south)) = \south$. + It remains to show that for any $y:\bool$, these equalities are preserved as $x$ varies along $\merid(y)$, which is to say that when $\refl{\north}$ is transported along $\merid(y)$ it yields $\merid(\btrue)$. + By transport in path spaces and pulled back fibrations, this means we are to show that + \[ \opp{\ap g {\ap f {\merid(y)}}} \ct \refl{\north} \ct \merid(y) = \merid(\btrue). \] + Of course, we may cancel $\refl{\north}$. + Now by \bool-induction, we may assume either $y\jdeq \bfalse$ or $y\jdeq \btrue$. + If $y\jdeq \bfalse$, then we have + \begin{align*} + \opp{\ap g {\ap f {\merid(\bfalse)}}} \ct \merid(\bfalse) + &= \opp{\ap g {\lloop}} \ct \merid(\bfalse)\\ + &= \opp{(\merid(\bfalse) \ct \opp{\merid(\btrue)})} \ct \merid(\bfalse)\\ + &= \merid(\btrue) \ct \opp{\merid(\bfalse)} \ct \merid(\bfalse)\\ + &= \merid(\btrue) + \end{align*} + while if $y\jdeq \btrue$, then we have + \begin{align*} + \opp{\ap g {\ap f {\merid(\btrue)}}} \ct \merid(\btrue) + &= \opp{\ap g {\refl{\base}}} \ct \merid(\btrue)\\ + &= \opp{\refl{\north}} \ct \merid(\btrue)\\ + &= \merid(\btrue). + \end{align*} + Thus, for all $x:\susp \bool$, we have $g(f(x))=x$. + + Now we show by induction that $f(g(x))=x$ for all $x:\Sn^1$. + If $x\jdeq \base$, then $f(g(\base))\jdeq f(\north)\jdeq\base$, so we have $\refl{\base} : f(g(\base))=\base$. + It remains to show that this equality is preserved as $x$ varies along $\lloop$, which is to say that it is transported along $\lloop$ to itself. + Again, by transport in path spaces and pulled back fibrations, this means to show that + \[ \opp{\ap f {\ap g {\lloop}}} \ct \refl{\base} \ct \lloop = \refl{\base}.\] + However, we have + \begin{align*} + \ap f {\ap g {\lloop}} &= \ap f {\merid(\bfalse) \ct \opp{\merid(\btrue)}}\\ + &= \ap f {\merid(\bfalse)} \ct \opp{\ap f {\merid(\btrue)}}\\ + &= \lloop \ct \refl{\base} + \end{align*} + so this follows easily. +\end{proof} + +Topologically, the two-point space \bool is also known as the \emph{0-dimensional sphere}, $\Sn^0$. +(For instance, it is the space of points at distance $1$ from the origin in $\mathbb{R}^1$, just as the topological 1-sphere is the space of points at distance $1$ from the origin in $\mathbb{R}^2$.) +Thus, \cref{thm:suspbool} can be phrased suggestively as $\eqv{\susp\Sn^0}{\Sn^1}$. +\index{type!n-sphere@$n$-sphere|defstyle}% +\indexsee{n-sphere@$n$-sphere}{type, $n$-sphere}% +In fact, this pattern continues: we can define all the spheres inductively by +\begin{equation}\label{eq:Snsusp} + \Sn^0 \defeq \bool + \qquad\text{and}\qquad + \Sn^{n+1} \defeq \susp \Sn^n. +\end{equation} +We can even start one dimension lower by defining $\Sn^{-1}\defeq \emptyt$, and observe that $\eqv{\susp\emptyt}{\bool}$. + +To prove carefully that this agrees with the definition of $\Sn^n$ from the previous section would require making the latter more explicit. +However, we can show that the recursive definition has the same universal property that we would expect the other one to have. +If $(A,a_0)$ and $(B,b_0)$ are pointed types (with basepoints often left implicit), let $\Map_*(A,B)$ denote the type of based maps: +\index{based map} +\symlabel{based-maps} +\[ \Map_*(A,B) \defeq \sm{f:A\to B} (f(a_0)=b_0). \] +Note that any type $A$ gives rise to a pointed type $A_+ \defeq A+\unit$ with basepoint $\inr(\ttt)$; this is called \emph{adjoining a disjoint basepoint}. +\indexdef{basepoint!adjoining a disjoint}% +\index{disjoint!basepoint}% +\index{adjoining a disjoint basepoint}% + +\begin{lem} + For a type $A$ and a pointed type $(B,b_0)$, we have + \[ \eqv{\Map_*(A_+,B)}{(A\to B)} \] +\end{lem} +Note that on the right we have the ordinary type of \emph{unbased} functions from $A$ to $B$. +\begin{proof} + From left to right, given $f:A_+ \to B$ with $p:f(\inr(\ttt)) = b_0$, we have $f\circ \inl : A \to B$. + And from right to left, given $g:A\to B$ we define $g':A_+ \to B$ by $g'(\inl(a))\defeq g(a)$ and $g'(\inr(u)) \defeq b_0$. + We leave it to the reader to show that these are quasi-inverse operations. +\end{proof} + +In particular, note that $\eqv{\bool}{\unit_+}$. +Thus, for any pointed type $B$ we have +\[{\Map_*(\bool,B)} \eqvsym {(\unit \to B)}\eqvsym B.\] +% +Now recall that the loop space\index{loop space} operation $\Omega$ acts on pointed types, with definition $\Omega(A,a_0) \defeq (\id[A]{a_0}{a_0},\refl{a_0})$. +We can also make the suspension $\susp$ act on pointed types, by $\susp(A,a_0)\defeq (\susp A,\north)$. + +\begin{lem}\label{lem:susp-loop-adj} + \index{universal!property!of suspension}% + For pointed types $(A,a_0)$ and $(B,b_0)$ we have + \[ \eqv{\Map_*(\susp A, B)}{\Map_*(A,\Omega B)}.\] +\end{lem} +\addtocounter{thm}{1} % Because we removed a numbered equation in commit 8f54d16 +\begin{proof} +We first observe the following chain of equivalences: +\begin{align*} +\Map_*(\susp A, B) & \defeq \sm{f:\susp A\to B} (f(\north)=b_0) \\ + & \eqvsym \sm{f:\sm{b_n : B}{b_s : B} (A \to (b_n = b_s))} (\fst(f)=b_0) \\ + & \eqvsym \sm{b_n : B}{b_s : B} \big(A \to (b_n = b_s)\big) \times (b_n=b_0) \\ + & \eqvsym \sm{p : \sm{b_n : B} (b_n=b_0)}{b_s : B} (A \to (\fst(p) = b_s)) \\ + & \eqvsym \sm{b_s : B} (A \to (b_0 = b_s)) +\end{align*} +The first equivalence is by the universal property of suspensions, which says that +\[ \Parens{\susp A \to B} \eqvsym \Parens{\sm{b_n : B} \sm{b_s : B} (A \to (b_n = b_s)) } \] +with the function from right to left given by the recursor (see \cref{ex:susp-lump}). +The second and third equivalences are by \cref{ex:sigma-assoc}, along with a reordering of components. +Finally, the last equivalence follows from \cref{thm:omit-contr}, since by \cref{thm:contr-paths}, $\sm{b_n : B} (b_n=b_0)$ is contractible with center $(b_0, \refl{b_0})$. + +The proof is now completed by the following chain of equivalences: +\begin{align*} + \sm{b_s : B} (A \to (b_0 = b_s)) + &\eqvsym \sm{b_s : B}{g:A \to (b_0 = b_s)}{q:b_0 = b_s} (g(a_0) = q)\\ + &\eqvsym \sm{r : \sm{b_s : B}(b_0 = b_s)}{g:A \to (b_0 = \proj1(r))} (g(a_0) = \proj2(r))\\ + &\eqvsym \sm{g:A \to (b_0 = b_0)} (g(a_0) = \refl{b_0})\\ + &\jdeq \Map_*(A,\Omega B). +\end{align*} +Similar to before, the first and last equivalences are by \cref{thm:omit-contr,thm:contr-paths}, and the second is by \cref{ex:sigma-assoc} and reordering of components. +\end{proof} + +\index{type!n-sphere@$n$-sphere|defstyle}% +In particular, for the spheres defined as in~\eqref{eq:Snsusp} we have +\index{universal!property!of Sn@of $\Sn^n$}% +\[ \Map_*(\Sn^n,B) \eqvsym \Map_*(\Sn^{n-1}, \Omega B) \eqvsym \cdots \eqvsym \Map_*(\bool,\Omega^n B) \eqvsym \Omega^n B. \] +Thus, these spheres $\Sn^n$ have the universal property that we would expect from the spheres defined directly in terms of $n$-fold loop spaces\index{loop space!iterated} as in \cref{sec:circle}. + +\index{suspension|)}% + +\section{Cell complexes} +\label{sec:cell-complexes} + +\index{cell complex|(defstyle}% +\index{CW complex|(defstyle}% +In classical topology, a \emph{cell complex} is a space obtained by successively attaching discs along their boundaries. +It is called a \emph{CW complex} if the boundary of an $n$-dimensional disc\index{disc} is constrained to lie in the discs of dimension strictly less than $n$ (the $(n-1)$-skeleton).\index{skeleton!of a CW-complex} + +Any finite CW complex can be presented as a higher inductive type, by turning $n$-dimensional discs into $n$-dimensional paths and partitioning the image of the attaching\index{attaching map} map into a source\index{source!of a path constructor} and a target\index{target!of a path constructor}, with each written as a composite of lower dimensional paths. +Our explicit definitions of $\Sn^1$ and $\Sn^2$ in \cref{sec:circle} had this form. + +\index{torus}% +Another example is the torus $T^2$, which is generated by: +\begin{itemize} +\item a point $b:T^2$, +\item a path $p:b=b$, +\item another path $q:b=b$, and +\item a 2-path $t: p\ct q = q \ct p$. +\end{itemize} +Perhaps the easiest way to see that this is a torus is to start with a rectangle, having four corners $a,b,c,d$, four edges $p,q,r,s$, and an interior which is manifestly a 2-path $t$ from $p\ct q$ to $r\ct s$: +\begin{equation*} + \xymatrix{ + a\ar@{=}[r]^p\ar@{=}[d]_r \ar@{}[dr]|{\Downarrow t} & + b\ar@{=}[d]^q\\ + c\ar@{=}[r]_s & + d + } +\end{equation*} +Now identify the edge $r$ with $q$ and the edge $s$ with $p$, resulting in also identifying all four corners. +Topologically, this identification can be seen to produce a torus. + +\index{induction principle!for torus}% +\index{torus!induction principle for}% +The induction principle for the torus is the trickiest of any we've written out so far. +Given $P:T^2\to\type$, for a section $\prd{x:T^2} P(x)$ we require +\begin{itemize} +\item a point $b':P(b)$, +\item a path $p' : \dpath P p {b'} {b'}$, +\item a path $q' : \dpath P q {b'} {b'}$, and +\item a 2-path $t'$ between the ``composites'' $p'\ct q'$ and $q'\ct p'$, lying over $t$. +\end{itemize} +In order to make sense of this last datum, we need a composition operation for dependent paths, but this is not hard to define. +Then the induction principle gives a function $f:\prd{x:T^2} P(x)$ such that $f(b)\jdeq b'$ and $\apd f {p} = p'$ and $\apd f {q} = q'$ and something like ``$\apdtwo f t = t'$''. +However, this is not well-typed as it stands, firstly because the equalities $\apd f {p} = p'$ and $\apd f {q} = q'$ are not judgmental, and secondly because $\apdfunc f$ only preserves path concatenation up to homotopy. +We leave the details to the reader (see \cref{ex:torus}). + +Of course, another definition of the torus is $T^2 \defeq \Sn^1 \times \Sn^1$ (in \cref{ex:torus-s1-times-s1} we ask the reader to verify the equivalence of the two). +\index{Klein bottle}% +\index{projective plane}% +The cell-complex definition, however, generalizes easily to other spaces without such descriptions, such as the Klein bottle, the projective plane, etc. +But it does get increasingly difficult to write down the induction principles, requiring us to define notions of dependent $n$-paths and of $\apdfunc{}$ acting on $n$-paths. +Fortunately, once we have the spheres in hand, there is a way around this. + +\section{Hubs and spokes} +\label{sec:hubs-spokes} + +\indexsee{spoke}{hub and spoke}% +\index{hub and spoke|(defstyle}% + +In topology, one usually speaks of building CW complexes by attaching $n$-dimensional discs along their $(n-1)$-dimensional boundary spheres. +\index{attaching map}% +However, another way to express this is by gluing in the \emph{cone}\index{cone!of a sphere} on an $(n-1)$-dimensional sphere. +That is, we regard a disc\index{disc} as consisting of a cone point (or ``hub''), with meridians +\index{meridian}% +(or ``spokes'') connecting that point to every point on the boundary, continuously, as shown in \cref{fig:hub-and-spokes}. + +\begin{figure} + \centering + \begin{tikzpicture} + \draw (0,0) circle (2cm); + \foreach \x in {0,20,...,350} + \draw[\OPTblue] (0,0) -- (\x:2cm); + \node[\OPTblue,circle,fill,inner sep=2pt] (hub) at (0,0) {}; + \end{tikzpicture} + \caption{A 2-disc made out of a hub and spokes} + \label{fig:hub-and-spokes} +\end{figure} + +We can use this idea to express higher inductive types containing $n$-dimensional path con\-struc\-tors for $n>1$ in terms of ones containing only 1-di\-men\-sion\-al path con\-struc\-tors. +The point is that we can obtain an $n$-dimensional path as a continuous family of 1-dimensional paths parametrized by an $(n-1)$-di\-men\-sion\-al object. +The simplest $(n-1)$-dimensional object to use is the $(n-1)$-sphere, although in some cases a different one may be preferable. +(Recall that we were able to define the spheres in \cref{sec:suspension} inductively using suspensions, which involve only 1-dimensional path constructors. +Indeed, suspension can also be regarded as an instance of this idea, since it involves a family of 1-dimensional paths parametrized by the type being suspended.) + +\index{torus} +For instance, the torus $T^2$ from the previous section could be defined instead to be generated by: +\begin{itemize} +\item a point $b:T^2$, +\item a path $p:b=b$, +\item another path $q:b=b$, +\item a point $h:T^2$, and +\item for each $x:\Sn^1$, a path $s(x) : f(x)=h$, where $f:\Sn^1\to T^2$ is defined by $f(\base)\defeq b$ and $\ap f \lloop \defid p \ct q \ct \opp p \ct \opp q$. +\end{itemize} +The induction principle for this version of the torus says that given $P:T^2\to\type$, for a section $\prd{x:T^2} P(x)$ we require +\begin{itemize} +\item a point $b':P(b)$, +\item a path $p' : \dpath P p {b'} {b'}$, +\item a path $q' : \dpath P q {b'} {b'}$, +\item a point $h':P(h)$, and +\item for each $x:\Sn^1$, a path $\dpath {P}{s(x)}{g(x)}{h'}$, where $g:\prd{x:\Sn^1} P(f(x))$ is defined by $g(\base)\defeq b'$ and $\apd g \lloop \defid t(p' \ct q' \ct \opp{(p')} \ct \opp{(q')})$. + In the latter, $\ct$ denotes concatenation of dependent paths, and the definition of $t:\eqv{(\dpath{P}{\ap f \lloop}{b'}{b'})}{(\dpath{P\circ f}{\lloop}{b'}{b'})}$ is left to the reader. +\end{itemize} +Note that there is no need for dependent 2-paths or $\apdtwofunc{}$. +We leave it to the reader to write out the computation rules. + +\begin{rmk}\label{rmk:spokes-no-hub} +One might question the need for introducing the hub point $h$; why couldn't we instead simply add paths continuously relating the boundary of the disc to a point \emph{on} that boundary, as shown in \cref{fig:spokes-no-hub}? +However, this does not work without further modification. +For if, given some $f:\Sn^1 \to X$, we give a path constructor connecting each $f(x)$ to $f(\base)$, then what we end up with is more like the picture in \cref{fig:spokes-no-hub-ii} of a cone whose vertex is twisted around and glued to some point on its base. +The problem is that the specified path from $f(\base)$ to itself may not be reflexivity. +We could remedy the problem by adding a 2-dimensional path constructor to ensure this, but using a separate hub avoids the need for any path constructors of dimension above~$1$. +\end{rmk} + +\begin{figure} + \centering + \begin{minipage}{2in} + \begin{center} + \begin{tikzpicture} + \draw (0,0) circle (2cm); + \clip (0,0) circle (2cm); + \foreach \x in {0,15,...,165} + \draw[\OPTblue] (0,-2cm) -- (\x:4cm); + \end{tikzpicture} + \end{center} + \caption{Hubless spokes} + \label{fig:spokes-no-hub} + \end{minipage} + \qquad + \begin{minipage}{2in} + \begin{center} + \begin{tikzpicture}[xscale=1.3] + \draw (0,0) arc (-90:90:.7cm and 2cm) ; + \draw[dashed] (0,4cm) arc (90:270:.7cm and 2cm) ; + \draw[\OPTblue] (0,0) to[out=90,in=0] (-1,1) to[out=180,in=180] (0,0); + \draw[\OPTblue] (0,4cm) to[out=180,in=180,looseness=2] (0,0); + \path (0,0) arc (-90:-60:.7cm and 2cm) node (a) {}; + \draw[\OPTblue] (a.center) to[out=120,in=10] (-1.2,1.2) to[out=190,in=180] (0,0); + \path (0,0) arc (-90:-30:.7cm and 2cm) node (b) {}; + \draw[\OPTblue] (b.center) to[out=150,in=20] (-1.4,1.4) to[out=200,in=180] (0,0); + \path (0,0) arc (-90:0:.7cm and 2cm) node (c) {}; + \draw[\OPTblue] (c.center) to[out=180,in=30] (-1.5,1.5) to[out=210,in=180] (0,0); + \path (0,0) arc (-90:30:.7cm and 2cm) node (d) {}; + \draw[\OPTblue] (d.center) to[out=190,in=50] (-1.7,1.7) to[out=230,in=180] (0,0); + \path (0,0) arc (-90:60:.7cm and 2cm) node (e) {}; + \draw[\OPTblue] (e.center) to[out=200,in=70] (-2,2) to[out=250,in=180] (0,0); + \clip (0,0) to[out=90,in=0] (-1,1) to[out=180,in=180] (0,0); + \draw (0,4cm) arc (90:270:.7cm and 2cm) ; + \end{tikzpicture} + \end{center} + \caption{Hubless spokes, II} + \label{fig:spokes-no-hub-ii} + \end{minipage} +\end{figure} + +\begin{rmk} + \index{computation rule!propositional}% + Note also that this ``translation'' of higher paths into 1-paths does not preserve judgmental computation rules for these paths, though it does preserve propositional ones. +\end{rmk} + +\index{cell complex|)}% +\index{CW complex|)}% + +\index{hub and spoke|)}% + + +\section{Pushouts} +\label{sec:colimits} + +\index{type!limit}% +\index{type!colimit}% +\index{limit!of types}% +\index{colimit!of types}% +From a category-theoretic point of view, one of the important aspects of any foundational system is the ability to construct limits and colimits. +In set-theoretic foundations, these are limits and colimits of sets, whereas in our case they are limits and colimits of \emph{types}. +We have seen in \cref{sec:universal-properties} that cartesian product types have the correct universal property of a categorical product of types, and in \cref{ex:coprod-ump} that coproduct types likewise have their expected universal property. + +As remarked in \cref{sec:universal-properties}, more general limits can be constructed using identity types and $\Sigma$-types, e.g.\ the pullback\index{pullback} of $f:A\to C$ and $g:B\to C$ is $\sm{a:A}{b:B} (f(a)=g(b))$ (see \cref{ex:pullback}). +However, more general \emph{colimits} require identifying elements coming from different types, for which higher inductives are well-adapted. +Since all our constructions are homotopy-invariant, all our colimits are necessarily \emph{homotopy colimits}, but we drop the ubiquitous adjective in the interests of concision. + +In this section we discuss \emph{pushouts}, as perhaps the simplest and one of the most useful colimits. +Indeed, one expects all finite colimits (for a suitable homotopical definition of ``finite'') to be constructible from pushouts and finite coproducts. +It is also possible to give a direct construction of more general colimits using higher inductive types, but this is somewhat technical, and also not completely satisfactory since we do not yet have a good fully general notion of homotopy coherent diagrams. + +\indexsee{type!pushout of}{pushout}% +\index{pushout|(defstyle}% +\index{span}% +Suppose given a span of types and functions: +\[\Ddiag=\;\vcenter{\xymatrix{C \ar^g[r] \ar_f[d] & B \\ A & }}\] +The \define{pushout} of this span is the higher inductive type $A\sqcup^CB$ presented by +\begin{itemize} +\item a function $\inl:A\to A\sqcup^CB$, +\item a function $\inr:B \to A\sqcup^CB$, and +\item for each $c:C$ a path $\glue(c):(\inl(f(c))=\inr(g(c)))$. +\end{itemize} +In other words, $A\sqcup^CB$ is the disjoint union of $A$ and $B$, together with for every $c:C$ a witness that $f(c)$ and $g(c)$ are equal. +The recursion principle says that if $D$ is another type, we can define a map $s:A\sqcup^CB\to{}D$ by defining +\begin{itemize} +\item for each $a:A$, the value of $s(\inl(a)):D$, +\item for each $b:B$, the value of $s(\inr(b)):D$, and +\item for each $c:C$, the value of $\mapfunc{s}(\glue(c)):s(\inl(f(c)))=s(\inr(g(c)))$. +\end{itemize} +We leave it to the reader to formulate the induction principle. +It also implies the uniqueness principle that if $s,s':A\sqcup^CB\to{}D$ are two maps such that +\index{uniqueness!principle, propositional!for functions on a pushout}% +\begin{align*} + s(\inl(a))&=s'(\inl(a))\\ + s(\inr(b))&=s'(\inr(b))\\ + \mapfunc{s}(\glue(c))&=\mapfunc{s'}(\glue(c)) + \qquad\text{(modulo the previous two equalities)} +\end{align*} +for every $a,b,c$, then $s=s'$. + +To formulate the universal property of a pushout, we introduce the following. + +\begin{defn}\label{defn:cocone} + Given a span $\Ddiag= (A \xleftarrow{f} C \xrightarrow{g} B)$ and a type $D$, a \define{cocone under $\Ddiag$ with vertex $D$} + \indexdef{cocone}% + \index{vertex of a cocone}% + consists of functions $i:A\to{}D$ and $j:B\to{}D$ and a homotopy $h : \prd{c:C} (i(f(c))=j(g(c)))$: + \[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} + \xymatrix{C \ar^g[r] \ar_f[d] \drtwocell{^h} & B \ar^j[d] \\ A \ar_i[r] & D + }\] + We denote by $\cocone{\Ddiag}{D}$ the type of all such cocones, i.e. + \[ \cocone{\Ddiag}{D} \defeq + \sm{i:A\to D}{j:B\to D} \prd{c:C} (i(f(c))=j(g(c))). + \] +\end{defn} + +Of course, there is a canonical cocone under $\Ddiag$ with vertex $A\sqcup^C B$ consisting of $\inl$, $\inr$, and $\glue$. +\[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} +\xymatrix{C \ar^g[r] \ar_f[d] \drtwocell{^\glue\ \ } & B \ar^\inr[d] \\ + A \ar_-\inl[r] & A\sqcup^CB }\] +The following lemma says that this is the universal such cocone. + +\begin{lem}\label{thm:pushout-ump} + \index{universal!property!of pushout}% + For any type $E$, there is an equivalence + \[ (A\sqcup^C B \to E) \;\eqvsym\; \cocone{\Ddiag}{E}. \] +\end{lem} +\begin{proof} + Let's consider an arbitrary type $E:\type$. + There is a canonical function $c_\sqcup$ defined by + \[\function{(A\sqcup^CB\to{}E)}{\cocone{\Ddiag}{E}} + {t}{(t\circ{}\inl,t\circ{}\inr,\mapfunc{t}\circ{}\glue)}\] + We write informally $t\mapsto\composecocone{t}c_\sqcup$ for this function. + We show that this is an equivalence. + + Firstly, given a $c=(i,j,h):\cocone{\mathscr{D}}{E}$, we need to construct a + map $\mathsf{s}(c)$ from $A\sqcup^CB$ to $E$. + \[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} + \xymatrix{C \ar^g[r] \ar_f[d] \drtwocell{^h} & B \ar^{j}[d] \\ + A \ar_-{i}[r] & E }\] + The map $\mathsf{s}(c)$ is defined in the following way + \begin{align*} + \mathsf{s}(c)(\inl(a))&\defeq i(a),\\ + \mathsf{s}(c)(\inr(b))&\defeq j(b),\\ + \mapfunc{\mathsf{s}(c)}(\glue(x))&\defid h(x). + \end{align*} +We have defined a map +\[\function{\cocone{\Ddiag}{E}}{(A\sqcup^CB\to{}E)}{c}{\mathsf{s}(c)}\] +and we need to prove that this map is an inverse to +$t\mapsto{}\composecocone{t}c_\sqcup$. +On the one hand, if $c=(i,j,h):\cocone{\Ddiag}{E}$, we have +\begin{align*} + \composecocone{\mathsf{s}(c)}c_\sqcup & = + (\mathsf{s}(c)\circ\inl,\mathsf{s}(c)\circ\inr, + \mapfunc{\mathsf{s}(c)}\circ\glue) \\ + & = (\lamu{a:A} \mathsf{s}(c)(\inl(a)),\; + \lamu{b:B} \mathsf{s}(c)(\inr(b)),\; + \lamu{x:C} \mapfunc{\mathsf{s}(c)}(\glue(x))) \\ + & = (\lamu{a:A} i(a),\; + \lamu{b:B} j(b),\; + \lamu{x:C} h(x)) \\ + & \jdeq (i, j, h) \\ + & = c. +\end{align*} +% +On the other hand, if $t:A\sqcup^CB\to{}E$, we want to prove that +$\mathsf{s}(\composecocone{t}c_\sqcup)=t$. +For $a:A$, we have +\[\mathsf{s}(\composecocone{t}c_\sqcup)(\inl(a))=t(\inl(a))\] +because the first component of $\composecocone{t}c_\sqcup$ is $t\circ\inl$. In +the same way, for $b:B$ we have +\[\mathsf{s}(\composecocone{t}c_\sqcup)(\inr(b))=t(\inr(b))\] +and for $x:C$ we have +\[\mapfunc{\mathsf{s}(\composecocone{t}c_\sqcup)}(\glue(x)) +=\mapfunc{t}(\glue(x))\] +hence $\mathsf{s}(\composecocone{t}c_\sqcup)=t$. + +This proves that $c\mapsto\mathsf{s}(c)$ is a quasi-inverse to $t\mapsto{}\composecocone{t}c_\sqcup$, as desired. +\end{proof} + +A number of standard homotopy-theoretic constructions can be expressed as (homotopy) pushouts. +\begin{itemize} +\item The pushout of the span $\unit \leftarrow A \to \unit$ is the \define{suspension} $\susp A$ (see \cref{sec:suspension}).% + \index{suspension} +\symlabel{join} +\item The pushout of $A \xleftarrow{\proj1} A\times B \xrightarrow{\proj2} B$ is called the \define{join} of $A$ and $B$, written $A*B$.% + \indexdef{join!of types} +\item The pushout of $\unit \leftarrow A \xrightarrow{f} B$ is the \define{cone} or \define{cofiber} of $f$.% + \indexdef{cone!of a function}% + \indexsee{mapping cone}{cone of a function}% + \indexdef{cofiber of a function}% +\symlabel{wedge} +\item If $A$ and $B$ are equipped with basepoints $a_0:A$ and $b_0:B$, then the pushout of $A \xleftarrow{a_0} \unit \xrightarrow{b_0} B$ is the \define{wedge} $A\vee B$.% + \indexdef{wedge} +\symlabel{smash} +\item If $A$ and $B$ are pointed as before, define $f:A\vee B \to A\times B$ by $f(\inl(a))\defeq (a,b_0)$ and $f(\inr(b))\defeq (a_0,b)$, with $\ap f \glue \defid \refl{(a_0,b_0)}$. + Then the cone of $f$ is called the \define{smash product} $A\wedge B$.% + \indexdef{smash product} +\end{itemize} +We will discuss pushouts further in \cref{cha:hlevels,cha:homotopy}. + +\begin{rmk} + As remarked in \cref{subsec:prop-trunc}, the notations $\wedge$ and $\vee$ for the smash product and wedge of pointed spaces are also used in logic for ``and'' and ``or'', respectively. + Since types in homotopy type theory can behave either like spaces or like propositions, there is technically a potential for conflict --- but since they rarely do both at once, context generally disambiguates. + Furthermore, the smash product and wedge only apply to \emph{pointed} spaces, while the only pointed mere proposition is $\top\jdeq\unit$ --- and we have $\unit\wedge \unit = \unit$ and $\unit\vee\unit=\unit$ for either meaning of $\wedge$ and $\vee$. +\end{rmk} + +\index{pushout|)}% + +\begin{rmk} + Note that colimits do not in general preserve truncatedness. + For instance, $\Sn^0$ and \unit are both sets, but the pushout of $\unit \leftarrow \Sn^0 \to \unit$ is $\Sn^1$, which is not a set. + If we are interested in colimits in the category of $n$-types, therefore (and, in particular, in the category of sets), we need to ``truncate'' the colimit somehow. + We will return to this point in \cref{sec:hittruncations,cha:hlevels,cha:set-math}. +\end{rmk} + + +\section{Truncations} +\label{sec:hittruncations} + +\index{truncation!propositional|(}% +In \cref{subsec:prop-trunc} we introduced the propositional truncation as a new type forming operation; +we now observe that it can be obtained as a special case of higher inductive types. +This reduces the problem of understanding truncations to the problem of understanding higher inductives, which at least are amenable to a systematic treatment. +It is also interesting because it provides our first example of a higher inductive type which is truly \emph{recursive}, in that its constructors take inputs from the type being defined (as does the successor $\suc:\nat\to\nat$). + +Let $A$ be a type; we define its propositional truncation $\brck A$ to be the higher inductive type generated by: +\begin{itemize} +\item A function $\bprojf : A \to \brck A$, and +\item for each $x,y:\brck A$, a path $x=y$. +\end{itemize} +Note that the second constructor is by definition the assertion that $\brck A$ is a mere proposition. +Thus, the definition of $\brck A$ can be interpreted as saying that $\brck A$ is freely generated by a function $A\to\brck A$ and the fact that it is a mere proposition. + +The recursion principle for this higher inductive definition is easy to write down: it says that given any type $B$ together with +\begin{itemize} +\item a function $g:A\to B$, and +\item for any $x,y:B$, a path $x=_B y$, +\end{itemize} +there exists a function $f:\brck A \to B$ such that +\begin{itemize} +\item $f(\bproj a) \jdeq g(a)$ for all $a:A$, and +\item for any $x,y:\brck A$, the function $\apfunc f$ takes the specified path $x=y$ in $\brck A$ to the specified path $f(x) = f(y)$ in $B$ (propositionally). +\end{itemize} +\index{recursion principle!for truncation}% +These are exactly the hypotheses that we stated in \cref{subsec:prop-trunc} for the recursion principle of propositional truncation --- a function $A\to B$ such that $B$ is a mere proposition --- and the first part of the conclusion is exactly what we stated there as well. +The second part (the action of $\apfunc f$) was not mentioned previously, but it turns out to be vacuous in this case, because $B$ is a mere proposition, so \emph{any} two paths in it are automatically equal. + +\index{induction principle!for truncation}% +There is also an induction principle for $\brck A$, which says that given any $B:\brck A \to \type$ together with +\begin{itemize} +\item a function $g:\prd{a:A} B(\bproj a)$, and +\item for any $x,y:\brck A$ and $u:B(x)$ and $v:B(y)$, a dependent path $q:\dpath{B}{p(x,y)}{u}{v}$, where $p(x,y)$ is the path coming from the second constructor of $\brck A$, +\end{itemize} +there exists $f:\prd{x:\brck A} B(x)$ such that $f(\bproj a)\jdeq g(a)$ for $a:A$, and also another computation rule. +However, because there can be at most one function between any two mere propositions (up to homotopy), this induction principle is not really useful (see also \cref{ex:prop-trunc-ind}). + +\index{truncation!propositional|)}% +\index{truncation!set|(}% + +\index{set|(}% +We can, however, extend this idea to construct similar truncations landing in $n$-types, for any $n$. +For instance, we might define the \emph{0-trun\-ca\-tion} $\trunc0A$ to be generated by +\begin{itemize} +\item A function $\tprojf0 : A \to \trunc0 A$, and +\item For each $x,y:\trunc0A$ and each $p,q:x=y$, a path $p=q$. +\end{itemize} +Then $\trunc0A$ would be freely generated by a function $A\to \trunc0A$ together with the assertion that $\trunc0A$ is a set. +A natural induction principle for it would say that given $B:\trunc0 A \to \type$ together with +\begin{itemize} +\item a function $g:\prd{a:A} B(\tproj0a)$, and +\item for any $x,y:\trunc0A$ with $z:B(x)$ and $w:B(y)$, and each $p,q:x=y$ with $r:\dpath{B}{p}{z}{w}$ and $s:\dpath{B}{q}{z}{w}$, a 2-path $v:\dpath{\dpath{B}{-}{z}{w}}{u(x,y,p,q)}{r}{s}$, where $u(x,y,p,q):p=q$ is obtained from the second constructor of $\trunc0A$, +\end{itemize} +there exists $f:\prd{x:\trunc0A} B(x)$ such that $f(\tproj0a)\jdeq g(a)$ for all $a:A$, and also $\apdtwo{f}{u(x,y,p,q)}$ is the 2-path specified above. +(As in the propositional case, the latter condition turns out to be uninteresting.) +From this, however, we can prove a more useful induction principle. + +\begin{lem}\label{thm:trunc0-ind} + Suppose given $B:\trunc0 A \to \type$ together with $g:\prd{a:A} B(\tproj0a)$, and assume that each $B(x)$ is a set. + Then there exists $f:\prd{x:\trunc0A} B(x)$ such that $f(\tproj0a)\jdeq g(a)$ for all $a:A$. +\end{lem} +\begin{proof} + It suffices to construct, for any $x,y,z,w,p,q,r,s$ as above, a 2-path $v:\dpath{B}{u(x,y,p,q)}{r}{s}$. + However, by the definition of dependent 2-paths, this is an ordinary 2-path in the fiber $B(y)$. + Since $B(y)$ is a set, a 2-path exists between any two parallel paths. +\end{proof} + +This implies the expected universal property. + +\begin{lem}\label{thm:trunc0-lump} + \index{universal!property!of truncation}% + For any set $B$ and any type $A$, composition with $\tprojf0:A\to \trunc0A$ determines an equivalence + \[ \eqvspaced{(\trunc0A\to B)}{(A\to B)}. \] +\end{lem} +\begin{proof} + The special case of \cref{thm:trunc0-ind} when $B$ is the constant family gives a map from right to left, which is a right inverse to the ``compose with $\tprojf0$'' function from left to right. + To show that it is also a left inverse, let $h:\trunc0A\to B$, and define $h':\trunc0A\to B$ by applying \cref{thm:trunc0-ind} to the composite $a\mapsto h(\tproj0a)$. + Thus, $h'(\tproj0a)=h(\tproj0a)$. + + However, since $B$ is a set, for any $x:\trunc0A$ the type $h(x)=h'(x)$ is a mere proposition, and hence also a set. + Therefore, by \cref{thm:trunc0-ind}, the observation that $h'(\tproj0a)=h(\tproj0a)$ for any $a:A$ implies $h(x)=h'(x)$ for any $x:\trunc0A$, and hence $h=h'$. +\end{proof} + +\index{limit!of sets}% +\index{colimit!of sets}% +For instance, this enables us to construct colimits of sets. +We have seen that if $A \xleftarrow{f} C \xrightarrow{g} B$ is a span of sets, then the pushout $A\sqcup^C B$ may no longer be a set. +(For instance, if $A$ and $B$ are \unit and $C$ is \bool, then the pushout is $\Sn^1$.) +However, we can construct a pushout that is a set, and has the expected universal property with respect to other sets, by truncating. + +\begin{lem}\label{thm:set-pushout} + \index{universal!property!of pushout}% + Let $A \xleftarrow{f} C \xrightarrow{g} B$ be a span\index{span} of sets. + Then for any set $E$, there is a canonical equivalence + \[ \Parens{\trunc0{A\sqcup^C B} \to E} \;\eqvsym\; \cocone{\Ddiag}{E}. \] +\end{lem} +\begin{proof} + Compose the equivalences in \cref{thm:pushout-ump,thm:trunc0-lump}. +\end{proof} + +We refer to $\trunc0{A\sqcup^C B}$ as the \define{set-pushout} +\indexdef{set-pushout}% +\index{pushout!of sets} +of $f$ and $g$, to distinguish it from the (homotopy) pushout $A\sqcup^C B$. +Alternatively, we could modify the definition of the pushout in \cref{sec:colimits} to include the $0$-truncation constructor directly, avoiding the need to truncate afterwards. +Similar remarks apply to any sort of colimit of sets; we will explore this further in \cref{cha:set-math}. + +However, while the above definition of the 0-truncation works --- it gives what we want, and is consistent --- it has a couple of issues. +Firstly, it doesn't fit so nicely into the general theory of higher inductive types. +In general, it is tricky to deal directly with constructors such as the second one we have given for $\trunc0A$, whose \emph{inputs} involve not only elements of the type being defined, but paths in it. + +This can be gotten round fairly easily, however. +Recall in \cref{sec:bool-nat} we mentioned that we can allow a constructor of an inductive type $W$ to take ``infinitely many arguments'' of type $W$ by having it take a single argument of type $\nat\to W$. +There is a general principle behind this: to model a constructor with funny-looking inputs, use an auxiliary inductive type (such as \nat) to parametrize them, reducing the input to a simple function with inductive domain. + +For the 0-truncation, we can consider the auxiliary \emph{higher} inductive type $S$ generated by two points $a,b:S$ and two paths $p,q:a=b$. +Then the fishy-looking constructor of $\trunc 0A$ can be replaced by the unobjectionable +\begin{itemize} +\item For every $f:S\to \trunc 0A$, a path $\apfunc{f}(p) = \apfunc{f}(q)$. +\end{itemize} +Since to give a map out of $S$ is the same as to give two points and two parallel paths between them, this yields the same induction principle. + +\index{set|)}% + +\index{truncation!set|)}% +\index{truncation!n-truncation@$n$-truncation}% +A more serious problem with our current definition of $0$-truncation, however, is that it doesn't generalize very well. +If we want to describe a notion of definition of ``$n$-truncation'' into $n$-types uniformly for all $n:\nat$, then this approach is unfeasible, since the second constructor would need a number of arguments that increases with $n$. +In \cref{sec:truncations}, therefore, we will use a different idea to construct these, based on the observation that the type $S$ introduced above is equivalent to the circle $\Sn^1$. +This includes the 0-truncation as a special case, and satisfies generalized versions of \cref{thm:trunc0-ind,thm:trunc0-lump}. + + +\section{Quotients} +\label{sec:set-quotients} + +A particularly important sort of colimit of sets is the \emph{quotient} by a relation. +That is, let $A$ be a set and $R:A\times A \to \prop$ a family of mere propositions (a \define{mere relation}). +\indexdef{relation!mere}% +\indexdef{mere relation}% +Its quotient should be the set-coequalizer of the two projections +\[ \tsm{a,b:A} R(a,b) \rightrightarrows A. \] +We can also describe this directly, as the higher inductive type $A/R$ generated by +\index{set-quotient|(defstyle}% +\indexsee{quotient of sets}{set-quotient}% +\indexsee{type!quotient}{set-quotient}% +\begin{itemize} +\item A function $q:A\to A/R$; +\item For each $a,b:A$ such that $R(a,b)$, an equality $q(a)=q(b)$; and +\item The $0$-truncation constructor: for all $x,y:A/R$ and $r,s:x=y$, we have $r=s$. +\end{itemize} +We will sometimes refer to this higher inductive type $A/R$ as the \define{set-quotient} of $A$ by $R$, to emphasize that it produces a set by definition. +(There are more general notions of ``quotient'' in homotopy theory, but they are mostly beyond the scope of this book. +However, in \cref{sec:rezk} we will consider the ``quotient'' of a type by a 1-groupoid, which is the next level up from set-quotients.) + +\begin{rmk}\label{rmk:quotient-of-non-set} + It is not actually necessary for the definition of set-quotients, and most of their properties, that $A$ be a set. + However, this is generally the case of most interest. +\end{rmk} + +\begin{lem}\label{thm:quotient-surjective} + The function $q:A\to A/R$ is surjective. +\end{lem} +\begin{proof} + We must show that for any $x:A/R$ there merely exists an $a:A$ with $q(a)=x$. + We use the induction principle of $A/R$. + The first case is trivial: if $x$ is $q(a)$, then of course there merely exists an $a$ such that $q(a)=q(a)$. + And since the goal is a mere proposition, it automatically respects all path constructors, so we are done. +\end{proof} + +We can now prove that the set-quotient has the expected universal property of a (set-)coequalizer. + +\begin{lem}\label{thm:quotient-ump} + For any set $B$, precomposing with $q$ yields an equivalence + \[ \eqvspaced{(A/R \to B)}{\Parens{\sm{f:A\to B} \prd{a,b:A} R(a,b) \to (f(a)=f(b))}}.\] +\end{lem} +\begin{proof} + The quasi-inverse of $\blank\circ q$, going from right to left, is just the recursion principle for $A/R$. + That is, given $f:A\to B$ such that + \narrowequation{\prd{a,b:A} R(a,b) \to (f(a)=f(b)),} we define $\bar f:A/R\to B$ by $\bar f(q(a))\defeq f(a)$. + This defining equation says precisely that $(f\mapsto \bar f)$ is a right inverse to $(\blank\circ q)$. + + For it to also be a left inverse, we must show that for any $g:A/R\to B$ and $x:A/R$ we have $g(x) = \overline{g\circ q}(x)$. + However, by \cref{thm:quotient-surjective} there merely exists $a$ such that $q(a)=x$. + Since our desired equality is a mere proposition, we may assume there purely exists such an $a$, in which case $g(x) = g(q(a)) = \overline{g\circ q}(q(a)) = \overline{g\circ q}(x)$. +\end{proof} + +Of course, classically the usual case to consider is when $R$ is an \define{equivalence relation}, i.e.\ we have +\indexdef{relation!equivalence}% +\indexsee{equivalence!relation}{relation, equivalence}% +% +\begin{itemize} +\item \define{reflexivity}: $\prd{a:A} R(a,a)$, + \indexdef{reflexivity!of a relation}% + \indexdef{relation!reflexive}% +\item \define{symmetry}: $\prd{a,b:A} R(a,b) \to R(b,a)$, and + \indexdef{symmetry!of a relation}% + \indexdef{relation!symmetric}% +\item \define{transitivity}: $\prd{a,b,c:C} R(a,b) \times R(b,c) \to R(a,c)$. + \indexdef{transitivity!of a relation}% + \indexdef{relation!transitive}% +\end{itemize} +% +In this case, the set-quotient $A/R$ has additional good properties, as we will see in \cref{sec:piw-pretopos}: for instance, we have $R(a,b) \eqvsym (\id[A/R]{q(a)}{q(b)})$. +\symlabel{equivalencerelation} +We often write an equivalence relation $R(a,b)$ infix as $a\eqr b$. + +The quotient by an equivalence relation can also be constructed in other ways. +The set theoretic approach is to consider the set of equivalence classes, as a subset of the power set\index{power set} of $A$. +We can mimic this ``impredicative'' construction in type theory as well. +\index{impredicative!quotient} + +\begin{defn} + A predicate $P:A\to\prop$ is an \define{equivalence class} + \indexdef{equivalence!class}% + of a relation $R : A \times A \to \prop$ if there merely exists an $a:A$ such that for all $b:A$ we have $\eqv{R(a,b)}{P(b)}$. +\end{defn} + +As $R$ and $P$ are mere propositions, the equivalence $\eqv{R(a,b)}{P(b)}$ is the same thing as implications $R(a,b) \to P(b)$ and $P(b) \to R(a,b)$. +And of course, for any $a:A$ we have the canonical equivalence class $P_a(b) \defeq R(a,b)$. + +\begin{defn}\label{def:VVquotient} + We define + \begin{equation*} + A\sslash R \defeq \setof{ P:A\to\prop | P \text{ is an equivalence class of } R}. + \end{equation*} + The function $q':A\to A\sslash R$ is defined by $q'(a) \defeq P_a$. +\end{defn} + +\begin{thm} + For any equivalence relation $R$ on $A$, the type $A\sslash R$ is equivalent to the set-quotient $A/R$. +\end{thm} +\begin{proof} + First, note that if $R(a,b)$, then since $R$ is an equivalence relation we have $R(a,c) \Leftrightarrow R(b,c)$ for any $c:A$. + Thus, $R(a,c) = R(b,c)$ by univalence, hence $P_a=P_b$ by function extensionality, i.e.\ $q'(a)=q'(b)$. + Therefore, by \cref{thm:quotient-ump} we have an induced map $f:A/R \to A\sslash R$ such that $f\circ q = q'$. + + We show that $f$ is injective and surjective, hence an equivalence. + Surjectivity follows immediately from the fact that $q'$ is surjective, which in turn is true essentially by definition of $A\sslash R$. + For injectivity, if $f(x)=f(y)$, then to show the mere proposition $x=y$, by surjectivity of $q$ we may assume $x=q(a)$ and $y=q(b)$ for some $a,b:A$. + Then $R(a,c) = f(q(a))(c) = f(q(b))(c) = R(b,c)$ for any $c:A$, and in particular $R(a,b) = R(b,b)$. + But $R(b,b)$ is inhabited, since $R$ is an equivalence relation, hence so is $R(a,b)$. + Thus $q(a)=q(b)$ and so $x=y$. +\end{proof} + +In \cref{subsec:quotients} we will give an alternative proof of this theorem. +Note that unlike $A/R$, the construction $A\sslash R$ raises universe level: if $A:\UU_i$ and $R:A\to A\to \prop_{\UU_i}$, then in the definition of $A\sslash R$ we must also use $\prop_{\UU_i}$ to include all the equivalence classes, so that $A\sslash R : \UU_{i+1}$. +Of course, we can avoid this if we assume the propositional resizing axiom from \cref{subsec:prop-subsets}. + +\begin{rmk}\label{defn-Z} +The previous two constructions provide quotients in generality, but in particular cases there may be easier constructions. +For instance, we may define the integers \Z as a set-quotient +\indexdef{integers}% +\indexdef{number!integers}% +% +\[ \Z \defeq (\N \times \N)/{\eqr} \] +% +where $\eqr$ is the equivalence relation defined by +% +\[ (a,b) \eqr (c,d) \defeq (a + d = b + c). \] +% +In other words, a pair $(a,b)$ represents the integer $a - b$. +In this case, however, there are \emph{canonical representatives} of the equivalence classes: those of the form $(n,0)$ or $(0,n)$. +\end{rmk} + +The following lemma says that when this sort of thing happens, we don't need either general construction of quotients. +(A function $r:A\to A$ is called \define{idempotent} +\indexdef{function!idempotent}% +\indexdef{idempotent!function}% +if $r\circ r = r$.) + +\begin{lem}\label{lem:quotient-when-canonical-representatives} + Suppose $\eqr$ is a relation on a set $A$, and there exists an idempotent $r + : A \to A$ such that $\eqv{(r(x) = r(y))}{(x \eqr y)}$ for all $x, y: A$. + (This implies $\eqr$ is an equivalence relation.) + Then the type + % + \begin{equation*} + (A/{\eqr}) \defeq \Parens{\sm{x : A} r(x) = x} + \end{equation*} + % + satisfies the universal property of the set-quotient of $A$ by~$\eqr$, and hence is equivalent to it. + In other words, there is a map $q : A \to (A/{\eqr})$ such that for every set $B$, precomposition with $q$ induces an equivalence + % + \begin{equation} + \label{eq:quotient-when-canonical} + \Parens{(A/{\eqr}) \to B} \eqvsym \Parens{\sm{g : A \to B} \prd{x, y : A} (x \eqr y) \to (g(x) = g(y))}. + \end{equation} +\end{lem} + +\begin{proof} + Let $i : \prd{x : A} r(r(x)) = r(x)$ witness idempotence of~$r$. + The map $q : A \to (A/{\eqr})$ is defined by $q(x) \defeq (r(x), i(x))$. + Note that since $A$ is a set, we have $q(x)=q(y)$ if and only if $r(x)=r(y)$, hence (by assumption) if and only if $x \eqr y$. + We define a map $e$ from left to right in~\eqref{eq:quotient-when-canonical} by + \[ e(f) \defeq (f \circ q, \nameless), \] + % + where the underscore $\nameless$ denotes the following proof: if $x, y : A$ and $x \eqr y$, then $q(x)=q(y)$ as observed above, hence $f(q(x)) = f(q(y))$. + To see that $e$ is an equivalence, consider the map $e'$ in the opposite direction defined by + % + \[ e'(g, s) (x,p) \defeq g(x). \] + % + Given any $f : (A/{\eqr}) \to B$, + % + \[ e'(e(f))(x, p) \jdeq f(q(x)) \jdeq f(r(x), i(x)) = f(x, p) \] + % + where the last equality holds because $p : r(x) = x$ and so $(x,p) = (r(x), i(x))$ + because $A$ is a set. Similarly we compute + % + \[ e(e'(g, s)) \jdeq e(g \circ \proj{1}) \jdeq (g \circ \proj{1} \circ q, {\nameless}). \] + % + Because $B$ is a set we need not worry about the $\nameless$ part, while for the first + component we have + % + \[ g(\proj{1}(q(x))) \jdeq g(r(x)) = g(x), \] + % + where the last equation holds because $r(x) \eqr x$, and $g$ respects $\eqr$ by + the assumption $s$. +\end{proof} + +\begin{cor}\label{thm:retraction-quotient} + Suppose $p:A\to B$ is a retraction between sets. + Then $B$ is the quotient of $A$ by the equivalence relation $\eqr$ defined by + \[ (a_1 \eqr a_2) \defeq (p(a_1) = p(a_2)). \] +\end{cor} +\begin{proof} + Suppose $s:B\to A$ is a section of $p$. + Then $s\circ p : A\to A$ is an idempotent which satisfies the condition of \cref{lem:quotient-when-canonical-representatives} for this $\eqr$, and $s$ induces an isomorphism from $B$ to its set of fixed points. +\end{proof} + +\begin{rmk}\label{Z-quotient-by-canonical-representatives} +\cref{lem:quotient-when-canonical-representatives} applies to $\Z$ with the idempotent $r : \N \times \N \to \N \times \N$ +defined by +% +\begin{equation*} + r(a, b) = + \begin{cases} + (a - b, 0) & \text{if $a \geq b$,} \\ + (0, b - a) & \text{otherwise.} + \end{cases} +\end{equation*} +% +(This is a valid definition even constructively, since the relation $\geq$ on $\N$ is decidable.) +Thus a non-negative integer is canonically represented as $(k, 0)$ and a non-positive one by $(0, m)$, for $k,m:\N$. +This division into cases implies the following ``induction principle'' for integers, which will be useful in \cref{cha:homotopy}. +\index{natural numbers}% +(As usual, we identify a natural number $n$ with the corresponding non-negative integer, i.e.\ with the image of $(n,0):\N\times\N$ in $\Z$.) +\end{rmk} + +\begin{lem}\label{thm:sign-induction} + \index{integers!induction principle for}% + \index{induction principle!for integers}% + Suppose $P:\Z\to\type$ is a type family and that we have + \begin{itemize} + \item $d_0: P(0)$, + \item $d_+: \prd{n:\N} P(n) \to P(\suc(n))$, and + \item $d_- : \prd{n:\N} P(-n) \to P(-\suc(n))$. + \end{itemize} + Then we have $f:\prd{z:\Z} P(z)$ such that + \begin{itemize} + \item $f(0) = d_0$, + \item $f(\suc(n)) = d_+(n,f(n))$ for all $n:\N$, and + \item $f(-\suc(n)) = d_-(n,f(-n))$ for all $n:\N$. + \end{itemize} +\end{lem} +\begin{proof} + For purposes of this proof, let $\Z$ denote $\sm{x:\N\times\N}(r(x)=x)$, where $r$ is the above idempotent. + (We can then transport the result to any equivalent definition of $\Z$.) + Let $q:\N\times\N\to\Z$ be the quotient map, defined by $q(x) = (r(x),i(x))$ as in \cref{lem:quotient-when-canonical-representatives}. + Now define $Q\defeq P\circ q:\N\times \N \to \type$. + By transporting the given data across appropriate equalities, we obtain + \begin{align*} + d'_0 &: Q(0,0)\\ + d'_+ &: \prd{n:\N} Q(n,0) \to Q(\suc(n),0)\\ + d'_- &: \prd{n:\N} Q(0,n) \to Q(0,\suc(n)). + \end{align*} + Note also that since $q(n,m) = q(\suc(n),\suc(m))$, we have an induced equivalence + \[e_{n,m}:\eqv{Q(n,m)}{Q(\suc(n),\suc(m))}.\] + We can then construct $g:\prd{x:\N\times \N} Q(x)$ by double induction on $x$: + \begin{align*} + g(0,0) &\defeq d'_0,\\ + g(\suc(n),0) &\defeq d'_+(n,g(n,0)),\\ + g(0,\suc(m)) &\defeq d'_-(m,g(0,m)),\\ + g(\suc(n),\suc(m)) &\defeq e_{n,m}(g(n,m)). + \end{align*} + Now we have $\proj1 : \Z \to \N\times\N$, with the property that $q\circ \proj1 = \idfunc$. + In particular, therefore, we have $Q\circ \proj1 = P$, and hence a family of equivalences $s:\prd{z:\Z} \eqv{Q(\proj1(z))}{P(z)}$. + Thus, we can define $f(z) = s(z,g(\proj1(z)))$ to obtain $f:\prd{z:\Z} P(z)$, and verify the desired equalities. +\end{proof} + +We will sometimes denote a function $f:\prd{z:\Z} P(z)$ obtained from \cref{thm:sign-induction} with a pattern-matching syntax, involving the three cases $d_0$, $d_+$, and $d_-$: +\begin{align*} + f(0) &\defid d_0\\ + f(\suc(n)) &\defid d_+(n,f(n))\\ + f(-\suc(n)) &\defid d_-(n,f(-n)) +\end{align*} +We use $\defid$ rather than $\defeq$, as we did for the path constructors of higher inductive types, to indicate that the ``computation'' rules implied by \cref{thm:sign-induction} are only propositional equalities. +For example, in this way we can define the $n$-fold concatenation of a loop for any integer $n$. + +\begin{cor}\label{thm:looptothe} + \indexdef{path!concatenation!n-fold@$n$-fold}% + Let $A$ be a type with $a:A$ and $p:a=a$. + There is a function $\prd{n:\Z} (a=a)$, denoted $n\mapsto p^n$, defined by + \begin{align*} + p^0 &\defid \refl{a}\\ + p^{n+1} &\defid p^n \ct p + & &\text{for $n\ge 0$}\\ + p^{n-1} &\defid p^n \ct \opp p + & &\text{for $n\le 0$.} + \end{align*} +\end{cor} + +We will discuss the integers further in \cref{sec:free-algebras,sec:field-rati-numb}. + +\index{set-quotient|)}% + +\section{Algebra} +\label{sec:free-algebras} + +In addition to constructing higher-dimensional objects such as spheres and cell complexes, higher inductive types are also very useful even when working only with sets. +We have seen one example already in \cref{thm:set-pushout}: they allow us to construct the colimit of any diagram of sets, which is not possible in the base type theory of \cref{cha:typetheory}. +Higher inductive types are also very useful when we study sets with algebraic structure. + +As a running example in this section, we consider \emph{groups}, which are familiar to most mathematicians and exhibit the essential phenomena (and will be needed in later chapters). +However, most of what we say applies equally well to any sort of algebraic structure. + +\index{monoid|(}% + +\begin{defn} + A \define{monoid} + \indexdef{monoid}% + is a set $G$ together with + \begin{itemize} + \item a \emph{multiplication} + \indexdef{multiplication!in a monoid}% + \indexdef{multiplication!in a group}% + function $G\times G\to G$, written infix as $(x,y) \mapsto x\cdot y$; and + \item a \emph{unit} + \indexdef{unit!of a monoid}% + \indexdef{unit!of a group}% + element $e:G$; such that + \item for any $x:G$, we have $x\cdot e = x$ and $e\cdot x = x$; and + \item for any $x,y,z:G$, we have $x\cdot (y\cdot z) = (x\cdot y)\cdot z$. + \index{associativity!in a monoid}% + \index{associativity!in a group}% + \end{itemize} + A \define{group} + \indexdef{group}% + is a monoid $G$ together with + \begin{itemize} + \item an \emph{inversion} function $i:G\to G$, written $x\mapsto \opp x$; such that + \index{inverse!in a group}% + \item for any $x:G$ we have $x\cdot \opp x = e$ and $\opp x \cdot x = e$. + \end{itemize} +\end{defn} + +\begin{rmk}\label{rmk:infty-group} +Note that we require a group to be a set. +We could consider a more general notion of ``$\infty$-group''% +\index{.infinity-group@$\infty$-group} +which is not a set, but this would take us further afield than is appropriate at the moment. +With our current definition, we may expect the resulting ``group theory'' to behave similarly to the way it does in set-theoretic mathematics (with the caveat that, unless we assume \LEM{}, it will be ``constructive'' group theory).\index{mathematics!constructive} +\end{rmk} + +\begin{eg} + The natural numbers \N are a monoid under addition, with unit $0$, and also under multiplication, with unit $1$. + If we define the arithmetical operations on the integers \Z in the obvious way, then as usual they are a group under addition and a monoid under multiplication (and, of course, a ring). + For instance, if $u, v \in \Z$ are represented by $(a,b)$ and $(c,d)$, respectively, then $u + v$ is represented by $(a + c, b + d)$, $-u$ is represented by $(b, a)$, and $u v$ is represented by $(a c + b d, a d + b c)$. +\end{eg} + +\begin{eg}\label{thm:homotopy-groups} + We essentially observed in \cref{sec:equality} that if $(A,a)$ is a pointed type, then its loop space\index{loop space} $\Omega(A,a)\defeq (\id[A]aa)$ has all the structure of a group, except that it is not in general a set. + It should be an ``$\infty$-group'' in the sense mentioned in \cref{rmk:infty-group}, but we can also make it a group by truncation. + Specifically, we define the \define{fundamental group} + \indexsee{group!fundamental}{fundamental group}% + \indexdef{fundamental!group}% + of $A$ based at $a:A$ to be + \[\pi_1(A,a)\defeq \trunc0{\Omega(A,a)}.\] + This inherits a group structure; for instance, the multiplication $\pi_1(A,a) \times \pi_1(A,a) \to \pi_1(A,a)$ is defined by double induction on truncation from the concatenation of paths. + + More generally, the \define{$n^{\mathrm{th}}$ homotopy group} + \index{homotopy!group}% + \indexsee{group!homotopy}{homotopy group}% + of $(A,a)$ is $\pi_n(A,a)\defeq \trunc0{\Omega^n(A,a)}$. + \index{loop space!iterated}% + Then $\pi_n(A,a) = \pi_1(\Omega^{n-1}(A,a))$ for $n\ge 1$, so it is also a group. + (When $n=0$, we have $\pi_0(A) \jdeq \trunc0 A$, which is not a group.) + Moreover, the Eckmann--Hilton argument \index{Eckmann--Hilton argument} (\cref{thm:EckmannHilton}) implies that if $n\ge 2$, then $\pi_n(A,a)$ is an \emph{abelian}\index{group!abelian} group, i.e.\ we have $x\cdot y = y\cdot x$ for all $x,y$. + \cref{cha:homotopy} will be largely the study of these groups. +\end{eg} + +\index{algebra!free}% +\index{free!algebraic structure}% +One important notion in group theory is that of the \emph{free group} generated by a set, or more generally of a group \emph{presented} by generators\index{generator!of a group} and relations. +It is well-known in type theory that \emph{some} free algebraic objects can be defined using \emph{ordinary} inductive types. +\symlabel{lst-freemonoid}% +\indexdef{type!of lists}% +\indexsee{list type}{type, of lists}% +\index{monoid!free|(}% +For instance, the free monoid on a set $A$ can be identified with the type $\lst A$ of \emph{finite lists} \index{finite!lists, type of} of elements of $A$, which is inductively generated by +\begin{itemize} +\item a constructor $\nil:\lst A$, and +\item for each $\ell:\lst A$ and $a:A$, an element $\cons(a,\ell):\lst A$. +\end{itemize} +We have an obvious inclusion $\eta : A\to \lst A$ defined by $a\mapsto \cons(a,\nil)$. +The monoid operation on $\lst A$ is concatenation, defined recursively by +\begin{align*} + \nil \cdot \ell &\defeq \ell\\ + \cons (a,\ell_1) \cdot \ell_2 &\defeq \cons(a, \ell_1\cdot\ell_2). +\end{align*} +It is straightforward to prove, using the induction principle for $\lst A$, that $\lst A$ is a set and that concatenation of lists is associative +\index{associativity!of list concatenation}% +and has $\nil$ as a unit. +Thus, $\lst A$ is a monoid. + +\begin{lem}\label{thm:free-monoid} + \indexsee{free!monoid}{monoid, free}% + For any set $A$, the type $\lst A$ is the free monoid on $A$. + In other words, for any monoid $G$, composition with $\eta$ is an equivalence + \[ \eqv{\hom_{\mathrm{Monoid}}(\lst A,G)}{(A\to G)}, \] + where $\hom_{\mathrm{Monoid}}(\blank,\blank)$ denotes the set of monoid homomorphisms (functions which preserve the multiplication and unit). + \indexdef{homomorphism!monoid}% + \indexdef{monoid!homomorphism}% +\end{lem} +\begin{proof} + Given $f:A\to G$, we define $\bar{f}:\lst A \to G$ by recursion: + \begin{align*} + \bar{f}(\nil) &\defeq e\\ + \bar{f}(\cons(a,\ell)) &\defeq f(a) \cdot \bar{f}(\ell). + \end{align*} + It is straightforward to prove by induction that $\bar{f}$ is a monoid homomorphism, and that $f\mapsto \bar f$ is a quasi-inverse of $(\blank\circ \eta)$; see \cref{ex:free-monoid}. +\end{proof} + +\index{monoid!free|)}% + +This construction of the free monoid is possible essentially because elements of the free monoid have computable canonical forms (namely, finite lists). +However, elements of other free (and presented) algebraic structures --- such as groups --- do not in general have \emph{computable} canonical forms. +For instance, equality of words in group presentations is algorithmically\index{algorithm} undecidable. +However, we can still describe free algebraic objects as \emph{higher} inductive types, by simply asserting all the axiomatic equations as path constructors. + +\indexsee{free!group}{group, free}% +\index{group!free|(}% +For example, let $A$ be a set, and define a higher inductive type $\freegroup{A}$ with the following generators. +\begin{itemize} +\item A function $\eta:A\to \freegroup{A}$. +\item A function $m: \freegroup{A} \times \freegroup{A} \to \freegroup{A}$. +\item An element $e:\freegroup{A}$. +\item A function $i:\freegroup{A} \to \freegroup{A}$. +\item For each $x,y,z:\freegroup{A}$, an equality $m(x,m(y,z)) = m(m(x,y),z)$. +\item For each $x:\freegroup{A}$, equalities $m(x,e) = x$ and $m(e,x) = x$. +\item For each $x:\freegroup{A}$, equalities $m(x,i(x)) = e$ and $m(i(x),x) = e$. +\item The $0$-truncation constructor: for any $x,y:\freegroup{A}$ and $p,q:x=y$, we have $p=q$. +\end{itemize} +The first constructor says that $A$ maps to $\freegroup{A}$. +The next three give $\freegroup{A}$ the operations of a group: multiplication, an identity element, and inversion. +The three constructors after that assert the axioms of a group: associativity\index{associativity}, unitality, and inverses. +Finally, the last constructor asserts that $\freegroup{A}$ is a set. + +Therefore, $\freegroup{A}$ is a group. +It is also straightforward to prove: + +\begin{thm} + \index{universal!property!of free group}% + $\freegroup{A}$ is the free group on $A$. + In other words, for any (set) group $G$, composition with $\eta:A\to \freegroup{A}$ determines an equivalence + \[ \hom_{\mathrm{Group}}(\freegroup{A},G) \eqvsym (A\to G) \] + where $\hom_{\mathrm{Group}}(\blank,\blank)$ denotes the set of group homomorphisms between two groups. + \indexdef{group!homomorphism}% + \indexdef{homomorphism!group}% +\end{thm} +\begin{proof} + The recursion principle of the higher inductive type $\freegroup{A}$ says \emph{precisely} that if $G$ is a group and we have $f:A\to G$, then we have $\bar{f}:\freegroup{A} \to G$. + Its computation rules say that $\bar{f}\circ \eta \jdeq f$, and that $\bar f$ is a group homomorphism. + Thus, $(\blank\circ \eta) : \hom_{\mathrm{Group}}(\freegroup{A},G) \to (A\to G)$ has a right inverse. + It is straightforward to use the induction principle of $\freegroup{A}$ to show that this is also a left inverse. +\end{proof} + +\index{acceptance} +It is worth taking a step back to consider what we have just done. +We have proven that the free group on any set exists \emph{without} giving an explicit construction of it. +Essentially all we had to do was write down the universal property that it should satisfy. +In set theory, we could achieve a similar result by appealing to black boxes such as the adjoint functor theorem\index{adjoint!functor theorem}; type theory builds such constructions into the foundations of mathematics. + +Of course, it is sometimes also useful to have a concrete description of free algebraic structures. +In the case of free groups, we can provide one, using quotients. +Consider $\lst{A+A}$, where in $A+A$ we write $\inl(a)$ as $a$, and $\inr(a)$ as $\hat{a}$ (intended to stand for the formal inverse of $a$). +The elements of $\lst{A+A}$ are \emph{words} for the free group on $A$. + +\begin{thm} + Let $A$ be a set, and let $\freegroupx{A}$ be the set-quotient of $\lst{A+A}$ by the following relations. + \begin{align*} + (\dots,a_1,a_2,\widehat{a_2},a_3,\dots) &= + (\dots,a_1,a_3,\dots)\\ + (\dots,a_1,\widehat{a_2},a_2,a_3,\dots) &= + (\dots,a_1,a_3,\dots). + \end{align*} + Then $\freegroupx{A}$ is also the free group on the set $A$. +\end{thm} +\begin{proof} + First we show that $\freegroupx{A}$ is a group. + We have seen that $\lst{A+A}$ is a monoid; we claim that the monoid structure descends to the quotient. + We define $\freegroupx{A} \times \freegroupx{A} \to \freegroupx{A}$ by double quotient recursion; it suffices to check that the equivalence relation generated by the given relations is preserved by concatenation of lists. + Similarly, we prove the associativity and unit laws by quotient induction. + + In order to define inverses in $\freegroupx{A}$, we first define $\mathsf{reverse}:\lst B\to\lst B$ by recursion on lists: + \begin{align*} + \mathsf{reverse}(\nil) &\defeq \nil,\\ + \mathsf{reverse}(\cons(b,\ell))&\defeq \mathsf{reverse}(\ell)\cdot \cons(b,\nil). + \end{align*} + Now we define $i:\freegroupx{A}\to \freegroupx{A}$ by quotient recursion, acting on a list $\ell:\lst{A+A}$ by switching the two copies of $A$ and reversing the list. + This preserves the relations, hence descends to the quotient. + And we can prove that $i(x) \cdot x = e$ for $x:\freegroupx{A}$ by induction. + First, quotient induction allows us to assume $x$ comes from $\ell:\lst{A+A}$, and then we can do list induction; if we write $q:\lst{A+A}\to \freegroupx{A}$ for the quotient map, the cases are + \begin{align*} + i(q(\nil)) \ct q(\nil) &= q(\nil) \ct q(\nil)\\ + &= q(\nil)\\ + i(q(\cons(a,\ell))) \ct q(\cons(a,\ell)) &= i(q(\ell)) \ct q(\cons(\hat{a},\nil)) \ct q(\cons(a,\ell))\\ + &= i(q(\ell)) \ct q(\cons(\hat{a},\cons(a,\ell)))\\ + &= i(q(\ell)) \ct q(\ell)\\ + &= q(\nil). \tag{by the inductive hypothesis} + \end{align*} + (We have omitted a number of fairly evident lemmas about the behavior of concatenation of lists, etc.) + + This completes the proof that $\freegroupx{A}$ is a group. + Now if $G$ is any group with a function $f:A\to G$, we can define $A+A\to G$ to be $f$ on the first copy of $A$ and $f$ composed with the inversion map of $G$ on the second copy. + Now the fact that $G$ is a monoid yields a monoid homomorphism $\lst{A+A} \to G$. + And since $G$ is a group, this map respects the relations, hence descends to a map $\freegroupx{A}\to G$. + It is straightforward to prove that this is a group homomorphism, and the unique one which restricts to $f$ on $A$. +\end{proof} + +\index{monoid|)}% + +If $A$ has decidable equality\index{decidable!equality} (such as if we assume excluded middle), then the quotient defining $\freegroupx{A}$ can be obtained from an idempotent as in \cref{lem:quotient-when-canonical-representatives}. +We define a word, which we recall is just an element of $\lst{A+A}$, to be \define{reduced} +\indexdef{reduced word in a free group} +if it contains no adjacent pairs of the form $(a,\hat a)$ or $(\hat a,a)$. +When $A$ has decidable equality, it is straightforward to define the \define{reduction} +\index{reduction!of a word in a free group}% +of a word, which is an idempotent generating the appropriate quotient; we leave the details to the reader. + +If $A\defeq \unit$, which has decidable equality, a reduced word must consist either entirely of $\ttt$'s or entirely of $\hat{\ttt}$'s. +Thus, the free group on $\unit$ is equivalent to the integers \Z, with $0$ corresponding to $\nil$, the positive integer $n$ corresponding to a reduced word of $n$ $\ttt$'s, and the negative integer $(-n)$ corresponding to a reduced word of $n$ $\hat{\ttt}$'s. +One could also, of course, show directly that \Z has the universal property of $\freegroup{\unit}$. + +\begin{rmk}\label{thm:freegroup-nonset} + Nowhere in the construction of $\freegroup{A}$ and $\freegroupx{A}$, and the proof of their universal properties, did we use the assumption that $A$ is a set. + Thus, we can actually construct the free group on an arbitrary type. + Comparing universal properties, we conclude that $\eqv{\freegroup{A}}{\freegroup{\trunc0A}}$. +\end{rmk} + +\index{group!free|)}% + +\index{algebra!colimits of}% +We can also use higher inductive types to construct colimits of algebraic objects. +For instance, suppose $f:G\to H$ and $g:G\to K$ are group homomorphisms. +Their pushout in the category of groups, called the \define{amalgamated free product} +\indexdef{amalgamated free product}% +\indexdef{free!product!amalgamated}% +$H *_G K$, can be constructed as the higher inductive type generated by +\begin{itemize} +\item Functions $h:H\to H *_G K$ and $k:K\to H *_G K$. +\item The operations and axioms of a group, as in the definition of $\freegroup{A}$. +\item Axioms asserting that $h$ and $k$ are group homomorphisms. +\item For $x:G$, we have $h(f(x)) = k(g(x))$. +\item The $0$-truncation constructor. +\end{itemize} +On the other hand, it can also be constructed explicitly, as the set-quotient of $\lst{H+K}$ by the following relations: +\begin{align*} + (\dots, x_1, x_2, \dots) &= (\dots, x_1\cdot x_2, \dots) + & &\text{for $x_1,x_2:H$}\\ + (\dots, y_1, y_2, \dots) &= (\dots, y_1\cdot y_2, \dots) + & &\text{for $y_1,y_2:K$}\\ + (\dots, 1_G, \dots) &= (\dots, \dots) && \\ + (\dots, 1_H, \dots) &= (\dots, \dots) && \\ + (\dots, f(x), \dots) &= (\dots, g(x), \dots) + & &\text{for $x:G$.} +\end{align*} +We leave the proofs to the reader. +In the special case that $G$ is the trivial group, the last relation is unnecessary, and we obtain the \define{free product} +\indexdef{free!product}% +$H*K$, the coproduct in the category of groups. +(This notation unfortunately clashes with that for the \emph{join} of types, as in \cref{sec:colimits}, but context generally disambiguates.) + +\index{presentation!of a group}% +Note that groups defined by \emph{presentations} can be regarded as a special case of colimits. +Suppose given a set (or more generally a type) $A$, and a pair of functions $R\rightrightarrows \freegroup{A}$. +We regard $R$ as the type of ``relations'', with the two functions assigning to each relation the two words that it sets equal. +For instance, in the presentation $\langle a \mid a^2 = e \rangle$ we would have $A\defeq \unit$ and $R\defeq \unit$, with the two morphisms $R\rightrightarrows \freegroup{A}$ picking out the list $(a,a)$ and the empty list $\nil$, respectively. +Then by the universal property of free groups, we obtain a pair of group homomorphisms $\freegroup{R} \rightrightarrows \freegroup{A}$. +Their coequalizer in the category of groups, which can be built just like the pushout, is the group \emph{presented} by this presentation. + +\mentalpause + +Note that all these sorts of construction only apply to \emph{algebraic} theories,\index{theory!algebraic} which are theories whose axioms are (universally quantified) equations referring to variables, constants, and operations from a given signature\index{signature!of an algebraic theory}. +They can be modified to apply also to what are called \emph{essentially algebraic theories}:\index{theory!essentially algebraic} those whose operations are partially defined on a domain specified by equalities between previous operations. +They do not apply, for instance, to the theory of fields, in which the ``inversion'' operation is partially defined on a domain $\setof{x | x \mathrel{\#} 0}$ specified by an \emph{apartness} $\#$ between previous operations, see \cref{RD-inverse-apart-0}. +And indeed, it is well-known that the category of fields has no initial object. +\index{initial!field}% + +On the other hand, these constructions do apply just as well to \emph{infinitary}\index{infinitary!algebraic theory} algebraic theories, whose ``operations'' can take infinitely many inputs. +In such cases, there may not be any presentation of free algebras or colimits of algebras as a simple quotient, unless we assume the axiom of choice. +This means that higher inductive types represent a significant strengthening of constructive type theory (not necessarily in terms of proof-theoretic strength, but in terms of practical power), and indeed are stronger in some ways than Zermelo--Fraenkel\index{set theory!Zermelo--Fraenkel} set theory (without choice)~\cite{blass:freealg}. +% We will see an example of this in \cref{sec:ordinals}. + + +\section{The flattening lemma} +\label{sec:flattening} + +As we will see in \cref{cha:homotopy}, amazing things happen when we combine higher inductive types with univalence. +The principal way this comes about is that if $W$ is a higher inductive type and \UU is a type universe, then we can define a type family $P:W\to \UU$ by using the recursion principle for $W$. +When we come to the clauses of the recursion principle dealing with the path constructors of $W$, we will need to supply paths in \UU, and this is where univalence comes in. + +For example, suppose we have a type $X$ and a self-equivalence $e:\eqv X X$. +Then we can define a type family $P:\Sn^1 \to \UU$ by using $\Sn^1$-recursion: +\begin{equation*} + P(\base) \defeq X + \qquad\text{and}\qquad + \ap P\lloop \defid \ua(e). +\end{equation*} +The type $X$ thus appears as the fiber $P(\base)$ of $P$ over the basepoint. +The self-equivalence $e$ is a little more hidden in $P$, but the following lemma says that it can be extracted by transporting along \lloop. + +\begin{lem}\label{thm:transport-is-given} + Given $B:A\to\type$ and $x,y:A$, with a path $p:x=y$ and an equivalence $e:\eqv{B(x)}{B(y)}$ such that $\ap{B}p = \ua(e)$, then for any $u:B(x)$ we have + \begin{align*} + \transfib{B}{p}{u} &= e(u). + \end{align*} +\end{lem} +\begin{proof} + Applying \cref{thm:transport-is-ap}, we have + \begin{align*} + \transfib{B}{p}{u} &= \idtoeqv(\ap{B}p)(u)\\ + &= \idtoeqv(\ua(e))(u)\\ + &= e(u).\qedhere + \end{align*} +\end{proof} + +We have seen type families defined by recursion before: in \cref{sec:compute-coprod,sec:compute-nat} we used them to characterize the identity types of (ordinary) inductive types. +In \cref{cha:homotopy}, we will use similar ideas to calculate homotopy groups of higher inductive types. + +In this section, we describe a general lemma about type families of this sort which will be useful later on. +We call it the \define{flattening lemma}: +\indexdef{flattening lemma}% +\indexdef{lemma!flattening}% +it says that if $P:W\to\UU$ is defined recursively as above, then its total space $\sm{x:W} P(x)$ is equivalent to a ``flattened'' higher inductive type, whose constructors may be deduced from those of $W$ and the definition of $P$. +(From a category-theoretic point of view, $\sm{x:W} P(x)$ is the ``Grothendieck\index{Grothendieck construction} construction'' of $P$, and the flattening lemma expresses its universal property as a ``lax\index{lax colimit} colimit''. Although because types in homotopy type theory (like $W$) correspond categorically to $\infty$-groupoids (since all paths are invertible), in this case the lax colimit is the same as a pseudo colimit.) + +We prove here one general case of the flattening lemma, which directly implies many particular cases and suggests the method to prove others. +Suppose we have $A,B:\type$ and $f,g:B\to{}A$, and that the higher inductive type $W$ is generated by +\begin{itemize} +\item $\cc:A\to{}W$ and +\item $\pp:\prd{b:B} (\cc(f(b))=_W\cc(g(b)))$. +\end{itemize} +Thus, $W$ is the \define{(homotopy) coequalizer} +\indexdef{coequalizer}% +\indexdef{type!coequalizer}% +of $f$ and $g$. +Using binary sums (coproducts) and dependent sums ($\Sigma$-types), a lot of interesting nonrecursive higher +inductive types can be represented in this form. All point constructors have to +be bundled in the type $A$ and all path constructors in the type $B$. +For instance: +\begin{itemize} +\item The circle $\Sn^1$ can be represented by taking $A\defeq \unit$ and $B\defeq \unit$, with $f$ and $g$ the identity. +\item The pushout of $j:X\to Y$ and $k:X\to Z$ can be represented by taking $A\defeq Y+Z$ and $B\defeq X$, with $f\defeq \inl \circ j$ and $g\defeq \inr\circ k$. +\end{itemize} +Now suppose in addition that +\begin{itemize} +\item $C:A\to\type$ is a family of types over $A$, and +\item $D:\prd{b:B}\eqv{C(f(b))}{C(g(b))}$ is a family of equivalences over $B$. +\end{itemize} +Define a type family $P : W\to\type$ recursively by +\begin{align*} + P(\cc(a)) &\defeq C(a)\\ + \map{P}{\pp(b)} &\defid \ua(D(b)). +\end{align*} +Let \Wtil be the higher inductive type generated by +\begin{itemize} +\item $\cct:\prd{a:A} C(a) \to \Wtil$ and +\item $\ppt:\prd{b:B}{y:C(f(b))} (\cct(f(b),y)=_{\Wtil}\cct(g(b),D(b)(y)))$. +\end{itemize} + +The flattening lemma is: + +\begin{lem}[Flattening lemma]\label{thm:flattening} + In the above situation, we have + \[ \eqvspaced{\Parens{\sm{x:W} P(x)}}{\widetilde{W}}. \] +\end{lem} + +\index{universal!property!of dependent pair type}% +As remarked above, this equivalence can be seen as expressing the universal property of $\sm{x:W} P(x)$ as a ``lax\index{lax colimit} colimit'' of $P$ over $W$. +It can also be seen as part of the \emph{stability and descent} property of colimits, which characterizes higher toposes.% +\index{.infinity1-topos@$(\infty,1)$-topos}% +\index{stability!and descent}% + +The proof of \cref{thm:flattening} occupies the rest of this section. +It is somewhat technical and can be skipped on a first reading. +But it is also a good example of ``proof-relevant mathematics'', +\index{mathematics!proof-relevant}% +so we recommend it on a second reading. + +The idea is to show that $\sm{x:W} P(x)$ has the same universal property as \Wtil. +We begin by showing that it comes with analogues of the constructors $\cct$ and $\ppt$. + +\begin{lem}\label{thm:flattening-cp} + There are functions + \begin{itemize} + \item $\cct':\prd{a:A} C(a) \to \sm{x:W} P(x)$ and + \item $\ppt':\prd{b:B}{y:C(f(b))} \Big(\cct'(f(b),y)=_{\sm{w:W}P(w)}\cct'(g(b),D(b)(y))\Big)$. + \end{itemize} +\end{lem} +\begin{proof} + The first is easy; define $\cct'(a,x) \defeq (\cc(a),x)$ and note that by definition $P(\cc(a))\jdeq C(a)$. + For the second, suppose given $b:B$ and $y:C(f(b))$; we must give an equality + \[ (\cc(f(b)),y) = (\cc(g(b)),D(b)(y)). \] + Since we have $\pp(b):\cc(f(b))=\cc(g(b))$, by equalities in $\Sigma$-types it suffices to give an equality $\trans{\pp(b)}{y} = D(b)(y)$. + But this follows from \cref{thm:transport-is-given}, using the definition of $P$. +\end{proof} + +Now the following lemma says to define a section of a type family over $\sm{w:W} P(w)$, it suffices to give analogous data as in the case of \Wtil. + +\begin{lem}\label{thm:flattening-rect} + Suppose $Q:\big(\sm{x:W} P(x)\big) \to \type$ is a type family and that we have + \begin{itemize} + \item $c : \prd{a:A}{x:C(a)} Q(\cct'(a,x))$ and + \item $p : \prd{b:B}{y:C(f(b))} \Big(\trans{\ppt'(b,y)}{c(f(b),y)} = c(g(b),D(b)(y))\Big)$. %_{Q(\cct'(g(b),D(b)(y)))} + \end{itemize} + Then there exists $k:\prd{z:\sm{w:W} P(w)} Q(z)$ such that $k(\cct'(a,x)) \jdeq c(a,x)$. +\end{lem} +\begin{proof} + Suppose given $w:W$ and $x:P(w)$; we must produce an element $k(w,x):Q(w,x)$. + By induction on $w$, it suffices to consider two cases. + When $w\jdeq \cc(a)$, then we have $x:C(a)$, and so $c(a,x):Q(\cc(a),x)$ as desired. + (This part of the definition also ensures that the stated computational rule holds.) + + Now we must show that this definition is preserved by transporting along $\pp(b)$ for any $b:B$. + Since what we are defining, for all $w:W$, is a function of type $\prd{x:P(w)} Q(w,x)$, by \cref{thm:dpath-forall} it suffices to show that for any $y:C(f(b))$, we have + \[ \transfib{Q}{\pairpath(\pp(b),\refl{\trans{\pp(b)}{y}})}{c(f(b),y)} = c(g(b),\trans{\pp(b)}{y}). \] + Let $q:\trans{\pp(b)}{y} = D(b)(y)$ be the path obtained from \cref{thm:transport-is-given}. + Then we have + \begin{align} + c(g(b),\trans{\pp(b)}{y}) + &= \transfib{x\mapsto Q(\cct'(g(b),x))}{\opp{q}}{c(g(b),D(b)(y))} + \tag{by $\opp{\apdfunc{x\mapsto c(g(b),x)}(\opp q)}$} \\ + &= \transfib{Q}{\apfunc{x\mapsto \cct'(g(b),x)}(\opp q)}{c(g(b),D(b)(y))} + \tag{by \cref{thm:transport-compose}}. + \end{align} + Thus, it suffices to show + \begin{multline*} + \Transfib{Q}{\pairpath(\pp(b),\refl{\trans{\pp(b)}{y}})}{c(f(b),y)} = {}\\ + \Transfib{Q}{\apfunc{x\mapsto \cct'(g(b),x)}(\opp q)}{c(g(b),D(b)(y))}. + \end{multline*} + Moving the right-hand transport to the other side, and combining two transports, this is equivalent to + % + \begin{narrowmultline*} + \Transfib{Q}{\pairpath(\pp(b),\refl{\trans{\pp(b)}{y}}) \ct + \apfunc{x\mapsto \cct'(g(b),x)}(q)}{c(f(b),y)} = + \narrowbreak + c(g(b),D(b)(y)). + \end{narrowmultline*} + % + However, we have + \begin{multline*} + \pairpath(\pp(b),\refl{\trans{\pp(b)}{y}}) \ct \apfunc{x\mapsto \cct'(g(b),x)}(q) + = {} \\ + \pairpath(\pp(b),\refl{\trans{\pp(b)}{y}}) \ct \pairpath(\refl{\cc(g(b))},q) + = \pairpath(\pp(b),q) + = \ppt'(b,y) + \end{multline*} + so the construction is completed by the assumption $p(b,y)$ of type + \[ \transfib{Q}{\ppt'(b,y)}{c(f(b),y)} = c(g(b),D(b)(y)). \qedhere \] +\end{proof} + +\cref{thm:flattening-rect} \emph{almost} gives $\sm{w:W}P(w)$ the same induction principle as \Wtil. +The missing bit is the equality $\apdfunc{k}(\ppt'(b,y)) = p(b,y)$. +In order to prove this, we would need to analyze the proof of \cref{thm:flattening-rect}, which of course is the definition of $k$. + +It should be possible to do this, but it turns out that we only need the computation rule for the non-dependent recursion principle. +Thus, we now give a somewhat simpler direct construction of the recursor, and a proof of its computation rule. + +\begin{lem}\label{thm:flattening-rectnd} + Suppose $Q$ is a type and that we have + \begin{itemize} + \item $c : \prd{a:A} C(a) \to Q$ and + \item $p : \prd{b:B}{y:C(f(b))} \Big(c(f(b),y) =_Q c(g(b),D(b)(y))\Big)$. + \end{itemize} + Then there exists $k:\big(\sm{w:W} P(w)\big) \to Q$ such that $k(\cct'(a,x)) \jdeq c(a,x)$. +\end{lem} +\begin{proof} + As in \cref{thm:flattening-rect}, we define $k(w,x)$ by induction on $w:W$. + When $w\jdeq \cc(a)$, we define $k(\cc(a),x)\defeq c(a,x)$. + Now by \cref{thm:dpath-arrow}, it suffices to consider, for $b:B$ and $y:C(f(b))$, the composite path + \begin{equation}\label{eq:flattening-rectnd} + \transfib{x\mapsto Q}{\pp(b)}{c(f(b),y)} + = c(g(b),\transfib{P}{\pp(b)}{y}) + \end{equation} + % + defined as the composition + % + \begin{align} + \transfib{x\mapsto Q}{\pp(b)}{c(f(b),y)} + &= c(f(b),y) \tag{by \cref{thm:trans-trivial}}\\ + &= c(g(b),D(b)(y)) \tag{by $p(b,y)$}\\ + &= c(g(b),\transfib{P}{\pp(b)}{y}). \tag{by \cref{thm:transport-is-given}} + \end{align} + The computation rule $k(\cct'(a,x)) \jdeq c(a,x)$ follows by definition, as before. +\end{proof} + +For the second computation rule, we need the following lemma. + +\begin{lem}\label{thm:ap-sigma-rect-path-pair} + Let $Y:X\to\type$ be a type family and let $k:(\sm{x:X}Y(x)) \to Z$ be defined componentwise by $k(x,y) \defeq d(x)(y)$ for a curried function $d:\prd{x:X} Y(x)\to Z$. + Then for any $s:\id[X]{x_1}{x_2}$ and any $y_1:Y(x_1)$ and $y_2:Y(x_2)$ with a path $r:\trans{s}{y_1}=y_2$, the path + \[\apfunc k (\pairpath(s,r)) :k(x_1,y_1) = k(x_2,y_2)\] + is equal to the composite + \begin{align} + k(x_1,y_1) + &\jdeq d(x_1)(y_1) \notag\\ + &= \transfib{x\mapsto Z}{s}{d(x_1)(y_1)} + \tag{by $\opp{\text{(\cref{thm:trans-trivial})}}$}\\ + &= \transfib{x\mapsto Z}{s}{d(x_1)(\trans{\opp s}{\trans{s}{y_1}})} + \notag\\ + &= \big(\transfib{x\mapsto (Y(x)\to Z)}{s}{d(x_1)}\big)(\trans{s}{y_1}) + \tag{by~\eqref{eq:transport-arrow}}\\ + &= d(x_2)(\trans{s}{y_1}) + \tag{by $\happly(\apdfunc{d}(s))(\trans{s}{y_1}$}\\ + &= d(x_2)(y_2) + \tag{by $\apfunc{d(x_2)}(r)$}\\ + &\jdeq k(x_2,y_2). + \notag + \end{align} +\end{lem} +\begin{proof} + After path induction on $s$ and $r$, both equalities reduce to reflexivities. +\end{proof} + +At first it may seem surprising that \cref{thm:ap-sigma-rect-path-pair} has such a complicated statement, while it can be proven so simply. +The reason for the complication is to ensure that the statement is well-typed: $\apfunc k (\pairpath(s,r))$ and the composite path it is claimed to be equal to must both have the same start and end points. +Once we have managed this, the proof is easy by path induction. + +\begin{lem}\label{thm:flattening-rectnd-beta-ppt} + In the situation of \cref{thm:flattening-rectnd}, we have $\apfunc{k}(\ppt'(b,y)) = p(b,y)$. +\end{lem} +\begin{proof} + Recall that $\ppt'(b,y) \defeq \pairpath(\pp(b),q)$ where $q:\trans{\pp(b)}{y} = D(b)(y)$ comes from \cref{thm:transport-is-given}. + Thus, since $k$ is defined componentwise, we may compute $\apfunc{k}(\ppt'(b,y))$ by \cref{thm:ap-sigma-rect-path-pair}, with + \begin{align*} + x_1 &\defeq \cc(f(b)) & y_1 &\defeq y\\ + x_2 &\defeq \cc(g(b)) & y_2 &\defeq D(b)(y)\\ + s &\defeq \pp(b) & r &\defeq q. + \end{align*} + The curried function $d:\prd{w:W} P(w) \to Q$ was defined by induction on $w:W$; + to apply \cref{thm:ap-sigma-rect-path-pair} we need to understand $\apfunc{d(x_2)}(r)$ and $\happly(\apdfunc{d}(s),\trans s {y_1})$. + + For the first, since $d(\cc(a),x)\jdeq c(a,x)$, we have + \[ \apfunc{d(x_2)}(r) \jdeq \apfunc{c(g(b),-)}(q). \] + For the second, the computation rule for the induction principle of $W$ tells us that $\apdfunc{d}(\pp(b))$ is equal to the composite~\eqref{eq:flattening-rectnd}, passed across the equivalence of \cref{thm:dpath-arrow}. + Thus, the computation rule given in \cref{thm:dpath-arrow} implies that $\happly(\apdfunc{d}(\pp(b)),\trans {\pp(b)}{y})$ is equal to the composite + \begin{align} + \big(\trans{\pp(b)}{c(f(b),-)}\big)(\trans {\pp(b)}{y}) + &= \trans{\pp(b)}{c(f(b),\trans{\opp {\pp(b)}}{\trans {\pp(b)}{y}})} + \tag{by~\eqref{eq:transport-arrow}}\\ + &= \trans{\pp(b)}{c(f(b),y)} + \notag \\ + &= c(f(b),y) + \tag{by \cref{thm:trans-trivial}}\\ + &= c(g(b),D(b)(y)) + \tag{by $p(b,y)$}\\ + &= c(g(b),\trans{\pp(b)}{y}). + \tag{by $\opp{\apfunc{c(g(b),-)}(q)}$} + \end{align} + Finally, substituting these values of $\apfunc{d(x_2)}(r)$ and $\happly(\apdfunc{d}(s),\trans s {y_1})$ into \cref{thm:ap-sigma-rect-path-pair}, we see that all the paths cancel out in pairs, leaving only $p(b,y)$. +\end{proof} + +Now we are finally ready to prove the flattening lemma. + +\begin{proof}[Proof of \cref{thm:flattening}] + We define $h:\Wtil \to \sm{w:W}P(w)$ by using the recursion principle for \Wtil, with $\cct'$ and $\ppt'$ as input data. + Similarly, we define $k:(\sm{w:W}P(w)) \to \Wtil$ by using the recursion principle of \cref{thm:flattening-rectnd}, with $\cct$ and $\ppt$ as input data. + + On the one hand, we must show that for any $z:\Wtil$, we have $k(h(z))=z$. + By induction on $z$, it suffices to consider the two constructors of \Wtil. + But we have + \[k(h(\cct(a,x))) \jdeq k(\cct'(a,x)) \jdeq \cct(a,x)\] + by definition, while similarly + \[\ap k{\ap h{\ppt(b,y)}} = \ap k{\ppt'(b,y)} = \ppt(b,y) \] + using the propositional computation rule for $\Wtil$ and \cref{thm:flattening-rectnd-beta-ppt}. + + On the other hand, we must show that for any $z:\sm{w:W}P(w)$, we have $h(k(z))=z$. + But this is essentially identical, using \cref{thm:flattening-rect} for ``induction on $\sm{w:W}P(w)$'' and the same computation rules. +\end{proof} + +\section{The general syntax of higher inductive definitions} +\label{sec:naturality} + +In \cref{sec:strictly-positive}, we discussed the conditions on a putative ``inductive definition'' which make it acceptable, namely that all inductive occurrences of the type in its constructors are ``strictly positive''.\index{strict!positivity} +In this section, we say something about the additional conditions required for \emph{higher} inductive definitions. +Finding a general syntactic description of valid higher inductive definitions is an area of current research, and all of the solutions proposed to date are somewhat technical in nature; thus we only give a general description and not a precise definition. +Fortunately, the corner cases never seem to arise in practice. + +Like an ordinary inductive definition, a higher inductive definition is specified by a list of \emph{constructors}, each of which is a (dependent) function. +For simplicity, we may require the inputs of each constructor to satisfy the same condition as the inputs for constructors of ordinary inductive types. +In particular, they may contain the type being defined only strictly positively. +Note that this excludes definitions such as the $0$-truncation as presented in \cref{sec:hittruncations}, where the input of a constructor contains not only the inductive type being defined, but its identity type as well. +It may be possible to extend the syntax to allow such definitions; but also, in \cref{sec:truncations} we will give a different construction of the $0$-truncation whose constructors do satisfy the more restrictive condition. + +The only difference between an ordinary inductive definition and a higher one, then, is that the \emph{output} type of a constructor may be, not the type being defined ($W$, say), but some identity type of it, such as $\id[W]uv$, or more generally an iterated identity type such as $\id[({\id[W]uv})]pq$. +Thus, when we give a higher inductive definition, we have to specify not only the inputs of each constructor, but the expressions $u$ and $v$ (or $u$, $v$, $p$, and $q$, etc.)\ which determine the source\index{source!of a path constructor} and target\index{target!of a path constructor} of the path being constructed. + +Importantly, these expressions may refer to \emph{other} constructors of $W$. +For instance, in the definition of $\Sn^1$, the constructor $\lloop$ has both $u$ and $v$ being $\base$, the previous constructor. +To make sense of this, we require the constructors of a higher inductive type to be specified \emph{in order}, and we allow the source and target expressions $u$ and $v$ of each constructor to refer to previous constructors, but not later ones. +(Of course, in practice the constructors of any inductive definition are written down in some order, but for ordinary inductive types that order is irrelevant.) + +Note that this order is not necessarily the order of ``dimension'': in principle, a 1-dimensional path constructor could refer to a 2-dimensional one and hence need to come after it. +However, we have not given the 0-dimensional constructors (point constructors) any way to refer to previous constructors, so they might as well all come first. +And if we use the hub-and-spoke construction (\cref{sec:hubs-spokes}) to reduce all constructors to points and 1-paths, then we might assume that all point constructors come first, followed by all 1-path constructors --- but the order among the 1-path constructors continues to matter. + +The remaining question is, what sort of expressions can $u$ and $v$ be? +We might hope that they could be any expression at all involving the previous constructors. +However, the following example shows that a naive approach to this idea does not work. + +\begin{eg}\label{eg:unnatural-hit} + Consider a family of functions $f:\prd{X:\type} (X\to X)$. + Of course, $f_X$ might be just $\idfunc[X]$ for all $X$, but other such $f$s may also exist. + For instance, nothing prevents $f_{\bool}:\bool\to\bool$ from being the nonidentity automorphism\index{automorphism!of 2, nonidentity@of $\bool$, nonidentity} (see \cref{ex:unnatural-endomorphisms}). + + Now suppose that we attempt to define a higher inductive type $K$ generated by: + \begin{itemize} + \item two elements $a,b:K$, and + \item a path $\sigma:f_K(a)=f_K(b)$. + \end{itemize} + What would the induction principle for $K$ say? + We would assume a type family $P:K\to\type$, and of course we would need $x:P(a)$ and $y:P(b)$. + The remaining datum should be a dependent path in $P$ living over $\sigma$, which must therefore connect some element of $P(f_K(a))$ to some element of $P(f_K(b))$. + But what could these elements possibly be? + We know that $P(a)$ and $P(b)$ are inhabited by $x$ and $y$, respectively, but this tells us nothing about $P(f_K(a))$ and $P(f_K(b))$. +\end{eg} + +Clearly some condition on $u$ and $v$ is required in order for the definition to be sensible. +It seems that, just as the domain of each constructor is required to be (among other things) a \emph{covariant functor}, the appropriate condition on the expressions $u$ and $v$ is that they define \emph{natural transformations}. +Making precise sense of this requirement is beyond the scope of this book, but informally it means that $u$ and $v$ must only involve operations which are preserved by all functions between types. + +For instance, it is permissible for $u$ and $v$ to refer to concatenation of paths, as in the case of the final constructor of the torus in \cref{sec:cell-complexes}, since all functions in type theory preserve path concatenation (up to homotopy). +However, it is not permissible for them to refer to an operation like the function $f$ in \cref{eg:unnatural-hit}, which is not necessarily natural: there might be some function $g:X\to Y$ such that $f_Y \circ g \neq g\circ f_X$. +(Univalence implies that $f_X$ must be natural with respect to all \emph{equivalences}, but not necessarily with respect to functions that are not equivalences.) + +The intuition of naturality supplies only a rough guide for when a higher inductive definition is permissible. +Even if it were possible to give a precise specification of permissible forms of such definitions in this book, such a specification would probably be out of date quickly, as new extensions to the theory are constantly being explored. +For instance, the presentation of $n$-spheres in terms of ``dependent $n$-loops\index{loop!dependent n-@dependent $n$-}'' referred to in \cref{sec:circle}, and the ``higher inductive-recursive definitions'' used in \cref{cha:real-numbers}, were innovations introduced while this book was being written. +We encourage the reader to experiment --- with caution. + + +\sectionNotes + +The general idea of higher inductive types was conceived in discussions between Andrej Bauer, Peter Lumsdaine, Mike Shulman, and Michael Warren at the Oberwolfach meeting in 2011, although there are some suggestions of some special cases in earlier work. Subsequently, Guillaume Brunerie and Dan Licata contributed substantially to the general theory, especially by finding convenient ways to represent them in computer proof assistants +\index{proof!assistant} +and do homotopy theory with them (see \cref{cha:homotopy}). + +A general discussion of the syntax of higher inductive types, and their semantics in higher-categorical models, appears in~\cite{ls:hits}. +As with ordinary inductive types, models of higher inductive types can be constructed by transfinite iterative processes; a slogan is that ordinary inductive types describe \emph{free} monads while higher inductive types describe \emph{presentations} of monads.\index{monad} +The introduction of path constructors also involves the model-category-theoretic equivalence between ``right homotopies'' (defined using path spaces) and ``left homotopies'' (defined using cylinders) --- the fact that this equivalence is generally only up to homotopy provides a semantic reason to prefer propositional computation rules for path constructors. + +Another (temporary) reason for this preference comes from the limitations of existing computer implementations. +Proof assistants\index{proof!assistant} like \Coq and \Agda have ordinary inductive types built in, but not yet higher inductive types. +We can of course introduce them by assuming lots of axioms, but this results in only propositional computation rules. +However, there is a trick due to Dan Licata which implements higher inductive types using private data types; this yields judgmental rules for point constructors but not path constructors. + +The type-theoretic description of higher spheres using loop spaces and suspensions in \cref{sec:circle,sec:suspension} is largely due to Brunerie and Licata; Hou has given a type-theoretic version of the alternative description that uses $n$-dimensional paths\index{path!n-@$n$-}. +The reduction of higher paths to 1-dimensional paths with hubs and spokes (\cref{sec:hubs-spokes}) is due to Lumsdaine and Shulman. +The description of truncation as a higher inductive type is due to Lumsdaine; the $(-1)$-truncation is closely related to the ``bracket types'' of~\cite{ab:bracket-types}. +The flattening lemma was first formulated in generality by Brunerie. + +\index{set-quotient} +Quotient types are unproblematic in extensional type theory, such as \NuPRL~\cite{constable+86nuprl-book}. +They are often added by passing to an extended system of setoids.\index{setoid} +However, quotients are a trickier issue in intensional type theory (the starting point for homotopy type theory), because one cannot simply add new propositional equalities without specifying how they are to behave. Some solutions to this problem have been studied~\cite{hofmann:thesis,Altenkirch1999,altenkirch+07ott}, and several different notions of quotient types have been considered. The construction of set-quotients using higher-inductives provides an argument for our particular approach (which is similar to some that have previously been considered), because it arises as an instance of a general mechanism. Our construction does not yet provide a new solution to all the computational problems related to quotients, since we still lack a good computational understanding of higher inductive types in general --- but it does mean that ongoing work on the computational interpretation of higher inductives applies to the quotients as well. The construction of quotients in terms of equivalence classes is, of +course, a standard set-theoretic idea, and a well-known aspect of elementary topos theory; its use in type theory (which depends on the univalence axiom, at least for mere propositions) was proposed by Voevodsky. The fact that quotient types in intensional type theory imply function extensionality was proved by~\cite{hofmann:thesis}, inspired by the work of~\cite{carboni} on exact completions; \cref{thm:interval-funext} is an adaptation of such arguments. + +\sectionExercises + +\begin{ex}\label{ex:torus} + Define concatenation of dependent paths, prove that application of dependent functions preserves concatenation, and write out the precise induction principle for the torus $T^2$ with its computation rules.\index{torus} +\end{ex} + +\begin{ex}\label{ex:suspS1} + Prove that $\eqv{\susp \Sn^1}{\Sn^2}$, using the explicit definition of $\Sn^2$ in terms of $\base$ and $\surf$ given in \cref{sec:circle}. +\end{ex} + +\begin{ex}\label{ex:torus-s1-times-s1} + Prove that the torus $T^2$ as defined in \cref{sec:cell-complexes} is equivalent to $\Sn^1\times \Sn^1$. + (Warning: the path algebra for this is rather difficult.) +\end{ex} + +\begin{ex}\label{ex:nspheres} + Define dependent $n$-loops\index{loop!dependent n-@dependent $n$-} and the action of dependent functions on $n$-loops, and write down the induction principle for the $n$-spheres as defined at the end of \cref{sec:circle}. +\end{ex} + +\begin{ex}\label{ex:susp-spheres-equiv} + Prove that $\eqv{\susp \Sn^n}{\Sn^{n+1}}$, using the definition of $\Sn^n$ in terms of $\Omega^n$ from \cref{sec:circle}. +\end{ex} + +\begin{ex}\label{ex:spheres-make-U-not-2-type} + Prove that if the type $\Sn^2$ belongs to some universe \type, then \type is not a 2-type. +\end{ex} + +\begin{ex}\label{ex:monoid-eq-prop} + Prove that if $G$ is a monoid and $x:G$, then $\sm{y:G}((x\cdot y = e) \times (y\cdot x =e))$ is a mere proposition. + Conclude, using the principle of unique choice (\cref{cor:UC}), that it would be equivalent to define a group to be a monoid such that for every $x:G$, there merely exists a $y:G$ such that $x\cdot y = e$ and $y\cdot x=e$. +\end{ex} + +\begin{ex}\label{ex:free-monoid} + Prove that if $A$ is a set, then $\lst A$ is a monoid. + Then complete the proof of \cref{thm:free-monoid}.\index{monoid!free} +\end{ex} + +\begin{ex}\label{ex:unnatural-endomorphisms} + Assuming \LEM{}, construct a family $f:\prd{X:\type}(X\to X)$ such that $f_\bool:\bool\to\bool$ is the nonidentity automorphism.\index{automorphism!of 2, nonidentity@of $\bool$, nonidentity} +\end{ex} + +\begin{ex}\label{ex:funext-from-interval} + Show that the map constructed in \cref{thm:interval-funext} is in fact a quasi-inverse to $\happly$, so that an interval type implies the full function extensionality axiom. + (You may have to use \cref{ex:strong-from-weak-funext}.) +\end{ex} + +\begin{ex}\label{ex:susp-lump} + Prove the universal property of suspension: + \[ \Parens{\susp A \to B} \eqvsym \Parens{\sm{b_n : B} \sm{b_s : B} (A \to (b_n = b_s)) } \] +\end{ex} + +\begin{ex}\label{ex:alt-integers} + Show that $\eqv{\Z}{\N+\unit+\N}$. + Show that if we were to define $\Z$ as $\N+\unit+\N$, then we could obtain \cref{thm:sign-induction} with judgmental computation rules. +\end{ex} + +\begin{ex}\label{ex:trunc-bool-interval} + Show that we can also prove \cref{thm:interval-funext} by using $\brck \bool$ instead of $\interval$. +\end{ex} + +\index{type!higher inductive|)}% + +% Local Variables: +% TeX-master: "hott-online" +% End: diff --git a/hlevels.tex b/hlevels.tex new file mode 100644 index 0000000000000000000000000000000000000000..901dcfa85c7b7ced3f71af1aa939973e536ba715 --- /dev/null +++ b/hlevels.tex @@ -0,0 +1,2139 @@ +\chapter{Homotopy \texorpdfstring{$n$}{n}-types} +\label{cha:hlevels} + +\index{n-type@$n$-type|(}% +\indexsee{h-level}{$n$-type} + +One of the basic notions of homotopy theory is that of a \emph{homotopy $n$-type}: a space containing no interesting homotopy above dimension $n$. +For instance, a homotopy $0$-type is essentially a set, containing no nontrivial paths, while a homotopy $1$-type may contain nontrivial paths, but no nontrivial paths between paths. +Homotopy $n$-types are also called \emph{$n$-truncated spaces}. +We have mentioned this notion already in \cref{sec:basics-sets}; our first goal in this chapter is to give it a precise definition in homotopy type theory. + +A dual notion to truncatedness is connectedness: a space is \emph{$n$-connected} if it has no interesting homotopy in dimensions $n$ and \emph{below}. +For instance, a space is $0$-connected (also called just ``connected'') if it has only one connected component, and $1$-connected (also called ``simply connected'') if it also has no nontrivial loops (though it may have nontrivial higher loops between loops\index{loop!n-@$n$-}). + +The duality between truncatedness and connectedness is most easily seen by extending both notions to maps. +We call a map \emph{$n$-truncated} or \emph{$n$-connected} if all its fibers are so. +Then $n$-connected and $n$-truncated maps form the two classes of maps in an \emph{orthogonal factorization system}, +\index{orthogonal factorization system} +\indexsee{factorization!system, orthogonal}{orthogonal factorization system} +i.e.\ every map factors uniquely as an $n$-connected map followed by an $n$-truncated one. + +In the case $n={-1}$, the $n$-truncated maps are the embeddings and the $n$-connected maps are the surjections, as defined in \cref{sec:mono-surj}. +Thus, the $n$-connected factorization system is a massive generalization of the standard image factorization of a function between sets into a surjection followed by an injection. +At the end of this chapter, we sketch briefly an even more general theory: any type-theoretic \emph{modality} gives rise to an analogous factorization system. + + +\section{Definition of \texorpdfstring{$n$}{n}-types} +\label{sec:n-types} + +As mentioned in \cref{sec:basics-sets,sec:contractibility}, it turns out to be convenient to define $n$-types starting two levels below zero, with the $(-1)$-types being the mere propositions and the $(-2)$-types the contractible ones. + +\begin{defn}\label{def:hlevel} + Define the predicate $\istype{n} : \type \to \type$ for $n \geq -2$ by recursion as follows: + \[ \istype{n}(X) \defeq + \begin{cases} + \iscontr(X) & \text{ if } n = -2, \\ + \prd{x,y : X} \istype{n'}(\id[X]{x}{y}) & \text{ if } n = n'+1. + \end{cases} + \] + We say that $X$ is an \define{$n$-type}, or sometimes that it is \emph{$n$-truncated}, + \indexdef{n-type@$n$-type}% + \indexsee{n-truncated@$n$-truncated!type}{$n$-type}% + \indexsee{type!n-type@$n$-type}{$n$-type}% + \indexsee{type!n-truncated@$n$-truncated}{$n$-type}% + if $\istype{n}(X)$ is inhabited. +\end{defn} + +\begin{rmk} + The number $n$ in \cref{def:hlevel} ranges over all integers greater than or equal to $-2$. + We could make sense of this formally by defining a type $\Z_{{\geq}-2}$ of such integers (a type whose induction principle is identical to that of $\nat$), or instead defining a predicate $\istype{(k-2)}$ for $k : \nat$. + Either way, we can prove theorems about $n$-types by induction on $n$, with $n = -2$ as the base case. +\end{rmk} + +\begin{eg} + \index{set} + We saw in \cref{thm:prop-minusonetype} that $X$ is a $(-1)$-type if and only if it is a mere proposition. + Therefore, $X$ is a $0$-type if and only if it is a set. +\end{eg} + +We have also seen that there are types which are not sets (\cref{thm:type-is-not-a-set}). +So far, however, we have not shown for any $n>0$ that there exist types which are not $n$-types. +In \cref{cha:homotopy}, however, we will show that the $(n+1)$-sphere $\Sn^{n+1}$ is not an $n$-type. +(Kraus has also shown that the $n^{\mathrm{th}}$ nested univalent universe is also not an $n$-type, without using any higher inductive types.) +Moreover, in \cref{sec:whitehead} will give an example of a type that is not an $n$-type for \emph{any} (finite) number $n$. + +We begin the general theory of $n$-types by showing they are closed under certain operations and constructors. + +\begin{thm}\label{thm:h-level-retracts} + \index{retract!of a type}% + \index{retraction}% + Let $p : X \to Y$ be a retraction and suppose that $X$ is an $n$-type, for any $n\geq -2$. + Then $Y$ is also an $n$-type. +\end{thm} + +\begin{proof} + We proceed by induction on $n$. + The base case $n=-2$ is handled by \cref{thm:retract-contr}. + + For the inductive step, assume that any retract of an $n$-type is an $n$-type, and that $X$ is an $\nplusone$-type. + Let $y, y' : Y$; we must show that $\id{y}{y'}$ is an $n$-type. + Let $s$ be a section of $p$, and let $\epsilon$ be a homotopy $\epsilon : p \circ s \htpy 1$. + Since $X$ is an $\nplusone$-type, $\id[X]{s(y)}{s(y')}$ is an $n$-type. + We claim that $\id{y}{y'}$ is a retract of $\id[X]{s(y)}{s(y')}$. + For the section, we take + \[ \apfunc s : (y=y') \to (s(y)=s(y')). \] + For the retraction, we define $t:(s(y)=s(y'))\to(y=y')$ by + \[ t(q) \defeq \opp{\epsilon_y} \ct \ap p q \ct \epsilon_{y'}.\] + To show that $t$ is a retraction of $\apfunc s$, we must show that + \[ \opp{\epsilon_y} \ct \ap p {\ap sr} \ct \epsilon_{y'} = r \] + for any $r:y=y'$. + But this follows from \cref{lem:htpy-natural}. +\end{proof} + +As an immediate corollary we obtain the stability of $n$-types under equivalence (which is also immediate from univalence): + +\begin{cor}\label{cor:preservation-hlevels-weq} + If $\eqv{X}{Y}$ and $X$ is an $n$-type, then so is $Y$. +\end{cor} + +Recall also the notion of embedding from \cref{sec:mono-surj}. + +\begin{thm}\label{thm:isntype-mono} + \index{function!embedding} + If $f:X\to Y$ is an embedding and $Y$ is an $n$-type for some $n\ge -1$, then so is $X$. +\end{thm} +\begin{proof} + Let $x,x':X$; we must show that $\id[X]{x}{x'}$ is an $\nminusone$-type. + But since $f$ is an embedding, we have $(\id[X]{x}{x'}) \eqvsym (\id[Y]{f(x)}{f(x')})$, and the latter is an $\nminusone$-type by assumption. +\end{proof} + +Note that this theorem fails when $n=-2$: the map $\emptyt \to \unit$ is an embedding, but $\unit$ is a $(-2)$-type while $\emptyt$ is not. + +\begin{thm}\label{thm:hlevel-cumulative} + The hierarchy of $n$-types is cumulative in the following sense: + given a number $n \geq -2$, if $X$ is an $n$-type, then it is also an $\nplusone$-type. +\end{thm} + +\begin{proof} + We proceed by induction on $n$. + + For $n = -2$, we need to show that a contractible type, say, $A$, has contractible path spaces. + Let $a_0: A$ be the center of contraction of $A$, and let $x, y : A$. We show that $\id[A]{x}{y}$ + is contractible. + By contractibility of $A$ we have a path $\contr_x \ct \opp{\contr_y} : x = y$, which we choose as + the center of contraction for $\id{x}{y}$. + Given any $p : x = y$, we need to show $p = \contr_x \ct \opp{\contr_y}$. + By path induction, it suffices to show that + $\refl{x} = \contr_x \ct \opp{\contr_x}$, which is trivial. + + For the inductive step, we need to show that $\id[X]{x}{y}$ is an $\nplusone$-type, provided + that $X$ is an $\nplusone$-type. Applying the inductive hypothesis to $\id[X]{x}{y}$ + yields the desired result. +\end{proof} + +% \section{Preservation under constructors} +% \label{sec:ntype-pres} + +We now show that $n$-types are preserved by most of the type forming operations. + +\begin{thm}\label{thm:ntypes-sigma} + Let $n \geq -2$, and let $A : \type$ and $B : A \to \type$. + If $A$ is an $n$-type and for all $a : A$, $B(a)$ is an $n$-type, then so is $\sm{x : A} B(x)$. +\end{thm} + +\begin{proof} + We proceed by induction on $n$. + + For $n = -2$, we choose the center of contraction for $\sm{x : A} B(x)$ to be the pair + $(a_0, b_0)$, where $a_0 : A$ is the center of contraction of $A$ and $b_0 : B(a_0)$ is the center of contraction of $B(a_0)$. + Given any other element $(a,b)$ of $\sm{x : A} B(x)$, we provide a path $\id{(a, b)}{(a_0,b_0)}$ + by contractibility of $A$ and $B(a_0)$, respectively. + + For the inductive step, suppose that $A$ is an $\nplusone$-type and + for any $a : A$, $B(a)$ is an $\nplusone$-type. We show that $\sm{x : A} B(x)$ is an $\nplusone$-type: + fix $(a_1, b_1)$ and $(a_2,b_2)$ in $\sm{x : A} B(x)$, + we show that $\id{(a_1, b_1)}{(a_2,b_2)}$ is an $n$-type. + By \cref{thm:path-sigma} we have + \[ \eqvspaced{(\id{(a_1, b_1)}{(a_2,b_2)})}{\sm{p : \id{a_1}{a_2}} (\id[B(a_2)]{\trans{p}{b_1}}{b_2})} \] + and by preservation of $n$-types under equivalences (\cref{cor:preservation-hlevels-weq}) + it suffices to prove that the latter is an $n$-type. This follows from the + inductive hypothesis. +\end{proof} + +As a special case, if $A$ and $B$ are $n$-types, so is $A\times B$. +Note also that \cref{thm:hlevel-cumulative} implies that if $A$ is an $n$-type, then so is $\id[A]xy$ for any $x,y:A$. +Combining this with \cref{thm:ntypes-sigma}, we see that for any functions $f:A\to C$ and $g:B\to C$ between $n$-types, their pullback\index{pullback} +\[ A\times_C B \defeq \sm{x:A}{y:B} (f(x)=g(y)) \] +(see \cref{ex:pullback}) is also an $n$-type. +More generally, $n$-types are closed under all \emph{limits}. + +\begin{thm}\label{thm:hlevel-prod} + Let $n\geq -2$, and let $A : \type$ and $B : A \to \type$. + If for all $a : A$, $B(a)$ is an $n$-type, then so is $\prd{x : A} B(x)$. +\end{thm} + +\begin{proof} + We proceed by induction on $n$. + For $n = -2$, the result is simply \cref{thm:contr-forall}. + + For the inductive step, assume the result is true for $n$-types, and that each $B(a)$ is an $\nplusone$-type. + Let $f, g : \prd{a:A}B(a)$. + We need to show that $\id{f}{g}$ is an $n$-type. + By function extensionality and closure of $n$-types under equivalence, it suffices to show that $\prd{a : A} (\id[B(a)]{f(a)}{g(a)})$ is an $n$-type. + This follows from the inductive hypothesis. +\end{proof} + +As a special case of the above theorem, the function space $A \to B$ is an $n$-type provided that $B$ is an $n$-type. +We can now generalize our observations in \cref{cha:basics} that $\isset(A)$ and $\isprop(A)$ are mere propositions. + +\begin{thm}\label{thm:isaprop-isofhlevel} + For any $n \geq -2$ and any type $X$, the type $\istype{n}(X)$ is a mere proposition. +\end{thm} +\begin{proof} + We proceed by induction with respect to $n$. + + For the base case, we need to show that for any $X$, the type $\iscontr(X)$ is a mere proposition. + This is \cref{thm:isprop-iscontr}. + +For the inductive step we need to show +\[\prd{X : \type} \isprop (\istype{n}(X)) \to \prd{X : \type} \isprop (\istype{\nplusone}(X)). \] +To show the conclusion of this implication, we need to show that for any type $X$, the type +\[\prd{x, x' : X}\istype{n}(x = x')\] +is a mere proposition. By \cref{thm:isprop-forall} or \cref{thm:hlevel-prod}, it suffices to show that for any $x, x' : X$, the type $\istype{n}(x =_X x')$ is a mere +proposition. +But this follows from the inductive hypothesis applied to the type $(x =_X x')$. +\end{proof} + +Finally, we show that the type of $n$-types is itself an $\nplusone$-type. +We define this to be: +\symlabel{universe-of-ntypes} +\[\ntype{n} \defeq \sm{X : \type} \istype{n}(X). \] +If necessary, we may specify the universe $\UU$ by writing $\ntypeU{n}$. +In particular, we have $\prop \defeq \ntype{(-1)}$ and $\set \defeq \ntype{0}$, as defined in \cref{cha:basics}. +Note that just as for \prop and \set, because $\istype{n}(X)$ is a mere proposition, by \cref{thm:path-subset} for any $(X,p), (X',p'):\ntype{n}$ we have +\begin{align*} + \Big(\id[\ntype{n}]{(X, p)}{(X', p')}\Big) &\eqvsym (\id[\type] X X')\\ + &\eqvsym (\eqv{X}{X'}). +\end{align*} + +\begin{thm}\label{thm:hleveln-of-hlevelSn} + For any $n \geq -2$, the type $\ntype{n}$ is an $\nplusone$-type. +\end{thm} +\begin{proof}%[Proof of \cref{thm:hleveln-of-hlevelSn}] + Let $(X, p), (X', p') : \ntype{n}$; we need to show that $\id{(X, p)}{(X', p')}$ is an $n$-type. + By the above observation, this type is equivalent to $\eqv{X}{X'}$. + Next, we observe that the projection + \[(\eqv{X}{X'}) \to (X \rightarrow X').\] + is an embedding, so that if $n\geq -1$, then by \cref{thm:isntype-mono} it suffices to show that $X \rightarrow X'$ is an $n$-type. + But since $n$-types are preserved under the arrow type, this reduces to an assumption that $X'$ is an $n$-type. + + In the case $n=-2$, this argument shows that $\eqv{X}{X'}$ is a $(-1)$-type --- but it is also inhabited, since any two contractible types +are equivalent to \unit, and hence to each other. + Thus, $\eqv{X}{X'}$ is also a $(-2)$-type. +\end{proof} + +\section{Uniqueness of identity proofs and Hedberg's theorem} +\label{sec:hedberg} + +\index{set|(}% + +In \cref{sec:basics-sets} we defined a type $X$ to be a \emph{set} if for all $x, y : X$ and $p, q : x =_X y$ we have $p = q$. +In conventional type theory, this property goes by the name of \define{uniqueness of identity proofs (UIP)}. +\indexdef{uniqueness!of identity proofs}% +We have seen also that it is equivalent to being a $0$-type in the sense of the previous section. +Here is another equivalent characterization, involving Streicher's ``Axiom K'' \cite{Streicher93}: + +\begin{thm}\label{thm:h-set-uip-K} + A type $X$ is a set if and only if it satisfies \define{Axiom K}: + \indexdef{axiom!Streicher's Axiom K}% + for all $x : X$ and $p : (x =_A x)$ we have $p = \refl{x}$. +\end{thm} + +\begin{proof} + Clearly Axiom K is a special case of UIP. + Conversely, if $X$ satisfies Axiom K, let $x, y : X$ and $p, q : (\id{x}{y})$; we want to show $p=q$. + But induction on $q$ reduces this goal precisely to Axiom K. +\end{proof} + +We stress that \emph{we} are not assuming UIP or the K principle as axioms! +They are simply properties which a particular type may or may not satisfy (which are equivalent to being a set). +Recall from \cref{thm:type-is-not-a-set} that \emph{not} all types are sets. + +The following theorem is another useful way to show that types are sets. + +\begin{thm}\label{thm:h-set-refrel-in-paths-sets} + \index{relation!reflexive}% + Suppose $R$ is a reflexive\index{reflexivity!of a relation} mere relation on a type $X$ implying identity. + Then $X$ is a set, and $R(x,y)$ is equivalent to $\id[X]{x}{y}$ for all $x,y:X$. +\end{thm} + +\begin{proof} + Let $\rho : \prd{x:X} R(x,x)$ witness reflexivity of $R$, and let \narrowequation{f : \prd{x,y:X} R(x,y) \to (\id[X]{x}{y})} be a witness that $R$ +implies identity. + Note first that the two statements in the theorem are equivalent. + For on one hand, if $X$ is a set, then $\id[X]xy$ is a mere proposition, and since it is logically equivalent to the mere proposition +$R(x,y)$ by hypothesis, it must also be equivalent to it. + On the other hand, if $\id[X]xy$ is equivalent to $R(x,y)$, then like the latter it is a mere proposition for all $x,y:X$, and hence $X$ +is a set. + + We give two proofs of this theorem. + The first shows directly that $X$ is a set; the second shows directly that $R(x,y)\eqvsym (x=y)$. + + \emph{First proof:} we show that $X$ is a set. + The idea is the same as that of \cref{thm:prop-set}: the function $f$ must be continuous in its arguments $x$ and $y$. + However, it is slightly more notationally complicated because we have to deal with the additional argument of type $R(x,y)$. + + Firstly, for any $x:X$ and $p:\id[X]xx$, consider $\apdfunc{f(x)}(p)$. + This is a dependent path from $f(x,x)$ to itself. + Since $f(x,x)$ is still a function $R(x,x) \to (\id[X]xx)$, by \cref{thm:dpath-arrow} this yields for any $r:R(x,x)$ a path + \[\trans{p}{f(x,x,r)} = f(x,x,\trans{p}r). + \] + On the left-hand side, we have transport in an identity type, which is concatenation. + And on the right-hand side, we have $\trans{p}r = r$, since both lie in the mere proposition $R(x,x)$. + Thus, substituting $r\defeq \rho(x)$, we obtain + \[ f(x,x,\rho(x)) \ct p = f(x,x,\rho(x)). \] + By cancellation, $p=\refl{x}$. + So $X$ satisfies Axiom K, and hence is a set. + + \emph{Second proof:} we show that each $f(x,y) : R(x,y) \to \id[X]{x}{y}$ is an equivalence. + By \cref{thm:total-fiber-equiv}, it suffices to show that $f$ induces an equivalence of total spaces: + \begin{equation*} + \eqv{\Parens{\sm{y:X}R(x,y)}}{\Parens{\sm{y:X}\id[X]{x}{y}}}. + \end{equation*} + By \cref{thm:contr-paths}, the type on the right is contractible, so it + suffices to show that the type on the left is contractible. As the center of + contraction we take the pair $\pairr{x,\rho(x)}$. It remains to show, for + every ${y:X}$ and every ${H:R(x,y)}$ that + \begin{equation*} + \id{\pairr{x,\rho(x)}}{\pairr{y,H}}. + \end{equation*} + But since $R(x,y)$ is a mere proposition, by \cref{thm:path-sigma} it suffices to show that + $\id[X]{x}{y}$, which we get from $f(H)$. +\end{proof} + +\begin{cor}\label{notnotstable-equality-to-set} + If a type $X$ has the property that $\neg\neg(x=y)\to(x=y)$ for any $x,y:X$, then $X$ is a set. +\end{cor} + +Another convenient way to show that a type is a set is the following. +Recall from \cref{sec:intuitionism} that a type $X$ is said to have \emph{decidable equality} +\index{decidable!equality|(}% +if for all $x, y : X$ we have +\[(x =_X y) + \neg (x =_X y).\] +\index{continuity of functions in type theory@``continuity'' of functions in type theory}% +\index{functoriality of functions in type theory@``functoriality'' of functions in type theory}% +This is a very strong condition: it says that a path $x=y$ can be chosen, when it exists, continuously (or computably, or functorially) in $x$ and $y$. +This turns out to imply that $X$ is a set, by way of \cref{thm:h-set-refrel-in-paths-sets} and the following lemma. + +\begin{lem}\label{lem:hedberg-helper} +For any type $A$ we have $(A+\neg A)\to(\neg\neg A\to A)$. +\end{lem} + +\begin{proof} +This was essentially already proven in \cref{thm:not-lem}, but we repeat the argument. +Suppose $x:A+\neg A$. We have two cases to consider. +If $x$ is $\inl(a)$ for some $a:A$, then we have the constant function $\neg\neg A +\to A$ which maps everything to $a$. If $x$ is $\inr(t)$ for some $t:\neg A$, +we have $g(t):\emptyt$ for every $g:\neg\neg A$. Hence we may use +\emph{ex falso quodlibet}, that is $\rec{\emptyt}$, to obtain an element of $A$ for any $g:\neg\neg A$. +\end{proof} + +\index{anger} +\begin{thm}[Hedberg]\label{thm:hedberg} + \index{Hedberg's theorem}% + \index{theorem!Hedberg's}% + If $X$ has decidable equality, then $X$ is a set. +\end{thm} + +\begin{proof} +If $X$ has decidable equality, it follows that $\neg\neg(x=y)\to(x=y)$ for any +$x,y:X$. Therefore, Hedberg's theorem follows from +\cref{notnotstable-equality-to-set}. +\end{proof} + +There is, of course, a strong connection between this theorem and \cref{thm:not-lem}. +The statement \LEM{\infty} that is denied by \cref{thm:not-lem} clearly implies that every type has decidable equality, and hence is a set, which we know is not the case. +\index{excluded middle}% +Note that the consistent axiom \LEM{} from \cref{sec:intuitionism} implies only that every type has \emph{merely decidable equality}, i.e.\ that for any $A$ we have +\indexdef{equality!merely decidable}% +\indexdef{merely!decidable equality}% +\[ \prd{a,b:A} (\brck{a=b} + \neg\brck{a=b}). \] + +\index{decidable!equality|)}% + +As an example application of \cref{thm:hedberg}, recall that in \cref{thm:nat-set} we observed that $\nat$ is a set, using our characterization of its equality types in +\cref{sec:compute-nat}. +A more traditional proof of this theorem uses only~\eqref{eq:zero-not-succ} and~\eqref{eq:suc-injective}, rather than the full +characterization of \cref{thm:path-nat}, with \cref{thm:hedberg} to fill in the blanks. + +\begin{thm}\label{prop:nat-is-set} + The type $\nat$ of natural numbers has decidable equality, and hence is a set. +\end{thm} + +\begin{proof} + Let $x, y : \nat$ be given; we proceed by induction on $x$ and case analysis on $y$ to prove $(x=y)+\neg(x=y)$. + If $x \jdeq 0$ and $y \jdeq 0$, we take $\inl(\refl0)$. + If $x \jdeq 0$ and $y \jdeq \suc(n)$, then by~\eqref{eq:zero-not-succ} we get $\neg (0 = \suc (n))$. + + For the inductive step, let $x \jdeq \suc (n)$. + If $y \jdeq 0$, we use~\eqref{eq:zero-not-succ} again. + Finally, if $y \jdeq \suc (m)$, the inductive hypothesis gives $(m = n)+\neg(m = n)$. + In the first case, if $p:m=n$, then $\ap \suc p:\suc(m)=\suc(n)$. + And in the second case,~\eqref{eq:suc-injective} yields $\neg(\suc(m)=\suc(n))$. +\end{proof} + +\index{set|)}% + +\index{axiom!Streicher's Axiom K!generalization to n-types@generalization to $n$-types}% +Although Hedberg's theorem appears rather special to sets ($0$-types), ``Axiom K'' generalizes naturally to $n$-types. +Note that the ordinary Axiom K (as a property of a type $X$) states that for all $x:X$, the loop space\index{loop space} $\Omega(X,x)$ (see \cref{def:loopspace}) is contractible. +Since $\Omega(X,x)$ is always inhabited (by $\refl{x}$), this is equivalent to its being a mere proposition (a $(-1)$-type). +Since $0 = (-1)+1$, this suggests the following generalization. + +\begin{thm}\label{thm:hlevel-loops} + For any $n\geq -1$, a type $X$ is an $\nplusone$-type if and only if for all $x : X$, the type $\Omega(X, x)$ is an $n$-type. +\end{thm} + +Before proving this, we prove an auxiliary lemma: + +\begin{lem}\label{lem:hlevel-if-inhab-hlevel} + Given $n \geq -1$ and $X : \type$. + If, given any inhabitant of $X$ it follows that $X$ is an $n$-type, then $X$ is an $n$-type. +\end{lem} +\begin{proof} + Let $f : X \to \istype{n}(X)$ be the given map. + We need to show that for any $x, x' : X$, the type $\id{x}{x'}$ is an $\nminusone$-type. + But then $f(x)$ shows that $X$ is an $n$-type, hence all its path spaces are $\nminusone$-types. +\end{proof} + +\begin{proof}[Proof of \cref{thm:hlevel-loops}] + The ``only if'' direction is obvious, since $\Omega(X,x)\defeq (\id[X]xx)$. + Conversely, in order to show that $X$ is an $\nplusone$-type, we need to show that for any $x, x' : X$, the type $\id{x}{x'}$ is an +$n$-type. + Following \cref{lem:hlevel-if-inhab-hlevel} it suffices to give a map + \[ (\id{x}{x'}) \to \istype{n}(\id{x}{x'}). \] + By path induction, it suffices to do this when $x\jdeq x'$, in which case it follows from the assumption that $\Omega(X, x)$ is an +$n$-type. +\end{proof} + +\index{whiskering} +By induction and some slightly clever whiskering, we can obtain a generalization of the K property to $n>0$. + +\begin{thm}\label{thm:ntype-nloop} + \index{loop space!iterated}% + For every $n\ge -1$, a type $A$ is an $n$-type if and only if $\Omega^{n+1}(A,a)$ is contractible for all $a:A$. +\end{thm} +\begin{proof} + Recalling that $\Omega^0(A,a) = (A,a)$, the case $n=-1$ is \cref{ex:prop-inhabcontr}. + The case $n=0$ is \cref{thm:h-set-uip-K}. + Now we use induction; suppose the statement holds for $n:\N$. + By \cref{thm:hlevel-loops}, $A$ is an $(n+1)$-type iff $\Omega(A,a)$ is an $n$-type for all $a:A$. + By the inductive hypothesis, the latter is equivalent to saying that $\Omega^{n+1}(\Omega(A,a),p)$ is contractible for all $p:\Omega(A,a)$. + + Since $\Omega^{n+2}(A,a) \defeq \Omega^{n+1}(\Omega(A,a),\refl{a})$, and $\Omega^{n+1} = \Omega^n \circ \Omega$, it will suffice to show that $\Omega(\Omega(A,a),p)$ is equal to $\Omega(\Omega(A,a),\refl{a})$, in the type $\pointed\type$ of pointed types. + For this, it suffices to give an equivalence + \[ g : \Omega(\Omega(A,a),p) \eqvsym \Omega(\Omega(A,a),\refl{a}) \] + which carries the basepoint $\refl{p}$ to the basepoint $\refl{\refl{a}}$. + For $q:p=p$, define $g(q):\refl{a} = \refl{a}$ to be the following composite: + \[ \refl{a} = p\ct \opp p \overset{q}{=} p\ct\opp p = \refl{a}, \] + where the path labeled ``$q$'' is actually $\apfunc{\lam{r} r\ct\opp p} (q)$. + Then $g$ is an equivalence because it is a composite of equivalences + \[ (p=p) \xrightarrow{\apfunc{\lam{r} r\ct\opp p}} (p\ct \opp p = p\ct \opp p) \xrightarrow{i\ct - \ct \opp i} (\refl{a} = \refl{a}). \] + using \cref{eg:concatequiv,thm:paths-respects-equiv}, where $i:\refl{a} = p\ct \opp p$ is the canonical equality. + And it is evident that $g(\refl{p}) = \refl{\refl{a}}$. +\end{proof} + +\section{Truncations} +\label{sec:truncations} + +\indexsee{n-truncation@$n$-truncation}{truncation}% +\index{truncation!n-truncation@$n$-truncation|(defstyle}% + +In \cref{subsec:prop-trunc} we introduced the propositional truncation, which makes the ``best approximation'' of a type that is a mere +proposition, i.e.\ a $(-1)$-type. +In \cref{sec:hittruncations} we constructed this truncation as a higher inductive type, and gave one way to generalize it to a +0-truncation. +We now explain a better generalization of this, which truncates any type into an $n$-type for any $n\geq -2$; in classical homotopy theory this would be called its \define{$n^{\mathrm{th}}$ Postnikov section}.\index{Postnikov tower} + +The idea is to make use of \cref{thm:ntype-nloop}, which states that $A$ is an $n$-type just when $\Omega^{n+1}(A,a)$ +\index{loop space!iterated}% +is contractible for +all $a:A$, and \cref{lem:susp-loop-adj}, which implies that +\narrowequation{\Omega^{n+1}(A,a) \eqvsym \Map_{*}(\Sn^{n+1},(A,a)),} where $\Sn^{n+1}$ is equipp\-ed with some basepoint which we may as well call \base. +However, contractibility of $\Map_*(\Sn^{n+1},(A,a))$ is something that we can ensure directly by giving path constructors. + +\index{hub and spoke}% +We will use the ``hub and spoke'' construction as in \cref{sec:hubs-spokes}. +Thus, for $n\ge -1$, we take $\trunc nA$ to be the higher inductive type generated by: +\begin{itemize} +\item a function $\tprojf n : A \to \trunc n A$, +\item for each $r:\Sn^{n+1} \to \trunc n A$, a \emph{hub} point $h(r):\trunc n A$, and +\item for each $r:\Sn^{n+1} \to \trunc n A$ and each $x:\Sn^{n+1}$, a \emph{spoke} path $s_r(x):r(x) = h(r)$. +\end{itemize} + +\noindent +The existence of these constructors is now enough to show: + +\begin{lem} + $\trunc n A$ is an $n$-type. +\end{lem} +\begin{proof} + By \cref{thm:ntype-nloop}, it suffices to show that $\Omega ^{n+1}(\trunc nA,b)$ is contractible for all $b:\trunc nA$, which by +\cref{lem:susp-loop-adj} is equivalent to \narrowequation{\Map_*(\Sn^{n+1},(\trunc nA,b)).} + As center of contraction for the latter, we choose the function $c_b:\Sn^{n+1} \to \trunc nA$ which is constant at $b$, together with +$\refl b : c_b(\base) = b$. + + Now, an arbitrary element of $\Map_*(\Sn^{n+1},(\trunc nA,b))$ consists of a map $r:\Sn^{n+1} \to \trunc n A$ together with a path +$p:r(\base)=b$. + By function extensionality, to show $r = c_b$ it suffices to give, for each $x:\Sn^{n+1}$, a path $r(x)=c_b(x) \jdeq b$. + We choose this to be the composite $s_r(x) \ct \opp{s_r(\base)} \ct p$, where $s_r(x)$ is the spoke at $x$. + + + Finally, we must show that when transported along this equality $r=c_b$, the path $p$ becomes $\refl b$. + By transport in path types, this means we need + \[\opp{(s_r(\base) \ct \opp{s_r(\base)} \ct p)} \ct p = \refl b.\] + But this is immediate from path operations. +\end{proof} + +(This construction fails for $n=-2$, but in that case we can simply define $\trunc{-2}{A}\defeq \unit$ for all $A$. +From now on we assume $n\ge -1$.) + +\index{induction principle!for truncation}% +To show the desired universal property of the $n$-truncation, we need the induction principle. +We extract this from the constructors in the usual way; it says that given $P:\trunc nA\to\type$ together with +\begin{itemize} +\item For each $a:A$, an element $g(a) : P(\tproj na)$, +\item For each $r:\Sn^{n+1} \to \trunc n A$ and $r':\prd{x:\Sn^{n+1}} P(r(x))$, an element $h'(r,r'):P(h(r))$, +\item For each $r:\Sn^{n+1} \to \trunc n A$ and $r':\prd{x:\Sn^{n+1}} P(r(x))$, and each $x:\Sn^{n+1}$, a dependent path +$\dpath{P}{s_r(x)}{r'(x)}{h'(r,r')}$, +\end{itemize} +there exists a section $f:\prd{x:\trunc n A} P(x)$ with $f(\tproj n a) \jdeq g(a)$ for all $a:A$. +To make this more useful, we reformulate it as follows. + +\begin{thm}\label{thm:truncn-ind} + For any type family $P:\trunc n A \to \type$ such that each $P(x)$ is an $n$-type, and any function $g : \prd{a:A} P(\tproj n a)$, there +exists a section $f:\prd{x:\trunc n A} P(x)$ such that $f(\tproj n a)\defeq g(a)$ for all $a:A$. +\end{thm} +\begin{proof} + It will suffice to construct the second and third data listed above, since $g$ has exactly the type of the first datum. + Given $r:\Sn^{n+1} \to \trunc n A$ and $r':\prd{x:\Sn^{n+1}} P(r(x))$, we have $h(r):\trunc n A$ and $s_r :\prd{x:\Sn^{n+1}} (r(x) = +h(r))$. + Define $t:\Sn^{n+1} \to P(h(r))$ by $t(x) \defeq \trans{s_r(x)}{r'(x)}$. + Then since $P(h(r))$ is $n$-truncated, there exists a point $u:P(h(r))$ and a contraction $v:\prd{x:\Sn^{n+1}} (t(x) = u)$. + Define $h'(r,r') \defeq u$, giving the second datum. + Then (recalling the definition of dependent paths), $v$ has exactly the type required of the third datum. +\end{proof} + +In particular, if $E$ is some $n$-type, we can consider the constant family of types equal to $E$ for every point of $A$. +\symlabel{extend} +\index{recursion principle!for truncation}% +Thus, every map $f:A\to{}E$ can be extended to a map $\extend{f}:\trunc nA\to{}E$ defined by $\extend{f}(\tproj na)\defeq f(a)$; this is the \emph{recursion principle} for $\trunc n A$. + +The induction principle also implies a uniqueness principle for functions of this form. +\index{uniqueness!principle, propositional!for functions on a truncation}% +Namely, if $E$ is an $n$-type and $g,g':\trunc nA\to{}E$ are such +that $g(\tproj na)=g'(\tproj na)$ for every $a:A$, then $g(x)=g'(x)$ for all $x:\trunc nA$, since the type $g(x)=g'(x)$ is an $n$-type. +Thus, $g=g'$. +(In fact, this uniqueness principle holds more generally when $E$ is an $\nplusone$-type.) +This yields the following universal property. + +\begin{lem}[Universal property of truncations]\label{thm:trunc-reflective} + \index{universal!property!of truncation}% + Let $n\ge-2$, $A:\type$ and $B:\typele{n}$. The following map is an + equivalence: + \[\function{(\trunc nA\to{}B)}{(A\to{}B)}{g}{g\circ\tprojf n}\] +\end{lem} + +\begin{proof} + Given that $B$ is $n$-truncated, any $f:A\to{}B$ can be extended to a map $\extend{f}:\trunc nA\to{}B$. + The map $\extend{f}\circ\tprojf n$ is equal to $f$, because for every $a:A$ we have $\extend{f}(\tproj na)=f(a)$ by definition. + And the map $\extend{g\circ\tprojf n}$ is equal to $g$, because they both send $\tproj na$ to $g(\tproj na)$. +\end{proof} + +In categorical language, this says that the $n$-types form a \emph{reflective subcategory} of the category of types. +\index{reflective!subcategory}% +(To state this fully precisely, one ought to use the language of $(\infty,1)$-categories.) +\index{.infinity1-category@$(\infty,1)$-category}% +In particular, this implies that the $n$-truncation is functorial: +given $f:A\to B$, applying the recursion principle to the composite $A\xrightarrow{f} B \to \trunc n B$ yields a map $\trunc n f: \trunc n A \to \trunc n B$. +By definition, we have a homotopy +\begin{equation} + \mathsf{nat}^f_n : \prd{a:A} \trunc n f(\tproj n a) = \tproj n {f(a)},\label{eq:trunc-nat} +\end{equation} +expressing \emph{naturality} of the maps $\tprojf n$. + +Uniqueness implies functoriality laws such as $\trunc n {g\circ f} = \trunc n g \circ \trunc n f$ and $\trunc n{\idfunc[A]} = \idfunc[\trunc n A]$, with attendant coherence laws. +We also have higher functoriality, for instance: + +\begin{lem}\label{thm:trunc-htpy} + Given $f,g:A\to B$ and a homotopy $h:f\htpy g$, there is an induced homotopy $\trunc n h : \trunc n f \htpy \trunc n g$ such that the composite + \begin{equation} + \xymatrix@C=3.6pc{\tproj n{f(a)} \ar@{=}[r]^-{\opp{\mathsf{nat}^f_n(a)}} & + \trunc n f(\tproj n a) \ar@{=}[r]^-{\trunc n h(\tproj na)} & + \trunc n g(\tproj n a) \ar@{=}[r]^-{\mathsf{nat}^g_n(a)} & + \tproj n{g(a)}}\label{eq:trunc-htpy} + \end{equation} + is equal to $\apfunc{\tprojf n}(h(a))$. +\end{lem} +\begin{proof} + First, we indeed have a homotopy with components $\apfunc{\tprojf n}(h(a)) : \tproj n{f(a)} = \tproj n{g(a)}$. + Composing on either sides with the paths $\tproj n{f(a)} = \trunc n f(\tproj n a)$ and $\tproj n{g(a)} = \trunc n g(\tproj n a)$, which arise from the definitions of $\trunc n f$ and $\trunc ng$, we obtain a homotopy $(\trunc n f \circ \tprojf n) \htpy (\trunc n g \circ \tprojf n)$, and hence an equality by function extensionality. + But since $(\blank\circ \tprojf n)$ is an equivalence, there must be a path $\trunc nf = \trunc ng$ inducing it, and the coherence laws for function extensionality imply~\eqref{eq:trunc-htpy}. +\end{proof} + +The following observation about reflective subcategories is also standard. + +\begin{cor} + A type $A$ is an $n$-type if and only if $\tprojf n : A \to \trunc n A$ is an equivalence. +\end{cor} +\begin{proof} + ``If'' follows from closure of $n$-types under equivalence. + On the other hand, if $A$ is an $n$-type, we can define $\ext(\idfunc[A]):\trunc n A\to{}A$. + Then we have $\ext(\idfunc[A])\circ\tprojf n=\idfunc[A]:A\to{}A$ by + definition. In order to prove that + $\tprojf n\circ\ext(\idfunc[A])=\idfunc[\trunc nA]$, we only need to prove + that $\tprojf n\circ\ext(\idfunc[A])\circ\tprojf n= + \idfunc[\trunc nA]\circ\tprojf n$. + This is again true: + \[\raisebox{\depth-\height+1em}{\xymatrix{ + A \ar^-{\tprojf n}[r] \ar_{\idfunc[A]}[rd] & + \trunc nA \ar^>>>{\ext(\idfunc[A])}[d] \ar@/^40pt/^{\idfunc[\trunc nA]}[dd] \\ + & A \ar_{\tprojf n}[d] \\ + & \trunc nA}} + \qedhere\] +\end{proof} + +The category of $n$-types also has some special properties not possessed by all reflective subcategories. +For instance, the reflector $\trunc n-$ preserves finite products. + +\begin{thm}\label{cor:trunc-prod} + For any types $A$ and $B$, the induced map $\trunc n{A\times B} \to \trunc nA \times \trunc nB$ is an equivalence. +\end{thm} +\begin{proof} + It suffices to show that $\trunc nA \times \trunc nB$ has the same universal property as $\trunc n{A\times B}$. + Thus, let $C$ be an $n$-type; we have + \begin{align*} + (\trunc nA \times \trunc nB \to C) + &= (\trunc nA \to (\trunc nB \to C))\\ + &= (\trunc nA \to (B \to C))\\ + &= (A \to (B \to C))\\ + &= (A \times B \to C) + \end{align*} + using the universal properties of $\trunc nB$ and $\trunc nA$, along with the fact that $B\to C$ is an $n$-type since $C$ is. + It is straightforward to verify that this equivalence is given by composing with $\tprojf n \times \tprojf n$, as needed. +\end{proof} + +The following related fact about dependent sums is often useful. + +\begin{thm}\label{thm:trunc-in-truncated-sigma} +Let $P:A\to\type$ be a family of types. Then there is an equivalence +\begin{equation*} +\eqv{\Trunc n{\sm{x:A}\trunc n{P(x)}}}{\Trunc n{\sm{x:A}P(x)}}. +\end{equation*} +\end{thm} + +\begin{proof} +We use the induction principle of $n$-truncation several times to construct +functions +\begin{align*} +\varphi & : \Trunc n{\sm{x:A}\trunc n{P(x)}}\to\Trunc n{\sm{x:A}P(x)}\\ +\psi & : \Trunc n{\sm{x:A}P(x)}\to \Trunc n{\sm{x:A} \trunc n{P(x)}} +\end{align*} +and homotopies $H:\varphi\circ\psi\htpy \idfunc$ and $K:\psi\circ\varphi\htpy +\idfunc$ exhibiting them as quasi-inverses. +We define $\varphi$ by setting $\varphi(\tproj n{\pairr{x,\tproj nu}})\defeq\tproj n{\pairr{x,u}}$. +We define $\psi$ by setting $\psi(\tproj n{\pairr{x,u}})\defeq\tproj n{\pairr{x,\tproj nu}}$. +Then we define $H(\tproj n{\pairr{x,u}})\defeq \refl{\tproj n{\pairr{x,u}}}$ and +$K(\tproj n{\pairr{x,\tproj nu}})\defeq \refl{\tproj n{\pairr{x,\tproj nu}}}$. +\end{proof} + +\begin{cor}\label{thm:refl-over-ntype-base} + If $A$ is an $n$-type and $P:A\to\type$ is any type family, then + \[ \eqv{\sm{a:A} \trunc n{P(a)}}{\Trunc n{\sm{a:A}P(a)}} \] +\end{cor} +\begin{proof} + If $A$ is an $n$-type, then the left-hand type above is already an $n$-type, hence equivalent to its $n$-truncation; thus this follows from \cref{thm:trunc-in-truncated-sigma}. +\end{proof} + +We can characterize the path spaces of a truncation using the same method that we used in \cref{sec:compute-coprod,sec:compute-nat} for +coproducts and natural numbers (and which we will use in \cref{cha:homotopy} to calculate homotopy groups). +Unsurprisingly, the path spaces in the $(n+1)$-truncation of $A$ are the $n$-truncations of the path spaces of $A$. +Indeed, for any $x,y:A$ there is a canonical map +\begin{equation} + f:\ttrunc n{x=_Ay}\to \Big(\tproj {n+1}x=_{\trunc{n+1}A}\tproj {n+1}y\Big)\label{eq:path-trunc-map} +\end{equation} +defined by +\[f(\tproj n{p})\defeq \apfunc{\tprojf {n+1}}(p). \] +This definition uses the recursion principle for $\truncf n$, which is correct because $\trunc {n+1}A$ is $(n+1)$-truncated, so that the +codomain of $f$ is $n$-truncated. + +\begin{thm} \label{thm:path-truncation} + For any $A$ and $x,y:A$ and $n\ge -2$, the map~\eqref{eq:path-trunc-map} is an equivalence; thus we have + \[ \eqv{\ttrunc n{x=_Ay}}{\Big(\tproj {n+1}x=_{\trunc{n+1}A}\tproj {n+1}y\Big)}. \] +\end{thm} + +\begin{proof} + The proof is a simple application of the encode-decode method: + As in previous situations, we cannot directly define a quasi-inverse to the map~\eqref{eq:path-trunc-map} because there is no way to induct on an +equality between $\tproj {n+1}x$ and $\tproj {n+1}y$. + Thus, instead we generalize its type, in order to have general elements of the type $\trunc{n+1}A$ instead of $\tproj {n+1}x$ and $\tproj +{n+1}y$. + Define $P:\trunc {n+1}A\to\trunc {n+1}A\to\typele{n}$ by + \[P(\tproj {n+1}x,\tproj {n+1}y)\defeq \trunc n{x=_Ay}\] + This definition is correct because $\trunc n{x=_Ay}$ is $n$-truncated, and $\typele{n}$ is $(n+1)$-truncated by +\cref{thm:hleveln-of-hlevelSn}. + Now for every $u,v:\trunc{n+1}A$, there is a map + \[\decode:P(u,v) \to \big(u=_{\trunc{n+1}A}v\big)\] + defined for $u=\tproj {n+1}x$ and $v=\tproj {n+1}y$ and $p:x=y$ by + \[\decode(\tproj n{p})\defeq \apfunc{\tprojf{n+1}} (p).\] + Since the codomain of $\decode$ is $n$-truncated, it suffices to define it only for $u$ and $v$ of this form, and then it's just the same +definition as before. + We also define a function + \[ r : \prd{u:\trunc{n+1} A} P(u,u) \] + by induction on $u$, where $r(\tproj{n+1} x) \defeq \tproj n {\refl x}$. + + Now we can define an inverse map + \[\encode: (u=_{\trunc{n+1}A}v) \to P(u,v)\] + by + \[\encode(p) \defeq \transfib{v\mapsto P(u,v)}{p}{r(u)}. \] + To show that the composite + \[ (u=_{\trunc{n+1}A}v) \xrightarrow{\encode} P(u,v) \xrightarrow{\decode} (u=_{\trunc{n+1}A}v) \] + is the identity function, by path induction it suffices to check it for $\refl u : u=u$, in which case what we need to know is that +$\decode(r(u)) = \refl{u}$. + But since this is an $(n-1)$-type, hence also an $(n+1)$-type, we may assume $u\jdeq \tproj {n+1} x$, in which case it follows by definition +of $r$ and $\decode$. + Finally, to show that + \[ P(u,v) \xrightarrow{\decode} (u=_{\trunc{n+1}A}v) \xrightarrow{\encode} P(u,v) \] + is the identity function, since this goal is again an $(n-1)$-type, we may assume that $u=\tproj {n+1}x$ and $v=\tproj {n+1}y$ and that we are +considering $\tproj n p:P(\tproj{n+1}x,\tproj{n+1}y)$ for some $p:x=y$. + Then we have + \begin{align*} + \encode(\decode(\tproj n p)) &= \encode(\apfunc{\tprojf{n+1}}(p))\\ + &= \transfib{v\mapsto P(\tproj{n+1}x,v)}{\apfunc{\tprojf{n+1}}(p)}{\tproj n {\refl x}}\\ + &= \transfib{y\mapsto \trunc n{x=y}}{p}{\tproj n {\refl x}}\\ + &= \tproj n {\transfib{y \mapsto (x=y)}{p}{\refl x}}\\ + &= \tproj n p, + \end{align*} + using \cref{thm:transport-compose,thm:ap-transport}. + (Alternatively, we could do path induction on $p$; the desired equality would then hold judgmentally.) + This completes the proof that \decode and \encode are quasi-inverses. + The stated result is then the special case where $u=\tproj {n+1}x$ and $v=\tproj {n+1}y$. +\end{proof} + +\begin{cor} + Let $n\ge-2$ and $(A,a)$ be a pointed type. Then + \[\ttrunc n{\Omega(A,a)}=\Omega\mathopen{}\left(\trunc{n+1}{(A,a)}\right)\] +\end{cor} +\begin{proof} + This is a special case of the previous lemma where $x=y=a$. +\end{proof} + +\begin{cor} + Let $n\ge -2$ and $k\ge 0$ and $(A,a)$ a pointed type. Then + \[\ttrunc n{\Omega^k(A,a)} = \Omega^k\mathopen{}\left(\trunc{n+k}{(A,a)}\right). \] +\end{cor} +\begin{proof} + By induction on $k$, using the recursive definition of $\Omega^k$. +\end{proof} + +We also observe that ``truncations are cumulative'': if we truncate to an $n$-type and then to a $k$-type with $k\le n$, then we might as +well have truncated directly to a $k$-type. + +\begin{lem} \label{lem:truncation-le} + Let $k,n\ge-2$ with $k\le{}n$ and $A:\type$. Then + $\trunc k{\trunc nA}=\trunc kA$. +\end{lem} +\begin{proof} + We define two maps $f:\trunc k{\trunc nA}\to\trunc kA$ and + $g:\trunc kA\to\trunc k{\trunc nA}$ by + % + \[ + f(\tproj k{\tproj na}) \defeq \tproj ka + \qquad\text{and}\qquad + g(\tproj ka) \defeq \tproj k{\tproj na}. + \] + % + The map $f$ is well-defined because $\trunc kA$ is $k$-truncated and also + $n$-truncated (because $k\le{}n$), and the map $g$ is well-defined because + $\trunc k{\trunc nA}$ is $k$-truncated. + + The composition $f\circ{}g:\trunc kA\to\trunc kA$ satisfies + $(f\circ{}g)(\tproj ka)=\tproj ka$, hence $f\circ{}g=\idfunc[\trunc kA]$. + Similarly, we have $(g\circ{}f)(\tproj k{\tproj na})=\tproj k{\tproj na}$ and hence $g\circ{}f=\idfunc[\trunc k{\trunc nA}]$. +\end{proof} + +% \begin{lem} +% We have $\trunc n{\unit}=\unit$. +% \end{lem} +% \begin{proof} +% Indeed, $\unit$ is $n$-truncated for every $n$ hence $\trunc n{\unit}=\unit$ by +% \cref{reflectPequiv}. +% \end{proof} + +\index{truncation!n-truncation@$n$-truncation|)}% + +\section{Colimits of \texorpdfstring{$n$}{n}-types} +\label{sec:pushouts} + +Recall that in \cref{sec:colimits}, we used higher inductive types to define pushouts of types, and proved their universal property. +In general, a (homotopy) colimit of $n$-types may no longer be an $n$-type (for an extreme counterexample, see \cref{ex:s2-colim-unit}). +However, if we $n$-truncate it, we obtain an $n$-type which satisfies the correct universal property with respect to other $n$-types. + +In this section we prove this for pushouts, which are the most important and nontrivial case of colimits. +Recall the following definitions from \cref{sec:colimits}. + +\begin{defn} + A \define{span} % in $\P$ + \indexdef{span} % + is a 5-tuple $\Ddiag=(A,B,C,f,g)$ with % $A,B,C:\P$ and + $f:C\to{}A$ and $g:C\to{}B$. + \[\Ddiag=\quad\vcenter{\xymatrix{C \ar^g[r] \ar_f[d] & B \\ A & }}\] +\end{defn} + +\begin{defn} + Given a span $\Ddiag=(A,B,C,f,g)$ and a type $D$, a %$D:\P$, a + \define{cocone under $\Ddiag$ with base $D$} is a triple $(i, j, h)$ + \index{cocone} % + with $i:A\to{}D$, $j:B\to{}D$ and $h : \prd{c:C}i(f(c))=j(g(c))$: + \[\uppercurveobject{{ }}\lowercurveobject{{ }}\twocellhead{{ }} + \xymatrix{C \ar^g[r] \ar_f[d] \drtwocell{^h} & B \ar^j[d] \\ A \ar_i[r] & D + }\] + We denote by $\cocone{\Ddiag}{D}$ the type of all such cocones. +\end{defn} + +The type of cocones is (covariantly) functorial. +For instance, given $D,E$ % $D,E:\P$ +and a map $t:D\to{}E$, there is a map + \[\function{\cocone{\Ddiag}{D}}{\cocone{\Ddiag}{E}}{c}{\composecocone{t}c}\] + defined by: + \[\composecocone{t}(i,j,h)=(t\circ{}i,t\circ{}j,\mapfunc{t}\circ{}h).\] +And given $D,E,F$, %$:\P$, +functions $t:D\to{}E$, $u:E\to{}F$ and $c:\cocone{\Ddiag}{D}$, we have +\begin{align} + \composecocone{\idfunc[D]}c &= c \label{eq:composeconeid}\\ + \composecocone{(u\circ{}t)}c&=\composecocone{u}(\composecocone{t}c). \label{eq:composeconefunc} +\end{align} + +\begin{defn} + Given a span $\Ddiag$ of $n$-types, an $n$-type $D$, and a cocone + $c:\cocone{\Ddiag}{D}$, the pair $(D,c)$ is said to be a \define{pushout + of $\Ddiag$ in $n$-types} + \indexdef{pushout!in ntypes@in $n$-types}% + if for every $n$-type $E$, the map + \[\function{(D\to{}E)}{\cocone{\Ddiag}{E}}{t}{\composecocone{t}c}\] + is an equivalence. +\end{defn} + +\begin{comment} +We showed in \cref{thm:pushout-ump} that pushouts exist when $\P$ is \type itself, by giving a direct construction in terms of higher +inductive types. +For a general \P, pushouts may or may not exist, but if they do, then they are unique. + +\begin{lem} + If $(D,c)$ and $(D',c')$ are two pushouts of $\Ddiag$ in $\P$, then + $(D,c)=(D',c')$. +\end{lem} +\begin{proof} + We first prove that the two types $D$ and $D'$ are equivalent. + + Using the universal property of $D$ with $D'$, we see that the following map is an + equivalence + % + \[ + \function{(D\to{}D')}{\cocone{\Ddiag}{D'}}{t}{\composecocone{t}c} + \] + % + In particular, there is a function $f:D\to{}D'$ satisfying $\composecocone{f}c=c'$. In the + same way there is a function $g:D'\to{}D$ such that $\composecocone{g}c'=c$. + + In order to prove that $g\circ{}f=\idfunc[D]$ we use the universal property of + $D$ for $D$, which says that the following map is an equivalence: + % + \[ + \function{(D\to{}D)}{\cocone{\Ddiag}{D}}{t}{\composecocone{t}c} + \] + % + Using the functoriality of $t\mapsto{}\composecocone{t}c$ we see that + \begin{align*} + \composecocone{(g\circ{}f)}c &= \composecocone{g}(\composecocone{f}c) \\ + &= \composecocone{g}c' \\ + &= c \\ + &= \composecocone{\idfunc[D]}c + \end{align*} + hence + $g\circ{}f=\idfunc[D]$, because equivalences are injective. The same argument + with $D'$ instead of $D$ shows that $f\circ{}g=\idfunc[D']$. + + Hence $D$ and $D'$ are equal, and the fact that $(D,c)=(D',c')$ follows from + the fact that the equivalence between $D$ and $D'$ we just defined sends $c$ + to $c'$. +\end{proof} + +\begin{cor} + The type of pushouts of $\Ddiag$ in $\P$ is a mere proposition. In particular if + pushouts merely exist then they actually exist. +\end{cor} + +As in the case of pullbacks, if \P is reflective, then pushouts in \P always exist. +However, unlike the case of pullbacks, pushouts in \P are not the same as the pushouts in \type: they are obtained by applying the +reflector. +\end{comment} + +In order to construct pushouts of $n$-types, we need to explain how to reflect spans and cocones. + +\bgroup +\def\reflect(#1){\trunc n{#1}} + +\begin{defn} + Let + \[\Ddiag=\quad\vcenter{\xymatrix{C \ar^g[r] \ar_f[d] & B \\ A & }}\] + be a span. We denote by $\reflect(\Ddiag)$ the following + span of $n$-types: + \[\reflect(\Ddiag)\defeq\quad \vcenter{\xymatrix{\reflect(C) \ar^{\reflect(g)}[r] + \ar_{\reflect(f)}[d] & \reflect(B) \\ \reflect(A) & }}\] +\end{defn} + +\begin{defn} + Let $D:\type$ and $c=(i,j,h):\cocone{\Ddiag}{D}$. + We define + \[\reflect(c)=(\reflect(i),\reflect(j),k): + \cocone{\reflect(\Ddiag)}{\reflect(D)}\] + where $k$ is the composite homotopy + \[ \reflect(i) \circ \reflect(f) \htpy \reflect(i\circ f) \htpy \reflect(j\circ g) \htpy \reflect(j) \circ \reflect(g) \] + using \cref{thm:trunc-htpy} and the functoriality of $\reflect(\blank)$. + % \[\reflect(h):\prd{c:\reflect(C)}\reflect(i)(\reflect(f)(c))=\reflect(j)(\reflect(g)(c))\] + % is defined in the following way: +\end{defn} + +\egroup + +We now observe that the maps from each type to its $n$-truncation assemble into a map of spans, in the following sense. + +\begin{defn} + Let + \[\Ddiag=\quad\vcenter{\xymatrix{C \ar^g[r] \ar_f[d] & B \\ A & }} + \qquad\text{and}\qquad + \Ddiag'=\quad\vcenter{\xymatrix{C' \ar^{g'}[r] \ar_{f'}[d] & B' \\ A' & }} + \] + be spans. + A \define{map of spans} + \indexdef{map!of spans}% + $\Ddiag \to \Ddiag'$ consists of functions $\alpha:A\to A'$, $\beta:B\to B'$, and $\gamma:C\to C'$ and homotopies $\phi: \alpha\circ f \htpy f'\circ \gamma$ and $\psi:\beta\circ g \htpy g' \circ \gamma$. +\end{defn} + +Thus, for any span $\Ddiag$, we have a map of spans $\tprojf[\Ddiag] n : \Ddiag \to \trunc n\Ddiag$ consisting of $\tprojf[A]n$, $\tprojf[B]n$, $\tprojf[C]n$, and the naturality homotopies $\mathsf{nat}^f_n$ and $\mathsf{nat}^g_n$ from~\eqref{eq:trunc-nat}. + +We also need to know that maps of spans behave functorially. +Namely, if $(\alpha,\beta,\gamma,\phi,\psi):\Ddiag \to \Ddiag'$ is a map of spans and $D$ any type, then we have +\[ \function{\cocone{\Ddiag'}{D}}{\cocone{\Ddiag}{D}}{(i,j,h)}{(i\circ \alpha,j\circ\beta, k)} \] +where $k: \prd{z:C} i(\alpha(f(z))) = j(\beta(g(z)))$ is the composite +\begin{equation}\label{eq:mapofspans-htpy} +\xymatrix{ + i(\alpha(f(z))) \ar@{=}[r]^{\apfunc{i}(\phi)} & + i(f'(\gamma(z))) \ar@{=}[r]^{h(\gamma(z))} & + j(g'(\gamma(z))) \ar@{=}[r]^{\apfunc{j}(\psi)} & + j(\beta(g(z))). } +\end{equation} +We denote this cocone by $(i,j,h) \circ (\alpha,\beta,\gamma,\phi,\psi)$. +Moreover, this functorial action commutes with the other functoriality of cocones: + +\begin{lem}\label{thm:conemap-funct} + Given $(\alpha,\beta,\gamma,\phi,\psi):\Ddiag \to \Ddiag'$ and $t:D\to E$, the following diagram commutes: + \begin{equation*} + \vcenter{\xymatrix{ + \cocone{\Ddiag'}{D}\ar[r]^{t \circ {\blank}}\ar[d] & + \cocone{\Ddiag'}{E}\ar[d]\\ + \cocone{\Ddiag}{D}\ar[r]_{t \circ {\blank}} & + \cocone{\Ddiag}{E} + }} + \end{equation*} +\end{lem} +\begin{proof} + Given $(i,j,h):\cocone{\Ddiag'}{D}$, note that both composites yield a cocone whose first two components are $t\circ i\circ \alpha$ and $t\circ j\circ\beta$. + Thus, it remains to verify that the homotopies agree. + For the top-right composite, the homotopy is~\eqref{eq:mapofspans-htpy} with $(i,j,h)$ replaced by $(t\circ i, t\circ j, \apfunc{t}\circ h)$: + \begin{equation*} + \xymatrix@+2.8em{ + {t \, i \, \alpha \, f \, z} \ar@{=}[r]^{\apfunc{t\circ i}(\phi)} & + {t \, i \, f' \, \gamma \, z} \ar@{=}[r]^{\apfunc{t}(h(\gamma(z)))} & + {t \, j \, g' \, \gamma \, z} \ar@{=}[r]^{\apfunc{t\circ j}(\psi)} & + {t \, j \, \beta \, g \, z} + } + \end{equation*} + (For brevity, we are omitting the parentheses around the arguments of functions.) + On the other hand, for the left-bottom composite, the homotopy is $\apfunc{t}$ applied to~\eqref{eq:mapofspans-htpy}. + Since $\apfunc{}$ respects path-concatenation, this is equal to + \begin{equation*} + \xymatrix@+2.8em{ + {t \, i \, \alpha \, f \, z} \ar@{=}[r]^{\apfunc{t}(\apfunc{i}(\phi))} & + {t \, i \, f' \, \gamma \, z} \ar@{=}[r]^{\apfunc{t}(h(\gamma(z)))} & + {t \, j \, g' \, \gamma \, z} \ar@{=}[r]^{\apfunc{t}(\apfunc{j}(\psi))} & + {t \, j \, \beta \, g \, z}. } + \end{equation*} + But $\apfunc{t}\circ \apfunc{i} = \apfunc{t\circ i}$ and similarly for $j$, so these two homotopies are equal. +\end{proof} + +Finally, note that since we defined $\trunc nc : \cocone{\trunc n \Ddiag}{\trunc n D}$ using \cref{thm:trunc-htpy}, the additional condition~\eqref{eq:trunc-htpy} implies +\begin{equation} + \tprojf[D] n \circ c = \trunc n c \circ \tprojf[\Ddiag]n. \label{eq:conetrunc} +\end{equation} +for any $c:\cocone{\Ddiag}{D}$. +Now we can prove our desired theorem. + +\begin{thm} + \label{reflectcommutespushout} + \index{universal!property!of pushout}% + Let $\Ddiag$ be a span and $(D,c)$ its pushout. + Then $(\trunc nD,\trunc n c)$ is a pushout of $\trunc n\Ddiag$ in $n$-types. +\end{thm} +\begin{proof} + Let $E$ be an $n$-type, and consider the following diagram: +\bgroup +\def\reflect(#1){\trunc n{#1}} + \begin{equation*} + \vcenter{\xymatrix{ + (\trunc nD \to E)\ar[r]^-{\blank\circ \tprojf[D] n}\ar[d]_{\blank\circ \trunc nc} & + (D\to E)\ar[d]^{\blank\circ c}\\ + \cocone{\trunc n \Ddiag}{E}\ar[r]^-{\blank\circ \tprojf[\Ddiag]n}\ar@{<-}[d]_{\ell_1} & + \cocone{\Ddiag}{E}\ar@{<-}[d]^{\ell_2}\\ + (\reflect(A)\to{}E)\times_{(\reflect(C)\to{}E)}(\reflect(B)\to{}E)\ar[r] & + (A\to{}E)\times_{(C\to{}E)}(B\to{}E) + }} + \end{equation*} +\egroup + The upper horizontal arrow is an equivalence since $E$ is an $n$-type, while $\blank\circ c$ is an equivalence since $c$ is a pushout cocone. + Thus, by the 2-out-of-3 property, to show that $\blank\circ \trunc nc$ is an equivalence, it will suffice to show that the upper square commutes and that the middle horizontal arrow is an equivalence. + To see that the upper square commutes, let $t:\trunc nD \to E$; then + \begin{align} + \big(t \circ \trunc n c\big) \circ \tprojf[\Ddiag] n + &= t \circ \big(\trunc n c \circ \tprojf[\Ddiag] n\big) + \tag{by \cref{thm:conemap-funct}}\\ + &= t\circ \big(\tprojf[D]n \circ c\big) + \tag{by~\eqref{eq:conetrunc}}\\ + &= \big(t\circ \tprojf[D]n\big) \circ c + \tag{by~\eqref{eq:composeconefunc}}. + \end{align} + To show that the middle horizontal arrow is an equivalence, consider the lower square. + The two lower vertical arrows are simply applications of $\happly$: + \begin{align*} + \ell_1(i,j,p) &\defeq (i,j,\happly(p))\\ + \ell_2(i,j,p) &\defeq (i,j,\happly(p)) + \end{align*} + and hence are equivalences by function extensionality. + The lowest horizontal arrow is defined by + \[ (i,j,p) \mapsto \big( i\circ \tprojf[A]n,\;\; j \circ \tprojf[B] n,\;\; q\big) \] + where $q$ is the composite + \begin{align} + i\circ \tprojf[A]n \circ f + &= i\circ \trunc nf \circ \tprojf[C]n + \tag{by $\funext(\lam{z} \apfunc{i}(\mathsf{nat}^f_n(z)))$}\\ + &= j\circ \trunc ng \circ \tprojf[C]n + \tag{by $\apfunc{\blank\circ \tprojf[C] n}(p)$}\\ + &= j\circ \tprojf[B]n \circ g. + \tag{by $\funext(\lam{z} \apfunc{j}(\mathsf{nat}^g_n(z)))$} + \end{align} + This is an equivalence, because it is induced by an equivalence of cospans. + Thus, by 2-out-of-3, it will suffice to show that the lower square commutes. + But the two composites around the lower square agree definitionally on the first two components, so it suffices to show that for $(i,j,p)$ in the lower left corner and $z:C$, the path + \[ \happly(q,z) : i(\tproj n{f(z)}) = j(\tproj n{g(z)}) \] + (with $q$ as above) + is equal to the composite + \begin{align} + i(\tproj n{f(z)}) + &= i(\trunc nf(\tproj nz)) + \tag{by $\apfunc{i}(\mathsf{nat}^f_n(z))$}\\ + &= j(\trunc ng(\tproj nz)) + \tag{by $\happly(p,\tproj nz)$}\\ + &= j(\tproj n{g(z)}). + \tag{by $\apfunc{j}(\mathsf{nat}^g_n(z))$} + \end{align} + However, since $\happly$ is functorial, it suffices to check equality for the three component paths: + \begin{align*} + \happly({\funext(\lam{z} \apfunc{i}(\mathsf{nat}^f_n(z)))},z) + &= {\apfunc{i}(\mathsf{nat}^f_n(z))}\\ + \happly(\apfunc{\blank\circ \tprojf[C] n}(p), z) + &= {\happly(p,\tproj nz)}\\ + \happly({\funext(\lam{z} \apfunc{j}(\mathsf{nat}^g_n(z)))},z) + &= {\apfunc{j}(\mathsf{nat}^g_n(z))}. + \end{align*} + The first and third of these are just the fact that $\happly$ is quasi-inverse to $\funext$, while + the second is an easy general lemma about $\happly$ and precomposition. +\end{proof} + + +\section{Connectedness} +\label{sec:connectivity} + +An $n$-type is one that has no interesting information above dimension $n$. +By contrast, an \emph{$n$-connected type} is one that has no interesting information \emph{below} dimension $n$. +It turns out to be natural to study a more general notion for functions as well. + +\begin{defn} +A function $f:A\to B$ is said to be \define{$n$-connected} +\indexdef{function!n-connected@$n$-connected}% +\indexsee{n-connected@$n$-connected!function}{function, $n$-connected}% +if for all $b:B$, the type $\trunc n{\hfiber f b}$ is contractible: +\begin{equation*} + \mathsf{conn}_n(f)\defeq \prd{b:B}\iscontr(\trunc n{\hfiber{f}b}). +\end{equation*} +A type $A$ is said to be \define{$n$-connected} +\indexsee{n-connected@$n$-connected!type}{type, $n$-connected}% +\indexdef{type!n-connected@$n$-connected}% + if the unique function $A\to\unit$ is $n$-connected, i.e.\ if $\trunc nA$ is contractible. +\end{defn} +\indexsee{connected!function}{function, $n$-connected} + +Thus, a function $f:A\to B$ is $n$-connected if and only if $\hfib{f}b$ is $n$-connected for every $b:B$. +Of course, every function is $(-2)$-connected. +At the next level, we have: + +\begin{lem}\label{thm:minusoneconn-surjective} + \index{function!surjective}% + A function $f$ is $(-1)$-connected if and only if it is surjective in the sense of \cref{sec:mono-surj}. +\end{lem} +\begin{proof} + We defined $f$ to be surjective if $\trunc{-1}{\hfiber f b}$ is inhabited for all $b$. + But since it is a mere proposition, inhabitation is equivalent to contractibility. +\end{proof} + +Thus, $n$-connectedness of a function for $n\ge 0$ can be thought of as a strong form of surjectivity. +Category-theoretically, $(-1)$-connectedness corresponds to essential surjectivity on objects, while $n$-connectedness corresponds to essential surjectivity on $k$-morphisms for $k\le n+1$. + +\cref{thm:minusoneconn-surjective} also implies that a type $A$ is $(-1)$-connected if and only if it is merely inhabited. +When a type is $0$-connected we may simply say that it is \define{connected}, +\indexdef{connected!type}% +\indexdef{type!connected}% +and when it is $1$-connected we say it is \define{simply connected}. +\indexdef{simply connected type}% +\indexdef{type!simply connected}% + +\begin{rmk}\label{rmk:connectedness-indexing} + While our notion of $n$-connectedness for types agrees with the standard notion in homotopy theory, our notion of $n$-connectedness for \emph{functions} is off by one from a common indexing in classical homotopy theory. + Whereas we say a function $f$ is $n$-connected if all its fibers are $n$-connected, some classical homotopy theorists would call such a function $(n+1)$-connected. + (This is due to a historical focus on \emph{cofibers} rather than fibers.) +\end{rmk} + +We now observe a few closure properties of connected maps. +\index{function!n-connected@$n$-connected} + +\begin{lem} +\index{retract!of a function}% +Suppose that $g$ is a retract of a $n$-connected function $f$. Then $g$ is +$n$-connected. +\end{lem} +\begin{proof} +This is a direct consequence of \cref{lem:func_retract_to_fiber_retract}. +\end{proof} + +\begin{cor} +If $g$ is homotopic to a $n$-connected function $f$, then $g$ is $n$-connected. +\end{cor} + +\begin{lem}\label{lem:nconnected_postcomp} +Suppose that $f:A\to B$ is $n$-connected. Then $g:B\to C$ is $n$-connected if and only if $g\circ f$ is +$n$-connected. +\end{lem} + +\begin{proof} +For any $c:C$, we have +\begin{align*} + \trunc n{\hfib{g\circ f}c} + & \eqvsym \Trunc n{ \sm{w:\hfib{g}c}\hfib{f}{\proj1 w}} + \tag{by \cref{ex:unstable-octahedron}}\\ + & \eqvsym \Trunc n{\sm{w:\hfib{g}c} \trunc n{\hfib{f}{\proj1 w}}} + \tag{by \cref{thm:trunc-in-truncated-sigma}}\\ + & \eqvsym \trunc n{\hfib{g}c}. + \tag{since $\trunc n{\hfib{f}{\proj1 w}}$ is contractible} +\end{align*} +It follows that $\trunc n{\hfib{g}c}$ is contractible if and only if $\trunc n{\hfib{g\circ f}c}$ is +contractible. +\end{proof} + +Importantly, $n$-connected functions can be equivalently characterized as those which satisfy an ``induction principle'' with respect to $n$-types.\index{induction principle!for connected maps} +This idea will lead directly into our proof of the Freudenthal suspension theorem in \cref{sec:freudenthal}. + +\begin{lem}\label{prop:nconnected_tested_by_lv_n_dependent types} +For $f:A\to B$ and $P:B\to\type$, consider the following function: +\begin{equation*} +\lam{s} s\circ f :\Parens{\prd{b:B} P(b)}\to\Parens{\prd{a:A}P(f(a))}. +\end{equation*} +For a fixed $f$ and $n\ge -2$, the following are equivalent. +\begin{enumerate} +\item $f$ is $n$-connected.\label{item:conntest1} +\item For every $P:B\to\ntype{n}$, the map $\lam{s} s\circ f$ is an equivalence.\label{item:conntest2} +\item For every $P:B\to\ntype{n}$, the map $\lam{s} s\circ f$ has a section.\label{item:conntest3} +\end{enumerate} +\end{lem} + +\begin{proof} +Suppose that $f$ is $n$-connected and let $P:B\to\ntype{n}$. Then we have the equivalences +\begin{align} + \prd{b:B} P(b) & \eqvsym \prd{b:B} \Parens{\trunc n{\hfib{f}b} \to P(b)} + \tag{since $\trunc n{\hfib{f}b}$ is contractible}\\ + & \eqvsym \prd{b:B} \Parens{\hfib{f}b\to P(b)} + \tag{since $P(b)$ is an $n$-type}\\ + & \eqvsym \prd{b:B}{a:A}{p:f(a)= b} P(b) + \tag{by the left universal property of $\Sigma$-types}\\ + & \eqvsym \prd{a:A} P(f(a)). + \tag{by the left universal property of path types} +\end{align} +We omit the proof that this equivalence is indeed given by $\lam{s} s\circ f$. +Thus,~\ref{item:conntest1}$\Rightarrow$\ref{item:conntest2}, and clearly~\ref{item:conntest2}$\Rightarrow$\ref{item:conntest3}. +To show~\ref{item:conntest3}$\Rightarrow$\ref{item:conntest1}, consider the type family +\begin{equation*} +P(b)\defeq \trunc n{\hfib{f}b}. +\end{equation*} +Then~\ref{item:conntest3} yields a map $c:\prd{b:B} \trunc n{\hfib{f}b}$ with +$c(f(a))=\tproj n{\pairr{a,\refl{f(a)}}}$. To show that each $\trunc n{\hfib{f}b}$ is contractible, +we will find a function of type +\begin{equation*} +\prd{b:B}{w:\trunc n{\hfib{f}b}} w= c(b). +\end{equation*} +By \cref{thm:truncn-ind}, for this it suffices to find a function of type +\begin{equation*} +\prd{b:B}{a:A}{p:f(a)= b} \tproj n{\pairr{a,p}}= c(b). +\end{equation*} +But by rearranging variables and path induction, this is equivalent to the type +\begin{equation*} +\prd{a:A} \tproj n{\pairr{a,\refl{f(a)}}}= c(f(a)). +\end{equation*} +This property holds by our choice of $c(f(a))$. +\end{proof} + +\begin{cor}\label{cor:totrunc-is-connected} +For any $A$, the canonical function $\tprojf n:A\to\trunc n A$ is $n$-connected. +\end{cor} +\begin{proof} +By \cref{thm:truncn-ind} and the associated uniqueness principle, the condition of \cref{prop:nconnected_tested_by_lv_n_dependent types} holds. +\end{proof} + +For instance, when $n=-1$, \cref{cor:totrunc-is-connected} says that the map $A\to \brck A$ from a type to its propositional truncation is surjective. + +\begin{cor}\label{thm:nconn-to-ntype-const}\label{connectedtotruncated} +A type $A$ is $n$-connected if and only if the map +\begin{equation*} + \lam{b}{a} b: B \to (A\to B) +\end{equation*} +is an equivalence for every $n$-type $B$. +In other words, ``every map from $A$ to an $n$-type is constant''. +\end{cor} +\begin{proof} + By \cref{prop:nconnected_tested_by_lv_n_dependent types} applied to a function with codomain $\unit$. +\end{proof} + +\begin{lem}\label{lem:nconnected_to_leveln_to_equiv} +Let $B$ be an $n$-type and let $f:A\to B$ be a function. Then the induced function $g:\trunc n A\to B$ is an +equivalence if and only if $f$ is $n$-connected. +\end{lem} + +\begin{proof} +By \cref{cor:totrunc-is-connected}, $\tprojf n$ is $n$-connected. +Thus, since $f = g\circ \tprojf n$, by +\cref{lem:nconnected_postcomp} $f$ is $n$-connected if and only if $g$ is $n$-connected. +But since $g$ is a function between $n$-types, its fibers are also $n$-types. +Thus, $g$ is $n$-connected if and only if it is an equivalence. +\end{proof} + +We can also characterize connected pointed types in terms of connectivity of the inclusion of their basepoint. + +\begin{lem}\label{thm:connected-pointed} + \index{basepoint}% + Let $A$ be a type and $a_0:\unit\to A$ a basepoint, with $n\ge -1$. + Then $A$ is $n$-connected if and only if the map $a_0$ is $(n-1)$-connected. +\end{lem} +\begin{proof} + First suppose $a_0:\unit\to A$ is $(n-1)$-connected and let $B$ be an $n$-type; we will use \cref{thm:nconn-to-ntype-const}. + The map $\lam{b}{a} b: B \to (A\to B)$ has a retraction given by $f\mapsto f(a_0)$, so it suffices to show it also has a section, i.e.\ that for any $f:A\to B$ there is $b:B$ such that $f = \lam{a}b$. + We choose $b\defeq f(a_0)$. + Define $P:A\to\type$ by $P(a) \defeq (f(a)=f(a_0))$. + Then $P$ is a family of $(n-1)$-types and we have $P(a_0)$; hence we have $\prd{a:A} P(a)$ since $a_0:\unit\to A$ is $(n-1)$-connected. + Thus, $f = \lam{a} f(a_0)$ as desired. + + Now suppose $A$ is $n$-connected, and let $P:A\to\ntype{(n-1)}$ and $u:P(a_0)$ be given. + By \cref{prop:nconnected_tested_by_lv_n_dependent types}, it will suffice to construct $f:\prd{a:A} P(a)$ such that $f(a_0)=u$. + Now $\ntype{(n-1)}$ is an $n$-type and $A$ is $n$-connected, so by \cref{thm:nconn-to-ntype-const}, there is an $n$-type $B$ such that $P = \lam{a} B$. + Hence, we have a family of equivalences $g:\prd{a:A} (\eqv{P(a)}{B})$. + Define $f(a) \defeq \opp{g_a}(g_{a_0}(u))$; then $f:\prd{a:A} P(a)$ and $f(a_0) = u$ as desired. +\end{proof} + +In particular, a pointed type $(A,a_0)$ is 0-connected if and only if $a_0:\unit\to A$ is surjective, which is to say $\prd{x:A} \brck{x=a_0}$. +For a similar result in the not-necessarily-pointed case, see \cref{ex:connectivity-inductively}. + +A useful variation on \cref{lem:nconnected_postcomp} is: + +\begin{lem}\label{lem:nconnected_postcomp_variation} +Let $f:A\to B$ be a function and $P:A\to\type$ and $Q:B\to\type$ be type families. Suppose that $g:\prd{a:A} P(a)\to Q(f(a))$ +is a fiberwise $n$-connected% +\index{fiberwise!n-connected family of functions@$n$-connected family of functions} +family of functions, i.e.\ each function $g_a : P(a) \to Q(f(a))$ is $n$-connected. +If $f$ is also $n$-connected, then so is the function +\begin{align*} +\varphi &:\Parens{\sm{a:A} P(a)}\to\Parens{\sm{b:B} Q(b)}\\ +\varphi(a,u) &\defeq \pairr{f(a),g_a(u)}. +\end{align*} +Conversely, if $\varphi$ and each $g_a$ are $n$-connected, and moreover $Q$ is fiberwise merely inhabited (i.e.\ we have $\brck{Q(b)}$ for all $b:B$), then $f$ is $n$-connected. +\end{lem} + +\begin{proof} +For any $b:B$ and $v:Q(b)$ we have +{\allowdisplaybreaks +\begin{align*} +\trunc n{\hfib{\varphi}{\pairr{b,v}}} & \eqvsym \Trunc n{\sm{a:A}{u:P(a)}{p:f(a)= b} \trans{p}{g_a(u)}= v}\\ +& \eqvsym \Trunc n{\sm{w:\hfib{f}b}{u:P(\proj1(w))} g_{\proj 1 w}(u)= \trans{\opp{\proj2(w)}}{v}}\\ +& \eqvsym \Trunc n{\sm{w:\hfib{f}b} \hfib{g(\proj1 w)}{\trans{\opp{\proj 2(w)}}{v}}}\\ +& \eqvsym \Trunc n{\sm{w:\hfib{f}b} \trunc n{\hfib{g(\proj1 w)}{\trans{\opp{\proj 2(w)}}{v}}}}\\ +& \eqvsym \trunc n{\hfib{f}b} +\end{align*}}% +where the transportations along $f(p)$ and $f(p)^{-1}$ are with respect to $Q$. +Therefore, if either is contractible, so is the other. + +In particular, if $f$ is $n$-connected, then $\trunc n{\hfib{f}b}$ is contractible for all $b:B$, and hence so is $\trunc n{\hfib{\varphi}{\pairr{b,v}}}$ for all $(b,v):\sm{b:B} Q(b)$. +On the other hand, if $\varphi$ is $n$-connected, then $\trunc n{\hfib{\varphi}{\pairr{b,v}}}$ is contractible for all $(b,v)$, hence so is $\trunc n{\hfib{f}b}$ for any $b:B$ such that there exists some $v:Q(b)$. +Finally, since contractibility is a mere proposition, it suffices to merely have such a $v$. +\end{proof} + +The converse direction of \cref{lem:nconnected_postcomp_variation} can fail if $Q$ is not fiberwise merely inhabited. +For example, if $P$ and $Q$ are both constant at $\emptyt$, then $\varphi$ and each $g_a$ are equivalences, but $f$ could be arbitrary. + +In the other direction, we have + +\begin{lem}\label{prop:nconn_fiber_to_total} +Let $P,Q:A\to\type$ be type families and consider a fiberwise transformation\index{fiberwise!transformation} +\begin{equation*} +f:\prd{a:A} \Parens{P(a)\to Q(a)} +\end{equation*} +from $P$ to $Q$. Then the induced map $\total f: \sm{a:A}P(a) \to \sm{a:A} Q(a)$ is $n$-connected if and only if each $f(a)$ is $n$-connected. +\end{lem} + +Of course, the ``only if'' direction is also a special case of \cref{lem:nconnected_postcomp_variation}. + +\begin{proof} +By \cref{fibwise-fiber-total-fiber-equiv}, we have +$\hfib{\total f}{\pairr{x,v}}\eqvsym\hfib{f(x)}v$ +for each $x:A$ and $v:Q(x)$. Hence $\trunc n{\hfib{\total f}{\pairr{x,v}}}$ is contractible if and only if +$\trunc n{\hfib{f(x)}v}$ is contractible. +\end{proof} + +Another useful fact about connected maps is that they induce an +equivalence on $n$-truncations: + +\begin{lem} \label{lem:connected-map-equiv-truncation} +If $f : A \to B$ is $n$-connected, then it induces an equivalence +$\eqv{\trunc{n}{A}}{\trunc{n}{B}}$. +\end{lem} +\begin{proof} +Let $c$ be the proof that $f$ is $n$-connected. From left to right, we +use the map $\trunc{n}{f} : \trunc{n}{A} \to \trunc{n}{B}$. +To define the map from right to left, by the universal property of +truncations, it suffices to give a map $\mathsf{back} : B \to {\trunc{n}{A}}$. We can +define this map as follows: +\[ +\mathsf{back}(y) \defeq \trunc{n}{\proj{1}}{(\proj{1}{(c(y))})}. +\] +By definition, $c(y)$ has type $\iscontr(\trunc n {\hfiber{f}y})$, so its +first component has type $\trunc n{\hfiber{f}y}$, and we can obtain an +element of $\trunc n A$ from this by projection. + +Next, we show that the composites are the identity. In both directions, +because the goal is a path in an $n$-truncated type, it suffices to +cover the case of the constructor $\tprojf{n}$. + +In one direction, we must show that for all $x:A$, +\[ +\trunc{n}{\proj{1}}{(\proj{1}{(c(f(x)))})} = \tproj{n}{x}. +\] +But $\tproj{n}{(x, \refl{f(x)})} : \trunc n{\hfiber{f}{f(x)}}$, and +$c(f(x))$ says that this type is contractible, so +\[ +\proj{1}{(c(f(x)))} = \tproj{n}{(x, \refl{})}. +\] +Applying $\trunc{n}{\proj{1}}$ to both sides of this equation gives the +result. + +In the other direction, we must show that for all $y:B$, +\[ +\trunc{n}{f}(\trunc{n}{\proj{1}} (\proj{1}{(c(y))})) = \tproj{n}{y}. +\] +$\proj{1}{(c(y))}$ has type $\trunc n {\hfiber{f}y}$, and the path we +want is essentially the second component of the $\hfiber{f}y$, but we +need to make sure the truncations work out. + +In general, suppose we are given $p:\trunc{n}{\sm{x:A} B(x)}$ and wish to prove +$P(\trunc{n}{\proj{1}{}}(p))$. By truncation induction, it suffices to +prove $P(\tproj{n}{a})$ for all $a:A$ and $b:B(a)$. Applying this +principle in this case, it suffices to prove +\[ +\trunc{n}{f}(\tproj{n}{a}) = \tproj{n}{y} +\] +given $a:A$ and $b:f (a) = y$. But the left-hand side equals $\tproj{n}{f (a)}$, +so applying $\tprojf{n}$ to both sides of $b$ gives the result. +\end{proof} + +One might guess that this fact characterizes the $n$-connected maps, but in fact being $n$-connected is a bit stronger than this. +For instance, the inclusion $\bfalse:\unit \to\bool$ induces an equivalence on $(-1)$-truncations, but is not surjective (i.e.\ $(-1)$-connected). +In \cref{sec:long-exact-sequence-homotopy-groups} we will see that the difference in general is an analogous extra bit of surjectivity. + + +\section{Orthogonal factorization} +\label{sec:image-factorization} + +\index{unique!factorization system|(}% +\index{orthogonal factorization system|(}% +In set theory, the surjections and the injections form a unique factorization system: every function factors essentially uniquely as a surjection followed by an injection. +We have seen that surjections generalize naturally to $n$-connected maps, so it is natural to inquire whether these also participate in a factorization system. +Here is the corresponding generalization of injections. + +\begin{defn} + A function $f:A\to B$ is \define{$n$-truncated} + \indexdef{n-truncated@$n$-truncated!function}% + \indexdef{function!n-truncated@$n$-truncated}% +if the fiber $\hfib f b$ is an $n$-type for all $b:B$. +\end{defn} + +In particular, $f$ is $(-2)$-truncated if and only if it is an equivalence. +And of course, $A$ is an $n$-type if and only if $A\to\unit$ is $n$-truncated. +Moreover, $n$-truncated maps could equivalently be defined recursively, like $n$-types. + +\begin{lem}\label{thm:modal-mono} + For any $n\ge -2$, a function $f:A\to B$ is $(n+1)$-truncated if and only if for all $x,y:A$, the map $\apfunc{f}:(x=y) \to (f(x)=f(y))$ is $n$-truncated. + \index{function!embedding}% + \index{function!injective}% + In particular, $f$ is $(-1)$-truncated if and only if it is an embedding in the sense of \cref{sec:mono-surj}. +\end{lem} +\begin{proof} + Note that for any $(x,p),(y,q):\hfib f b$, we have + \begin{align*} + \big((x,p) = (y,q)\big) + &= \sm{r:x=y} (p = \apfunc f(r)\ct q)\\ + &= \sm{r:x=y} (\apfunc f (r) = p\ct \opp q)\\ + &= \hfib{\apfunc{f}}{p\ct \opp q}. + \end{align*} + Thus, any path space in any fiber of $f$ is a fiber of $\apfunc{f}$. + On the other hand, choosing $b\defeq f(y)$ and $q\defeq \refl{f(y)}$ we see that any fiber of $\apfunc f$ is a path space in a fiber of $f$. + The result follows, since $f$ is $\nplusone$-truncated if all path spaces of its fibers are $n$-types. +\end{proof} + +We can now construct the factorization, in a fairly obvious way. + +\begin{defn}\label{defn:modal-image} +Let $f:A\to B$ be a function. The \define{$n$-image} +\indexdef{image}% +\indexdef{image!n-image@$n$-image}% +\indexdef{n-image@$n$-image}% +\indexdef{function!n-image of@$n$-image of}% +of $f$ is defined as +\begin{equation*} +\im_n(f)\defeq \sm{b:B} \trunc n{\hfib{f}b}. +\end{equation*} +When $n=-1$, we write simply $\im(f)$ and call it the \define{image} of $f$. +\end{defn} + +\begin{lem}\label{prop:to_image_is_connected} +For any function $f:A\to B$, the canonical function $\tilde{f}:A\to\im_n(f)$ is $n$-connected. +Consequently, any function factors as an $n$-connected function followed by an $n$-truncated function. +\end{lem} + +\begin{proof} +Note that $A\eqvsym\sm{b:B}\hfib{f}b$. The function $\tilde{f}$ is the function on total spaces induced by the canonical fiberwise transformation +\begin{equation*} +\prd{b:B} \Parens{\hfib{f}b\to\trunc n{\hfib{f}b}}. +\end{equation*} +Since each map $\hfib{f}b\to\trunc n{\hfib{f}b}$ is $n$-connected by \cref{cor:totrunc-is-connected}, $\tilde{f}$ is $n$-connected by \cref{prop:nconn_fiber_to_total}. +Finally, the projection $\proj1:\im_n(f) \to B$ is $n$-truncated, since its fibers are equivalent to the $n$-truncations of the fibers of $f$. +\end{proof} + +In the following lemma we set up some machinery to prove the unique factorization theorem. + +\begin{lem}\label{prop:factor_equiv_fiber} +Suppose we have a commutative diagram of functions +\begin{equation*} + \xymatrix{ + {A} \ar[r]^{g_1} \ar[d]_{g_2} & + {X_1} \ar[d]^{h_1} & + \\ + {X_2} \ar[r]_{h_2} + & + {B} + } +\end{equation*} +with $H:h_1\circ g_1\htpy h_2\circ g_2$, where $g_1$ and $g_2$ are $n$-connected and where $h_1$ and $h_2$ are $n$-truncated. +Then there is an equivalence +\begin{equation*} +E(H,b):\hfib{h_1}b\eqvsym\hfib{h_2}b +\end{equation*} +for any $b:B$, such that for any $a:A$ we have an identification +\[\overline{E}(H,a) : E(H,h_1(g_1(a)))({g_1(a),\refl{h_1(g_1(a))}}) = \pairr{g_2(a),\opp{H(a)}}.\] +\end{lem} + +\begin{proof} +Let $b:B$. Then we have the following equivalences: +\begin{align} +\hfib{h_1}b +& \eqvsym \sm{w:\hfib{h_1}b} \trunc n{ \hfib{g_1}{\proj1 w}} +\tag{since $g_1$ is $n$-connected}\\ +& \eqvsym \Trunc n{\sm{w:\hfib{h_1}b}\hfib{g_1}{\proj1 w}} +\tag{by \cref{thm:refl-over-ntype-base}, since $h_1$ is $n$-truncated}\\ +& \eqvsym \trunc n{\hfib{h_1\circ g_1}b} +\tag{by \cref{ex:unstable-octahedron}} +\end{align} +and likewise for $h_2$ and $g_2$. +Also, since we have a homotopy $H:h_1\circ g_1\htpy h_2\circ g_2$, there is an obvious equivalence $\hfib{h_1\circ g_1}b\eqvsym\hfib{h_2\circ g_2}b$. +Hence we obtain +\begin{equation*} +\hfib{h_1}b\eqvsym\hfib{h_2}b +\end{equation*} +for any $b:B$. By analyzing the underlying functions, we get the following representation of what happens to the element +$\pairr{g_1(a),\refl{h_1(g_1(a))}}$ after applying each of the equivalences of which $E$ is composed. +Some of the identifications are definitional, but others (marked with a $=$ below) are only propositional; putting them together we obtain $\overline E(H,a)$. +{\allowdisplaybreaks +\begin{align*} +\pairr{g_1(a),\refl{h_1(g_1(a))}} & + \overset{=}{\mapsto} \Pairr{\pairr{g_1(a),\refl{h_1(g_1(a))}}, \tproj n{ \pairr{a,\refl{g_1(a)}}}}\\ + & \mapsto \tproj n { \pairr{\pairr{g_1(a),\refl{h_1(g_1(a))}}, \pairr{a,\refl{g_1(a)}} }}\\ + & \mapsto \tproj n { \pairr{a,\refl{h_1(g_1(a))}}}\\ + & \overset{=}{\mapsto} \tproj n { \pairr{a,\opp{H(a)}}}\\ + & \mapsto \tproj n { \pairr{\pairr{g_2(a),\opp{H(a)}},\pairr{a,\refl{g_2(a)}}} }\\ + & \mapsto \Pairr{\pairr{g_2(a),\opp{H(a)}}, \tproj n {\pairr{a,\refl{g_2(a)}}} }\\ + & \mapsto \pairr{g_2(a),\opp{H(a)}} +\end{align*}} +The first equality is because for general $b$, the map +\narrowequation{ \hfib{h_1}b \to \sm{w:\hfib{h_1}b} \trunc n{ \hfib{g_1}{\proj1 w}} } +inserts the center of contraction for $\trunc n{ \hfib{g_1}{\proj1 w}}$ supplied by the assumption that $g_1$ is $n$-truncated; whereas in the case in question this type has the obvious inhabitant $\tproj n{ \pairr{a,\refl{g_1(a)}}}$, which by contractibility must be equal to the center. +The second propositional equality is because the equivalence $\hfib{h_1\circ g_1}b\eqvsym\hfib{h_2\circ g_2}b$ concatenates the second components with $\opp{H(a)}$, and we have $\opp{H(a)} \ct \refl{} = \opp{H(a)}$. +The reader may check that the other equalities are definitional (assuming a reasonable solution to \cref{ex:unstable-octahedron}). +\end{proof} + +% The equivalences $E(H,b)$ are such that $E(H^{-1},b)= E(H,b)^{-1}$. + +Combining \cref{prop:to_image_is_connected,prop:factor_equiv_fiber}, we have the following unique factorization result: + +\begin{thm}\label{thm:orth-fact} +For each $f:A\to B$, the space $\fact_n(f)$ defined by +\begin{equation*} +\sm{X:\type}{g:A\to X}{h:X\to B} (h\circ g\htpy f)\times\mathsf{conn}_n(g)\times\mathsf{trunc}_n(h) +\end{equation*} +is contractible. +Its center of contraction is the element +\begin{equation*} +\pairr{\im_n(f),\tilde{f},\proj1,\theta,\varphi,\psi}:\fact_n(f) +\end{equation*} +arising from \cref{prop:to_image_is_connected}, +where $\theta:\proj1\circ\tilde{f}\htpy f$ is the canonical homotopy, where $\varphi$ is the proof of +\cref{prop:to_image_is_connected}, and where $\psi$ is the obvious proof that $\proj1:\im_n(f)\to B$ has $n$-truncated fibers. +\end{thm} + +\begin{proof} +By \cref{prop:to_image_is_connected} we know that there is an element of $\fact_n(f)$, hence it is enough to +show that $\fact_n(f)$ is a mere proposition. Suppose we have two $n$-factorizations +\begin{equation*} +\pairr{X_1,g_1,h_1,H_1,\varphi_1,\psi_1}\qquad\text{and}\qquad\pairr{X_2,g_2,h_2,H_2,\varphi_2,\psi_2} +\end{equation*} +of $f$. Then we have the pointwise-concatenated homotopy +\[ H\defeq (\lam{a} H_1(a) \ct H_2^{-1}(a)) \,:\, (h_1\circ g_1\htpy h_2\circ g_2).\] +By univalence and the characterization of paths and transport in $\Sigma$-types, function types, and path types, it suffices to show that +\begin{enumerate} +\item there is an equivalence $e:X_1\eqvsym X_2$, +\item there is a homotopy $\zeta:e\circ g_1\htpy g_2$, +% \note{Is it easy enough to see that these elements are the various transports?} +\item there is a homotopy $\eta:h_2\circ e\htpy h_1$, +\item for any $a:A$ we have $\opp{\apfunc{h_2}(\zeta(a))} \ct \eta(g_1(a)) \ct H_1(a) = H_2(a)$. +\end{enumerate} +%where $\underline{e}$ is the function underlying the equivalence. +We prove these four assertions in that order. +\begin{enumerate} +\item By \cref{prop:factor_equiv_fiber}, we have a fiberwise equivalence +% \note{It could be a nice exercise for the book to show +% that if $f_1:A_1\to B$ and $f_2:A_2\to B$ have equivalent fibers, then $A_1\eqvsym A_2$}. +\begin{equation*} +E(H) : \prd{b:B} \eqv{\hfib{h_1}b}{\hfib{h_2}b}. +\end{equation*} +This induces an equivalence of total spaces, i.e.\ we have +\begin{equation*} +\eqvspaced{\Parens{\sm{b:B} \hfib{h_1}b}}{\Parens{\sm{b:B}\hfib{h_2}b}}. +\end{equation*} +Of course, we also have the equivalences $X_1\eqvsym\sm{b:B}\hfib{h_1}b$ and $X_2\eqvsym\sm{b:B} +\hfib{h_2}b$ from \cref{thm:total-space-of-the-fibers}. +This gives us our equivalence $e:X_1\eqvsym X_2$; the reader may verify that the underlying function of $e$ is given by +\begin{equation*} +e(x) \jdeq \proj1(E(H,h_1(x))(x,\refl{h_1(x)})). +\end{equation*} +\item By \cref{prop:factor_equiv_fiber}, we may choose + $\zeta(a) \defeq \apfunc{\proj1}(\overline E(H,a)) : e(g_1(a)) = g_2(a)$. + \label{item:orth-fact-2} +\item For every $x:X_1$, we have +\begin{equation*} +\proj2(E(H,h_1(x))({x,\refl{h_1(x)}})) :h_2(e(x))= h_1(x), +\end{equation*} +giving us a homotopy $\eta:h_2\circ e\htpy h_1$. +\item By the characterization of paths in fibers (\cref{lem:hfib}), the path $\overline E(H,a)$ from \cref{prop:factor_equiv_fiber} gives us + $\eta(g_1(a)) = \apfunc{h_2}(\zeta(a)) \ct \opp{H(a)}$. + The desired equality follows by substituting the definition of $H$ and rearranging paths.\qedhere +\end{enumerate} +\end{proof} + +% I can't make sense of this, and it doesn't seem necessary +% +% \begin{cor} +% A function $f:A\to B$ is $n$-connected if and only if +% \begin{equation*} +% \prd C\prd{g:\modalfunc(B\to C)} \iscontr\big(\sm{h:\modalfunc(B\to C)}\underline{h}\circ +% f\htpy\underline{g}\circ f\big). +% \end{equation*} +% \end{cor} + +By standard arguments, this yields the following orthogonality principle. + +\begin{thm} + Let $e:A\to B$ be $n$-connected and $m:C\to D$ be $n$-truncated. + Then the map + \[ \varphi: (B\to C) \;\to\; \sm{h:A\to C}{k:B\to D} (m\circ h \htpy k \circ e) \] + is an equivalence. +\end{thm} +\begin{proof}[Sketch of proof] + For any $(h,k,H)$ in the codomain, let $h = h_2 \circ h_1$ and $k = k_2 \circ k_1$, where $h_1$ and $k_1$ are $n$-connected and $h_2$ and $k_2$ are $n$-truncated. + Then $f = (m\circ h_2) \circ h_1$ and $f = k_2 \circ (k_1\circ e)$ are both $n$-factorizations of $m \circ h = k\circ e$. + Thus, there is a unique equivalence between them. + It is straightforward (if a bit tedious) to extract from this that $\hfib\varphi{(h,k,H)}$ is contractible. +\end{proof} + +\index{orthogonal factorization system|)}% +\index{unique!factorization system|)}% + +We end by showing that images are stable under pullback. +\index{image!stability under pullback} +\index{factorization!stability under pullback} + +\begin{lem}\label{lem:hfiber_wrt_pullback} +Suppose that the square +\begin{equation*} + \vcenter{\xymatrix{ + A\ar[r]\ar[d]_f & + C\ar[d]^g\\ + B\ar[r]_-h & + D + }} +\end{equation*} +is a pullback square and let $b:B$. Then $\hfib{f}b\eqvsym\hfib{g}{h(b)}$. +\end{lem} + +\begin{proof} +This follows from pasting of pullbacks (\cref{ex:pullback-pasting}), since the type $X$ in the diagram +\begin{equation*} + \vcenter{\xymatrix{ + X\ar[r]\ar[d] & + A\ar[r]\ar[d]_f & + C\ar[d]^g\\ + \unit\ar[r]_b & + B\ar[r]_h & + D + }} +\end{equation*} +is the pullback of the left square if and only if it is the pullback of the outer rectangle, while $\hfib{f}b$ is the pullback of the square on the left and $\hfib{g}{h(b)}$ is the pullback of the outer rectangle. +\end{proof} + +\begin{thm}\label{thm:stable-images} +\index{stability!of images under pullback}% +Consider functions $f:A\to B$, $g:C\to D$ and the diagram +\begin{equation*} + \vcenter{\xymatrix{ + A\ar[r]\ar[d]_{\tilde{f}_n} & + C\ar[d]^{\tilde{g}_n}\\ + \im_n(f)\ar[r]\ar[d]_{\proj1} & + \im_n(g)\ar[d]^{\proj1}\\ + B\ar[r]_h & + D + }} +\end{equation*} +If the outer rectangle is a pullback, then so is the bottom square (and hence so is the top square, by \cref{ex:pullback-pasting}). Consequently, images are stable under pullbacks. +\end{thm} + +\begin{proof} +Assuming the outer square is a pullback, we have equivalences +\begin{align*} +B\times_D\im_n(g) & \jdeq \sm{b:B}{w:\im_n(g)} h(b)=\proj1 w\\ +& \eqvsym \sm{b:B}{d:D}{w:\trunc n{\hfib{g}d}} h(b)= d\\ +& \eqvsym \sm{b:B} \trunc n{\hfib{g}{h(b)}}\\ +& \eqvsym \sm{b:B} \trunc n{\hfib{f}b} && +\text{(by \cref{lem:hfiber_wrt_pullback})}\\ +& \equiv \im_n(f). && \qedhere +\end{align*} +\end{proof} + +\index{n-type@$n$-type|)}% + +\section{Modalities} +\label{sec:modalities} + +\index{modality|(} + +Nearly all of the theory of $n$-types and connectedness can be done in much greater generality. +This section will not be used in the rest of the book. + +Our first thought regarding generalizing the theory of $n$-types might be to take \cref{thm:trunc-reflective} as a definition. + +\begin{defn}\label{defn:reflective-subuniverse} + A \define{reflective subuniverse} + \indexdef{reflective!subuniverse}% + \indexdef{subuniverse, reflective}% + is a predicate $P:\type\to\prop$ such that + for every $A:\type$ we have a type $\reflect A$ such that $P(\reflect A)$ and a map + $\project_A:A\to\reflect A$, with the property that for every $B:\type$ with $P(B)$, the following map is an equivalence: + \[\function{(\reflect A\to{}B)}{(A\to{}B)}{f}{f\circ\project_A}.\] +\end{defn} + +We write $\P \defeq \setof{A:\type | P(A)}$, so $A:\P$ means that $A:\type$ and we have $P(A)$. +We also write $\rec{\modal}$ for the quasi-inverse of the above map. +The notation $\reflect$ may seem slightly odd, but it will make more sense soon. + +For any reflective subuniverse, we can prove all the familiar facts about reflective subcategories from category theory, in the usual way. +For instance, we have: +\begin{itemize} +\item A type $A$ lies in $\P$ if and only if $\project_A:A\to\reflect A$ is an equivalence. +\item $\P$ is closed under retracts. + In particular, $A$ lies in $\P$ as soon as $\project_A$ admits a retraction. +\item The operation $\reflect$ is a functor in a suitable up-to-coherent-homotopy sense, which we can make precise at as high levels as necessary. +\item The types in $\P$ are closed under all limits such as products and pullbacks. + In particular, for any $A:\P$ and $x,y:A$, the identity type $(x=_A y)$ is also in $\P$, since it is a pullback of two functions $\unit\to A$. +\item Colimits in $\P$ can be constructed by applying $\reflect$ to ordinary colimits of types. +\end{itemize} + +Importantly, closure under products extends also to ``infinite products'', i.e.\ dependent function types. + +\begin{thm}\label{thm:reflsubunv-forall} + If $B:A\to\P$ is any family of types in a reflective subuniverse \P, then $\prd{x:A} B(x)$ is also in \P. +\end{thm} +\begin{proof} + For any $x:A$, consider the function $\mathsf{ev}_x : (\prd{x:A} B(x)) \to B(x)$ defined by $\mathsf{ev}_x(f) \defeq f(x)$. + Since $B(x)$ lies in $P$, this extends to a function + \[ \rec{\modal}(\mathsf{ev}_x) : \reflect\Parens{\prd{x:A} B(x)} \to B(x). \] + Thus we can define $h:\reflect(\prd{x:A} B(x)) \to \prd{x:A} B(x)$ by $h(z)(x) \defeq \rec{\modal}(\mathsf{ev}_x)(z)$. + Then $h$ is a retraction of $\project_{\prd{x:A} B(x)}$, so that ${\prd{x:A} B(x)}$ is in $\P$. +\end{proof} + +In particular, if $B:\P$ and $A$ is any type, then $(A\to B)$ is in \P. +In categorical language, this means that any reflective subuniverse is an \define{exponential ideal}. +\indexdef{exponential ideal}% +This, in turn, implies by a standard argument that the reflector preserves finite products. + +\begin{cor}\label{cor:trunc_prod} + For any types $A$ and $B$ and any reflective subuniverse, the induced map $\reflect(A\times B) \to \reflect(A) \times \reflect(B)$ is an equivalence. +\end{cor} +\begin{proof} + It suffices to show that $\reflect(A) \times \reflect(B)$ has the same universal property as $\reflect(A\times B)$. + It lies in $\P$ by the above remark that types in $\P$ are closed under limits. + Now let $C:\P$; we have + \begin{align*} + (\reflect(A) \times \reflect(B) \to C) + &= (\reflect(A) \to (\reflect(B) \to C))\\ + &= (\reflect(A) \to (B \to C))\\ + &= (A \to (B \to C))\\ + &= (A \times B \to C) + \end{align*} + using the universal properties of $\reflect(B)$ and $\reflect(A)$, along with the fact that $B\to C$ is in \P since $C$ is. + It is straightforward to verify that this equivalence is given by composing with $\mreturn_A \times \mreturn_B$, as needed. +\end{proof} + +It may seem odd that every reflective subcategory of types is automatically an exponential ideal, with a product-preserving reflector. +However, this is also the case classically in the category of \emph{sets}, for the same reasons. +It's just that this fact is not usually remarked on, since the classical category of sets --- in contrast to the category of homotopy +types --- does not have many interesting reflective subcategories. + +Two basic properties of $n$-types are \emph{not} shared by general reflective subuniverses: \cref{thm:ntypes-sigma} (closure under $\Sigma$-types) and \cref{thm:truncn-ind} (truncation induction). +However, the analogues of these two properties are equivalent to each other. + + +\begin{thm}\label{thm:modal-char} + For a reflective subuniverse \P, the following are logically equivalent. + \begin{enumerate} + \item If $A:\P$ and $B:A\to \P$, then $\sm{x:A} B(x)$ is in \P.\label{item:mchr1} + \item for every $A:\type$, type family $B:\reflect A\to\P$, and map $g:\prd{a:A} B(\project(a))$, there exists $f:\prd{z:\reflect A} B(z)$ such that $f(\project(a)) = g(a)$ for all $a:A$.\label{item:mchr2} + \end{enumerate} +\end{thm} +\begin{proof} + Suppose~\ref{item:mchr1}. + Then in the situation of~\ref{item:mchr2}, the type $\sm{z:\reflect A} B(z)$ lies in $\P$, and we have $g':A\to \sm{z:\reflect A} B(z)$ defined by $g'(a)\defeq (\project(a),g(a))$. + Thus, we have $\rec{\modal}(g'):\reflect A \to \sm{z:\reflect A} B(z)$ such that $\rec{\modal}(g')(\project(a)) = (\project(a),g(a))$. + + Now consider the functions $\proj1 \circ \rec{\modal}(g') : \reflect A \to \reflect A$ and $\idfunc[\reflect A]$. + By assumption, these become equal when precomposed with $\project$. + Thus, by the universal property of $\reflect$, they are equal already, i.e.\ we have $p_z:\proj1(\rec{\modal}(g')(z)) = z$ for all $z$. + Now we can define + % + \narrowequation{f(z) \defeq \trans{p_z}{\proj2(\rec{\modal}(g')(z))},} + % + Using the adjunction property of the equivalence of + definition~\ref{defn:reflective-subuniverse}, one can show that the first component of + % + \narrowequation{\rec{\modal}(g')(\project(a)) = (\project(a),g(a))} + % + is equal to $p_{\project(a)}$. Thus, its second component yields + $f(\project(a)) = g(a)$, as needed. + + Conversely, suppose~\ref{item:mchr2}, and that $A:\P$ and $B:A\to\P$. + Let $h$ be the composite + \[ \reflect\Parens{\sm{x:A} B(x)} \xrightarrow{\reflect(\proj1)} \reflect A \xrightarrow{\opp{(\project_A)}} A. \] + Then for $z:\sm{x:A} B(x)$ we have + \begin{align*} + h(\project(z)) &= \opp\project(\reflect(\proj1)(\project(z)))\\ + &= \opp\project(\project(\proj1(z)))\\ + &= \proj1(z). + \end{align*} + Denote this path by $p_z$. + Now if we define $C:\reflect(\sm{x:A} B(x)) \to \type$ by $C(w) \defeq B(h(w))$, we have + \[ g \defeq \lam{z} \trans{p_z}{\proj2(z)} \;:\; \prd{z:\sm{x:A} B(x)} C(\project(z)). \] + Thus, the assumption yields + % + \narrowequation{f:\prd{w:\reflect(\sm{x:A}B(x))} C(w)} + % + such that $f(\project(z)) = g(z)$. + Together, $h$ and $f$ give a function + % + \narrowequation{k:\reflect(\sm{x:A}B(x)) \to \sm{x:A}B(x)} + % + defined by $k(w) \defeq (h(w),f(w))$, while $p_z$ and the equality $f(\project(z)) = g(z)$ show that $k$ is a retraction of $\project_{\sm{x:A}B(x)}$. + Therefore, $\sm{x:A}B(x)$ is in \P. +\end{proof} + +Note the similarity to the discussion in \cref{sec:htpy-inductive}. +\index{recursion principle!for a modality}% +\index{induction principle!for a modality}% +\index{uniqueness!principle, propositional!for a modality}% +The universal property of the reflector of a reflective subuniverse is like a recursion principle with its uniqueness property, while \cref{thm:modal-char}\ref{item:mchr2} is like the corresponding induction principle. +Unlike in \cref{sec:htpy-inductive}, the two are not equivalent here, because of the restriction that we can only eliminate into types that lie in $\P$. +Condition~\ref{item:mchr1} of \cref{thm:modal-char} is what fixes the disconnect. + +Unsurprisingly, of course, if we have the induction principle, then we can derive the recursion principle. +We can also derive its uniqueness property, as long as we allow ourselves to eliminate into path types. +This suggests the following definition. +Note that any reflective subuniverse can be characterized by the operation $\reflect:\type\to\type$ and the functions $\project_A:A\to \reflect A$, since we have $P(A) = \isequiv(\project_A)$. + +\begin{defn}\label{defn:modality} +A \define{modality} +\indexdef{modality} +is an operation $\modal:\type\to\type$ for which there are +\begin{enumerate} +\item functions $\mreturn^\modal_A:A\to\modal(A)$ for every type $A$.\label{item:modal1} +\item for every $A:\type$ and every type family $B:\modal(A)\to\type$, a function\label{item:modal2} +\begin{equation*} +\ind{\modal}:\Parens{\prd{a:A}\modal(B(\mreturn^\modal_A(a)))}\to\prd{z:\modal(A)}\modal(B(z)). +\end{equation*} +\item A path $\ind\modal(f)(\mreturn^\modal_A(a)) = f(a)$ for each $f:\prd{a:A}\modal(B(\mreturn^\modal_A(a)))$.\label{item:modal3} +\item For any $z,z':\modal(A)$, the function $\mreturn^\modal_{z=z'} : (z=z') \to \modal(z=z')$ is an equivalence.\label{item:modal4} +\end{enumerate} +We say that $A$ is \define{modal} +\indexdef{modal!type}% +\indexdef{type!modal}% +for $\modal$ if $\mreturn^\modal_A:A\to\modal(A)$ is an equivalence, and we write +\begin{equation} + \modaltype\defeq\setof{X:\type | X \text{ is $\modal$-modal} }\label{eq:modaltype} +\end{equation} +for the type of modal types. +\end{defn} + +Conditions~\ref{item:modal2} and~\ref{item:modal3} are very similar to \cref{thm:modal-char}\ref{item:mchr2}, but phrased using $\modal B(z)$ rather than assuming $B$ to be valued in $\P$. +This allows us to state the condition purely in terms of the operation $\modal$, rather than requiring the predicate $P:\type\to\prop$ to be given in advance. +(It is not entirely satisfactory, since we still have to refer to $P$ not-so-subtly in clause~\ref{item:modal4}. +We do not know whether~\ref{item:modal4} follows from~\ref{item:modal1}--\ref{item:modal3}.) +However, the stronger-looking property of \cref{thm:modal-char}\ref{item:mchr2} follows from \cref{defn:modality}\ref{item:modal2} and~\ref{item:modal3}, since for any $C:\modal A \to \modaltype$ we have $C(z) \eqvsym \modal C(z)$, and we can pass back across this equivalence. + +\index{universal!property!of a modality}% +As with other induction principles, this implies a universal property. + +\begin{thm}\label{prop:lv_n_deptype_sec_equiv_by_precomp} +Let $A$ be a type and let $B:\modal(A)\to\modaltype$. Then the function +\begin{equation*} +(\blank\circ \mreturn^\modal_A) : \Parens{\prd{z:\modal(A)}B(z)} \to \Parens{\prd{a:A}B(\mreturn^\modal_A(a))} +\end{equation*} +is an equivalence. +\end{thm} +\begin{proof} +By definition, the operation $\ind{\modal}$ is a right inverse to $(\blank\circ \mreturn^\modal_A)$. +Thus, we only need to find a homotopy +\begin{equation*} +\prd{z:\modal(A)}s(z)= \ind{\modal}(s\circ \mreturn^\modal_A)(z) +\end{equation*} +for each $s:\prd{z:\modal(A)}B(z)$, exhibiting it as a left inverse as well. +By assumption, each $B(z)$ is modal, and hence each type $s(z)= R^\modal_X(s\circ \mreturn^\modal_A)(z)$ +is also modal. +Thus, it suffices to find a function of type +\begin{equation*} +\prd{a:A}s(\mreturn^\modal_A(a))= \ind{\modal}(s\circ \mreturn^\modal_A)(\mreturn^\modal_A(a)) +\end{equation*} +which follows from \cref{defn:modality}\ref{item:modal3}. +\end{proof} + +In particular, for every type $A$ and every modal type $B$, we have an equivalence $(\modal A\to B)\eqvsym (A\to B)$. + +\begin{cor} + For any modality $\modal$, the $\modal$-modal types form a reflective subuniverse satisfying the equivalent conditions of \cref{thm:modal-char}. +\end{cor} + +Thus, modalities can be identified with reflective subuniverses closed under $\Sigma$-types. +The name \emph{modality} comes, of course, from \emph{modal logic}\index{modal!logic}, which studies logic where we can form statements such as ``possibly $A$'' (usually written $\diamond A$) or ``necessarily $A$'' (usually written $\Box A$). +The symbol $\modal$ is somewhat common for an arbitrary modal operator\index{modal!operator}. % (rather than a specific one such as $\diamond$ or $\Box$). +Under the propositions-as-types principle, a modality in the sense of modal logic corresponds to an operation on \emph{types}, and \cref{defn:modality} seems a reasonable candidate for how such an operation should be defined. +(More precisely, we should perhaps call these \emph{idempotent, monadic} modalities; see the Notes.) +\index{idempotent!modality}% +As mentioned in \cref{subsec:when-trunc}, we may in general use adverbs\index{adverb} to speak informally about such modalities, such as ``merely''\index{merely} for the propositional truncation and ``purely''\index{purely} for the identity modality +\index{identity!modality}% +\index{modality!identity}% +(i.e.\ the one defined by $\modal A \defeq A$). + +For any modality $\modal$, we define a map $f:A\to B$ to be \define{$\modal$-connected} +\indexdef{function!.circle-connected@$\modal$-connected}% +\indexdef{.circle-connected function@$\modal$-connected function}% +if $\modal(\hfib f b)$ is contractible for all $b:B$, and to be \define{$\modal$-truncated} +\indexdef{function!.circle-truncated@$\modal$-truncated}% +\indexdef{.circle-truncated function@$\modal$-truncated function}% +if $\hfib f b$ is modal for all $b:B$. +All of the theory of \cref{sec:connectivity,sec:image-factorization} which doesn't involve relating $n$-types for different values of $n$ applies verbatim in this generality. +\index{orthogonal factorization system}% +\index{unique!factorization system}% +In particular, we have an orthogonal factorization system. + +An important class of modalities which does \emph{not} include the $n$-trun\-ca\-tions is the \emph{left exact} modalities: those for which the functor $\modal$ preserves pullbacks as well as finite products. +\index{topology!Lawvere-Tierney}% +These are a categorification of ``Lawvere-Tierney\index{Lawvere}\index{Tierney} topologies'' in elementary topos\index{topos} theory, +and correspond in higher-categorical semantics to sub-$(\infty,1)$-toposes. +\index{.infinity1-topos@$(\infty,1)$-topos}% +However, this is beyond the scope of this book. + +Some particular examples of modalities other than $n$-truncation can be found in the exercises. + +\index{modality|)} + +\sectionNotes + +The notion of homotopy $n$-type in classical homotopy theory is quite old. +It was Voevodsky who realized that the notion can be defined recursively in homotopy type theory, starting from contractibility. + +\index{axiom!Streicher's Axiom K}% +The property ``Axiom K'' was so named by Thomas Streicher, as a property of identity types which comes after J, the latter being the traditional name for the eliminator of identity types. +\cref{thm:hedberg} is due to Hedberg~\cite{hedberg1998coherence}; \cite{krausgeneralizations} contains more information and generalizations. + +The notions of $n$-connected spaces and functions are also classical in homotopy theory, although as mentioned before, our indexing for connectedness of functions is off by one from the classical indexing. +The importance of the resulting factorization system has been emphasized by recent work in higher topos theory by Rezk, Lurie, and others.% +\index{.infinity1-topos@$(\infty,1)$-topos} +In particular, the results of this chapter should be compared with~\cite[\S6.5.1]{lurie:higher-topoi}. +In \cref{sec:freudenthal}, the theory of $n$-connected maps will be crucial to our proof of the Freudenthal suspension theorem. + +Modal operators\index{modal!operator} in \emph{simple} type theory have been studied extensively; see e.g.~\cite{modalTT}. In the setting of dependent type theory, \cite{ab:bracket-types} treats the special case of propositional truncation ($(-1)$-truncation) as a modal operator\index{modal!operator}. The development presented here greatly extends and generalizes this work, while drawing also on ideas from topos theory.\index{topos} + +Generally, modal operators\index{modal!operator} come in (at least) two flavors: those such as $\diamond$ (``possibly'') for which $A\Rightarrow \diamond A$, and those such as $\Box$ (``necessarily'') for which $\Box A \Rightarrow A$. +When they are also \emph{idempotent} (i.e.\ $\diamond A = \diamond{\diamond A}$ or $\Box A = \Box{\Box A}$), the former may be identified with reflective subcategories (or equivalently, idempotent monads), and the latter with coreflective subcategories (or idempotent comonads). +\index{monad} +\index{comonad} +However, in dependent type theory it is trickier to deal with the comonadic sort, since they are more rarely stable under pullback, and thus cannot be interpreted as operations on the universe \UU. +Sometimes there are ways around this (see e.g.~\cite{QGFTinCHoTT12}), but for simplicity, here we stick to the monadic sort. + +On the computational side, monads (and hence modalities\index{modality}) are used to model computational effects in functional programming~\cite{Moggi89}.% +\index{programming}% +\index{computational effect} +A computation is said to be \emph{pure} if its execution results in no side effects (such as printing a message to the screen, playing music, or sending data over the Internet). +There exist ``purely functional'' programming languages, such as Haskell\index{Haskell}, in which it is technically only possible to write pure functions: side effects are represented by applying ``monads'' to output types. +For instance, a function of type $\mathsf{Int}\to\mathsf{Int}$ is pure, while a function of type $\mathsf{Int}\to \mathsf{IO}(\mathsf{Int})$ may perform input and output along the way to computing its result; the operation $\mathsf{IO}$ is a monad. +\index{purely}% +(This is the origin of our use of the adverb ``purely'' for the identity monad, since it corresponds computationally to pure functions with no side-effects.) +The modalities we have considered in this chapter are all idempotent, whereas those used in functional programming rarely are, but the ideas are still closely related. + + +\sectionExercises + +\begin{ex}\label{ex:all-types-sets}\ + \begin{enumerate} + \item Use \cref{thm:h-set-refrel-in-paths-sets} to show + that if $\brck{A}\to A$ for every type $A$, + then every type is a set. + \item Show that if every surjective function (purely) splits, + i.e.~if + % + \narrowequation{\prd{b:B}\brck{\hfib{f}{b}}\to\prd{b:B}\hfib{f}{b}} + % + for every $f:A\to B$, then every type is a set. + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:s2-colim-unit} + For this exercise, we consider the following general notion of colimit. + Define a \define{graph}\indexdef{graph} $\Gamma$ to consist of a type $\Gamma_0$ and a family $\Gamma_1 : \Gamma_0 \to \Gamma_0 \to \UU$. + A \define{diagram}\index{diagram} (of types) over a graph $\Gamma$ consists of a family $F:\Gamma_0 \to \UU$ together with for each $x,y:\Gamma_0$, a function $F_{x,y}:\Gamma_1(x,y) \to F(x) \to F(y)$. + The \define{colimit}\index{colimit!of types} of such a diagram is the higher inductive type $\colim(F)$ generated by + \begin{itemize} + \item for each $x:\Gamma_0$, a function $\inc_x:F(x) \to \colim(F)$, and + \item for each $x,y:\Gamma_0$ and $\gamma:\Gamma_1(x,y)$ and $a:F(x)$, a path $\inc_y(F_{x,y}(\gamma,a)) = \inc_x(a)$. + \end{itemize} + There are more general kinds of colimits as well (see e.g.\ \cref{ex:s2-colim-unit-2}), but this is good enough for many purposes. + \begin{enumerate} + \item Exhibit a graph $\Gamma$ such that colimits of $\Gamma$-diagrams can be identified with pushouts as defined in \cref{sec:colimits}. + In other words, each span should induce a diagram over $\Gamma$ whose colimit is the pushout of the span. + \item Exhibit a graph $\Gamma$ and a diagram $F$ over $\Gamma$ such that $F(x)=\unit$ for all $x$, but such that $\colim(F)=\Sn^2$. + Note that $\unit$ is a $(-2)$-type, while $\Sn^2$ is not expected to be an $n$-type for any finite $n$. + See also \cref{ex:s2-colim-unit-2}. + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:ntypes-closed-under-wtypes} + Show that if $A$ is an $n$-type and $B:A\to \ntype{n}$ is a family of $n$-types, where $n\ge -1$, then the $W$-type $\wtype{a:A} B(a)$ (see \cref{sec:w-types}) is also an $n$-type. +\end{ex} + +\begin{ex}\label{ex:connected-pointed-all-section-retraction} + Use \cref{prop:nconn_fiber_to_total} to extend \cref{thm:connected-pointed} to any section-retraction pair. +\end{ex} + +\begin{ex}\label{ex:ntype-from-nconn-const} + Show that \cref{thm:nconn-to-ntype-const} also works as a characterization in the other direction: $B$ is an $n$-type if and only if every map into $B$ from an $n$-con\-nect\-ed type is constant. + Ideally, your proof should work for any modality as in \cref{sec:modalities}. +\end{ex} + +\begin{ex}\label{ex:connectivity-inductively} + Prove that for $n\ge -1$, a type $A$ is $n$-connected if and only if it is merely inhabited and for all $a,b:A$ the type $\id[A]ab$ is $(n-1)$-connected. + Thus, since every type is $(-2)$-connected, $n$-connectedness of types can be defined inductively using only propositional truncations. + (In particular, $A$ is 0-connected if and only if $\brck{A}$ and $\prd{a,b:A} \brck{a=b}$.) +\end{ex} + +\begin{ex}\label{ex:lemnm} + \indexdef{excluded middle!LEMnm@$\LEM{n,m}$}% + For $-1\le n,m \le\infty$, let $\LEM{n,m}$ denote the statement + \[ \prd{A:\ntype{n}} \trunc m{A + \neg A},\] + where $\ntype{\infty} \defeq \type$ and $\trunc{\infty}{X}\defeq X$. + Show that: + \begin{enumerate} + \item If $n=-1$ or $m=-1$, then $\LEM{n,m}$ is equivalent to $\LEM{}$ from \cref{sec:intuitionism}. + \item If $n\ge 0$ and $m\ge 0$, then $\LEM{n,m}$ is inconsistent with univalence. + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:acnm} + \indexdef{axiom!of choice!ACnm@$\choice{n,m}$}% + For $-1\le n,m\le\infty$, let $\choice{n,m}$ denote the statement + \[ \prd{X:\set}{Y:X\to\ntype{n}} + \Parens{\prd{x:X} \trunc m{Y(x)}} + \to + \Trunc m{\prd{x:X} Y(x)}, + \] + with conventions as in \cref{ex:lemnm}. + Thus $\choice{0,-1}$ is the axiom of choice from \cref{sec:axiom-choice}, + while $\choice{\infty,\infty}$ is the identity function. + (If we had formulated $\choice{n,m}$ analogously to \eqref{eq:ac} + rather than \eqref{eq:epis-split}, + $\choice{\infty,\infty}$ would be like \cref{thm:ttac}.) + It is known that $\choice{\infty,-1}$ is consistent with univalence, since it holds in Voevodsky's simplicial model. + \begin{enumerate} + \item Without using univalence, show that $\LEM{n,\infty}$ implies $\choice{n,m}$ for all $m$. + (On the other hand, in \cref{subsec:emacinsets} we will show that $\choice{}=\choice{0,-1}$ implies $\LEM{}=\LEM{-1,-1}$.) + \item Of course, $\choice{n,m}\Rightarrow \choice{k,m}$ if $k\le n$. + Are there any other implications between the principles $\choice{n,m}$? + Is $\choice{n,m}$ consistent with univalence for any $m\ge 0$ and any $n$? + (These are open questions.)\index{open!problem} + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:acnm-surjset} + Show that $\choice{n,-1}$ implies that for any $n$-type $A$, there merely exists a set $B$ and a surjection $B\to A$. +\end{ex} + +\begin{ex}\label{ex:acconn} + Define the \define{$n$-connected axiom of choice} + \indexdef{n-connected@$n$-connected!axiom of choice}% + \indexdef{axiom!of choice!n-connected@$n$-connected}% + to be the statement + \begin{quote} + If $X$ is a set and $Y:X\to \type$ is a family of types such that each $Y(x)$ is $n$-connected, then $\prd{x:X} Y(x)$ is $n$-connected. + \end{quote} + Note that the $(-1)$-connected axiom of choice is $\choice{\infty,-1}$ from \cref{ex:acnm}. + \begin{enumerate} + \item Prove that the $(-1)$-connected axiom of choice implies the $n$-con\-nect\-ed axiom of choice for all $n\ge -1$. + \item Are there any other implications between the $n$-connected axioms of choice and the principles $\choice{n,m}$? + (This is an open question.)\index{open!problem} + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:n-truncation-not-left-exact} + Show that the $n$-truncation modality is not left exact for any $n\ge -1$. + That is, exhibit a pullback which it fails to preserve. +\end{ex} + +\begin{ex}\label{ex:double-negation-modality} + Show that $X\mapsto (\neg\neg X)$ is a modality.\index{modal!operator}% +\end{ex} + +\begin{ex}\label{ex:prop-modalities} + Let $P$ be a mere proposition. + \begin{enumerate} + \item Show that $X\mapsto (P\to X)$ is a left exact modality. + This is called the \define{open modality} + \indexdef{open!modality}% + \indexdef{modality!open}% + associated to $P$. + \item Show that $X\mapsto P*X$ is a left exact modality, where $*$ denotes the join (see \cref{sec:colimits}). + This is called the \define{closed modality} + \indexdef{closed!modality}% + \indexdef{modality!closed}% + associated to $P$. + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:f-local-type} + Let $f:A\to B$ be a map; a type $Z$ is \define{$f$-local} + \indexdef{f-local type@$f$-local type}% + \indexdef{type!f-local@$f$-local}% + if $(\blank\circ f):(B\to Z) \to (A\to Z)$ is an equivalence. + \begin{enumerate} + \item Prove that the $f$-local types form a reflective subuniverse. + You will want to use a higher inductive type to define the reflector (localization). + \item Prove that if $B=\unit$, then this subuniverse is a modality. + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:trunc-spokes-no-hub} + Show that in contrast to \cref{rmk:spokes-no-hub}, we could equivalently define $\trunc nA$ to be generated by a function $\tprojf n : A \to \trunc n A$ together with for each $r:\Sn^{n+1} \to \trunc n A$ and each $x:\Sn^{n+1}$, a path $s_r(x):r(x) = r(\base)$. +\end{ex} + +\begin{ex}\label{ex:s2-colim-unit-2} + In this exercise, we consider a slightly fancier notion of colimit than in \cref{ex:s2-colim-unit}. + Define a \define{graph with composition}\indexdef{graph!with composition} $\Gamma$ to be a graph as in \cref{ex:s2-colim-unit} together with for each $x,y,z:\Gamma_0$, a function $\Gamma_1(y,z) \to \Gamma_1(x,y) \to \Gamma_1(x,z)$, written as $\delta\mapsto\gamma \mapsto \delta \circ \gamma$. + (For instance, any precategory as in \cref{cha:category-theory} is a graph with composition.) + A \define{diagram}\index{diagram} $F$ over a graph with composition $\Gamma$ consists of a diagram over the underlying graph, together with for each $x,y,z:\Gamma_0$ and $\gamma:\Gamma_1(x,y)$ and $\delta:\Gamma_1(y,z)$, a homotopy $\cmp_{x,y,z}(\delta,\gamma) : F_{y,z}(\delta) \circ F_{x,y}(\gamma) \htpy F_{x,z}(\delta\circ\gamma)$. + The \define{colimit}\index{colimit!of types} of such a diagram is the higher inductive type $\colim(F)$ generated by + \begin{itemize} + \item for each $x:\Gamma_0$, a function $\inc_x:F(x) \to \colim(F)$, + \item for each $x,y:\Gamma_0$ and $\gamma:\Gamma_1(x,y)$ and $a:F(x)$, a path $\glue_{x,y}(\gamma,a) : \inc_y(F_{x,y}(\gamma,a)) = \inc_x(a)$, and + \item for each $x,y,z:\Gamma_0$ and $\gamma:\Gamma_1(x,y)$ and $\delta:\Gamma_1(y,z)$ and $a:F(x)$, a path + \[ \ap{\inc_z}{\cmp_{x,y,z}(\delta,\gamma,a)} \ct \glue_{x,z}(\delta\circ \gamma,a) = \glue_{y,z}(\delta,F_{x,y}(\gamma,a)) \ct \glue_{x,y}(\gamma,a). \] + \end{itemize} + (This is a ``second-order approximation'' to a fully homotopy-theoretic notions of diagram and colimit, which ought to involve ``coherence paths'' of this sort at all higher levels. + Defining such things in type theory is an important open problem.) + + Exhibit a graph with composition $\Gamma$ such that $\Gamma_0$ is a set and each type $\Gamma_1(x,y)$ is a mere proposition, and a diagram $F$ over $\Gamma$ such that $F(x)=\unit$ for all $x$, for which $\colim(F)=\Sn^2$. +\end{ex} + +\begin{ex}\label{ex:fiber-map-not-conn} + Comparing \cref{lem:nconnected_postcomp_variation,prop:nconn_fiber_to_total}, one might be tempted to conjecture that if $f:A\to B$ is $n$-connected and $g:\prd{a:A} P(a) \to Q(f(a))$ induces an $n$-connected map $\Parens{\sm{a:A} P(a)} \to \Parens{\sm{b:B} Q(b)}$, then $g$ is fiberwise $n$-connected. + Give a counterexample to show that this is false. + (In fact, when generalized to modalities, this property characterizes the left exact ones; see \cref{ex:prop-modalities}.) +\end{ex} + +\begin{ex}\label{ex:is-conn-trunc-functor} + Show that if $f : A \to B$ is $n$-connected, then $\trunc kf : \trunc kA \to \trunc kB$ is also $n$-connected. +\end{ex} + +\begin{ex}\label{ex:categorical-connectedness} + We say a type $A$ is \define{categorically connected} + \indexdef{connected!categorically} if for every types $B, C$ the canonical map + $e_{A, B, C}:((A\to B) + (A\to C)) \to (A \to B + C)$ defined by + \begin{align*} + e_{A,B,C}(\inl(g)) &\defeq \lam{x} \inl(g(x)),\\ + e_{A,B,C}(\inr(g)) &\defeq \lam{x} \inr(g(x)) + \end{align*} + is an equivalence. + \begin{enumerate} + \item Show that any connected type is categorically connected. + \item Show that all categorically connected types are connected if and only if $\LEM{}$ holds. (Hint: consider $A \defeq \Sigma P$ such that $\neg \neg P$ holds.) + \end{enumerate} +\end{ex} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "hott-online" +%%% End: diff --git a/homotopy.tex b/homotopy.tex new file mode 100644 index 0000000000000000000000000000000000000000..82c6a0386cc6b7ddfec9fa41846479272cf04b9d --- /dev/null +++ b/homotopy.tex @@ -0,0 +1,2892 @@ +\chapter{Homotopy theory} +\label{cha:homotopy} + +\index{acceptance|(} + +In this chapter, we develop some homotopy theory within type theory. We +use the \emph{synthetic approach} to homotopy theory introduced in +\cref{cha:basics}: Spaces, points, paths, and homotopies are basic +notions, which are represented by types and elements of types, particularly +the identity type. The algebraic structure of paths and homotopies is +represented by the natural $\infty$-groupoid +\index{.infinity-groupoid@$\infty$-groupoid}% +structure on types, which is generated +by the rules for the identity type. Using higher inductive types, as +introduced in \cref{cha:hits}, we can describe spaces directly by their +universal properties. + +\index{synthetic mathematics}% +There are several interesting aspects of this synthetic approach. +First, it combines advantages of concrete models (such as topological +spaces\index{topological!space} +or simplicial sets)\index{simplicial!sets} +with advantages of abstract categorical frameworks +for homotopy theory (such as Quillen model categories).\index{Quillen model category} + On the one hand, +our proofs feel elementary, and refer concretely to +points, paths, and homotopies in types. On the other hand, our approach nevertheless abstracts away from +any concrete presentation of these objects --- for example, +associativity of path concatenation is proved by path induction, rather +than by reparametrization of maps $[0,1] \to X$ or by horn-filling conditions. +Type theory seems to be a very convenient way to study the abstract homotopy theory +of $\infty$-groupoids: by using the rules for the identity type, we +can avoid the complicated combinatorics involved in many definitions of +$\infty$-groupoids, and explicate only as much of the +structure as is needed in any particular proof. + +The abstract nature of type theory means that our proofs apply automatically in a variety of settings. +In particular, as mentioned previously, homotopy type theory has one interpretation in +Kan\index{Kan complex} simplicial sets\index{simplicial!sets}, +which is one model for the homotopy theory of $\infty$-groupoids. Thus, +our proofs apply to this model, and transferring them along the geometric +realization\index{geometric realization} functor from simplicial sets to topological spaces gives +proofs of corresponding theorems in classical homotopy theory. +However, though the details are work in progress, we can also +interpret type theory in a wide variety of other categories +that look like the category of $\infty$-groupoids, such as +$(\infty,1)$-toposes\index{.infinity1-topos@$(\infty,1)$-topos}. +Thus, proving a result in type theory will show +that it holds in these settings as well. +This sort of extra generality is well-known as a property of ordinary categorical logic: +univalent foundations extends it to homotopy theory as well. + +Second, our synthetic approach has suggested new type-theoretic +methods and proofs. Some of our proofs are fairly +direct transcriptions of classical proofs. Others have a more +type-theoretic feel, and consist mainly of calculations with +$\infty$-groupoid operations, in a style that is very similar to how +computer scientists use type theory to reason about computer programs. +One thing that seems to have permitted these new proofs is the fact that type theory +emphasizes different aspects of homotopy theory than other approaches: +while tools like path induction and the universal properties of higher +inductives are available in a setting like Kan\index{Kan complex} simplicial sets, type +theory elevates their importance, because they are the \emph{only} +primitive tools available for working with these types. Focusing on +these tools had led to new descriptions of familiar constructions such +as the universal cover of the circle and the Hopf fibration, using just the +recursion principles for higher inductive types. These descriptions are +very direct, and many of the proofs in this chapter involve +computational calculations with such fibrations. +\index{mathematics!constructive}% +Another new aspect of our proofs is that they are constructive (assuming +univalence and higher inductives types are constructive); we describe an +application of this to homotopy groups of spheres in +\cref{sec:moreresults}. + +\index{mathematics!formalized}% +\indexsee{formalization of mathematics}{mathematics, formalized}% +Third, our synthetic approach is very amenable to computer-checked +proofs in proof assistants\index{proof!assistant} such as \Coq and \Agda. +Almost all of the proofs +described in this chapter have been computer-checked, and many of these +proofs were first given in a proof assistant, and then ``unformalized'' +for this book. The computer-checked proofs are comparable in length and +effort to the informal proofs presented here, and in some cases they are +even shorter and easier to do. + +\mentalpause + +Before turning to the presentation of our results, we briefly review some + basic concepts and theorems from homotopy theory for the benefit of the reader who is not familiar with them. + We also give an overview of the +results proved in this chapter. + +\index{classical!homotopy theory|(}% +Homotopy theory is a branch of algebraic topology, and uses tools from abstract algebra, +such as group theory, to investigate properties of spaces. One question +homotopy theorists investigate is how to tell whether two spaces are the +same, where ``the same'' means \emph{homotopy equivalence} +\index{homotopy!equivalence!topological}% +(continuous +maps back and forth that compose to the identity up to homotopy --- this +gives the opportunity to ``correct'' maps that don't exactly compose to +the identity). One common way to tell whether two spaces are the same +is to calculate \emph{algebraic invariants} associated with a space, +which include its \emph{homotopy groups} and \emph{homology} and +\emph{cohomology groups}. +\index{homology}% +\index{cohomology}% +Equivalent spaces have isomorphic +homotopy/(co)homology groups, so if two spaces have different groups, +then they are not equivalent. Thus, these algebraic invariants provide +global information about a space, which can be used to tell spaces +apart, and complements the local information provided by notions such as +continuity. For example, the torus locally looks like the $2$-sphere, but it +has a global difference, because it has a hole in it, and this difference +is visible in the homotopy groups of these two spaces. + +The simplest example of a homotopy group is the \emph{fundamental group} +\index{fundamental!group}% +of a space, which is written $\pi_1(X,x_0$): Given a space $X$ and a +point $x_0$ in it, one can make a group whose elements are loops at +$x_0$ (continuous paths from $x_0$ to $x_0$), considered up to homotopy, with the +group operations given by the identity path (standing still), path +concatenation, and path reversal. For example, the fundamental group of +the $2$-sphere is trivial, but the fundamental group of the torus is not, +which shows that the sphere and the torus are not homotopy equivalent. +The intuition is that every loop on the sphere is homotopic to the +identity, because its inside can be filled in. In contrast, a loop on +the torus that goes through the donut's hole is not homotopic to the +identity, so there are non-trivial elements in the fundamental group. + +\index{homotopy!group} +The \emph{higher homotopy groups} provide additional information about a +space. Fix a point $x_0$ in $X$, and consider the constant path +$\refl{x_0}$. Then the homotopy classes of homotopies between $\refl{x_0}$ +and itself form a group $\pi_2(X,x_0)$, which tells us something about +the two-dimensional structure of the space. Then $\pi_3(X,x_0$) is the +group of homotopy classes of homotopies between homotopies, and so on. +One of the basic problems of algebraic topology is +\emph{calculating the homotopy groups of a space $X$}, which means +giving a group isomorphism between $\pi_k(X,x_0)$ 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. As can be seen from +\cref{tab:homotopy-groups-of-spheres}, some patterns emerge in the +higher homotopy groups of spheres, but there is no general formula, and +many homotopy groups of spheres are currently still unknown. + +\bgroup +% Colors for the table of homotopy groups of spheres +\definecolor{xA}{\OPTcolormodel}{\OPTcolxA} +\definecolor{xB}{\OPTcolormodel}{\OPTcolxB} +\definecolor{xC}{\OPTcolormodel}{\OPTcolxC} +\definecolor{xD}{\OPTcolormodel}{\OPTcolxD} +\definecolor{xE}{\OPTcolormodel}{\OPTcolxE} +\definecolor{xF}{\OPTcolormodel}{\OPTcolxF} +\definecolor{xG}{\OPTcolormodel}{\OPTcolxG} +\definecolor{xH}{\OPTcolormodel}{\OPTcolxH} +\definecolor{xI}{\OPTcolormodel}{\OPTcolxI} +\definecolor{xJ}{\OPTcolormodel}{\OPTcolxJ} +\definecolor{xK}{\OPTcolormodel}{\OPTcolxK} +\definecolor{xL}{\OPTcolormodel}{\OPTcolxL} +\definecolor{xM}{\OPTcolormodel}{\OPTcolxM} + +\newcommand{\cA}{\colorbox{xG}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cB}{\colorbox{xH}{\hbox to 20pt {\hfil$\Z$\hfil}}} +\newcommand{\cC}{\colorbox{xI}{\hbox to 20pt {\hfil$\Z_{2}$\hfil}}} +\newcommand{\cD}{\colorbox{xJ}{\hbox to 20pt {\hfil$\Z_{2}$\hfil}}} +\newcommand{\cE}{\colorbox{xK}{\hbox to 20pt {\hfil$\Z_{24}$\hfil}}} +\newcommand{\cF}{\colorbox{xL}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cG}{\colorbox{xM}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cH}{\colorbox{xF}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cI}{\colorbox{xE}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cJ}{\colorbox{xD}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cK}{\colorbox{xC}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cL}{\colorbox{xB}{\hbox to 20pt {\hfil$0$\hfil}}} +\newcommand{\cM}{\colorbox{xA}{\hbox to 20pt {\hfil$0$\hfil}}} + +\begin{table}[htb] +\centering\small +\begin{tabular}{p{15pt}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}>{\centering\arraybackslash}p{\OPTspherescolwidth}} +\toprule + & $\Sn^0$ & $\Sn^1$ & $\Sn^{2}$ & $\Sn^{3}$ & $\Sn^{4}$ & $\Sn^{5}$ & $\Sn^{6}$ & $\Sn^{7}$ & $\Sn^{8}$ \\ \addlinespace[3pt] \midrule +$\pi_{1}$ & $0$ & $\Z$ & \cA & \cH & \cI & \cJ & \cK & \cL & \cM \\ \addlinespace[3pt] +$\pi_{2}$ & $0$ & $0$ & \cB & \cA & \cH & \cI & \cJ & \cK & \cL \\ \addlinespace[3pt] +$\pi_{3}$ & $0$ & $0$ & $\Z$ & \cB & \cA & \cH & \cI & \cJ & \cK \\ \addlinespace[3pt] +$\pi_{4}$ & $0$ & $0$ & $\Z_{2}$ & \cC & \cB & \cA & \cH & \cI & \cJ \\ \addlinespace[3pt] +$\pi_{5}$ & $0$ & $0$ & $\Z_{2}$ & $\Z_{2}$ & \cC & \cB & \cA & \cH & \cI \\ \addlinespace[3pt] +$\pi_{6}$ & $0$ & $0$ & $\Z_{12}$ & $\Z_{12}$ & \cD & \cC & \cB & \cA & \cH \\ \addlinespace[3pt] +$\pi_{7}$ & $0$ & $0$ & $\Z_{2}$ & $\Z_{2}$ & {\footnotesize $\Z {\times} \Z_{12}$} & \cD & \cC & \cB & \cA \\ \addlinespace[3pt] +$\pi_{8}$ & $0$ & $0$ & $\Z_{2}$ & $\Z_{2}$ & $\Z_{2}^{2}$ & \cE & \cD & \cC & \cB \\ \addlinespace[3pt] +$\pi_{9}$ & $0$ & $0$ & $\Z_{3}$ & $\Z_{3}$ & $\Z_{2}^{2}$ & $\Z_{2}$ & \cE & \cD & \cC \\ \addlinespace[3pt] +$\pi_{10}$ & $0$ & $0$ & $\Z_{15}$ & $\Z_{15}$ & \footnotesize{$\Z_{24} {\times} \Z_{3}$} & $\Z_{2}$ & \cF & \cE & \cD \\ \addlinespace[3pt] +$\pi_{11}$ & $0$ & $0$ & $\Z_{2}$ & $\Z_{2}$ & $\Z_{15}$ & $\Z_{2}$ & $\Z$ & \cF & \cE \\ \addlinespace[3pt] +$\pi_{12}$ & $0$ & $0$ & $\Z_{2}^{2}$ & $\Z_{2}^{2}$ & $\Z_{2}$ & $\Z_{30}$ & $\Z_{2}$ & \cG & \cF \\ \addlinespace[3pt] +$\pi_{13}$ & $0$ & $0$ & {\footnotesize $\Z_{12} {\times} \Z_{2}$} & {\footnotesize $\Z_{12} {\times} \Z_{2}$} & $\Z_{2}^{3}$ & $\Z_{2}$ & $\Z_{60}$ & $\Z_{2}$ & \cG \\ \addlinespace[3pt] +%$\pi_{14}$ & $0$ & $0$ & $\Z_{84} {\times} \Z_{2}^{2}$ & $\Z_{84} {\times} \Z_{2}^{2}$ & {\footnotesize $\Z_{120} {\times} \Z_{12} {\times} \Z_{2}$} & $\Z_{2}^{3}$ & $\Z_{24} {\times} \Z_{2}$ & $\Z_{120}$ & $\Z_{2}$ \\ \addlinespace[3pt] +%$\pi_{15}$ & $0$ & $0$ & $\Z_{2}^{2}$ & $\Z_{2}^{2}$ & $\Z_{84} {\times} \Z_{2}^{5}$ & $\Z_{72} {\times} \Z_{2}$ & $\Z_{2}^{3}$ & $\Z_{2}^{3}$ & $\Z {\times} \Z_{120}$ \\ \addlinespace[3pt] +\bottomrule +\end{tabular} + +\caption{Homotopy groups of spheres~\cite{wikipedia-groups}.\index{homotopy!group!of sphere} +The $k^{\textrm{th}}$ homotopy group $\pi_k$ of the $n$-dimensional sphere +$\Sn^n$ is isomorphic to the group listed in each entry, where $\Z$ is +the additive group of integers,\index{integers} and $\Z_{m}$ is the cyclic group\index{group!cyclic}\index{cyclic group} of order~$m$. +} +\label{tab:homotopy-groups-of-spheres} +\end{table} +\egroup + + +One way of understanding this complexity is through the correspondence +between spaces and $\infty$-groupoids +\index{.infinity-groupoid@$\infty$-groupoid}% +introduced in \cref{cha:basics}. +As discussed in \cref{sec:circle}, the 2-sphere is presented by a higher +inductive type with one point and one 2-dimensional loop. Thus, one +might wonder why $\pi_3(\Sn ^2)$ is $\Z$, when the type $\Sn ^2$ has no +generators creating 3-dimensional cells. It turns out that the +generating element of $\pi_3(\Sn ^2)$ is constructed using the +interchange law described in the proof of \cref{thm:EckmannHilton}: the +algebraic structure of an $\infty$-groupoid includes non-trivial +interactions between levels, and these interactions create elements of +higher homotopy groups. + +\index{classical!homotopy theory|)}% + +Type theory provides a natural setting for investigating this structure, as +we can easily define the higher homotopy groups. Recall from \cref{def:loopspace} that for $n:\N$, the +$n$-fold iterated loop space\index{loop space!iterated} of a pointed type $(A,a)$ is defined +recursively by: +\begin{align*} + \Omega^0(A,a)&=(A,a)\\ + \Omega^{n+1}(A,a)&=\Omega^n(\Omega(A,a)). +\end{align*} +% +This gives a \emph{space} (i.e.\ a type) of $n$-dimensional loops\index{loop!n-@$n$-}, which itself has +higher homotopies. We obtain the set of $n$-dimensional loops by +truncation (this was also defined as an example in +\cref{sec:free-algebras}): + +\begin{defn}[Homotopy Groups]\label{def-of-homotopy-groups} + Given $n\ge 1$ and $(A,a)$ a pointed type, we define the \define{homotopy groups} of $A$ + \indexdef{homotopy!group}% + at $a$ by + \[\pi_n(A,a)\defeq \Trunc0{\Omega^n(A,a)}\] +\end{defn} + +\noindent +Since $n\ge 1$, the path concatenation and inversion operations on +$\Omega^n(A)$ induce operations on $\pi_n(A)$ making it into a group in +a straightforward way. If $n\ge 2$, then the group $\pi_n(A)$ is +abelian\index{group!abelian}, by the Eckmann--Hilton argument \index{Eckmann--Hilton argument} (\cref{thm:EckmannHilton}). +It is convenient to also write $\pi_0(A) \defeq \trunc0 A$, +but this case behaves somewhat differently: not only is it not a group, +it is defined without reference to any basepoint in $A$. + +\index{presentation!of an infinity-groupoid@of an $\infty$-groupoid}% +This definition is a suitable one for investigating homotopy groups +because the (higher) inductive definition of a type $X$ presents $X$ as +a free type, analogous to a free $\infty$-groupoid, +\index{.infinity-groupoid@$\infty$-groupoid}% +and this +presentation \emph{determines} but does not \emph{explicitly describe} +the higher identity types of $X$. The identity types are populated by +both the generators ($\lloop$, for the circle) and the results of applying to them all of the groupoid +operations (identity, composition, inverses, associativity, interchange, +\ldots). Thus, the higher-inductive presentation of a space allows us +to pose the question ``what does the identity type of $X$ really turn out +to be?'' though it can take some significant mathematics to answer it. +This is a higher-dimensional generalization of a familiar fact in type +theory: characterizing the identity type of $X$ can take some work, +even if $X$ is an ordinary inductive type, such as the natural numbers +or booleans. For example, the theorem that $\bfalse$ is different +from $\btrue$ does not follow immediately from the definition; +see \cref{sec:compute-coprod}. + +\index{univalence axiom}% +The univalence axiom plays an essential role in calculating homotopy +groups (without univalence, type theory is compatible with an +interpretation where all paths, including, for example, the loop on the +circle, are reflexivity). We will see this in the calculation of the +fundamental group of the circle below: the map from $\Omega(\Sn^1)$ to $\Z$ is defined by mapping a loop on the circle to an +automorphism\index{automorphism!of Z, successor@of $\Z$, successor} of the set $\Z$, so that, for example, $\lloop \ct \opp +\lloop$ is sent to $\mathsf{successor} \ct \mathsf{predecessor}$ (where +$\mathsf{successor}$ and $\mathsf{predecessor}$ are automorphisms of +$\Z$ viewed, by univalence, as paths in the universe), and then applying +the automorphism to 0. Univalence produces non-trivial paths in the +universe, and this is used to extract information from paths in higher +inductive types. + +In this chapter, we first calculate some homotopy groups of spheres, +including $\pi_k(\Sn ^1)$ (\cref{sec:pi1-s1-intro}), $\pi_{k}(\Sn +^n)$ for $k1$, so we will actually have calculated \emph{all} the homotopy groups of $\Sn^1$. + +\subsection{Getting started} +\label{sec:pi1s1-initial-thoughts} + +It is not too hard to define functions in both directions between $\Omega(\Sn^1)$ and \Z. +By specializing \cref{thm:looptothe} to $\lloop:\base=\base$, we have a function $\lloop^{\blank} : \Z \rightarrow (\id{\base}{\base})$ defined (loosely speaking) by +\[ + \lloop^n = + \begin{cases} + \underbrace{\lloop \ct \lloop \ct \cdots \ct \lloop}_{n} & \text{if $n > 0$,} \\ + \underbrace{\opp \lloop \ct \opp \lloop \ct \cdots \ct \opp \lloop}_{-n} & \text{if $n < 0$,} \\ + \refl{\base} & \text{if $n = 0$.} +\end{cases} +\] +% +Defining a function $g:\Omega(\Sn^1)\to\Z$ in the other direction is a bit trickier. +Note that the successor function $\Zsuc:\Z\to\Z$ is an equivalence, +\index{successor!isomorphism on Z@isomorphism on $\Z$}% +and hence induces a path $\ua(\Zsuc):\Z=\Z$ in the universe \type. +Thus, the recursion principle of $\Sn^1$ induces a map $c:\Sn^1\to\type$ by $c(\base)\defeq \Z$ and $\apfunc c (\lloop) \defid \ua(\Zsuc)$. +Then we have $\apfunc{c} : (\base=\base) \to (\Z=\Z)$, and we can define $g(p)\defeq \transfib{X\mapsto X}{\apfunc{c}(p)}{0}$. + +With these definitions, we can even prove that $g(\lloop^n)=n$ for any $n:\Z$, using the induction principle \cref{thm:sign-induction} for $n$. +(We will prove something more general a little later on.) +However, the other equality $\lloop^{g(p)}=p$ is significantly harder. +The obvious thing to try is path induction, but path induction does not apply to loops such as $p:(\base=\base)$ that have \emph{both} endpoints fixed! +A new idea is required, one which can be explained both in terms of classical homotopy theory and in terms of type theory. +We begin with the former. + + +\subsection{The classical proof} +\label{sec:pi1s1-classical-proof} + +\index{classical!homotopy theory|(}% +In classical homotopy theory, there is a standard proof of $\pi_1(\Sn^1)=\Z$ using universal covering spaces. +Our proof can be regarded as a type-theoretic version of this proof, with covering spaces appearing here as fibrations whose fibers are sets. +\index{fibration}% +\index{total!space}% +Recall that \emph{fibrations} over a space $B$ in homotopy theory correspond to type families $B\to\type$ in type theory. +\index{path!fibration}% +\index{fibration!of paths}% +In particular, for a point $x_0:B$, the type family $(x\mapsto (x_0=x))$ corresponds to the \emph{path fibration} $P_{x_0} B \to B$, in which the points of $P_{x_0} B$ are paths in $B$ starting at $x_0$, and the map to $B$ selects the other endpoint of such a path. +This total space $P_{x_0} B$ is contractible, since we can ``retract'' any path to its initial endpoint $x_0$ --- we have seen the type-theoretic version of this as \cref{thm:contr-paths}. +Moreover, the fiber over $x_0$ is the loop space\index{loop space} $\Omega(B,x_0)$ --- in type theory this is obvious by definition of the loop space. + +\begin{figure}\centering + \begin{tikzpicture}[xscale=1.4,yscale=.6] + \node (R) at (2,1) {$\mathbb{R}$}; + \node (S1) at (2,-2) {$S^1$}; + \draw[->] (R) -- node[auto] {$w$} (S1); + \draw (0,-2) ellipse (1 and .4); + \draw[dotted] (1,0) arc (0:-30:1 and .8); + \draw (1,0) arc (0:90:1 and .8) arc (90:270:1 and .3) coordinate (t1); + \draw[white,line width=4pt] (t1) arc (-90:90:1 and .8); + \draw (t1) arc (-90:90:1 and .8) arc (90:270:1 and .3) coordinate (t2); + \draw[white,line width=4pt] (t2) arc (-90:90:1 and .8); + \draw (t2) arc (-90:90:1 and .8) arc (90:270:1 and .3) coordinate (t3); + \draw[white,line width=4pt] (t3) arc (-90:90:1 and .8); + \draw (t3) arc (-90:-30:1 and .8) coordinate (t4); + \draw[dotted] (t4) arc (-30:0:1 and .8); + \node[fill,circle,inner sep=1pt,label={below:\scriptsize \base}] at (0,-2.4) {}; + \node[fill,circle,inner sep=1pt,label={above left:\scriptsize 0}] at (0,.2) {}; + \node[fill,circle,inner sep=1pt,label={above left:\scriptsize 1}] at (0,1.2) {}; + \node[fill,circle,inner sep=1pt,label={above left:\scriptsize 2}] at (0,2.2) {}; + \end{tikzpicture} + \caption{The winding map in classical topology}\label{fig:winding} +\end{figure} + +Now in classical homotopy theory, where $\Sn^1$ is regarded as a topological space, we may proceed as follows. +\index{winding!map}% +Consider the ``winding'' map $w:\mathbb{R}\to \Sn ^1$, which looks like a helix projecting down onto the circle (see \cref{fig:winding}). +This map $w$ sends each point on the helix\index{helix} to the point on the circle that it is ``sitting above''. +It is a fibration, and the fiber over each point is isomorphic to the integers.\index{integers} +If we lift the path that goes counterclockwise around the loop on the bottom, we go up one level in the helix, incrementing the integer in the fiber. +Similarly, going clockwise around the loop on the bottom corresponds to going down one level in the helix, decrementing this count. +This fibration is called the \emph{universal cover} of the circle. +\index{universal!cover}% +\index{cover!universal}% +\index{covering space!universal}% + +Now a basic fact in classical homotopy theory is that a map $E_1\to E_2$ of fibrations over $B$ which is a homotopy equivalence between $E_1$ and $E_2$ induces a homotopy equivalence on all fibers. +(We have already seen the type-theoretic version of this as well in \cref{thm:total-fiber-equiv}.) +Since $\mathbb{R}$ and $P_{\base} S^1$ are both contractible topological spaces, they are homotopy equivalent, and thus their fibers $\Z$ and $\Omega(\Sn ^1)$ over the basepoint are also homotopy equivalent. + +\index{classical!homotopy theory|)}% + +\subsection{The universal cover in type theory} +\label{sec:pi1s1-universal-cover} + +\index{universal!cover|(}% +\index{cover!universal|(}% +\index{covering space!universal|(}% + +Let us consider how we might express the preceding proof in type theory. +We have already remarked that the path fibration of $\Sn^1$ is represented by the type family $(x\mapsto (\base=x))$. +We have also already seen a good candidate for the universal cover of $\Sn^1$: it's none other than the type family $c:\Sn^1\to\type$ which we defined in \cref{sec:pi1s1-initial-thoughts}! +By definition, the fiber of this family over $\base$ is $\Z$, while the effect of transporting around $\lloop$ is to add one --- thus it behaves just as we would expect from \cref{fig:winding}. + +However, since we don't know yet that this family behaves like a universal cover is supposed to (for instance, that its total space is simply connected), we use a different name for it. +For reference, therefore, we repeat the definition. +\index{integers} + +\begin{defn}[Universal Cover of $\Sn^1$] \label{S1-universal-cover} + Define $\code : \Sn ^1 \to \type$ by circle-recursion, with + \begin{align*} + \code(\base) &\defeq \Z \\ + \apfunc{\code}({\lloop}) &\defid \ua(\Zsuc). + \end{align*} +\end{defn} + +We emphasize briefly the definition of this family, since it is so different from how one usually defines covering spaces in classical homotopy theory. +To define a function by circle recursion, we need to find a point and a +loop in the codomain. In this case, the codomain is $\type$, and the point +we choose is $\Z$, corresponding to our expectation that the +fiber of the universal cover should be the integers. The loop we choose +is the successor/predecessor +\index{successor!isomorphism on Z@isomorphism on $\Z$}% +\index{predecessor!isomorphism on Z@isomorphism on $\Z$}% +isomorphism on $\Z$, which +corresponds to the fact that going around the loop in the base goes up +one level on the helix. Univalence is necessary for this part of the +proof, because we need to convert a \emph{non-trivial} equivalence on $\Z$ into an identity. + +We call this the fibration of ``codes'', because its elements are combinatorial data that act as codes for paths on the circle: the integer $n$ codes for the path which loops around the circle $n$ times. + +From this definition, it is simple to calculate that transporting with +$\code$ takes $\lloop$ to the successor function, and +$\opp{\lloop}$ to the predecessor function: +\begin{lem} \label{lem:transport-s1-code} +\id{\transfib \code \lloop x} {x + 1} and +\id{\transfib \code {\opp \lloop} x} {x - 1}. +\end{lem} +\begin{proof} +For the first equation, we calculate as follows: +\begin{align} +{\transfib \code \lloop x} +&= \transfib {A \mapsto A} {(\ap{\code}{\lloop})} x \tag{by \cref{thm:transport-compose}}\\ +&= \transfib {A \mapsto A} {\ua (\Zsuc)} x \tag{by computation for $\rec{\Sn^1}$}\\ +&= x + 1 \tag{by computation for \ua}. +\end{align} +The second equation follows from the first, because $\transfib{B}{p}{\blank}$ and $\transfib{B}{\opp p}{\blank}$ are always inverses, so $\transfib\code {\opp \lloop}{\blank}$ must be the inverse of $\Zsuc$. +\end{proof} + +We can now see what was wrong with our first approach: we defined $f$ and $g$ only on the fibers $\Omega(\Sn^1)$ and \Z, when we should have defined a whole morphism \emph{of fibrations} over $\Sn^1$. +In type theory, this means we should have defined functions having types +\begin{align} + \prd{x:\Sn^1} &((\base=x) \to \code(x)) \qquad\text{and/or} \label{eq:pi1s1-encode}\\ + \prd{x:\Sn^1} &(\code(x) \to (\base=x))\label{eq:pi1s1-decode} +\end{align} +instead of only the special cases of these when $x$ is \base. +This is also an instance of a common observation in type theory: when attempting to prove something about particular inhabitants of some inductive type, it is often easier to generalize the statement so that it refers to \emph{all} inhabitants of that type, which we can then prove by induction. +Looked at in this way, the proof of $\Omega(\Sn^1)=\Z$ fits into the same pattern as the characterization of the identity types of coproducts and natural numbers in \cref{sec:compute-coprod,sec:compute-nat}. + +At this point, there are two ways to finish the proof. +We can continue mimicking the classical argument by constructing~\eqref{eq:pi1s1-encode} or~\eqref{eq:pi1s1-decode} (it doesn't matter which), proving that a homotopy equivalence between total spaces induces an equivalence on fibers, and then that the total space of the universal cover is contractible. +The first type-theoretic proof of $\Omega(\Sn^1)=\Z$ followed this pattern; we call it the \emph{homotopy-theoretic} proof. + +Later, however, we discovered that there is an alternative proof, which has a more type-theoretic feel and more closely follows the proofs in \cref{sec:compute-coprod,sec:compute-nat}. +In this proof, we directly construct both~\eqref{eq:pi1s1-encode} and~\eqref{eq:pi1s1-decode}, and prove that they are mutually inverse by calculation. +We will call this the \emph{encode-decode} proof, because we call the functions~\eqref{eq:pi1s1-encode} and~\eqref{eq:pi1s1-decode} \emph{encode} and \emph{decode} respectively. +Both proofs use the same construction of the cover given above. +Where the classical proof induces an equivalence on fibers from an equivalence between total spaces, the encode-decode proof constructs the inverse map (\emph{decode}) explicitly as a map between fibers. +And where the classical proof uses contractibility, the encode-decode proof uses path induction, circle induction, and integer induction. +These are the same tools used to prove contractibility --- indeed, path induction \emph{is} essentially contractibility of the path fibration composed with $\mathsf{transport}$ --- but they are applied in a different way. + +Since this is a book about homotopy type theory, we present the encode-decode proof first. +A homotopy theorist who gets lost is encouraged to skip to the homotopy-theoretic proof (\cref{subsec:pi1s1-homotopy-theory}). + +\index{universal!cover|)}% +\index{cover!universal|)}% +\index{covering space!universal|)}% + +\subsection{The encode-decode proof} +\label{subsec:pi1s1-encode-decode} + +\index{encode-decode method|(}% +\indexsee{encode}{encode-decode method}% +\indexsee{decode}{encode-decode method}% +We begin with the function~\eqref{eq:pi1s1-encode} that maps paths to codes: +\begin{defn} +Define $\encode : \prd{x : \Sn ^1} (\base=x) \rightarrow \code(x)$ by +\[ +\encode \: p \defeq \transfib{\code} p 0 +\] +(we leave the argument $x$ implicit). +\end{defn} +Encode is defined by lifting a path into the universal cover, which +determines an equivalence, and then applying the resulting equivalence +to $0$. +The interesting thing about this function is that it computes a concrete +number from a loop on the circle, when this loop is represented using +the abstract groupoidal framework of homotopy type theory. To gain an +intuition for how it does this, observe that by the above lemmas, +$\transfib \code \lloop x$ is the successor map and $\transfib \code {\opp + \lloop} x$ is the predecessor map. +Further, $\mathsf{transport}$ is functorial (\cref{cha:basics}), so +$\transfib{\code} {\lloop \ct \lloop}{\blank}$ is +\[(\transfib \code \lloop-) \circ (\transfib \code \lloop-)\] +and so on. +Thus, when $p$ is a composition like +\[ +\lloop \ct \opp \lloop \ct \lloop \ct \cdots +\] +$\transfib{\code}{p}{\blank}$ will compute a composition of functions like +\[ +\Zsuc \circ \Zpred \circ \Zsuc \circ \cdots +\] +Applying this composition of functions to 0 will compute the +\index{winding!number}% +\emph{winding number} of the path --- how many times it goes around the +circle, with orientation marked by whether it is positive or negative, +after inverses have been canceled. Thus, the computational behavior of +$\encode$ follows from the reduction rules for higher-inductive types and +univalence, and the action of $\mathsf{transport}$ on compositions and inverses. + +Note that the instance $\encode' \defeq \encode_{\base}$ has type +$(\id \base \base) \rightarrow \Z$. +This will be one half of our desired equivalence; indeed, it is exactly the function $g$ defined in \cref{sec:pi1s1-initial-thoughts}. + +Similarly, the function~\eqref{eq:pi1s1-decode} is a generalization of the function $\lloop^{\blank}$ from \cref{sec:pi1s1-initial-thoughts}. + +\begin{defn}\label{thm:pi1s1-decode} +Define $\decode : \prd{x : \Sn ^1}\code(x) \rightarrow (\base=x)$ by +circle induction on $x$. It suffices to give a function +${\code(\base) \rightarrow (\base=\base)}$, for which we use $\lloop^{\blank}$, and +to show that $\lloop^{\blank}$ respects the loop. +\end{defn} + +\begin{proof} +To show that $\lloop^{\blank}$ respects the loop, it suffices to give a path +from $\lloop^{\blank}$ to itself that lies over $\lloop$. +By the definition of dependent paths, this means a path from +\[\transfib {(x' \mapsto \code(x') \rightarrow (\base=x'))} {\lloop} {\lloop^{\blank}}\] +to $\lloop^{\blank}$. We define such a +path as follows: +\begin{align*} + \MoveEqLeft \transfib {(x' \mapsto \code(x') \rightarrow (\base=x'))} \lloop {\lloop^{\blank}}\\ +&= \transfibf {x'\mapsto (\base=x')}(\lloop) \circ {\lloop^{\blank}} \circ \transfibf \code ({\opp \lloop}) \\ +&= (- \ct \lloop) \circ (\lloop^{\blank}) \circ \transfibf \code ({\opp \lloop}) \\ +&= (- \ct \lloop) \circ (\lloop^{\blank}) \circ \Zpred \\ +&= (n \mapsto \lloop^{n - 1} \ct \lloop). +\end{align*} +On the first line, we apply the characterization of $\mathsf{transport}$ +when the outer connective of the fibration is $\rightarrow$, which +reduces the $\mathsf{transport}$ to pre- and post-composition with +$\mathsf{transport}$ at the domain and codomain types. On the second line, +we apply the characterization of $\mathsf{transport}$ when the type family +is $x\mapsto \id{\base}{x}$, which is post-composition of paths. On the third line, +we use the action of $\code$ on $\opp \lloop$ from +\cref{lem:transport-s1-code}. And on the fourth line, we simply +reduce the function composition. Thus, it suffices to show that for all +$n$, $\id{\lloop^{n - 1} \ct \lloop}{\lloop^{n}}$. This is an easy application of \cref{thm:sign-induction}, using the groupoid laws. +\end{proof} + +We can now show that $\encode$ and $\decode$ are quasi-inverses. +What used to be the difficult direction is now easy! + +\begin{lem} \label{lem:s1-decode-encode} +For all $x: \Sn ^1$ and $p : \id \base x$, $\id +{\decode_x({{\encode_x(p)}})} p$. +\end{lem} + +\begin{proof} +By path induction, it suffices to show that +\narrowequation{\id {\decode_{\base}({{\encode_{\base}(\refl{\base})}})} {\refl{\base}}.} +But +\narrowequation{\encode_{\base}(\refl{\base}) \jdeq \transfib{\code}{\refl{\base}} 0 \jdeq 0,} +and $\decode_{\base}(0) \jdeq \lloop^ 0 \jdeq \refl{\base}$. +\end{proof} + +The other direction is not much harder. + +\begin{lem} \label{lem:s1-encode-decode} For all +$x: \Sn ^1$ and $c : \code(x)$, we have $\id +{\encode_x({{\decode_x(c)}})} c$. +\end{lem} + +\begin{proof} +The proof is by circle induction. It suffices to show the case for +\base, because the case for \lloop is a path between paths in +$\Z$, which is immediate because $\Z$ is a set. + +Thus, it suffices to show, for all $n : \Z$, that +\[ +\id {\encode'(\lloop^n)} {n}. +\] +The proof is by induction, using \cref{thm:sign-induction}. +% +\begin{itemize} + +\item In the case for $0$, the result is true by definition. + +\item In the case for $n+1$, +\begin{align} + {\encode'(\lloop^{n+1})} +&= {\encode'(\lloop^{n} \ct \lloop)} \tag{by definition of $\lloop^{\blank}$} \\ +&= \transfib{\code}{(\lloop^{n} \ct \lloop)}{0} \tag{by definition of $\encode$}\\ +&= \transfib{\code}{\lloop}{(\transfib{\code}{\lloop^n}{0})} \tag{by functoriality}\\ +&= {(\transfib{\code}{\lloop^n}{0})} + 1 \tag{by \cref{lem:transport-s1-code}}\\ +&= n + 1. \tag{by the inductive hypothesis} +\end{align} + +\item The case for negatives is analogous. \qedhere +\end{itemize} +\end{proof} + +Finally, we conclude the theorem. + +\begin{thm} +There is a family of equivalences $\prd{x : \Sn ^1} (\eqv {(\base=x)} {\code(x)})$. +\end{thm} +\begin{proof} +The maps $\encode$ and $\decode$ are quasi-inverses by +\cref{lem:s1-decode-encode,lem:s1-encode-decode}. +\end{proof} + +Instantiating at {\base} gives +\begin{cor}\label{cor:omega-s1} +$\eqv {\Omega(\Sn^1,\base)} {\Z}$. +\end{cor} + +A simple induction shows that this equivalence takes addition to +composition, so that $\Omega(\Sn ^1) = \Z$ as groups. + +\begin{cor} \label{cor:pi1s1} +$\id{\pi_1(\Sn ^1)} {\Z}$, while $\id{\pi_n(\Sn ^1)}0$ for $n>1$. +\end{cor} +\begin{proof} +For $n=1$, we sketched the proof from \cref{cor:omega-s1} above. +For $n > 1$, we have $\trunc 0 {\Omega^{n}(\Sn ^1)} = \trunc 0 {\Omega^{n-1}(\Omega{\Sn ^1})} = \trunc 0 {\Omega^{n-1}(\Z)}$. +And since $\Z$ is a set, $\Omega^{n-1}(\Z)$ is contractible, so this is trivial. +\end{proof} + +\index{encode-decode method|)}% + + +\subsection{The homotopy-theoretic proof} +\label{subsec:pi1s1-homotopy-theory} + +In \cref{sec:pi1s1-universal-cover}, we defined the putative universal cover $\code:\Sn^1\to\type$ in type theory, and in \cref{subsec:pi1s1-encode-decode} we defined a map $\encode : \prd{x:\Sn^1} (\base=x) \to \code(x)$ from the path fibration to the universal cover. +What remains for the classical proof is to show that this map induces an equivalence on total spaces because both are contractible, and to deduce from this that it must be an equivalence on each fiber. + +\index{total!space}% +In \cref{thm:contr-paths} we saw that the total space $\sm{x:\Sn^1} (\base=x)$ is contractible. +For the other, we have: + +\begin{lem}\label{thm:iscontr-s1cover} + The type $\sm{x:\Sn^1}\code(x)$ is contractible. +\end{lem} +\begin{proof} + We apply the flattening lemma (\cref{thm:flattening}) with the following values: + \begin{itemize} + \item $A\defeq\unit$ and $B\defeq\unit$, with $f$ and $g$ the obvious functions. + Thus, the base higher inductive type $W$ in the flattening lemma is equivalent to $\Sn^1$. + \item $C:A\to\type$ is constant at \Z. + \item $D:\prd{b:B} (\eqv{\Z}{\Z})$ is constant at $\Zsuc$. + \end{itemize} + Then the type family $P:\Sn^1\to\type$ defined in the flattening lemma is equivalent to $\code:\Sn^1\to\type$. + Thus, the flattening lemma tells us that $\sm{x:\Sn^1}\code(x)$ is equivalent to a higher inductive type with the following generators, which we denote $R$: + \begin{itemize} + \item A function $\mathsf{c}: \Z \to R$. + \item For each $z:\Z$, a path $\mathsf{p}_z:\mathsf{c}(z) = \mathsf{c}(\Zsuc(z))$. + \end{itemize} + We might call this type the \define{homotopical reals}; + \indexdef{real numbers!homotopical}% + it plays the same role as the topological space $\mathbb{R}$ in the classical proof. + + Thus, it remains to show that $R$ is contractible. + As center of contraction we choose $\mathsf{c}(0)$; we must now show that $x=\mathsf{c}(0)$ for all $x:R$. + We do this by induction on $R$. + Firstly, when $x$ is $\mathsf{c}(z)$, we must give a path $q_z:\mathsf{c}(0) = \mathsf{c}(z)$, which we can do by induction on $z:\Z$, using \cref{thm:sign-induction}: + \begin{align*} + q_0 &\defid \refl{\mathsf{c}(0)}\\ + q_{n+1} &\defid q_n \ct \mathsf{p}_n & &\text{for $n\ge 0$}\\ + q_{n-1} &\defid q_n \ct \opp{\mathsf{p}_{n-1}} & &\text{for $n\le 0$.} + \end{align*} + Secondly, we must show that for any $z:\Z$, the path $q_z$ is transported along $\mathsf{p}_z$ to $q_{z+1}$. + By transport of paths, this means we want $q_z \ct \mathsf{p}_z = q_{z+1}$. + This is easy by induction on $z$, using the definition of $q_z$. + This completes the proof that $R$ is contractible, and thus so is $\sm{x:\Sn^1}\code(x)$. +\end{proof} + +\begin{cor}\label{thm:encode-total-equiv} + The map induced by \encode: + \[ \tsm{x:\Sn^1} (\base=x) \to \tsm{x:\Sn^1}\code(x) \] + is an equivalence. +\end{cor} +\begin{proof} + Both types are contractible. +\end{proof} + +\begin{thm} + $\eqv {\Omega(\Sn^1,\base)} {\Z}$. +\end{thm} +\begin{proof} + Apply \cref{thm:total-fiber-equiv} to $\encode$, using \cref{thm:encode-total-equiv}. +\end{proof} + +In essence, the two proofs are not very different: the encode-decode one may be seen as a ``reduction'' or ``unpackaging'' of the homotopy-theoretic one. +Each has its advantages; the interplay between the two points of view is part of the interest of the subject. +\index{fundamental!group!of circle|)} + + +\subsection{The universal cover as an identity system} +\label{sec:pi1s1-idsys} + +Note that the fibration $\code:\Sn^1\to\type$ together with $0:\code(\base)$ is a \emph{pointed predicate} in the sense of \cref{defn:identity-systems}. +From this point of view, we can see that the encode-decode proof in \cref{subsec:pi1s1-encode-decode} consists of proving that \code satisfies \cref{thm:identity-systems}\ref{item:identity-systems3}, while the homotopy-theoretic proof in \cref{subsec:pi1s1-homotopy-theory} consists of proving that it satisfies \cref{thm:identity-systems}\ref{item:identity-systems4}. +This suggests a third approach. + +\begin{thm} + The pair $(\code,0)$ is an identity system at $\base:\Sn^1$ in the sense of \cref{defn:identity-systems}. +\end{thm} +\begin{proof} + Let $D:\prd{x:\Sn^1} \code(x) \to \type$ and $d:D(\base,0)$ be given; we want to define a function $f:\prd{x:\Sn^1}{c:\code(x)} D(x,c)$. + By circle induction, it suffices to specify $f(\base):\prd{c:\code(\base)} D(\base,c)$ and verify that $\trans{\lloop}{f(\base)} = f(\base)$. + + Of course, $\code(\base)\jdeq \Z$. + By \cref{lem:transport-s1-code} and induction on $n$, we may obtain a path $p_n : \transfib{\code}{\lloop^n}{0} = n$ for any integer $n$. + Therefore, by paths in $\Sigma$-types, we have a path $\pairpath(\lloop^n,p_n) : (\base,0) = (\base,n)$ in $\sm{x:\Sn^1} \code(x)$. + Transporting $d$ along this path in the fibration $\widehat{D}:(\sm{x:\Sn^1} \code(x)) \to\type$ associated to $D$, we obtain an element of $D(\base,n)$ for any $n:\Z$. + We define this element to be $f(\base)(n)$: + \[ f(\base)(n) \defeq \transfib{\widehat{D}}{\pairpath(\lloop^n,p_n)}{d}. \] + % + Now we need $\transfib{\lam{x} \prd{c:\code(x)} D(x,c)}{\lloop}{f(\base)} = f(\base)$. + By \cref{thm:dpath-forall}, this means we need to show that for any $n:\Z$, + % + \begin{narrowmultline*} + \transfib{\widehat D}{\pairpath(\lloop,\refl{\trans\lloop n})}{f(\base)(n)} + =_{D(\base,\trans\lloop n)} \narrowbreak + f(\base)(\trans\lloop n). + \end{narrowmultline*} + % + Now we have a path $q:\trans\lloop n = n+1$, so transporting along this, it suffices to show + \begin{multline*} + \transfib{D(\base)}{q}{\transfib{\widehat D}{\pairpath(\lloop,\refl{\trans\lloop n})}{f(\base)(n)}}\\ + =_{D(\base,n+1)} \transfib{D(\base)}{q}{f(\base)(\trans\lloop n)}. + \end{multline*} + By a couple of lemmas about transport and dependent application, this is equivalent to + \[ \transfib{\widehat D}{\pairpath(\lloop,q)}{f(\base)(n)} =_{D(\base,n+1)} f(\base)(n+1). \] + However, expanding out the definition of $f(\base)$, we have + \begin{narrowmultline*} + \transfib{\widehat D}{\pairpath(\lloop,q)}{f(\base)(n)} + \narrowbreak + \begin{aligned}[t] + &= \transfib{\widehat D}{\pairpath(\lloop,q)}{\transfib{\widehat{D}}{\pairpath(\lloop^n,p_n)}{d}}\\ + &= \transfib{\widehat D}{\pairpath(\lloop^n,p_n) \ct \pairpath(\lloop,q)}{d}\\ + &= \transfib{\widehat D}{\pairpath(\lloop^{n+1},p_{n+1})}{d}\\ + &= f(\base)(n+1). + \end{aligned} + \end{narrowmultline*} + We have used the functoriality of transport, the characterization of composition in $\Sigma$-types (which was an exercise for the reader), and a lemma relating $p_n$ and $q$ to $p_{n+1}$ which we leave it to the reader to state and prove. + + This completes the construction of $f:\prd{x:\Sn^1}{c:\code(x)} D(x,c)$. + Since + \[f(\base,0) \jdeq \trans{\pairpath(\lloop^0,p_0)}{d} = \trans{\refl{\base}}{d} = d,\] + we have shown that $(\code,0)$ is an identity system. +\end{proof} + +\begin{cor} + For any $x:\Sn^1$, we have $\eqv{(\base=x)}{\code(x)}$. +\end{cor} +\begin{proof} + By \cref{thm:identity-systems}. +\end{proof} + +Of course, this proof also contains essentially the same elements as the previous two. +Roughly, we can say that it unifies the proofs of \cref{thm:pi1s1-decode,lem:s1-encode-decode}, performing the requisite inductive argument only once in a generic case. + +\begin{rmk} + Note that all of the above proofs that $\eqv{\pi_1(\Sn^1)}{\Z}$ use the univalence axiom in an essential way. + This is unavoidable: univalence or something like it is \emph{necessary} in order to prove $\eqv{\pi_1(\Sn^1)}{\Z}$. + In the absence of univalence, it is consistent to assume the statement ``all types are sets'' (a.k.a.\ ``uniqueness of identity proofs'' or ``Axiom K'', as discussed in \cref{sec:hedberg}), and this statement implies instead that $\eqv{\pi_1(\Sn^1)}{\unit}$. + In fact, the (non)triviality of $\pi_1(\Sn^1)$ detects exactly whether all types are sets: the proof of \cref{thm:loop-nontrivial} showed conversely that if $\lloop=\refl{\base}$ then all types are sets. +\end{rmk} + +\section{Connectedness of suspensions} +\label{sec:conn-susp} + +Recall from \cref{sec:connectivity} that a type $A$ is called \define{$n$-connected} if $\trunc nA$ is contractible. +The aim of this section is to prove that the operation of suspension from \cref{sec:suspension} increases connectedness. + +\begin{thm} \label{thm:suspension-increases-connectedness} + If $A$ is $n$-connected then the suspension of $A$ is $(n+1)$-connected. +\end{thm} + +\begin{proof} + We remarked in \cref{sec:colimits} that the suspension of $A$ is the pushout $\unit\sqcup^A\unit$, so we need to + prove that the following type is contractible: + % + \[\trunc{n+1}{\unit\sqcup^A\unit}.\] + % + By \cref{reflectcommutespushout} we know that + $\trunc{n+1}{\unit\sqcup^A\unit}$ is a pushout in $\typelep{n+1}$ of the diagram + \[\xymatrix{\trunc{n+1}A \ar[d] \ar[r] & \trunc{n+1}{\unit} \\ + \trunc{n+1}{\unit} & }.\] + % + Given that $\trunc{n+1}{\unit}=\unit$, the type + $\trunc{n+1}{\unit\sqcup^A\unit}$ is also a pushout of the following diagram in + $\typelep{n+1}$ (because both diagrams are equal) + % + \[\Ddiag=\vcenter{\xymatrix{\trunc{n+1}A \ar[d] \ar[r] & \unit \\ + \unit & }}.\] + % + We will now prove that $\unit$ is also a pushout of $\Ddiag$ in + $\typelep{n+1}$. + % + Let $E$ be an $(n+1)$-truncated type; we need to prove that the following map + is an equivalence + % + \[\function{(\unit \to E)}{\cocone{\Ddiag}{E}}{y} + {(y,y,\lamu{u:{\trunc{n+1}A}} \refl{y(\ttt)})}.\] + % + where we recall that $\cocone{\Ddiag}{E}$ is the type + \[\sm{f:\unit \to E}{g:\unit \to E}(\trunc{n+1}A\to + (f(\ttt)=_E{}g(\ttt))).\] + % + The map $\function{(\unit\to E)}{E}{f}{f(\ttt)}$ is an equivalence, hence + we also have + \[\cocone{\Ddiag}{E}=\sm{x:E}{y:E}(\trunc{n+1}A\to(x=_Ey)).\] + % + Now $A$ is $n$-connected hence so is $\trunc{n+1}A$ because + $\trunc n{\trunc{n+1}A}=\trunc nA=\unit$, and $(x=_Ey)$ is $n$-truncated because + $E$ is $(n+1)$-truncated. Hence by \cref{connectedtotruncated} the + following map is an equivalence + % + \[\function{(x=_Ey)}{(\trunc{n+1}A\to(x=_Ey))}{p}{\lam{z} p}\] + % + Hence we have + % + \[\cocone{\Ddiag}{E}=\sm{x:E}{y:E}(x=_Ey).\] + % + But the following map is an equivalence + % + \[\function{E}{\sm{x:E}{y:E}(x=_Ey)}{x}{(x,x,\refl{x})}.\] + % + Hence + % + \[\cocone{\Ddiag}{E}=E.\] + % + Finally we get an equivalence + % + \[(\unit \to E)\eqvsym\cocone{\Ddiag}{E}\] + % + We can now unfold the definitions in order to get the explicit expression of + this map, and we see easily that this is exactly the map we had at the + beginning. + + Hence we proved that $\unit$ is a pushout of $\Ddiag$ in $\typelep{n+1}$. Using + uniqueness of pushouts we get that $\trunc{n+1}{\unit\sqcup^A\unit}=\unit$ + which proves that the suspension of $A$ is $(n+1)$-connected. +\end{proof} + +\begin{cor} \label{cor:sn-connected} + For all $n:\N$, the sphere $\Sn^n$ is $(n-1)$-connected. +\end{cor} + +\begin{proof} + We prove this by induction on $n$. + % + For $n=0$ we have to prove that $\Sn^0$ is merely inhabited, which is clear. + % + Let $n:\N$ be such that $\Sn^n$ is $(n-1)$-connected. By definition $\Sn^{n+1}$ + is the suspension of $\Sn^n$, hence by the previous lemma $\Sn^{n+1}$ is + $n$-connected. +\end{proof} + +\section{\texorpdfstring{$\pi_{k \le n}$}{π\_(k≤n)} of an \texorpdfstring{$n$}{n}-connected space and \texorpdfstring{$\pi_{k < n}(\Sn ^n)$}{π\_(k0$ the set $\pi_n(A,a)$ has a group +structure, and if $n>1$ the group is abelian\index{group!abelian}. + +We can now say something about homotopy groups of $n$-truncated and +$n$-connected types. + +\begin{lem} + If $A$ is $n$-truncated and $a:A$, then $\pi_k(A,a)=\unit$ for all $k>n$. +\end{lem} + +\begin{proof} + The loop space of an $n$-type is an + $(n-1)$-type, hence $\Omega^k(A,a)$ is an $(n-k)$-type, and we have + $(n-k)\le-1$ so $\Omega^k(A,a)$ is a mere proposition. But $\Omega^k(A,a)$ is inhabited, + so it is actually contractible and + $\pi_k(A,a)=\trunc0{\Omega^k(A,a)}=\trunc0{\unit}=\unit$. +\end{proof} + +\begin{lem} \label{lem:pik-nconnected} + If $A$ is $n$-connected and $a:A$, then $\pi_k(A,a)=\unit$ for all $k\le{}n$. +\end{lem} + +\begin{proof} + We have the following sequence of equalities: + % + \begin{narrowmultline*} + \pi_k(A,a) = \trunc0{\Omega^k(A,a)} + = \Omega^k(\trunc k{(A,a)}) + = \Omega^k(\trunc k{\trunc n{(A,a)}}) + = \narrowbreak + \Omega^k(\trunc k{\unit}) + = \Omega^k(\unit) + = \unit. + \end{narrowmultline*} + % + The third equality uses the fact that $k\le{}n$ in order to use that + $\truncf k\circ\truncf n=\truncf k$ and the fourth equality uses the fact that $A$ is + $n$-connected. +\end{proof} + +\begin{cor} + $\pi_k(\Sn ^n) = \unit$ for $k < n$. +\end{cor} +\begin{proof} + The sphere $\Sn^n$ is $(n-1)$-connected by \cref{cor:sn-connected}, so + we can apply \cref{lem:pik-nconnected}. +\end{proof} + +\section{Fiber sequences and the long exact sequence} +\label{sec:long-exact-sequence-homotopy-groups} + +\index{fiber sequence|(}% +\index{sequence!fiber|(}% + +If the codomain of a function $f:X\to Y$ is equipped with a basepoint $y_0:Y$, then we refer to the fiber $F\defeq \hfib f {y_0}$ of $f$ over $y_0$ as \define{the fiber of $f$}\index{fiber}. +(If $Y$ is connected, then $F$ is determined up to mere equivalence; see \cref{ex:unique-fiber}.) +We now show that if $X$ is also pointed and $f$ preserves basepoints, then there is a relation between the homotopy groups of $F$, $X$, and $Y$ in the form of a \emph{long exact sequence}. +We derive this by way of the \emph{fiber sequence} associated to such an $f$. + +\begin{defn}\label{def:pointedmap} + A \define{pointed map} + \indexdef{pointed!map}% + \indexsee{function!pointed}{pointed map}% + between pointed types $(X,x_0)$ and $(Y,y_0)$ is a + map $f:X\to Y$ together with a path $f_0:f(x_0)=y_0$. +\end{defn} + +For any pointed types $(X,x_0)$ and $(Y,y_0)$, there is a pointed map $(\lam{x} y_0) : X\to Y$ which is constant at the basepoint. +We call this the \define{zero map}\indexdef{zero!map}\indexdef{function!zero} and sometimes write it as $0:X\to Y$. + +Recall that every pointed type $(X,x_0)$ has a loop space\index{loop space} $\Omega (X,x_0)$. +We now note that this operation is functorial on pointed maps.\index{loop space!functoriality of}\index{functor!loop space} + +\begin{defn}\label{def:loopfunctor} + Given a pointed map between pointed types $f:X \to Y$, we define a pointed + map $\Omega f:\Omega X + \to \Omega Y$ by + \[(\Omega f)(p) \defeq \rev{f_0}\ct\ap{f}{p}\ct f_0.\] + The path $(\Omega f)_0 : (\Omega f) (\refl{x_0}) = \refl{y_0}$, which exhibits $\Omega f$ as a pointed map, is the obvious path of type + \[\rev{f_0}\ct\ap{f}{\refl{x_0}}\ct f_0=\refl{y_0}.\] +\end{defn} + +There is another functor on pointed maps, which takes $f:X\to Y$ to $\proj1 : \hfib f {y_0} \to X$. +When $f$ is pointed, we always consider $\hfib f {y_0}$ to be pointed with basepoint $(x_0,f_0)$, in which case $\proj1$ is also a pointed map, with witness $(\proj1)_0 \defeq \refl{x_0}$. +Thus, this operation can be iterated. + +\begin{defn} + The \define{fiber sequence} + \indexdef{fiber sequence}% + \indexdef{sequence!fiber}% + of a pointed map $f:X\to Y$ is the infinite sequence of pointed types and pointed maps + \[\xymatrix{\dots \ar[r]^{f^{(n+1)}} & X^{(n+1)} \ar[r]^{f^{(n)}} & X^{(n)} \ar^-{f^{(n-1)}}[r] & \dots \ar[r] & X^{(2)} \ar^-{f^{(1)}}[r] & X^{(1)} \ar[r]^{f^{(0)}} & X^{(0)}}\] + defined recursively by + \[ X^{(0)} \defeq Y\qquad + X^{(1)} \defeq X\qquad + f^{(0)} \defeq f\qquad + \] + and + \begin{alignat*}{2} + X^{(n+1)} &\defeq \hfib {f^{(n-1)}}{x^{(n-1)}_0}\\ + f^{(n)} &\defeq \proj1 &: X^{(n+1)} \to X^{(n)}. + \end{alignat*} + where $x^{(n)}_0$ denotes the basepoint of $X^{(n)}$, chosen recursively as above. +\end{defn} + +Thus, any adjacent pair of maps in this fiber sequence is of the form +\[ \xymatrix{ X^{(n+1)} \jdeq \hfib{f^{(n-1)}}{x^{(n-1)}_0} \ar[rr]^-{f^{(n)}\jdeq \proj1} && X^{(n)} \ar[r]^{f^{(n-1)}} & X^{(n-1)}. } \] +In particular, we have $f^{(n-1)} \circ f^{(n)} = 0$. +We now observe that the types occurring in this sequence are the iterated loop spaces\index{loop space!iterated} of the base +space $Y$, the total space\index{total!space} $X$, and the fiber $F\defeq \hfib f {y_0}$, and similarly for the maps. + +\begin{lem}\label{thm:fiber-of-the-fiber} + Let $f:X\to Y$ be a pointed map of pointed spaces. Then: + \begin{enumerate} + \item The fiber of $f^{(1)}\defeq \proj1 : \hfib f {y_0} \to X$ is equivalent to $\Omega Y$.\label{item:fibseq1} + \item Similarly, the fiber of $f^{(2)} : \Omega Y \to \hfib f {y_0}$ is equivalent to $\Omega X$.\label{item:fibseq2} + \item Under these equivalences, the pointed map $f^{(3)} : \Omega X\to \Omega Y$ is identified with the pointed map $\Omega f\circ\rev{(\blank)}$.\label{item:fibseq3} + \end{enumerate} +\end{lem} +\begin{proof} + For~\ref{item:fibseq1}, we have + \begin{align*} + \hfib{f^{(1)}}{x_0} + &\defeq \sm{z:\hfib{f}{y_0}} (\proj{1}(z) = x_0)\\ + &\eqvsym \sm{x:X}{p:f(x)=y_0} (x = x_0) &\text{(by \cref{ex:sigma-assoc})}\\ + &\eqvsym (f(x_0) = y_0) &\text{(as $\tsm{x:X} (x=x_0)$ is contractible)}\\ + &\eqvsym (y_0 = y_0) &\text{(by $(f_0 \ct \blank)$)}\\ + &\jdeq \Omega Y. + \end{align*} + Tracing through, we see that this equivalence sends $((x,p),q)$ to $\opp{f_0} \ct \ap{f}{\opp q} \ct p$, while its inverse sends $r:y_0=y_0$ to $((x_0, f_0 \ct r), \refl{x_0})$. + In particular, the basepoint $((x_0,f_0),\refl{x_0})$ of $\hfib{f^{(1)}}{x_0}$ is sent to $\opp{f_0} \ct \ap{f}{\opp {\refl{x_0}}} \ct f_0$, which equals $\refl{y_0}$. + Hence this equivalence is a pointed map (see \cref{ex:pointed-equivalences}). + Moreover, under this equivalence, $f^{(2)}$ is identified with $\lam{r} (x_0, f_0 \ct r): \Omega Y \to \hfib f {y_0}$. + + \cref{item:fibseq2} follows immediately by applying~\ref{item:fibseq1} to $f^{(1)}$ in place of $f$. + % The resulting equivalence sends $(((x,p),p'),q') : \hfib{f^{(2)}}{(x_0,f_0)}$ to $\ap{f}{\opp {q'}} \ct p'$, while its inverse sends $s:x_0=x_0$ to $(((x_0,f_0), s), \refl{(x_0,f_0)})$. + Since $(f^{(1)})_0 \defeq \refl{x_0}$, under this equivalence $f^{(3)}$ is identified with the map $\Omega X \to \hfib {f^{(1)}}{x_0}$ defined by $s \mapsto ((x_0,f_0),s)$. + Thus, when we compose with the previous equivalence $\hfib {f^{(1)}}{x_0} \eqvsym \Omega Y$, we see that $s$ maps to $\opp{f_0} \ct \ap{f}{\opp s} \ct f_0$, which is by definition $(\Omega f)(\opp s)$. We omit the proof that this is an equality of pointed maps rather than just of functions. +\end{proof} + +Thus, the fiber sequence of $f:X\to Y$ can be pictured as: +\[\xymatrix@C=1.5pc{ + \dots \ar[r] & + \Omega^2 X \ar[r]^-{\Omega^2 f} & + \Omega^2 Y \ar[r]^-{-\Omega \partial} & + \Omega F \ar[r]^-{-\Omega i} & + \Omega X \ar[r]^-{-\Omega f} & + \Omega Y \ar[r]^-{\partial} & + F \ar[r]^-{i} & + X \ar[r]^{f} & Y.}\] +where the minus signs denote composition with path inversion $\rev{(\blank)}$. +Note that by \cref{ex:ap-path-inversion}, we have +\[ \Omega\left(\Omega f\circ \opp{(\blank)}\right) \circ \opp{(\blank)} += \Omega^2 f \circ \opp{(\blank)} \circ \opp{(\blank)} += \Omega^2 f. +\] +Thus, there are minus signs on the $k$-fold loop maps whenever $k$ is odd. + +From this fiber sequence we will deduce an \emph{exact sequence of pointed sets}. +\index{image}% +Let $A$ and $B$ be sets and $f:A\to B$ a function, and recall from \cref{defn:modal-image} the definition of the \emph{image} $\im(f)$, which can be regarded as a subset of $B$: +\[\im(f) \defeq \setof{b:B | \exis{a:A} f(a)=b}. \] +If $A$ and $B$ are moreover pointed with basepoints $a_0$ and $b_0$, and $f$ is a pointed map, we define the \define{kernel} +\indexdef{kernel}% +\indexdef{pointed!map!kernel of}% +of $f$ to be the following subset of $A$: +\symlabel{kernel} +\[\ker(f) \defeq \setof{x:A | f(x) = b_0}. \] +Of course, this is just the fiber of $f$ over the basepoint $b_0$; it is a subset of $A$ because $B$ is a set. + +Note that any group is a pointed set, with its unit element as basepoint, and any group homomorphism is a pointed map. +In this case, the kernel and image agree with the usual notions from group theory. + +\begin{defn} + An \define{exact sequence of pointed sets} + \indexdef{exact sequence}% + \indexdef{sequence!exact}% + is a (possibly bounded) sequence of pointed sets and pointed maps: + \[\xymatrix{\dots \ar[r] & A^{(n+1)} \ar[r]^-{f^{(n)}} & A^{(n)} \ar[r]^{f^{(n-1)}} & A^{(n-1)} \ar[r] & + \dots}\] + such that for every $n$, the image of $f^{(n)}$ is equal, as a subset of $A^{(n)}$, to the kernel of $f^{(n-1)}$. + In other words, for all $a:A^{(n)}$ we have + \[ (f^{(n-1)}(a) = a^{(n-1)}_0) \iff \exis{b:A^{(n+1)}} (f^{(n)}(b)=a). \] + where $a^{(n)}_0$ denotes the basepoint of $A^{(n)}$. +\end{defn} + +Usually, most or all of the pointed sets in an exact sequence are groups, and often abelian groups. +When we speak of an \define{exact sequence of groups}, it is assumed moreover that the maps are group homomorphisms and not just pointed maps. + +\index{exact sequence} +\begin{thm}\label{thm:les} + Let $f:X \to Y$ be a pointed map between pointed spaces with fiber $F\defeq \hfib f {y_0}$. + Then we have the following long exact sequence, which consists of groups except for the last three terms, and abelian groups except for the last six. + + \[ + \xymatrix@R=1.2pc@C=3pc{ + \vdots & \vdots & \vdots \ar[lld] \\ + \pi_k(F) \ar[r] & \pi_k(X) \ar[r] & \pi_k(Y) \ar[lld] \\ + \vdots & \vdots & \vdots \ar[lld] \\ + \pi_2(F) \ar[r] & \pi_2(X) \ar[r] & \pi_2(Y) \ar[lld] \\ + \pi_1(F) \ar[r] & \pi_1(X) \ar[r] & \pi_1(Y) \ar[lld]\\ + \pi_0(F) \ar[r] & \pi_0(X) \ar[r] & \pi_0(Y)} + \] +\end{thm} + +% In US trade we might want a page break here, and extra stretch, otherwise the +% whole page looks ugly. +\vspace*{0pt plus 10ex} +\goodbreak + +\begin{proof} + We begin by showing that the 0-truncation of a fiber sequence is an exact sequence of pointed sets. + Thus, we need to show that for any adjacent pair of maps in a fiber sequence: + % + \[\xymatrix{\hfib{f}{z_0} \ar^-g[r] & W \ar^-f[r] & Z}\] + % + with $g\defeq \proj1$, the sequence + % + \[\xymatrix{\trunc{0}{\hfib{f}{z_0}} \ar^-{\trunc0g}[r] & \trunc0{W} + \ar^-{\trunc0{f}}[r] & \trunc0{Z}}\] + % + is exact, i.e.\ that $\im(\trunc0g)\subseteq\ker(\trunc0f)$ and $\ker(\trunc0f)\subseteq\im(\trunc0g)$. + + The first inclusion is equivalent to $\trunc0f\circ\trunc0g=0$, which holds by functoriality of $\truncf0$ and the fact that $f\circ g=0$. + For the second, we assume $w':\trunc0W$ and $p':\trunc0f(w')=\tproj0{z_0}$ and show there merely exists ${t:\hfib{f}{z_0}}$ such that $\tproj0{g(t)}=w'$. + Since our goal is a mere proposition, we can assume that $w'$ is of the + form $\tproj0w$ for some $w:W$. + Now by \cref{thm:path-truncation}, $p' : \tproj0{f(w)}=\tproj0{z_0}$ yields $p'': \trunc{-1}{f(w)=z_0}$, so by a further truncation induction we may assume some $p:f(w)=z_0$. + But now we have $\tproj0{(w,p)}:\trunc{0}{\hfib{f}{z_0}}$ whose image under $\trunc0g$ is $\tproj0w\jdeq w'$, as desired. + + Thus, applying $\truncf0$ to the fiber sequence of $f$, we obtain a long exact sequence involving the pointed sets $\pi_k(F)$, $\pi_k(X)$, and $\pi_k(Y)$ in the desired order. + And of course, $\pi_k$ is a group for $k\ge1$, being the 0-truncation of a loop space, and an abelian group for $k\ge 2$ by the Eckmann--Hilton argument + \index{Eckmann--Hilton argument} (\cref{thm:EckmannHilton}). + Moreover, \cref{thm:fiber-of-the-fiber} allows us to identify the maps $\pi_k(F) \to \pi_k(X)$ and $\pi_k(X) \to \pi_k(Y)$ in this exact sequence as $(-1)^k \pi_k(i)$ and $(-1)^k \pi_k(f)$ respectively. + + More generally, every map in this long exact sequence except the last three is of the form $\trunc0{\Omega h}$ or $\trunc0{-\Omega h}$ for some $h$. + In the former case it is a group homomorphism, while in the latter case it is a homomorphism if the groups are abelian; otherwise it is an ``anti-homomorphism''. + However, the kernel and image of a group homomorphism are unchanged when we replace it by its negative, and hence so is the exactness of any sequence involving it. + Thus, we can modify our long exact sequence to obtain one involving $\pi_k(i)$ and $\pi_k(f)$ directly and in which all the maps are group homomorphisms (except the last three). +\end{proof} + +The usual properties of exact sequences of abelian groups\index{group!abelian!exact sequence of} can be proved as +usual. In particular we have: +\begin{lem}\label{thm:ses} + Suppose given an exact sequence of abelian groups: + % + \[\xymatrix{K \ar[r]& G \ar^f[r] & H \ar[r] & Q.}\] + % + \begin{enumerate} + \item If $K=0$, then $f$ is injective.\label{item:sesinj} + \item If $Q=0$, then $f$ is surjective.\label{item:sessurj} + \item If $K=Q=0$, then $f$ is an isomorphism.\label{item:sesiso} + \end{enumerate} +\end{lem} +\begin{proof} + Since the kernel of $f$ is the image of $K\to G$, if $K=0$ then the kernel of $f$ is $\{0\}$; + hence $f$ is injective because it's a group morphism. + Similarly, since the image of $f$ is the kernel of $H\to Q$, if $Q=0$ then the image of $f$ is all of $H$, so $f$ is surjective. + Finally,~\ref{item:sesiso} follows from~\ref{item:sesinj} and~\ref{item:sessurj} by \cref{thm:mono-surj-equiv}. +\end{proof} + +As an immediate application, we can now quantify in what way $n$-connectedness of a map is stronger than inducing an equivalence on $n$-truncations. + +\begin{cor}\label{thm:conn-pik} + Let $f:A\to B$ be $n$-connected and $a:A$, and define $b\defeq f(a)$. Then: + \begin{enumerate} + \item If $k\le n$, then $\pi_k(f):\pi_k(A,a) \to \pi_k(B,b)$ is an isomorphism.\label{item:conn-pik1} + \item If $k=n+1$, then $\pi_k(f):\pi_k(A,a) \to \pi_k(B,b)$ is surjective.\label{item:conn-pik2} + \end{enumerate} +\end{cor} +\begin{proof} + For $k=0$, part~\ref{item:conn-pik1} follows from \cref{lem:connected-map-equiv-truncation}, noticing that $\pi_0(f)\equiv\trunc 0f$. + For $k=0$ part~\ref{item:conn-pik2} follows from \cref{ex:is-conn-trunc-functor}, noticing that a function is surjective iff it's $(-1)$-connected, by \cref{thm:minusoneconn-surjective}. + For $k>0$ we have as part of the long exact sequence an exact sequence + \[\xymatrix{\pi_k(\hfib f b) \ar[r]& \pi_k(A,a) \ar^f[r] & \pi_k(B,b) \ar[r] & \pi_{k-1}(\hfib f b).}\] + Now since $f$ is $n$-connected, $\trunc n{\hfib f b}$ is contractible. + Therefore, if $k\le n$, then $\pi_k(\hfib f b) = \trunc0{\Omega^k(\hfib f b)} = \Omega^k(\trunc k{\hfib f b})$ is also contractible. + Thus, $\pi_k(f)$ is an isomorphism for $k\le n$ by \cref{thm:ses}\ref{item:sesiso}, while for $k=n+1$ it is surjective by \cref{thm:ses}\ref{item:sessurj}. +\end{proof} + +In \cref{sec:whitehead} we will see that the converse of \cref{thm:conn-pik} also holds. + +\index{fiber sequence|)}% +\index{sequence!fiber|)}% + +\section{The Hopf fibration} +\label{sec:hopf} + +In this section we will define the \define{Hopf fibration}. +\indexdef{Hopf!fibration}% + +\begin{thm}[Hopf Fibration]\label{thm:hopf-fibration} +There is a fibration $H$ over $\Sn ^2$ whose fiber over the basepoint is $\Sn ^1$ and +whose total space is $\Sn ^3$. +\end{thm} + +The Hopf fibration will allow us to compute several homotopy groups of +spheres. +Indeed, it yields the following long exact sequence +\index{homotopy!group!of sphere} +\index{sequence!exact} +of homotopy groups +(see +\cref{sec:long-exact-sequence-homotopy-groups}): +% +\[ +\xymatrix@R=1.2pc{ + \pi_k(\Sn^1) \ar[r] & \pi_k(\Sn^3) \ar[r] & \pi_k(\Sn^2) \ar[lld] \\ + \vdots & \vdots & \vdots \ar[lld] \\ + \pi_2(\Sn^1) \ar[r] & \pi_2(\Sn^3) \ar[r] & \pi_2(\Sn^2) \ar[lld] \\ + \pi_1(\Sn^1) \ar[r] & \pi_1(\Sn^3) \ar[r] & \pi_1(\Sn^2)} +\] +% +We've already computed all $\pi_n(\Sn^1)$, and $\pi_k(\Sn^n)$ for $k>}[d] & A \times A \ar[l]_-{\proj2} \ar@{->>}_{\proj1}[d] + \ar[r]^-{\mu} & A \ar@{->>}[d] \\ + 1 & A \ar[r] \ar[l] & 1}\] +% +and the fibration we just constructed is a fibration over $\susp A$ whose total +space is the pushout of the top line. + +Moreover, with $f(x,y)\defeq(\mu(x,y),y)$ we have the following diagram: +% +\[\xymatrix{A \ar_\idfunc[d] & A \times A \ar[l]_-{\proj2} \ar^f[d] + \ar[r]^-{\mu} & A \ar^\idfunc[d] \\ + A & A\times A \ar^-{\proj2}[l] \ar_-{\proj1}[r] & A}\] +% +The diagram commutes and the three vertical maps are equivalences, the inverse +of $f$ being the function $g$ defined by +\[g(u,v)\defeq(\opp{\mu(\blank,v)}(u),v).\] +% +This shows that the two lines are equivalent (hence equal) spans, so the total +space of the fibration we constructed is equivalent to the pushout of the bottom +line. +And by definition, this latter pushout is the \emph{join} of $A$ with itself (see \cref{sec:colimits}). +% +We have proven: + +\begin{lem}\label{lem:hopf-construction} + Given a connected H-space $A$, there is a fibration, called the + \define{Hopf construction}, + \indexdef{Hopf!construction}% + over $\susp A$ with fiber $A$ and total space $A*A$. +\end{lem} + +\subsection{The Hopf fibration} + +\index{Hopf fibration|(} +\indexsee{fibration!Hopf}{Hopf fibration} +We will first construct a structure of H-space on the circle $\Sn^1$, hence by +\cref{lem:hopf-construction} we will get a fibration over $\Sn^2$ with fiber +$\Sn^1$ and total space $\Sn^1*\Sn^1$. We will then prove that this join is +equivalent to $\Sn^3$. + +\begin{lem}\label{lem:hspace-S1} + There is an H-space structure on the circle $\Sn^1$. +\end{lem} +\begin{proof} + For the base point of the H-space structure we choose $\base$. + % + Now we need to define the multiplication operation + $\mu:\Sn^1\times\Sn^1\to\Sn^1$. + We will define the curried form $\widetilde\mu:\Sn^1\to(\Sn^1\to\Sn^1)$ of $\mu$ + by recursion on $\Sn^1$: + \begin{equation*} + \widetilde\mu(\base) \defeq\idfunc[\Sn^1], + \qquad\text{and}\qquad + \ap{\widetilde\mu}{\lloop} \defid\funext(h). + \end{equation*} + where $h:\prd{x:\Sn^1}(x=x)$ is the function defined in \cref{thm:S1-autohtpy}, + which has the property that $h(\base) \defeq\lloop$. + + Now we just have to prove that $\mu(x,\base)=\mu(\base,x)=x$ for every + $x:\Sn^1$. + % + By definition, if $x:\Sn^1$ we have + $\mu(\base,x)=\widetilde\mu(\base)(x)=\idfunc[\Sn^1](x)=x$. For the equality + $\mu(x,\base)=x$ we do it by induction on $x:\Sn^1$: + \begin{itemize} + \item If $x$ is $\base$ then $\mu(\base,\base)=\base$ by definition, so we + have $\refl\base:\mu(\base,\base)=\base$. + \item When $x$ varies along $\lloop$, we need to prove that + \[\refl\base\ct\apfunc{\lam{x}x}({\lloop})= + \apfunc{\lam{x}\mu(x,\base)}({\lloop})\ct\refl\base.\] + The left-hand side is equal to $\lloop$, and for the right-hand side we have: + \begin{align*} + \apfunc{\lam{x}\mu(x,\base)}({\lloop})\ct\refl\base &= + \apfunc{\lam{x}(\widetilde\mu(x))(\base)}({\lloop})\\ + &=\happly(\apfunc{\lam{x}(\widetilde\mu(x))}({\lloop}),\base)\\ + &=\happly(\funext(h),\base)\\ + &=h(\base)\\ + &=\lloop. \qedhere + \end{align*} + \end{itemize} +\end{proof} + +Now recall from \cref{sec:colimits} that the \emph{join} $A*B$ of types $A$ and $B$ is the pushout of the diagram +\index{join!of types}% +\[A \xleftarrow{\proj1}A\times B \xrightarrow{\proj2} B. \] + +\begin{lem} + \index{associativity!of join}% + The operation of join is associative: if $A$, $B$ and $C$ are three types + then we have an equivalence $\eqv{(A*B)*C}{A*(B*C)}$. +\end{lem} + +\begin{proof} + We define a map $f:(A*B)*C\to A*(B*C)$ by induction. We first need to define + $f\circ\inl:A*B\to A*(B*C)$ which will be done by induction, then + $f\circ\inr:C\to A*(B*C)$, and then $\apfunc{f}\circ\glue:\prd{t:(A*B)\times + C}f(\inl(\fst(t)))=f(\inr(\snd(t)))$ which will be done by induction on the + first component of $t$: + \begin{align*} + (f\circ\inl)(\inl(a)) &\defeq \inl(a), \\ + (f\circ\inl)(\inr(b)) &\defeq \inr(\inl(b)), \\ + \apfunc{f\circ\inl}(\glue(a,b)) &\defid \glue(a,\inl(b)), \\ + f(\inr(c)) &\defeq \inr(\inr(c)),\\ + \apfunc{f}(\glue(\inl(a),c)) &\defid\glue(a,\inr(c)),\\ + \apfunc{f}(\glue(\inr(b),c)) &\defid\apfunc{\inr}(\glue(b,c)),\\ + \apdfunc{\lam{x}\apfunc{f}(\glue(x,c))}(\glue(a,b)) &\defid + ``\apdfunc{\lam{x}\glue(a,x)}(\glue(b,c))''. + \end{align*} + % + For the last equation, note that the right-hand side is of type + \[\transfib{\lam{x}\inl(a)=\inr(x)}{\glue(b,c)}{\glue(a,\inl(b))}= + \glue(a,\inr(c))\] + whereas it is supposed to be of type + % + \begin{narrowmultline*} + \transfib{\lam{x}f(\inl(x))=f(\inr(c))}{\glue(a,b)}{\apfunc{f}(\glue(\inl(a),c))} + = \narrowbreak + \apfunc{f}(\glue(\inr(b),c)). + \end{narrowmultline*} + % + But by the previous clauses in the definition, both of these types are equivalent to the following type: + \[\glue(a,\inr(c))=\glue(a,\inl(b))\ct\apfunc\inr(\glue(b,c)),\] + and so we can coerce by an equivalence to obtain the necessary element. + % + Similarly, we can define a map $g:A*(B*C)\to(A*B)*C$, and checking that $f$ and + $g$ are inverse to each other is a long and tedious but essentially + straightforward computation. +\end{proof} + +A more conceptual proof sketch is as follows. + +\begin{proof} + Let us consider the following diagram where the maps are the obvious + projections: + \[\xymatrix{ + A & A\times C \ar[l] \ar[r] & A\times C\\ + A\times B \ar[u] \ar[d] & A\times B\times C \ar[l]\ar[u]\ar[r]\ar[d] & + A\times C \ar[u] \ar[d] \\ + B & B\times C \ar[l] \ar[r] & C}\] + % + Taking the colimit of the columns gives the following + diagram, whose colimit is $(A*B)*C$: + \[\xymatrix{A*B & (A*B)\times C \ar[l]\ar[r] & C}\] + % + On the other hand, taking the colimit of the lines gives a diagram whose + colimit is $A*(B*C)$. + + Hence using a Fubini-like theorem for colimits (that we haven’t proved) we + have an equivalence $\eqv{(A*B)*C}{A*(B*C)}$. The proof of this Fubini theorem + \index{Fubini theorem for colimits} + for colimits still requires the long and tedious computation, though. +\end{proof} + +\begin{lem} + For any type $A$, there is an equivalence $\eqv{\susp A}{\bool*A}$. +\end{lem} + +\begin{proof} + It is easy to define the two maps back and forth and to prove that they are + inverse to each other. The details are left as an exercise to the reader. +\end{proof} + +We can now construct the Hopf fibration: + +\begin{thm} + There is a fibration over $\Sn^2$ of fiber $\Sn^1$ and total space $\Sn^3$. + \index{total!space}% +\end{thm} +\begin{proof} + We proved that $\Sn^1$ has a structure of H-space (cf \cref{lem:hspace-S1}) + hence by \cref{lem:hopf-construction} there is a fibration over $\Sn^2$ of + fiber $\Sn^1$ and total space $\Sn^1*\Sn^1$. But by the two previous results + and \cref{thm:suspbool} we have: + \begin{equation*} + \Sn^1*\Sn^1 = (\susp\bool)*\Sn^1 + =(\bool*\bool)*\Sn^1 + =\bool*(\bool*\Sn^1) + =\susp(\susp\Sn^1) + =\Sn^3. \qedhere + \end{equation*} +\end{proof} +\index{Hopf fibration|)} + +\section{The Freudenthal suspension theorem} +\label{sec:freudenthal} + +\index{Freudenthal suspension theorem|(}% +\index{theorem!Freudenthal suspension|(}% + +Before proving the Freudenthal suspension theorem, we need some auxiliary lemmas about connectedness. +In \cref{cha:hlevels} we proved a number of facts about $n$-connected maps and $n$-types for fixed $n$; here we are now interested in what happens when we vary $n$. +For instance, in \cref{prop:nconnected_tested_by_lv_n_dependent types} we showed that $n$-connected maps are characterized by an ``induction principle'' relative to families of $n$-types. +If we want to ``induct along'' an $n$-connected map into a family of $k$-types for $k> n$, we don't immediately know that there is a function by such an induction principle, but the following lemma says that at least our ignorance can be quantified. + +\begin{lem}\label{thm:conn-trunc-variable-ind} + If $f:A\to B$ is $n$-connected and $P:B\to \ntype{k}$ is a family of $k$-types for $k\ge n$, then the induced function + \[ (\blank\circ f) : \Parens{\prd{b:B} P(b)} \to \Parens{\prd{a:A} P(f(a)) } \] + is $(k-n-2)$-truncated. +\end{lem} +\begin{proof} + We induct on the natural number $k-n$. + When $k=n$, this is \cref{prop:nconnected_tested_by_lv_n_dependent types}. + % + For the inductive step, suppose $f$ is $n$-connected and $P$ is a family of $(k+1)$-types. + To show that $(\blank\circ f)$ is $(k-n-1)$-truncated, let $\ell:\prd{a:A} P(f(a))$; then we have + \[ \hfib{(\blank\circ f)}{\ell} \eqvsym \sm{g:\prd{b:B} P(b)} \prd{a:A} g(f(a)) = \ell(a).\] + Let $(g,p)$ and $(h,q)$ lie in this type, so $p:g\circ f \htpy \ell$ and $q:h\circ f \htpy \ell$; then we also have + \[ \big((g,p) = (h,q)\big) \eqvsym + \Parens{\sm{r:g\htpy h} r\circ f = p \ct \opp{q}}. + \] + However, here the right-hand side is a fiber of the map + \[ (\blank\circ f) : \Parens{\prd{b:B} Q(b)} \to \Parens{\prd{a:A} Q(f(a)) } \] + where $Q(b) \defeq (g(b)=h(b))$. + Since $P$ is a family of $(k+1)$-types, $Q$ is a family of $k$-types, so the inductive hypothesis implies that this fiber is a $(k-n-2)$-type. + Thus, all path spaces of $\hfib{(\blank\circ f)}{\ell}$ are $(k-n-2)$-types, so it is a $(k-n-1)$-type. +\end{proof} + +Recall that if $\pairr{A,a_0}$ and $\pairr{B,b_0}$ are pointed types, then +their \define{wedge} +\index{wedge}% +$A\vee B$ is defined to be the pushout of $A\xleftarrow{a_0} +\unit\xrightarrow{b_0} B$. +There is a canonical map $i:A\vee B \to A\times B$ defined by the two maps $\lam{a} (a,b_0)$ and $\lam{b} (a_0,b)$; the following lemma essentially says that this map is highly connected if $A$ and $B$ are so. +It is a bit more convenient both to prove and use, however, if we use the characterization of connectedness from \cref{prop:nconnected_tested_by_lv_n_dependent types} and substitute in the universal property of the wedge (generalized to type families). + +\begin{lem}[Wedge connectivity lemma]\label{thm:wedge-connectivity} + Suppose that $\pairr{A,a_0}$ and $\pairr{B,b_0}$ are $n$- and $m$-connected pointed types, respectively, with $n,m\geq0$, and let +% +\narrowequation{P:A\to B\to \ntype{(n+m)}.} +% +Then for any ${f:\prd{a:A} P(a,b_0)}$ and ${g:\prd{b:B} P(a_0,b)}$ with $p:f(a_0) = g(b_0)$, there exists $h:\prd{a:A}{b:B} P(a,b)$ with homotopies +% +\begin{equation*} + q:\prd{a:A} h(a,b_0)=f(a) + \qquad\text{and}\qquad + r:\prd{b:B} h(a_0,b)=g(b) + \end{equation*} +% +such that $p = \opp{q(a_0)} \ct r(b_0)$. +\end{lem} +\begin{proof} + Define $Q:A\to\type$ by + \[ Q(a) \defeq \sm{k:\prd{b:B} P(a,b)} (f(a) = k(b_0)). \] + Then we have $(g,p):Q(a_0)$. + Since $a_0:\unit\to A$ is $(n-1)$-connected, if $Q$ is a family of $(n-1)$-types then we will have $\ell:\prd{a:A} Q(a)$ such that $\ell(a_0) = (g,p)$, in which case we can define $h(a,b) \defeq \proj1(\ell(a))(b)$. + However, for fixed $a$, the type $Q(a)$ is the fiber over $f(a)$ of the map + \[ \Parens{\prd{b:B} P(a,b) } \to P(a,b_0) \] + given by precomposition with $b_0:\unit\to B$. + Since $b_0:\unit\to B$ is $(m-1)$-connected, for this fiber to be $(n-1)$-truncated, by \cref{thm:conn-trunc-variable-ind} it suffices for each type $P(a,b)$ to be an $(n+m)$-type, which we have assumed. +\end{proof} + +Let $(X,x_0)$ be a pointed type, and recall the definition of the suspension $\susp X$ from \cref{sec:suspension}, with constructors $\north,\south:\susp X$ and $\merid:X \to (\north=\south)$. +We regard $\susp X$ as a pointed space with basepoint $\north$, so that we have $\Omega\susp X \defeq (\id[\susp X]\north\north)$. +Then there is a canonical map +\begin{align*} + \sigma &: X \to \Omega\susp X\\ + \sigma(x) &\defeq \merid(x) \ct \opp{\merid(x_0)}. +\end{align*} + +\begin{rmk} + In classical algebraic topology, one considers the \emph{reduced suspension}, in which the path $\merid(x_0)$ is collapsed down to a point, identifying $\north$ and $\south$. + The reduced and unreduced suspensions are homotopy equivalent, so the distinction is invisible to our purely homotopy-theoretic eyes --- and higher inductive types only allow us to ``identify'' points up to a higher path anyway, there is no purpose to considering reduced suspensions in homotopy type theory. + However, the ``unreducedness'' of our suspension is the reason for the (possibly unexpected) appearance of $\opp{\merid(x_0)}$ in the definition of $\sigma$. +\end{rmk} + +Our goal is now to prove the following. + +\begin{thm}[The Freudenthal suspension theorem]\label{thm:freudenthal} + Suppose that $X$ is $n$-connected and pointed, with $n\geq 0$. + Then the map $\sigma:X\to \Omega\susp(X)$ is $2n$-connected. +\end{thm} + +\index{encode-decode method|(}% + +We will use the encode-decode method, but applied in a slightly different way. +In most cases so far, we have used it to characterize the loop space $\Omega (A,a_0)$ of some type as equivalent to some other type $B$, by constructing a family $\code:A\to \type$ with $\code(a_0)\defeq B$ and a family of equivalences $\decode:\prd{x:A}\code(x) \eqvsym (a_0=x)$. +% We have also generalized it to characterize truncations of loop spaces by way of a family of equivalences $\prd{x:A}\code(x) \eqvsym \trunc n{a_0=x}$. + +In this case, however, we want to show that $\sigma:X\to \Omega \susp X$ is $2n$-connected. +We could use a truncated version of the previous method, such as we will see in \cref{sec:van-kampen}, to prove that $\trunc{2n}X\to \trunc{2n}{\Omega \susp X}$ is an equivalence --- but this is a slightly weaker statement than the map being $2n$-connected (see \cref{thm:conn-pik,thm:pik-conn}). +However, note that in the general case, to prove that $\decode(x)$ is an equivalence, we could equivalently be proving that its fibers are contractible, and we would still be able to use induction over the base type. +This we can generalize to prove connectedness of a map into a loop space, i.e.\ that the \emph{truncations} of its fibers are contractible. +Moreover, instead of constructing $\code$ and $\decode$ separately, we can construct directly a family of \emph{codes for the truncations of the fibers}. + +\begin{defn}\label{thm:freudcode} + If $X$ is $n$-connected and pointed with $n\geq 0$, then there is a family + \begin{equation} + \code:\prd{y:\susp X} (\north=y) \to \type\label{eq:freudcode} + \end{equation} + such that + \begin{align} + \code(\north,p) &\defeq \trunc{2n}{\hfib{\sigma}{p}} + \jdeq \trunc{2n}{\tsm{x:X} (\merid(x) \ct \opp{\merid(x_0)} = p)}\label{eq:freudcodeN}\\ + \code(\south,q) &\defeq \trunc{2n}{\hfib{\merid}{q}} + \jdeq \trunc{2n}{\tsm{x:X} (\merid(x) = q)}.\label{eq:freudcodeS} + \end{align} +\end{defn} + +Our eventual goal will be to prove that $\code(y,p)$ is contractible for all $y:\susp X$ and $p:\north=y$. +Applying this with $y\defeq \north$ will show that all fibers of $\sigma$ are $2n$-connected, and thus $\sigma$ is $2n$-connected. + +\begin{proof}[Proof of \cref{thm:freudcode}] + We define $\code(y,p)$ by induction on $y:\susp X$, where the first two cases are~\eqref{eq:freudcodeN} and~\eqref{eq:freudcodeS}. + It remains to construct, for each $x_1:X$, a dependent path + \[ \dpath{\lam{y}(\north=y)\to\type}{\merid(x_1)}{\code(\north)}{\code(\south)}. \] + By \cref{thm:dpath-arrow}, this is equivalent to giving a family of paths + \[ \prd{q:\north=\south} \code(\north)(\transfib{\lam{y}(\north=y)}{\opp{\merid(x_1)}}{q}) = \code(\south)(q). \] + And by univalence and transport in path types, this is equivalent to a family of equivalences + \[ \prd{q:\north=\south} \code(\north,q \ct \opp{\merid(x_1)}) \eqvsym \code(\south,q). \] + We will define a family of maps + \begin{equation}\label{eq:freudmap} + \prd{q:\north=\south} \code(\north,q \ct \opp{\merid(x_1)}) \to \code(\south,q). + \end{equation} + and then show that they are all equivalences. + Thus, let $q:\north=\south$; by the universal property of truncation and the definitions of $\code(\north,\blank)$ and $\code(\south,\blank)$, it will suffice to define for each $x_2:X$, a map + \begin{equation*} + \big(\merid(x_2)\ct \opp{\merid(x_0)} = q \ct \opp{\merid(x_1)}\big) + \to \trunc{2n}{\tsm{x:X} (\merid(x) = q)}. + \end{equation*} + Now for each $x_1,x_2:X$, this type is $2n$-truncated, while $X$ is $n$-connected. + Thus, by \cref{thm:wedge-connectivity}, it suffices to define this map when $x_1$ is $x_0$, when $x_2$ is $x_0$, and check that they agree when both are $x_0$. + + When $x_1$ is $x_0$, the hypothesis is $r:\merid(x_2)\ct \opp{\merid(x_0)} = q \ct \opp{\merid(x_0)}$. + Thus, by canceling $\opp{\merid(x_0)}$ from $r$ to get $r':\merid(x_2)=q$, so we can define the image to be $\tproj{2n}{(x_2,r')}$. + + When $x_2$ is $x_0$, the hypothesis is $r:\merid(x_0)\ct \opp{\merid(x_0)} = q \ct \opp{\merid(x_1)}$. + Rearranging this, we obtain $r'':\merid(x_1)=q$, and we can define the image to be $\tproj{2n}{(x_1,r'')}$. + + Finally, when both $x_1$ and $x_2$ are $x_0$, it suffices to show the resulting $r'$ and $r''$ agree; this is an easy lemma about path composition. + This completes the definition of~\eqref{eq:freudmap}. + To show that it is a family of equivalences, since being an equivalence is a mere proposition and $x_0:\unit\to X$ is (at least) $(-1)$-connected, it suffices to assume $x_1$ is $x_0$. + In this case, inspecting the above construction we see that it is essentially the $2n$-truncation of the function that cancels $\opp{\merid(x_0)}$, which is an equivalence. +\end{proof} + +In addition to~\eqref{eq:freudcodeN} and~\eqref{eq:freudcodeS}, we will need to extract from the construction of $\code$ some information about how it acts on paths. +For this we use the following lemma. + +\begin{lem}\label{thm:freudlemma} + Let $A:\UU$, $B:A\to \UU$, and $C:\prd{a:A} B(a)\to\UU$, and also $a_1,a_2:A$ with $m:a_1=a_2$ and $b:B(a_2)$. + Then the function + \[\transfib{\widehat{C}}{\pairpath(m,t)}{\blank} : C(a_1,\transfib{B}{\opp m}{b}) \to C(a_2,b),\] + where $t:\transfib{B}{m}{\transfib{B}{\opp m}{b}} = b$ is the obvious coherence path and $\widehat{C}:(\sm{a:A} B(a)) \to\type$ is the uncurried form of $C$, is equal to the equivalence obtained by univalence from the composite + \begin{align} + C(a_1,\transfib{B}{\opp m}{b}) + &= \transfib{\lam{a} B(a)\to \UU}{m}{C(a_1)}(b) + \tag{by~\eqref{eq:transport-arrow}}\\ + &= C(a_2,b). \tag{by $\happly(\apd{C}{m},b)$} + \end{align} +\end{lem} +\begin{proof} + By path induction, we may assume $a_2$ is $a_1$ and $m$ is $\refl{a_1}$, in which case both functions are the identity. +\end{proof} + +We apply this lemma with $A\defeq\susp X$ and $B\defeq \lam{y}(\north=y)$ and $C\defeq\code$, while $a_1\defeq\north$ and $a_2\defeq\south$ and $m\defeq \merid(x_1)$ for some $x_1:X$, and finally $b\defeq q$ is some path $\north=\south$. +The computation rule for induction over $\susp X$ identifies $\apd{C}{m}$ with a path constructed in a certain way out of univalence and function extensionality. +The second function described in \cref{thm:freudlemma} essentially consists of undoing these applications of univalence and function extensionality, reducing back to the particular functions~\eqref{eq:freudmap} that we defined using \cref{thm:wedge-connectivity}. +Therefore, \cref{thm:freudlemma} says that transporting along $\pairpath(q,t)$ essentially recovers these functions. + +Finally, by construction, when $x_1$ or $x_2$ coincides with $x_0$ and the input is in the image of $\tproj{2n}{\blank}$, we know more explicitly what these functions are. +Thus, for any $x_2:X$, we have +\begin{equation} + \transfib{\hat{\code}}{\pairpath(\merid(x_0),t)}{\tproj{2n}{(x_2,r)}} + =\tproj{2n}{(x_1,r')}\label{eq:freudcompute1} +\end{equation} +where $r:\merid(x_2) \ct \opp{\merid(x_0)} = \transfib{B}{\opp{\merid(x_0)}}{q}$ is arbitrary as before, and $r':\merid(x_2)=q$ is obtained from $r$ by identifying its end point with $q \ct \opp{\merid(x_0)}$ and canceling $\opp{\merid(x_0)}$. +Similarly, for any $x_1:X$, we have +\begin{equation} + \transfib{\hat{\code}}{\pairpath(\merid(x_1),t)}{\tproj{2n}{(x_0,r)}} + = \tproj{2n}{(x_1,r'')}\label{eq:freudcompute2} +\end{equation} +where $r:\merid(x_0) \ct \opp{\merid(x_0)} = \transfib{B}{\opp{\merid(x_1)}}{q}$, and $r'':\merid(x_1)=q$ is obtained by identifying its end point and rearranging paths. + +\begin{proof}[Proof of \cref{thm:freudenthal}] + It remains to show that $\code(y,p)$ is contractible for each $y:\susp X$ and $p:\north=y$. + First we must choose a center of contraction, say $c(y,p):\code(y,p)$. + This corresponds to the definition of the function $\encode$ in our previous proofs, so we define it by transport. + Note that in the special case when $y$ is $\north$ and $p$ is $\refl{\north}$, we have + \[\code(\north,\refl{\north}) \jdeq \trunc{2n}{\tsm{x:X} (\merid(x) \ct \opp{\merid(x_0)} = \refl{\north})}.\] + Thus, we can choose $c(\north,\refl{\north})\defeq \tproj{2n}{(x_0,\mathsf{rinv}_{\merid(x_0)})}$, where $\mathrm{rinv}_q$ is the obvious path $q\ct\opp q = \refl{}$ for any $q$. + We can now obtain $c:\prd{y:\susp X}{p:\north=y} \code(y,p)$ by path induction on $p$, but it will be important below that we can also give a concrete definition in terms of transport: + \[ c(y,p) \defeq \transfib{\hat{\code}}{\pairpath(p,\mathsf{tid}_p)}{c(\north,\refl{\north})} + \] + where $\hat{\code}: \big(\sm{y:\susp X} (\north=y)\big) \to \type$ is the uncurried version of \code, and $\mathsf{tid}_p:\trans{p}{\refl{}} = p$ is a standard lemma. + + Next, we must show that every element of $\code(y,p)$ is equal to $c(y,p)$. + Again, by path induction, it suffices to assume $y$ is $\north$ and $p$ is $\refl{\north}$. + In fact, we will prove it more generally when $y$ is $\north$ and $p$ is arbitrary. + That is, we will show that for any $p:\north=\north$ and $d:\code(\north,p)$ we have $d = c(\north,p)$. + Since this equality is a $(2n-1)$-type, we may assume $d$ is of the form $\tproj{2n}{(x_1,r)}$ for some $x_1:X$ and $r:\merid(x_1) \ct \opp{\merid(x_0)} = p$. + + Now by a further path induction, we may assume that $r$ is reflexivity, and $p$ is $\merid(x_1) \ct \opp{\merid(x_0)}$. + (This is why we generalized to arbitrary $p$ above.) + Thus, we have to prove that + \begin{equation} + \tproj{2n}{(x_1, \refl{\merid(x_1) \ct \opp{\merid(x_0)}})} + \;=\; + c\left(\north,\refl{\merid(x_1) \ct \opp{\merid(x_0)}}\right).\label{eq:freudgoal} + \end{equation} + By definition, the right-hand side of this equality is + \begin{multline*} + \Transfib{\hat{\code}}{\pairpath(\merid(x_1) \ct \opp{\merid(x_0)}, \nameless)}{\tproj{2n}{(x_0,\nameless)}} \\ + = \transfibf{\hat{\code}} + \begin{aligned}[t] + \Big( + &{\pairpath(\opp{\merid(x_0)}, \nameless)},\\ + &{\Transfib{\hat{\code}}{\pairpath(\merid(x_1), \nameless)}{\tproj{2n}{(x_0,\nameless)}}} + \Big) + \end{aligned} + \\ + = \Transfib{\hat{\code}}{\pairpath(\opp{\merid(x_0)}, \nameless)}{\tproj{2n}{(x_1,\nameless)}} + = \tproj{2n}{(x_1,\nameless)} + \end{multline*} + where the underscore $\nameless$ ought to be filled in with suitable coherence paths. + Here the first step is functoriality of transport, the second invokes~\eqref{eq:freudcompute2}, and the third invokes~\eqref{eq:freudcompute1} (with transport moved to the other side). + Thus we have the same first component as the left-hand side of~\eqref{eq:freudgoal}. + We leave it to the reader to verify that the coherence paths all cancel, giving reflexivity in the second component. +\end{proof} + +% As a corollary, we have the following equivalence. + +\begin{cor}[Freudenthal Equivalence] \label{cor:freudenthal-equiv} +Suppose that $X$ is $n$-connected and pointed, with $n\geq 0$. +Then $\eqv{\trunc{2n}{X}}{\trunc{2n}{\Omega\susp(X)}}$. +\end{cor} +\begin{proof} +By \cref{thm:freudenthal}, $\sigma$ is $2n$-connected. By +\cref{lem:connected-map-equiv-truncation}, it is therefore an +equivalence on $2n$-truncations. +\end{proof} + +\index{encode-decode method|)}% + +\index{Freudenthal suspension theorem|)}% +\index{theorem!Freudenthal suspension|)}% + +\index{homotopy!group!of sphere}% +\index{stability!of homotopy groups of spheres}% +\index{type!n-sphere@$n$-sphere}% +One important corollary of the Freudenthal suspension theorem is that the homotopy groups of +spheres are stable in a certain range (these are the northeast-to-southwest diagonals +in \cref{tab:homotopy-groups-of-spheres}): + +\begin{cor}[Stability for Spheres] \label{cor:stability-spheres} +If $k \le 2n-2$, then $\pi_{k+1}(S^{n+1}) = \pi_{k}(S^{n})$. +\end{cor} +\begin{proof} +Assume $k \le 2n-2$. +% +By \cref{cor:sn-connected}, $\Sn ^{n}$ is $\nminusone$-connected. Therefore, +by \cref{cor:freudenthal-equiv}, +\[ +\trunc{2(n-1)}{\Omega(\susp(\Sn^{n}))} = \trunc{2(n-1)}{\Sn^{n}}. +\] +By \cref{lem:truncation-le}, because $k \le 2(n-1)$, applying $\trunc{k}{\blank}$ +to both sides shows that this equation holds for $k$: +\begin{equation}\label{eq:freudenthal-for-spheres} +\trunc{k}{\Omega(\susp(\Sn^{n}))} = \trunc{k}{\Sn^{n}}. +\end{equation} +% +Then, the main idea of the proof is as follows; we omit checking that these +equivalences act appropriately on the base points of these spaces, and that for +$k > 0$ the equivalences respect multiplication: +% +\begin{align*} +\pi_{k+1}(\Sn^{n+1}) &\jdeq \trunc{0}{\Omega^{k+1}(\Sn^{n+1})} \\ + &\jdeq \trunc{0}{\Omega^k(\Omega(\Sn^{n+1}))} \\ + &\jdeq \trunc{0}{\Omega^k(\Omega(\susp(\Sn^{n})))} \\ + &= \Omega^k(\trunc{k}{(\Omega(\susp(\Sn^{n})))}) + \tag{by \cref{thm:path-truncation}}\\ + &= \Omega^k(\trunc{k}{\Sn^{n}}) + \tag{by \eqref{eq:freudenthal-for-spheres}}\\ + &= \trunc{0}{\Omega^k(\Sn^{n})} + \tag{by \cref{thm:path-truncation}}\\ + &\jdeq \pi_k(\Sn^{n}). \qedhere +\end{align*} +% +\end{proof} + +This means that once we have calculated one entry in one of these stable +diagonals, we know all of them. For example: +\begin{thm}\label{thm:pinsn} +$\pi_n(\Sn^n)=\Z$ for every $n\geq 1$. +\end{thm} + +\begin{proof} +The proof is by induction on $n$. We already have $\pi_1(\Sn ^1) = \Z$ +(\cref{cor:pi1s1}) and $\pi_2(\Sn ^2) = \Z$ (\cref{cor:pis2-hopf}). +When $n \ge 2$, $n \le (2n - 2)$. Therefore, by +\cref{cor:stability-spheres}, $\pi_{n+1}(S^{n+1}) = \pi_{n}(S^{n})$, and +this equivalence, combined with the inductive hypothesis, gives the result. +\end{proof} + +\begin{cor} + $\Sn^{n+1}$ is not an $n$-type for any $n\ge -1$. +\end{cor} + +\begin{cor}\label{thm:pi3s2} + $\pi_3(\Sn^2)=\Z$. +\end{cor} +\begin{proof} + By \cref{cor:pis2-hopf}, $\pi_3(\Sn^2) = \pi_3(\Sn^3)$. + But by \cref{thm:pinsn}, $\pi_3(\Sn^3) = \Z$. +\end{proof} + +\section{The van Kampen theorem} +\label{sec:van-kampen} + +\index{van Kampen theorem|(}% +\index{theorem!van Kampen|(}% + +\index{fundamental!group}% +The van Kampen theorem calculates the fundamental group $\pi_1$ of a (homotopy) pushout of spaces. +It is traditionally stated for a topological space $X$ which is the union of two open subspaces $U$ and $V$, but in homotopy-theoretic terms this is just a convenient way of ensuring that $X$ is the pushout of $U$ and $V$ over their intersection. +Thus, we will prove a version of the van Kampen theorem for arbitrary pushouts. + +In this section we will describe a proof of the van Kampen theorem which uses the same encode-decode method that we used for $\pi_1(\Sn^1)$ in \cref{sec:pi1-s1-intro}. +There is also a more homotopy-theoretic approach; see \cref{ex:rezk-vankampen}. + +We need a more refined version of the encode-decode method. +In \cref{sec:pi1-s1-intro} (as well as in \cref{sec:compute-coprod,sec:compute-nat}) we used it to characterize the path space of a (higher) inductive type $W$ --- deriving as a consequence a characterization of the loop space $\Omega(W)$, and thereby also of its 0-truncation $\pi_1(W)$. +In the van Kampen theorem, our goal is only to characterize the fundamental group $\pi_1(W)$, and we do not have any explicit description of the loop spaces or the path spaces to use. + +It turns out that we can use the same technique directly for a truncated version of the path fibration, thereby characterizing not only the fundamental \emph{group} $\pi_1(W)$, but also the whole fundamental \emph{groupoid}. +\index{fundamental!pregroupoid}% +Spe\-cif\-ical\-ly, for a type $X$, write $\Pi_1 X: X\to X\to \type$ for the $0$-truncation of its identity type, i.e.\ $\Pi_1 X(x,y) \defeq \trunc0{x=y}$. +Note that we have induced groupoid operations +\begin{align*} + (\blank\ct\blank) &\;:\; \Pi_1X(x,y) \to \Pi_1X(y,z) \to \Pi_1X(x,z)\\ + \opp{(\blank)} &\;:\; \Pi_1X(x,y) \to \Pi_1X(y,x)\\ + \refl{x} &\;:\; \Pi_1X(x,x)\\ + \apfunc{f} &\;:\; \Pi_1X(x,y) \to \Pi_1Y(fx,fy) +\end{align*} +for which we use the same notation as the corresponding operations on paths. + +\subsection{Naive van Kampen} +\label{sec:naive-vankampen} + +We begin with a ``naive'' version of the van Kampen theorem, which is useful but not quite as useful as the classical version. +In \cref{sec:better-vankampen} we will improve it to a more useful version. + +\index{encode-decode method|(}% + +Given types $A,B,C$ and functions $f:A\to B$ and $g:A\to C$, let $P$ be their pushout $B\sqcup^A C$. +As we saw in \cref{sec:colimits}, $P$ is the higher inductive type generated by +\begin{itemize} +\item $i:B\to P$, +\item $j:C\to P$, and +\item for all $x:A$, a path $k x:ifx = jgx$. +\end{itemize} +Define $\code:P\to P\to \type$ by double induction on $P$ as follows. +\begin{itemize} +\item $\code(ib,ib')$ is a set-quotient (see \cref{sec:set-quotients}) of the type of sequences %pairs $(\vec a, \vec a', \vec p, \vec q)$ + \[ (b, p_0, x_1, q_1, y_1, p_1, x_2, q_2, y_2, p_2, \dots, y_n, p_n, b') \] + where + \begin{itemize} + \item $n:\mathbb{N}$ + \item $x_k:A$ and $y_k:A$ for $00$, and $p_0:\Pi_1B(b,b')$ for $n=0$ + \item $p_k:\Pi_1B(f y_k, fx_{k+1})$ for $1\le k < n$ + \item $q_k:\Pi_1C(gx_k, gy_k)$ for $1\le k\le n$ + \end{itemize} + The quotient is generated by the following equalities: + \begin{align*} + (\dots, q_k, y_k, \refl{fy_k}, y_k, q_{k+1},\dots) + &= (\dots, q_k\ct q_{k+1},\dots)\\ + (\dots, p_k, x_k, \refl{gx_k}, x_k, p_{k+1},\dots) + &= (\dots, p_k\ct p_{k+1},\dots) + \end{align*} + (see \cref{rmk:naive} below). + We leave it to the reader to define this type of sequences precisely as an inductive type. +\item $\code(jc,jc')$ is identical, with the roles of $B$ and $C$ reversed. + We likewise notationally reverse the roles of $x$ and $y$, and of $p$ and $q$. +\item $\code(ib,jc)$ and $\code(jc,ib)$ are similar, with the parity changed so that they start in one type and end in the other. +\item For $a:A$ and $b:B$, we require an equivalence + \begin{equation} + \code(ib, ifa) \eqvsym \code(ib,jga).\label{eq:bfa-bga} + \end{equation} + We define this to consist of the two functions defined on sequences by + \begin{align*} + (\dots, y_n, p_n,fa) &\mapsto (\dots,y_n,p_n,a,\refl{ga},ga),\\ + (\dots, x_n, p_n, a, \refl{fa}, fa) &\mapsfrom (\dots, x_n, p_n, ga). + \end{align*} + Both of these functions are easily seen to respect the equivalence relations, and hence to define functions on the types of codes. + The left-to-right-to-left composite is + \[ (\dots, y_n, p_n,fa) \mapsto + (\dots,y_n,p_n,a,\refl{ga},a,\refl{fa},fa) + \] + which is equal to the identity by a generating equality of the quotient. + The other composite is analogous. + Thus we have defined an equivalence~\eqref{eq:bfa-bga}. +\item Similarly, we require equivalences + \begin{align*} + \code(jc,ifa) &\eqvsym \code(jc,jga)\\ + \code(ifa,ib)&\eqvsym (jga,ib)\\ + \code(ifa,jc)&\eqvsym (jga,jc) + \end{align*} + all of which are defined in exactly the same way (the second two by adding reflexivity terms on the beginning rather than the end). +\item Finally, we need to know that for $a,a':A$, the following diagram commutes: + \begin{equation}\label{eq:bfa-bga-comm} + \vcenter{\xymatrix{ + \code(ifa,ifa') \ar[r]\ar[d] & + \code(ifa,jga')\ar[d]\\ + \code(jga,ifa')\ar[r] & + \code(jga,jga') + }} + \end{equation} + This amounts to saying that if we add something to the beginning and then something to the end of a sequence, we might as well have done it in the other order. +\end{itemize} + +\begin{rmk}\label{rmk:naive} + One might expect to see in the definition of \code some additional generating equations for the set-quotient, such as + \begin{align*} + (\dots, p_{k-1} \ct fw, x_{k}', q_{k}, \dots) &= + (\dots, p_{k-1}, x_{k}, gw \ct q_{k}, \dots) + \tag{for $w:\Pi_1A(x_{k},x_{k}')$}\\ + (\dots, q_k \ct gw, y_k', p_k, \dots) &= + (\dots, q_k, y_k, fw \ct p_k, \dots). + \tag{for $w:\Pi_1A(y_k, y_k')$} + \end{align*} + However, these are not necessary! + In fact, they follow automatically by path induction on $w$. + This is the main difference between the ``naive'' van Kampen theorem and the more refined one we will consider in the next subsection. +\end{rmk} + +Continuing on, we can characterize transporting in the fibration $\code$: +\begin{itemize} +\item For $p:b=_B b'$ and $u:P$, we have + \[ \mathsf{transport}^{b\mapsto \code(u,ib)}(p, (\dots, y_n,p_n,b)) + = (\dots,y_n,p_n\ct p,b'). + \] +\item For $q:c=_C c'$ and $u:P$, we have + \[ \mathsf{transport}^{c\mapsto \code(u,jc)}(q, (\dots, x_n,q_n,c)) + = (\dots,x_n,q_n\ct q,c'). + \] +\end{itemize} +Here we are abusing notation by using the same name for a path in $X$ and its image in $\Pi_1X$. +Note that transport in $\Pi_1X$ is also given by concatenation with (the image of) a path. +From this we can prove the above statements by induction on $u$. +We also have: +\begin{itemize} +\item For $a:A$ and $u:P$, + \[ \mathsf{transport}^{v\mapsto \code(u,v)}(ha, (\dots, y_n,p_n,fa)) + = (\dots,y_n,p_n,a,\refl{ga},ga). + \] +\end{itemize} +This follows essentially from the definition of $\code$. + +We also construct a function +\[ r : \prd{u:P} \code(u,u) \] +by induction on $u$ as follows: +\begin{align*} + rib &\defeq (b,\refl{b},b)\\ + rjc &\defeq (c,\refl{c},c) +\end{align*} +and for $rka$ we take the composite equality +\begin{align*} + (ka,ka)_* (fa,\refl{fa},fa) + &= (ga,\refl{ga},a,\refl{fa},a,\refl{ga},ga) \\ + &= (ga,\refl{ga},ga) +\end{align*} +where the first equality is by the observation above about transporting in $\code$, and the second is an instance of the set quotient relation used to define $\code$. + +We will now prove: +\begin{thm}[Naive van Kampen theorem]\label{thm:naive-van-kampen} + For all $u,v:P$ there is an equivalence + \[ \Pi_1P(u,v) \eqvsym \code(u,v). \] +\end{thm} +\begin{proof} + +To define a function +\[ \encode : \Pi_1P(u,v) \to \code(u,v) \] +it suffices to define a function $(u=_P v) \to \code(u,v)$, +since $\code(u,v)$ is a set. +We do this by transport: +\[\encode(p) \defeq \mathsf{transport}^{v\mapsto \code(u,v)}(p,r(u)).\] +Now to define +\[ \decode: \code(u,v) \to \Pi_1P(u,v) \] +we proceed as usual by induction on $u,v:P$. +In each case for $u$ and $v$, we apply $i$ or $j$ to all the equalities $p_k$ and $q_k$ as appropriate and concatenate the results in $P$, using $h$ to identify the endpoints. +For instance, when $u\jdeq ib$ and $v\jdeq ib'$, we define +\begin{narrowmultline}\label{eq:decode} + \decode(b, p_0, x_1, q_1, y_1, p_1, \dots, y_n, p_n, b') \defeq\narrowbreak + (p_0)\ct h(x_1) \ct j(q_1) \ct \opp{h(y_1)} \ct i(p_1) \ct \cdots \ct \opp{h(y_n)}\ct i(p_n). +\end{narrowmultline} +This respects the set-quotient equivalence relation and the equivalences such as~\eqref{eq:bfa-bga}, since $h: fi \htpy gj$ is natural and $f$ and $g$ are functorial. + +As usual, to show that the composite +\[ \Pi_1P(u,v) \xrightarrow{\encode} \code(u,v) \xrightarrow{\decode} \Pi_1P(u,v) \] +is the identity, we first peel off the 0-truncation (since the codomain is a set) and then apply path induction. +The input $\refl{u}$ goes to $ru$, which then goes back to $\refl u$ (applying a further induction on $u$ to decompose $\decode(ru)$). + +Finally, consider the composite +\[ \code(u,v) \xrightarrow{\decode} \Pi_1P(u,v) \xrightarrow{\encode} \code(u,v). \] +We proceed by induction on $u,v:P$. +When $u\jdeq ib$ and $v\jdeq ib'$, this composite is +% +\begin{narrowmultline*} +(b, p_0, x_1, q_1, y_1, p_1, \dots, y_n, p_n, b') +\narrowbreak +\begin{aligned}[t] + &\mapsto \Big(ip_0\ct hx_1 \ct jq_1 \ct \opp{hy_1} \ct ip_1 \ct \cdots \ct \opp{hy_n}\ct ip_n\Big)_*(rib)\\ + &= (ip_n)_* \cdots(jq_1)_* (hx_1)_*(ip_0)_*(b,\refl{b},b)\\ + &= (ip_n)_* \cdots(jq_1)_* (hx_1)_*(b,p_0,ifx_1)\\ + &= (ip_n)_* \cdots(jq_1)_* (b,p_0,x_1,\refl{gx_1},jgx_1)\\ + &= (ip_n)_* \cdots (b,p_0,x_1,q_1,jgy_1)\\ + &= \quad\vdots\\ + &= (b, p_0, x_1, q_1, y_1, p_1, \dots, y_n, p_n, b'). +\end{aligned} +\end{narrowmultline*} +% +i.e., the identity function. +(To be precise, there is an implicit inductive argument needed here.) +The other three point cases are analogous, and the path cases are trivial since all the types are sets. +\end{proof} + +\index{encode-decode method|)}% + +\cref{thm:naive-van-kampen} allows us to calculate the fundamental groups of many types, provided $A$ is a set, +for in that case, each $\code(u,v)$ is, by definition, a set-quotient of a \emph{set} by a relation. + +\begin{eg}\label{eg:circle} + Let $A\defeq \bool$, $B\defeq\unit$, and $C\defeq \unit$. + Then $P \eqvsym S^1$. + Inspecting the definition of, say, $\code(i(\ttt),i(\ttt))$, we see that the paths all may as well be trivial, so the only information is in the sequence of elements $x_1,y_1,\dots,x_n,y_n: \bool$. + Moreover, if we have $x_k=y_k$ or $y_k=x_{k+1}$ for any $k$, then the set-quotient relations allow us to excise both of those elements. + Thus, every such sequence is equal to a canonical \emph{reduced} one in which no two adjacent elements are equal. + Clearly such a reduced sequence is uniquely determined by its length (a natural number $n$) together with, if $n>1$, the information of whether $x_1$ is $\bfalse$ or $\btrue$, since that determines the rest of the sequence uniquely. + And these data can, of course, be identified with an integer, where $n$ is the absolute value and $x_1$ encodes the sign. + Thus we recover $\pi_1(S^1)\cong \Z$. +\end{eg} + +Since \cref{thm:naive-van-kampen} asserts only a bijection of families of sets, this isomorphism $\pi_1(S^1)\cong \Z$ is likewise only a bijection of sets. +We could, however, define a concatenation operation on $\code$ (by concatenating sequences) and show that $\encode$ and $\decode$ form an isomorphism respecting this structure. +(In the language of \cref{cha:category-theory}, these would be ``pregroupoids''.) +We leave the details to the reader. + +\index{fundamental!group|(}% + +\begin{eg}\label{eg:suspension} + More generally, let $B\defeq\unit$ and $C\defeq \unit$ but $A$ be arbitrary, so that $P$ is the suspension of $A$. + Then once again the paths $p_k$ and $q_k$ are trivial, so that the only information in a path code is a sequence of elements $x_1,y_1,\dots,x_n,y_n: A$. + The first two generating equalities say that adjacent equal elements can be canceled, so it makes sense to think of this sequence as a word of the form + \[ x_1 y_1^{-1} x_2 y_2^{-1} \cdots x_n y_n^{-1} \] + in a group. + Indeed, it looks similar to the free group on $A$ (or equivalently on $\trunc0A$; see \cref{thm:freegroup-nonset}), but we are considering only words that start with a non-inverted element, alternate between inverted and non-inverted elements, and end with an inverted one. + This effectively reduces the size of the generating set by one. + For instance, if $A$ has a point $a:A$, then we can identify $\pi_1(\susp A)$ with the group presented by $\trunc0A$ as generators with the relation $\tproj0a = e$; see \cref{ex:vksusppt,ex:vksuspnopt} for details. +\end{eg} + +\begin{eg}\label{eg:wedge} + Let $A\defeq\unit$ and $B$ and $C$ be arbitrary, so that $f$ and $g$ simply equip $B$ and $C$ with basepoints $b$ and $c$, say. + Then $P$ is the \emph{wedge} $B\vee C$ of $B$ and $C$ (the coproduct in the category of based spaces). + In this case, it is the elements $x_k$ and $y_k$ which are trivial, so that the only information is a sequence of loops $(p_0,q_1,p_1,\dots,p_n)$ with $p_k:\pi_1(B,b)$ and $q_k:\pi_1(C,c)$. + Such sequences, modulo the equivalence relation we have imposed, are easily identified with the explicit description of the \emph{free product} of the groups $\pi_1(B,b)$ and $\pi_1(C,c)$, as constructed in \cref{sec:free-algebras}. + Thus, we have $\pi_1(B\vee C) \cong \pi_1(B) * \pi_1(C)$. +\end{eg} + +\index{fundamental!group|)}% + +However, \cref{thm:naive-van-kampen} stops just short of being the full classical van Kampen theorem, which handles +the case where $A$ is not necessarily a set, +and states that $\pi_1(B\sqcup^A C) \cong \pi_1(B) *_{\pi_1(A)} \pi_1(C)$ (with base point coming from $A$). +Indeed, the conclusion of \cref{thm:naive-van-kampen} says nothing at all about $\pi_1(A)$; the paths in $A$ are ``built into the quotienting'' in a type-theoretic way that makes it hard to extract explicit information, in that $\code(u,v)$ is a set-quotient of a non-set by a relation. +For this reason, in the next subsection we consider a better version of the van Kampen theorem. + + +\subsection{The van Kampen theorem with a set of basepoints} +\label{sec:better-vankampen} + +\index{basepoint!set of}% +The improvement of van Kampen we present now is closely analogous to a similar improvement in classical algebraic topology, where $A$ is equip\-ped with a \emph{set $S$ of base points}. +In fact, it turns out to be unnecessary for our proof to assume that the ``set of basepoints'' is a \emph{set} --- it might just as well be an arbitrary type; the utility of assuming $S$ is a set arises later, when applying the theorem to obtain computations. +What is important is that $S$ contains at least one point in each connected component of $A$. +We state this in type theory by saying that we have a type $S$ and a function $k:S \to A$ which is surjective, i.e.\ $(-1)$-connected. +If $S\jdeq A$ and $k$ is the identity function, then we will recover the naive van Kampen theorem. +Another example to keep in mind is when $A$ is pointed and (0-)connected, with $k:\unit\to A$ the point: by \cref{thm:minusoneconn-surjective,thm:connected-pointed} this map is surjective just when $A$ is 0-connected. + +Let $A,B,C,f,g,P,i,j,h$ be as in the previous section. +We now define, given our surjective map $k:S\to A$, an auxiliary type which improves the connectedness of $k$. +Let $T$ be the higher inductive type generated by +\begin{itemize} +\item A function $\ell:S\to T$, and +\item For each $s,s':S$, a function $m:(\id[A]{ks}{ks'}) \to (\id[T]{\ell s}{\ell s'})$. +\end{itemize} +There is an obvious induced function $\kbar:T\to A$ such that $\kbar \ell = k$, and any $p:ks=ks'$ is equal to the composite $ks = \kbar \ell s \overset{\kbar m p}{=} \kbar \ell s' = k s'$. + +\begin{lem}\label{thm:kbar} + $\kbar$ is 0-connected. +\end{lem} +\begin{proof} + We must show that for all $a:A$, the 0-truncation of the type $\sm{t:T}(\kbar t = a)$ is contractible. + Since contractibility is a mere proposition and $k$ is $(-1)$-connected, we may assume that $a=ks$ for some $s:S$. + Now we can take the center of contraction to be $\tproj0{(\ell s,q)}$ where $q$ is the equality $\kbar\ell s = k s$. + + It remains to show that for any $\phi:\trunc0{\sm{t:T} (\kbar t = ks)}$ we have $\phi = \tproj0{(\ell s,q)}$. + Since the latter is a mere proposition, and in particular a set, we may assume that $\phi=\tproj0{(t,p)}$ for $t:T$ and $p:\kbar t = ks$. + + Now we can do induction on $t:T$. + If $t\jdeq\ell s'$, then $ks' = \kbar \ell s' \overset{p}{=} ks$ yields via $m$ an equality $\ell s = \ell s'$. + Hence by definition of $\kbar$ and of equality in homotopy fibers, we obtain an equality $(ks',p) = (ks,q)$, and thus $\tproj0{(ks',p)} = \tproj0{(ks,q)}$. + Next we must show that as $t$ varies along $m$ these equalities agree. + But they are equalities in a set (namely $\trunc0{\sm{t:T} (\kbar t = ks)}$), and hence this is automatic. +\end{proof} + +\begin{rmk} + \index{kernel!pair}% + $T$ can be regarded as the (homotopy) coequalizer of the ``kernel pair'' of $k$. + If $S$ and $A$ were sets, then the $(-1)$-connectivity of $k$ would imply that $A$ is the $0$-truncation of this coequalizer (see \cref{cha:set-math}). + For general types, higher topos theory suggests that $(-1)$-con\-nec\-tiv\-i\-ty of $k$ will imply instead that $A$ is the colimit (a.k.a.\ ``geometric realization'') of the ``simplicial kernel'' of $k$. + \index{.infinity1-topos@$(\infty,1)$-topos}% + \index{geometric realization}% + \index{simplicial!kernel}% + \index{kernel!simplicial}% + The type $T$ is the colimit of the ``1-skeleton'' of this simplicial kernel, so it makes sense that it improves the connectivity of $k$ by $1$. + More generally, we might expect the colimit of the $n$-skeleton\index{skeleton!of a CW-complex} to improve connectivity by $n$. +\end{rmk} + +\index{encode-decode method|(}% + +Now we define $\code:P\to P\to \type$ by double induction as follows +\begin{itemize} +\item $\code(ib,ib')$ is now a set-quotient of the type of sequences + \[ (b, p_0, x_1, q_1, y_1, p_1, x_2, q_2, y_2, p_2, \dots, y_n, p_n, b') \] + where + \begin{itemize} + \item $n:\mathbb{N}$, + \item $x_k:S$ and $y_k:S$ for $00$, and $p_0:\Pi_1B(b,b')$ for $n=0$, + \item $p_k:\Pi_1B(fk y_k, fkx_{k+1})$ for $1\le k < n$, + \item $q_k:\Pi_1C(gkx_k, gky_k)$ for $1\le k\le n$. + \end{itemize} + The quotient is generated by the following equalities (see \cref{rmk:naive}): + \begin{align*} + (\dots, q_k, y_k, \refl{fy_k}, y_k, q_{k+1},\dots) + &= (\dots, q_k\ct q_{k+1},\dots)\\ + (\dots, p_k, x_k, \refl{gx_k}, x_k, p_{k+1},\dots) + &= (\dots, p_k\ct p_{k+1},\dots)\\ + (\dots, p_{k-1} \ct fw, x_{k}', q_{k}, \dots) &= + (\dots, p_{k-1}, x_{k}, gw \ct q_{k}, \dots) + \tag{for $w:\Pi_1A(kx_{k},kx_{k}')$}\\ + (\dots, q_k \ct gw, y_k', p_k, \dots) &= + (\dots, q_k, y_k, fw \ct p_k, \dots). + \tag{for $w:\Pi_1A(ky_k, ky_k')$} + \end{align*} + We will need below the definition of the case of $\decode$ on such a sequence, which as before concatenates all the paths $p_k$ and $q_k$ together with instances of $h$ to give an element of $\Pi_1P(ifb,ifb')$, cf.~\eqref{eq:decode}. + As before, the other three point cases are nearly identical. +\item For $a:A$ and $b:B$, we require an equivalence + \begin{equation} + \code(ib, ifa) \eqvsym \code(ib,jga).\label{eq:bfa-bga2} + \end{equation} + Since $\code$ is set-valued, by \cref{thm:kbar} we may assume that $a=\kbar t$ for some $t:T$. + Next, we can do induction on $t$. + If $t\jdeq \ell s$ for $s:S$, then we define~\eqref{eq:bfa-bga2} as in \cref{sec:naive-vankampen}: + \begin{align*} + (\dots, y_n, p_n,fks) &\mapsto (\dots,y_n,p_n,s,\refl{gks},gks),\\ + (\dots, x_n, p_n, s, \refl{fks}, fks) &\mapsfrom (\dots, x_n, p_n, gks). + \end{align*} + These respect the equivalence relations, and define quasi-inverses just as before. + Now suppose $t$ varies along $m_{s,s'}(w)$ for some $w:ks=ks'$; we must show that~\eqref{eq:bfa-bga2} respects transporting along $\kbar mw$. + By definition of $\kbar$, this essentially boils down to transporting along $w$ itself. + By the characterization of transport in path types, what we need to show is that + \[ w_*(\dots, y_n, p_n,fks) = (\dots,y_n, p_n \ct fw, fks') \] + is mapped by~\eqref{eq:bfa-bga2} to + \[ w_*(\dots,y_n,p_n,s,\refl{gks},gks) = (\dots, y_n, p_n, s, \refl{gks} \ct gw, gks') \] + But this follows directly from the new generators we have imposed on the set-quotient relation defining \code. +\item The other three requisite equivalences are defined similarly. +\item Finally, since the commutativity~\eqref{eq:bfa-bga-comm} is a mere proposition, by $(-1)$-connectedness of $k$ we may assume that $a=ks$ and $a'=ks'$, in which case it follows exactly as before. +\end{itemize} + +\begin{thm}[van Kampen with a set of basepoints]\label{thm:van-Kampen} + For all $u,v:P$ there is an equivalence + \[ \Pi_1P(u,v) \eqvsym \code(u,v). \] + with \code defined as in this section. +\end{thm} + +\begin{proof} + Basically just like before. + To show that $\decode$ respects the new generators of the quotient relation, we use the naturality of $h$. + And to show that $\decode$ respects the equivalences such as~\eqref{eq:bfa-bga2}, we need to induct on $\kbar$ and on $T$ in order to decompose those equivalences into their definitions, but then it becomes again simply functoriality of $f$ and $g$. + The rest is easy. + In particular, no additional argument is required for $\encode\circ\decode$, since the goal is to prove an equality in a set, and so the case of $h$ is trivial. +\end{proof} + +\index{encode-decode method|)}% + +\index{fundamental!group|(}% +\cref{thm:van-Kampen} allows us to calculate the fundamental group of a space~$A$, +even when $A$ is not a set, provided $S$ is a set, for in that case, +each $\code(u,v)$ is, by definition, a set-quotient of a \emph{set} by a +relation. In that respect, it is an improvement over +\cref{thm:naive-van-kampen}. + +\begin{eg}\label{eg:clvk} + Suppose $S\defeq \unit$, so that $A$ has a basepoint $a \defeq k(\ttt)$ and is connected. + Then code for loops in the pushout can be identified with alternating sequences of loops in $\pi_1(B,f(a))$ and $\pi_1(C,g(a))$, modulo an equivalence relation which allows us to slide elements of $\pi_1(A,a)$ between them (after applying $f$ and $g$ respectively). + Thus, $\pi_1(P)$ can be identified with the \emph{amalgamated free product} + \index{amalgamated free product}% + \index{free!product!amalgamated}% + $\pi_1(B) *_{\pi_1(A)} \pi_1(C)$ (the pushout in the category of groups), as constructed in \cref{sec:free-algebras}. + This (in the case when $B$ and $C$ are open subspaces of $P$ and $A$ their intersection) is probably the most classical version of the van Kampen theorem. +\end{eg} + +\begin{eg}\label{eg:cofiber} + \index{cofiber} + As a special case of \cref{eg:clvk}, suppose additionally that $C\defeq\unit$, so that $P$ is the cofiber $B/A$. + Then every loop in $C$ is equal to reflexivity, so the relations on path codes allow us to collapse all sequences to a single loop in $B$. + The additional relations require that multiplying on the left, right, or in the middle by an element in the image of $\pi_1(A)$ is the identity. + We can thus identify $\pi_1(B/A)$ with the quotient of the group $\pi_1(B)$ by the normal subgroup generated by the image of $\pi_1(A)$. +\end{eg} + +\begin{eg}\label{eg:torus} + \index{torus} + As a further special case of \cref{eg:cofiber}, let $B\defeq S^1 \vee S^1$, let $A\defeq S^1$, and let $f:A\to B$ pick out the composite loop $p \ct q \ct \opp p \ct \opp q$, where $p$ and $q$ are the generating loops in the two copies of $S^1$ comprising $B$. + Then $P$ is a presentation of the torus $T^2$. + Indeed, it is not hard to identify $P$ with the presentation of $T^2$ as described in \cref{sec:hubs-spokes}, using the cone on a particular loop. + Thus, $\pi_1(T^2)$ is the quotient of the free group on two generators\index{generator!of a group} (i.e., $\pi_1(B)$) by the relation $p \ct q \ct \opp p \ct \opp q = 1$. + This clearly yields the free \emph{abelian}\index{group!abelian} group on two generators, which is $\Z\times\Z$. +\end{eg} + + +\begin{eg} + \index{CW complex} + \index{hub and spoke} + More generally, any CW complex can be obtained by repeatedly ``coning off'' spheres, as described in \cref{sec:hubs-spokes}. + That is, we start with a set $X_0$ of points (``0-cells''), which is the ``0-skeleton'' of the CW complex. + We take the pushout + \begin{equation*} + \vcenter{\xymatrix{ + S_1 \times \Sn^0\ar[r]^-{f_1}\ar[d] & + X_0\ar[d]\\ + \unit \ar[r] & + X_1 + }} + \end{equation*} + for some set $S_1$ of 1-cells and some family $f_1$ of ``attaching maps'', obtaining the ``1-skeleton''\index{skeleton!of a CW-complex} $X_1$. + \index{attaching map}% + Then we take the pushout + \begin{equation*} + \vcenter{\xymatrix{ + S_2 \times \Sn^1\ar[r]^{f_2}\ar[d] & + X_1\ar[d]\\ + \unit \ar[r] & + X_2 + }} + \end{equation*} + for some set $S_2$ of 2-cells and some family $f_2$ of attaching maps, obtaining the 2-skeleton $X_2$, and so on. + The fundamental group of each pushout can be calculated from the van Kampen theorem: we obtain the group presented by generators derived from the 1-skeleton, and relations derived from $S_2$ and $f_2$. + The pushouts after this stage do not alter the fundamental group, since $\pi_1(\Sn^n)$ is trivial for $n>1$ (see \cref{sec:pik-le-n}). +\end{eg} + + +\begin{eg}\label{eg:kg1} + In particular, suppose given any presentation\index{presentation!of a group} of a (set-)group $G = \langle X \mid R \rangle$, with $X$ a set of generators and $R$ a set of words in these generators\index{generator!of a group}. + Let $B\defeq \bigvee_X S^1$ and $A\defeq \bigvee_R S^1$, with $f:A\to B$ sending each copy of $S^1$ to the corresponding word in the generating loops of $B$. + It follows that $\pi_1(P) \cong G$; thus we have constructed a connected type whose fundamental group is $G$. + Since any group has a presentation, any group is the fundamental group of some type. + If we 1-truncate such a type, we obtain a type whose only nontrivial homotopy group is $G$; this is called an \define{Eilenberg--Mac Lane space} $K(G,1)$.% + \indexdef{Eilenberg--Mac Lane space}% +\end{eg} + +\index{fundamental!group|)}% + +\index{van Kampen theorem|)}% +\index{theorem!van Kampen|)}% + +\section{Whitehead's theorem and Whitehead's principle} +\label{sec:whitehead} + +In classical homotopy theory, a map $f:A\to B$ which induces an isomorphism $\pi_n(A,a) \cong \pi_n(B,f(a))$ for all points $a$ in $A$ (and also an isomorphism $\pi_0(A)\cong\pi_0(B)$) is necessarily a homotopy equivalence, as long as the spaces $A$ and $B$ are well-behaved (e.g.\ have the homotopy types of CW-complexes). +\index{theorem!Whitehead's}% +\index{Whitehead's!theorem}% +This is known as \emph{Whitehead's theorem}. +In fact, the ``ill-behaved'' spaces for which Whitehead's theorem fails are invisible to type theory. +Roughly, the well-behaved topological spaces suffice to present $\infty$-groupoids,% +\index{.infinity-groupoid@$\infty$-groupoid} +and homotopy type theory deals with $\infty$-groupoids directly rather than actual topological spaces. +Thus, one might expect that Whitehead's theorem would be true in univalent foundations. + +However, this is \emph{not} the case: Whitehead's theorem is not provable. +In fact, there are known models of type theory in which it fails to be true, although for entirely different reasons than its failure for ill-behaved topological spaces. +These models are ``non-hypercomplete $\infty$-toposes'' +\index{.infinity1-topos@$(\infty,1)$-topos}% +\index{.infinity1-topos@$(\infty,1)$-topos!non-hypercomplete}% +(see~\cite{lurie:higher-topoi}); roughly speaking, they consist of sheaves of $\infty$-groupoids over $\infty$-dimensional base spaces. + +\index{axiom!Whitehead's principle|(}% +\index{Whitehead's!principle|(}% + +From a foundational point of view, therefore, we may speak of \emph{Whitehead's principle} as a ``classicality axiom'', akin to \LEM{} and \choice{}. +It may consistently be assumed, but it is not part of the computationally motivated type theory, nor does it hold in all natural models. +But when working from set-theoretic foundations, this principle is invisible: it cannot fail to be true in a world where $\infty$-groupoids are built up out of sets (using topological spaces, simplicial sets, or any other such model). + +This may seem odd, but actually it should not be surprising. +Homotopy type theory is the \emph{abstract} theory of homotopy types, whereas the homotopy theory of topological spaces or simplicial sets in set theory is a \emph{concrete} model of this theory, in the same way that the integers are a concrete model of the abstract theory of rings. +It is to be expected that any concrete model will have special properties which are not intrinsic to the corresponding abstract theory, but which we might sometimes want to assume as additional axioms (e.g.\ the integers are a Principal Ideal Domain, but not all rings are). + +It is beyond the scope of this book to describe any models of type theory, so we will not explain how Whitehead's principle might fail in some of them. +However, we can prove that it holds whenever the types involved are $n$-truncated for some finite $n$, by ``downward'' induction on $n$. +In addition to being of interest in its own right (for instance, it implies the essential uniqueness of Eilenberg--Mac Lane spaces), the proof of this result will hopefully provide some intuitive explanation for why we cannot hope to prove an analogous theorem without truncation hypotheses. + +We begin with the following modification of \cref{thm:mono-surj-equiv}, which will eventually supply the induction step in the proof of the truncated Whitehead's principle. +It may be regarded as a type-theoretic, $\infty$-group\-oid\-al version of the classical statement that a fully faithful and essentially surjective functor is an equivalence of categories. + +\begin{thm}\label{thm:whitehead0} + Suppose $f:A\to B$ is a function such that + \begin{enumerate} + \item $\trunc0 f : \trunc0 A \to \trunc0 B$ is surjective, and\label{item:whitehead01} + \item for any $x,y:A$, the function $\apfunc f : (\id[A]xy) \to (\id[B]{f(x)}{f(y)})$ is an equivalence.\label{item:whitehead02} + \end{enumerate} + Then $f$ is an equivalence. +\end{thm} +\begin{proof} + Note that~\ref{item:whitehead02} is precisely the statement that $f$ is an embedding, c.f.~\cref{sec:mono-surj}. + Thus, by \cref{thm:mono-surj-equiv}, it suffices to show that $f$ is surjective, i.e.\ that for any $b:B$ we have $\trunc{-1}{\hfib f b}$. + Suppose given $b$; then since $\trunc0 f$ is surjective, there merely exists an $a:A$ such that $\trunc 0 f(\tproj0a) = \tproj0b$. + And since our goal is a mere proposition, we may assume given such an $a$. + Then we have $\tproj0{f(a)} = \trunc 0 f(\tproj0a) =\tproj0b$, hence $\trunc{-1}{f(a)=b}$. + Again, since our goal is still a mere proposition, we may assume $f(a)=b$. + Hence $\hfib f b$ is inhabited, and thus merely inhabited. +\end{proof} + +Since homotopy groups are truncations of loop spaces\index{loop space}, rather than path spaces, we need to modify this theorem to speak about these instead. Recall the map $\Omega f$ from \cref{def:loopfunctor}. + +\begin{cor}\label{thm:whitehead1} + Suppose $f:A\to B$ is a function such that + \begin{enumerate} + \item $\trunc0 f : \trunc0 A \to \trunc0 B$ is a bijection, and + \item for any $x:A$, the function $\Omega f : \Omega(A,x) \to \Omega(B,f(x))$ is an equivalence. + \end{enumerate} + Then $f$ is an equivalence. +\end{cor} +\begin{proof} + By \cref{thm:whitehead0}, it suffices to show that $\apfunc f : (\id[A]xy) \to (\id[B]{f(x)}{f(y)})$ is an equivalence for any $x,y:A$. + And by \cref{thm:equiv-inhabcod}, we may assume $\id[B]{f(x)}{f(y)}$. + In particular, $\tproj0{f(x)} = \tproj0{f(y)}$, so since $\trunc0 f$ is an equivalence, we have $\tproj0 x = \tproj0y$, hence $\tproj{-1}{x=y}$. + Since we are trying to prove a mere proposition ($\apfunc f$ being an equivalence), we may assume given $p:x=y$. + But now the following square commutes up to homotopy: + \begin{equation*} + \vcenter{\xymatrix@C=3pc{ + \Omega(A,x)\ar[r]^-{\blank\ct p}\ar[d]_{\Omega f} & + (\id[A]xy) \ar[d]^{\apfunc f}\\ + \Omega(B,f(x))\ar[r]_-{\blank\ct f(p)} & + (\id[B]{f(x)}{f(y)}). + }} + \end{equation*} + The top and bottom maps are equivalences, and the left-hand map is so by assumption. + Hence, by the 2-out-of-3 property, so is the right-hand map. +\end{proof} + +Now we can prove the truncated Whitehead's principle. + +\begin{thm}\label{thm:whiteheadn} + Suppose $A$ and $B$ are $n$-types and $f:A\to B$ is such that + \begin{enumerate} + \item $\trunc0f:\trunc0A \to \trunc0B$ is a bijection, and\label{item:wh0} + \item $\pi_k(f):\pi_k(A,x) \to \pi_k(B,f(x))$ is a bijection for all $k\ge 1$ and all $x:A$.\label{item:whk} + \end{enumerate} + Then $f$ is an equivalence. +\end{thm} + +\noindent +Condition~\ref{item:wh0} is almost the case of~\ref{item:whk} when $k=0$, except that it makes no reference to any basepoint $x:A$. + +\begin{proof} + We proceed by induction on $n$. + When $n=-2$, the statement is trivial. + Thus, suppose it to be true for all functions between $n$-types, and let $A$ and $B$ be $(n+1)$-types and $f:A\to B$ as above. + The first condition in \cref{thm:whitehead1} holds by assumption, so it will suffice to show that for any $x:A$, the function $\Omega f: \Omega(A,x) \to \Omega(B,f(x))$ is an equivalence. + + Since $\Omega(A,x)$ and $\Omega(B,f(x))$ are $n$-types we can apply the induction hypothesis. + We need to check that $\trunc 0{\Omega f}$ is a bijection, and that for all $k\geq1$ and $p : x = x$ the map $\pi_k(\Omega f):\pi_k(x = x,p) \to \pi_k(f(x) = f(x),\Omega f(p))$ is a bijection. + The first statement holds by assumption, since $\trunc 0{\Omega f} \jdeq \pi_1(f)$. + To prove the second statement, we generalize it first: we show that for all $y : A$ and $q : x = y$ we have $\pi_k(\apfunc f):\pi_k(x = y,q) \to \pi_k(f(x) = f(y),\apfunc f(q))$. + This implies the desired statement, since when $y\defeq x$, we have $\pi_k(\Omega f)=\pi_k(\apfunc f)$ modulo identifying their base points $\Omega f(p)=\apfunc f(p)$. + To prove the generalization, it suffices by path induction to prove it when $q$ is $\refl{a}$. + In this case, we have $\pi_k(\apfunc f) = \pi_k(\Omega f) = \pi_{k+1}(f)$, and $\pi_{k+1}(f)$ is an bijection by the original assumptions. +\end{proof} + +Note that if $A$ and $B$ are not $n$-types for any finite $n$, then there is no way for the induction to get started. + +\begin{cor}\label{thm:whitehead-contr} + If $A$ is a $0$-connected $n$-type and $\pi_k(A,a)=0$ for all $k$ and $a:A$, then $A$ is contractible. +\end{cor} +\begin{proof} + Apply \cref{thm:whiteheadn} to the map $A\to\unit$. +\end{proof} + +As an application, we can deduce the converse of \cref{thm:conn-pik}. + +\begin{cor}\label{thm:pik-conn} + For $n\ge 0$, a map $f:A\to B$ is $n$-connected if and only if the following all hold: + \begin{enumerate} + \item $\trunc0f:\trunc0A \to \trunc0B$ is an isomorphism. + \item For any $a:A$ and $k\le n$, the map $\pi_k(f):\pi_k(A,a) \to \pi_k(B,f(a))$ is an isomorphism. + \item For any $a:A$, the map $\pi_{n+1}(f):\pi_{n+1}(A,a) \to \pi_{n+1}(B,f(a))$ is surjective. + \end{enumerate} +\end{cor} +\begin{proof} + The ``only if'' direction is \cref{thm:conn-pik}. + Conversely, by the long exact sequence of a fibration (\cref{thm:les}), + \index{sequence!exact}% + the hypotheses imply that $\pi_k(\hfib f {f(a)})=0$ for all $k\le n$ and $a:A$, and that $\trunc 0{\hfib f{f(a)}}$ is contractible. + Since $\pi_k(\hfib f {f(a)}) = \pi_k(\trunc n{\hfib f{f(a)}})$ for $k\le n$, and $\trunc n{\hfib f{f(a)}}$ is $n$-connected, by \cref{thm:whitehead-contr} it is contractible for any $a$. + + It remains to show that $\trunc n{\hfib f{b}}$ is contractible for $b:B$ not necessarily of the form $f(a)$. + However, by assumption, there is $x:\trunc0A$ with $\tproj 0b = \trunc0f(x)$. + Since contractibility is a mere proposition, we may assume $x$ is of the form $\tproj0a$ for $a:A$, in which case $\tproj 0 b = \trunc0f(\tproj0a) = \tproj0{f(a)}$, and therefore $\trunc{-1}{b=f(a)}$. + Again since contractibility is a mere proposition, we may assume $b=f(a)$, and the result follows. +\end{proof} + +A map $f$ such that $\trunc0f$ is a bijection and $\pi_k(f)$ is a bijection for all $k$ is called \define{$\infty$-connected}% +\indexdef{function!.infinity-connected@$\infty$-connected}% +\indexdef{.infinity-connected function@$\infty$-connected function} +or a \define{weak equivalence}.% +\indexdef{equivalence!weak}% +\indexdef{weak equivalence!of types} +This is equivalent to asking that $f$ be $n$-connected for all $n$. +A type $Z$ is called \define{$\infty$-truncated}% +\indexdef{type!.infinity-truncated@$\infty$-truncated}% +\indexdef{.infinity-truncated type@$\infty$-truncated type} +or \define{hypercomplete}% +\indexdef{type!hypercomplete}% +\indexdef{hypercomplete type} +if the induced map +\[(\blank\circ f):(B\to Z) \to (A\to Z)\] +is an equivalence whenever $f$ is $\infty$-connected --- that is, if $Z$ thinks every $\infty$-connected map is an equivalence. +\indexdef{axiom!Whitehead's principle}% +Then if we want to assume Whitehead's principle as an axiom, we may use either of the following equivalent forms. +\begin{itemize} +\item Every $\infty$-connected function is an equivalence. +\item Every type is $\infty$-truncated. +\end{itemize} +In higher topos models, +\index{.infinity1-topos@$(\infty,1)$-topos}% +the $\infty$-truncated types form a reflective subuniverse in the sense of +\cref{sec:modalities} (the ``hypercompletion'' of an $(\infty,1)$-topos), but we do not know whether this is +true in general. + +\index{axiom!Whitehead's principle|)}% +\index{Whitehead's!principle|)}% + +It may not be obvious that there \emph{are} any types which are not $n$-types for any $n$, but in fact there are. +Indeed, in classical homotopy theory, $\Sn^n$ has this property for any $n\ge 2$. +We have not proven this fact in homotopy type theory yet, but there are other types which we can prove to have ``infinite truncation level''. + +\begin{eg} + Suppose we have $B:\nat\to\type$ such that for each $n$, the type $B(n)$ contains an $n$-loop\index{loop!n-@$n$-} which is not equal to $n$-fold reflexivity, say $p_n:\Omega^n(B(n),b_n)$ with $p_n \neq \refl{b_n}^n$. + (For instance, we could define $B(n)\defeq \Sn^n$, with $p_n$ the image of $1:\Z$ under the isomorphism $\pi_n(\Sn^n)\cong \Z$.) + Consider $C\defeq \prd{n:\nat} B(n)$, with the point $c:C$ defined by $c(n)\defeq b_n$. + Since loop spaces commute with products, for any $m$ we have + \[\eqvspaced{\Omega^m (C,c)}{\prd{n:\nat}\Omega^m(B(n),b_n)}.\] + Under this equivalence, $\refl{c}^m$ corresponds to the function $(n\mapsto \refl{b_n}^m)$. + Now define $q_m$ in the right-hand type by + \[ q_m(n) \defeq + \begin{cases} + p_n &\quad m=n\\ + \refl{b_n}^m &\quad m\neq n. + \end{cases} + \] + If we had $q_m = (n\mapsto \refl{b_n}^m)$, then we would have $p_n = \refl{b_n}^n$, which is not the case. + Thus, $q_m \neq (n\mapsto \refl{b_n}^m)$, and so there is a point of $\Omega^m(C,c)$ which is unequal to $\refl{c}^m$. + Hence $C$ is not an $m$-type, for any $m:\nat$. +\end{eg} + +We expect it should also be possible to show that a universe $\UU$ itself is not an $n$-type for any $n$, using the fact that it contains higher inductive types such as $\Sn^n$ for all $n$. +However, this has not yet been done. + +\section{A general statement of the encode-decode method} +\label{sec:general-encode-decode} + +\indexdef{encode-decode method} + +We have used the encode-decode method to characterize the path spaces +of various types, including coproducts (\cref{thm:path-coprod}), natural +numbers (\cref{thm:path-nat}), truncations (\cref{thm:path-truncation}), +the circle (\cref{{cor:omega-s1}}), suspensions (\cref{thm:freudenthal}), and pushouts +(\cref{thm:van-Kampen}). Variants of this technique are used in the +proofs of many of the other theorems mentioned in the introduction to +this chapter, such as a direct proof of $\pi_n(\Sn^n)$, the Blakers--Massey theorem, and the construction of Eilenberg--Mac Lane spaces. +While it is tempting to try to +abstract the method into a lemma, this is difficult because +slightly different variants are needed for different problems. For +example, different variations on the same method can be used to +characterize a loop space (as in \cref{thm:path-coprod,cor:omega-s1}) or +a whole path space (as in \cref{thm:path-nat}), to give a complete +characterization of a loop space (e.g.\ $\Omega^1(\Sn ^1)$) or only to +characterize some truncation of it (e.g.\ van Kampen), and to calculate +homotopy groups or to prove that a map is $n$-connected (e.g.\ Freudenthal and +Blakers--Massey). + +However, we can state lemmas for specific variants of the method. +The proofs of these lemmas are almost trivial; the main point is to +clarify the method by stating them in generality. The simplest +case is using an encode-decode method to characterize the loop space of a +type, as in \cref{thm:path-coprod} and \cref{{cor:omega-s1}}. + +\begin{lem}[Encode-decode for Loop Spaces]\label{lem:encode-decode-loop} + \index{loop space}% +Given a pointed type $(A,a_0)$ and a fibration +$\code : A \to \type$, if +\begin{enumerate} +\item $c_0 : \code(a_0)$,\label{item:ed1} +\item $\decode : \prd{x:A} \code(x) \to (\id{a_0}{x})$,\label{item:ed2} +\item for all $c : \code(a_0)$, \id{\transfib{\code}{\decode(c)}{c_0}}{c}, and\label{item:ed3} +\item $\id{\decode(c_0)}{\refl{}}$,\label{item:ed4} +\end{enumerate} +then $(\id{a_0}{a_0})$ is equivalent to $\code(a_0)$. +\end{lem} + +\begin{proof} +Define +$\encode : \prd{x:A} (\id{a_0}{x}) \to \code(x)$ by +\[ +\encode_x(\alpha) = \transfib{\code}{\alpha}{c_0}. +\] +We show that $\encode_{a_0}$ and $\decode_{a_0}$ are quasi-inverses. +The composition $\encode_{a_0} \circ \decode_{a_0}$ is immediate by +assumption~\ref{item:ed3}. For the other composition, we show +\[ +\prd{x:A}{p : \id{a_0}{x}} \id{\decode_{x} (\encode_{x} p)}{p}. +\] +By path induction, it suffices to show +$\id{{\decode_{{a_0}} (\encode_{{a_o}} \refl{})}}{\refl{}}$. +After reducing the $\mathsf{transport}$, it suffices to show +$\id{{\decode_{{a_0}} (c_0)}}{\refl{}}$, which is assumption~\ref{item:ed4}. +\end{proof} + +If a fiberwise equivalence between $(\id{a_0}{\blank})$ and $\code$ is desired, +it suffices to strengthen condition (iii) to +\[ +\prd{x:A}{c : \code(x)} \id{\encode_{x}(\decode_{x}(c))}{c}. +\] +However, to calculate a loop space (e.g. $\Omega(\Sn ^1)$), this +stronger assumption is not necessary. + +Another variation, which comes up often when calculating homotopy +groups, characterizes the truncation of a loop space: + +\begin{lem}[Encode-decode for Truncations of Loop Spaces] +Assume a pointed type $(A,a_0)$ and a fibration +$\code : A \to \type$, where for every $x$, $\code(x)$ is a $k$-type. +Define +\[ +\encode : \prd{x:A} \trunc{k}{\id{a_0}{x}} \to \code(x) +\] +by truncation recursion (using the fact +that $\code(x)$ is a $k$-type), mapping $\alpha : \id{a_0}{x}$ to +\transfib{\code}{\alpha}{c_0}. Suppose: +\begin{enumerate} +\item $c_0 : \code(a_0)$, +\item $\decode : \prd{x:A} \code(x) \to \trunc{k}{\id{a_0}{x}}$, +\item \label{item:decode-encode-loop-iii} + $\id{\encode_{a_0}(\decode_{a_0}(c))}{c}$ for all $c : \code(a_0)$, and +\item \label{item:decode-encode-loop-iv} + $\id{\decode(c_0)}{\tproj{}{\refl{}}}$. +\end{enumerate} +Then $\trunc{k}{\id{a_0}{a_0}}$ is equivalent to $\code(a_0)$. +\end{lem} + +\begin{proof} +That $\decode \circ \encode$ is identity is immediate by \ref{item:decode-encode-loop-iii}. +% +To prove $\encode \circ \decode$, we first do a truncation induction, by +which it suffices to show +\[ +\prd{x:A}{p : \id{a_0}{x}} \id{\decode_{x}(\encode_{x}(\tproj{k}{p}))}{\tproj{k}{p}}. +\] +The truncation induction is allowed because paths in a $k$-type are a +$k$-type. To show this type, we do a path induction, and after reducing +the \encode, use assumption~\ref{item:decode-encode-loop-iv}. +\end{proof} + +\section{Additional Results} +\label{sec:moreresults} + +Though we do not present the proofs in this chapter, following results have also been established in homotopy type theory. + +\begin{thm} +\index{homotopy!group!of sphere} +There exists a $k$ such that for all $n \ge 3$, $\pi_{n+1}(\Sn ^n) = +\Z_k$. +\end{thm} + +\begin{proof}[Notes on the proof.] +The proof consists of a calculation of $\pi_4(\Sn ^3)$, together with an +appeal to stability (\cref{cor:stability-spheres}). In the classical +statement of this result, $k$ is $2$. While we have not yet checked that +$k$ is in fact $2$, our calculation of $\pi_4(\Sn ^3)$ is constructive,\index{mathematics!constructive} +like all the rest of the proofs in this chapter. +(More precisely, it doesn't use any additional axioms such as \LEM{} or \choice{}, making it as constructive as +univalence and higher inductive types are.) Thus, given a +computational interpretation of homotopy type theory, we could run the +proof on a computer to verify that $k$ is $2$. This example is quite +intriguing, because it is the first calculation of a homotopy group +for which we have not needed to know the answer in advance. +\end{proof} + +% Recall from \cref{sec:colimits} that $X \sqcup^C Y$ denotes the +% (homotopy) pushout of $X$ and $Y$ along $C$. +\index{pushout}% + +\begin{thm}[Blakers--Massey theorem]\label{Blakers-Massey} + \indexdef{theorem!Blakers--Massey}% + \indexsee{Blakers--Massey theorem}{theorem, Blakers--Massey}% + Suppose we are given maps $f : C \rightarrow X$, and $g : C \rightarrow Y$. Taking first the pushout $X \sqcup^C Y $ of $f$ and $g$ and then the pullback of its inclusions $\inl : X \rightarrow X \sqcup^C Y \leftarrow Y : \inr$, we have an induced map $C \to X \times_{(X \sqcup^C Y)} Y$. + + If $f$ is $i$-connected and $g$ is $j$-connected, then this induced map is $(i+j)$-connected. In other words, for any points $x:X$, $y:Y$, the corresponding fiber $C_{x,y}$ of $(f,g) : C \to X \times Y $ gives an approximation to the path space $\id[X \sqcup^C Y]{\inl(x)}{\inr(y)}$ in the pushout. +\end{thm} + +It should be noted that in classical algebraic topology, the Blakers--Massey theorem is often stated in a somewhat different form, where the maps $f$ and $g$ are replaced by inclusions of subcomplexes of CW complexes, and the homotopy pushout and homotopy pullback by a union and intersection, respectively. +In order to express the theorem in homotopy type theory, we have to replace notions of this sort with ones that are homotopy-invariant. +We have seen another example of this in the van Kampen theorem (\cref{sec:van-kampen}), where we had to replace a union of open subsets by a homotopy pushout. + +\begin{thm}[Eilenberg--Mac Lane Spaces]\label{Eilenberg-Mac-Lane-Spaces} +\index{Eilenberg--Mac Lane space} +For any abelian\index{group!abelian} group $G$ and positive integer $n$, there is an $n$-type +$K(G,n)$ such that $\pi_n(K(G,n)) = G$, and $\pi_k(K(G,n)) = 0$ +for $k\neq n$. +\end{thm} + +\begin{thm}[Covering spaces]\label{thm:covering-spaces} + \index{covering space}% + For a connected space $A$, there is an equivalence between covering spaces over $A$ and sets with an action of $\pi_1(A)$. +\end{thm} + + +\sectionNotes + +%% For the spheres, two +%% different definitions of the $n$-sphere $\Sn ^n$ have been used: the first as the +%% suspension of $\Sn ^ {n-1}$ (\cref{sec:suspension}), and the second +%% as a higher inductive type with one base point and one loop in +%% $\Omega^n$ (\cref{sec:circle}); we list the status for both +%% definitions. The equivalence of the two can be deduced from the remarks +%% at the end of \cref{sec:suspension}. + +{ +\newcommand{\humancheck}{\ding{52}} +\newcommand{\computercheck}{\ding{52}\kern-0.5em\ding{52}} +\begin{table}[htb] + \centering +\begin{tabular}{lcc} +\toprule +Theorem & Status \\ +\midrule +$\pi_1(\Sn ^1)$ & \computercheck \\ +$\pi_{k*{\copy\pbbox} \restore} + +% Macros for the categories chapter +\newcommand{\inv}[1]{{#1}^{-1}} +\newcommand{\idtoiso}{\ensuremath{\mathsf{idtoiso}}\xspace} +\newcommand{\isotoid}{\ensuremath{\mathsf{isotoid}}\xspace} +\newcommand{\op}{^{\mathrm{op}}} +\newcommand{\y}{\ensuremath{\mathbf{y}}\xspace} +\newcommand{\dgr}[1]{{#1}^{\dagger}} +\newcommand{\unitaryiso}{\mathrel{\cong^\dagger}} +\newcommand{\cteqv}[2]{\ensuremath{#1 \simeq #2}\xspace} +\newcommand{\cteqvsym}{\simeq} % Symbol for equivalence of categories + +%%% Natural numbers +\newcommand{\N}{\ensuremath{\mathbb{N}}\xspace} +%\newcommand{\N}{\textbf{N}} +\let\nat\N +\newcommand{\natp}{\ensuremath{\nat'}\xspace} % alternative nat in induction chapter + +\newcommand{\zerop}{\ensuremath{0'}\xspace} % alternative zero in induction chapter +\newcommand{\suc}{\mathsf{succ}} +\newcommand{\sucp}{\ensuremath{\suc'}\xspace} % alternative suc in induction chapter +\newcommand{\add}{\mathsf{add}} +\newcommand{\ack}{\mathsf{ack}} +\newcommand{\ite}{\mathsf{iter}} +\newcommand{\assoc}{\mathsf{assoc}} +\newcommand{\dbl}{\ensuremath{\mathsf{double}}} +\newcommand{\dblp}{\ensuremath{\dbl'}\xspace} % alternative double in induction chapter + + +%%% Lists +\newcommand{\lst}[1]{\mathsf{List}(#1)} +\newcommand{\nil}{\mathsf{nil}} +\newcommand{\cons}{\mathsf{cons}} +\newcommand{\lost}[1]{\mathsf{Lost}(#1)} + +%%% Vectors of given length, used in induction chapter +\newcommand{\vect}[2]{\ensuremath{\mathsf{Vec}_{#1}(#2)}\xspace} + +%%% Integers +\newcommand{\Z}{\ensuremath{\mathbb{Z}}\xspace} +\newcommand{\Zsuc}{\mathsf{succ}} +\newcommand{\Zpred}{\mathsf{pred}} + +%%% Rationals +\newcommand{\Q}{\ensuremath{\mathbb{Q}}\xspace} + +%%% Function extensionality +\newcommand{\funext}{\mathsf{funext}} +\newcommand{\happly}{\mathsf{happly}} + +%%% A naturality lemma +\newcommand{\com}[3]{\mathsf{swap}_{#1,#2}(#3)} + +%%% Code/encode/decode +\newcommand{\code}{\ensuremath{\mathsf{code}}\xspace} +\newcommand{\encode}{\ensuremath{\mathsf{encode}}\xspace} +\newcommand{\decode}{\ensuremath{\mathsf{decode}}\xspace} + +% Function definition with domain and codomain +\newcommand{\function}[4]{\left\{\begin{array}{rcl}#1 & + \longrightarrow & #2 \\ #3 & \longmapsto & #4 \end{array}\right.} + +%%% Cones and cocones +\newcommand{\cone}[2]{\mathsf{cone}_{#1}(#2)} +\newcommand{\cocone}[2]{\mathsf{cocone}_{#1}(#2)} +% Apply a function to a cocone +\newcommand{\composecocone}[2]{#1\circ#2} +\newcommand{\composecone}[2]{#2\circ#1} +%%% Diagrams +\newcommand{\Ddiag}{\mathscr{D}} + +%%% (pointed) mapping spaces +\newcommand{\Map}{\mathsf{Map}} + +%%% The interval +\newcommand{\interval}{\ensuremath{I}\xspace} +\newcommand{\izero}{\ensuremath{0_{\interval}}\xspace} +\newcommand{\ione}{\ensuremath{1_{\interval}}\xspace} + +%%% Arrows +\newcommand{\epi}{\ensuremath{\twoheadrightarrow}} +\newcommand{\mono}{\ensuremath{\rightarrowtail}} + +%%% Sets +\newcommand{\bin}{\ensuremath{\mathrel{\widetilde{\in}}}} + +%%% Semigroup structure +\newcommand{\semigroupstrsym}{\ensuremath{\mathsf{SemigroupStr}}} +\newcommand{\semigroupstr}[1]{\ensuremath{\mathsf{SemigroupStr}}(#1)} +\newcommand{\semigroup}[0]{\ensuremath{\mathsf{Semigroup}}} + +%%% Macros for the formal type theory +\newcommand{\emptyctx}{\ensuremath{\cdot}} +\newcommand{\production}{\vcentcolon\vcentcolon=} +\newcommand{\conv}{\downarrow} +\newcommand{\ctx}{\ensuremath{\mathsf{ctx}}} +\newcommand{\wfctx}[1]{#1\ \ctx} +\newcommand{\oftp}[3]{#1 \vdash #2 : #3} +\newcommand{\jdeqtp}[4]{#1 \vdash #2 \jdeq #3 : #4} +\newcommand{\judg}[2]{#1 \vdash #2} +\newcommand{\tmtp}[2]{#1 \mathord{:} #2} + +% rule names +\newcommand{\rform}{\textsc{form}} +\newcommand{\rintro}{\textsc{intro}} +\newcommand{\relim}{\textsc{elim}} +\newcommand{\rcomp}{\textsc{comp}} +\newcommand{\runiq}{\textsc{uniq}} +\newcommand{\Weak}{\mathsf{Wkg}} +\newcommand{\Vble}{\mathsf{Vble}} +\newcommand{\Exch}{\mathsf{Exch}} +\newcommand{\Subst}{\mathsf{Subst}} + +%%% Macros for HITs +\newcommand{\cc}{\mathsf{c}} +\newcommand{\pp}{\mathsf{p}} +\newcommand{\cct}{\widetilde{\mathsf{c}}} +\newcommand{\ppt}{\widetilde{\mathsf{p}}} +\newcommand{\Wtil}{\ensuremath{\widetilde{W}}\xspace} + +%%% Macros for n-types +\newcommand{\istype}[1]{\mathsf{is}\mbox{-}{#1}\mbox{-}\mathsf{type}} +\newcommand{\nplusone}{\ensuremath{(n+1)}} +\newcommand{\nminusone}{\ensuremath{(n-1)}} +\newcommand{\fact}{\mathsf{fact}} + +%%% Macros for homotopy +\newcommand{\kbar}{\overline{k}} % Used in van Kampen's theorem + +%%% Macros for induction +\newcommand{\natw}{\ensuremath{\mathbf{N^w}}\xspace} +\newcommand{\zerow}{\ensuremath{0^\mathbf{w}}\xspace} +\newcommand{\sucw}{\ensuremath{\mathsf{succ}^{\mathbf{w}}}\xspace} +\newcommand{\nalg}{\nat\mathsf{Alg}} +\newcommand{\nhom}{\nat\mathsf{Hom}} +\newcommand{\ishinitw}{\mathsf{isHinit}_{\mathsf{W}}} +\newcommand{\ishinitn}{\mathsf{isHinit}_\nat} +\newcommand{\w}{\mathsf{W}} +\newcommand{\walg}{\w\mathsf{Alg}} +\newcommand{\whom}{\w\mathsf{Hom}} + +%%% Macros for real numbers +\newcommand{\RC}{\ensuremath{\mathbb{R}_\mathsf{c}}\xspace} % Cauchy +\newcommand{\RD}{\ensuremath{\mathbb{R}_\mathsf{d}}\xspace} % Dedekind +\newcommand{\R}{\ensuremath{\mathbb{R}}\xspace} % Either +\newcommand{\barRD}{\ensuremath{\bar{\mathbb{R}}_\mathsf{d}}\xspace} % Dedekind completion of Dedekind + +\newcommand{\close}[1]{\sim_{#1}} % Relation of closeness +\newcommand{\closesym}{\mathord\sim} +\newcommand{\rclim}{\mathsf{lim}} % HIT constructor for Cauchy reals +\newcommand{\rcrat}{\mathsf{rat}} % Embedding of rationals into Cauchy reals +\newcommand{\rceq}{\mathsf{eq}_{\RC}} % HIT path constructor +\newcommand{\CAP}{\mathcal{C}} % The type of Cauchy approximations +\newcommand{\Qp}{\Q_{+}} +\newcommand{\apart}{\mathrel{\#}} % apartness +\newcommand{\dcut}{\mathsf{isCut}} % Dedekind cut +\newcommand{\cover}{\triangleleft} % inductive cover +\newcommand{\intfam}[3]{(#2, \lam{#1} #3)} % family of rational intervals + +% Macros for the Cauchy reals construction +\newcommand{\bsim}{\frown} +\newcommand{\bbsim}{\smile} + +\newcommand{\hapx}{\diamondsuit\approx} +\newcommand{\hapname}{\diamondsuit} +\newcommand{\hapxb}{\heartsuit\approx} +\newcommand{\hapbname}{\heartsuit} +\newcommand{\tap}[1]{\bullet\approx_{#1}\triangle} +\newcommand{\tapname}{\triangle} +\newcommand{\tapb}[1]{\bullet\approx_{#1}\square} +\newcommand{\tapbname}{\square} + +%%% Macros for surreals +\newcommand{\NO}{\ensuremath{\mathsf{No}}\xspace} +\newcommand{\surr}[2]{\{\,#1\,\big|\,#2\,\}} +\newcommand{\LL}{\mathcal{L}} +\newcommand{\RR}{\mathcal{R}} +\newcommand{\noeq}{\mathsf{eq}_{\NO}} % HIT path constructor + +\newcommand{\ble}{\trianglelefteqslant} +\newcommand{\blt}{\vartriangleleft} +\newcommand{\bble}{\sqsubseteq} +\newcommand{\bblt}{\sqsubset} + +\newcommand{\hle}{\diamondsuit\preceq} +\newcommand{\hlt}{\diamondsuit\prec} +\newcommand{\hlname}{\diamondsuit} +\newcommand{\hleb}{\heartsuit\preceq} +\newcommand{\hltb}{\heartsuit\prec} +\newcommand{\hlbname}{\heartsuit} +% \newcommand{\tle}{(\bullet\preceq\triangle)} +% \newcommand{\tlt}{(\bullet\prec\triangle)} +\newcommand{\tle}{\triangle\preceq} +\newcommand{\tlt}{\triangle\prec} +\newcommand{\tlname}{\triangle} +% \newcommand{\tleb}{(\bullet\preceq\square)} +% \newcommand{\tltb}{(\bullet\prec\square)} +\newcommand{\tleb}{\square\preceq} +\newcommand{\tltb}{\square\prec} +\newcommand{\tlbname}{\square} + +%%% Macros for set theory +\newcommand{\vset}{\mathsf{set}} % point constructor for cummulative hierarchy V +\def\cd{\tproj0} +\newcommand{\inj}{\ensuremath{\mathsf{inj}}} % type of injections +\newcommand{\acc}{\ensuremath{\mathsf{acc}}} % accessibility + +\newcommand{\atMostOne}{\mathsf{atMostOne}} + +\newcommand{\power}[1]{\mathcal{P}(#1)} % power set +\newcommand{\powerp}[1]{\mathcal{P}_+(#1)} % inhabited power set + +%%%% THEOREM ENVIRONMENTS %%%% + +% The cleveref package provides \cref{...} which is like \ref{...} +% except that it automatically inserts the type of the thing you're +% referring to, e.g. it produces "Theorem 3.8" instead of just "3.8" +% (and hyperref makes the whole thing a hyperlink). This saves a slight amount +% of typing, but more importantly it means that if you decide later on +% that 3.8 should be a Lemma or a Definition instead of a Theorem, you +% don't have to change the name in all the places you referred to it. + +% The following hack improves on this by using the same counter for +% all theorem-type environments, so that after Theorem 1.1 comes +% Corollary 1.2 rather than Corollary 1.1. This makes it much easier +% for the reader to find a particular theorem when flipping through +% the document. +\makeatletter +\def\defthm#1#2#3{% + %% Ensure all theorem types are numbered with the same counter + \newaliascnt{#1}{thm} + \newtheorem{#1}[#1]{#2} + \aliascntresetthe{#1} + %% This command tells cleveref's \cref what to call things + \crefname{#1}{#2}{#3}% following brace must be on separate line to support poorman cleveref sed file +} + +% Now define a bunch of theorem-type environments. +\newtheorem{thm}{Theorem}[section] +\crefname{thm}{Theorem}{Theorems} +%\defthm{prop}{Proposition} % Probably we shouldn't use "Proposition" in this way +\defthm{cor}{Corollary}{Corollaries} +\defthm{lem}{Lemma}{Lemmas} +\defthm{axiom}{Axiom}{Axioms} +% Since definitions and theorems in type theory are synonymous, should +% we actually use the same theoremstyle for them? +\theoremstyle{definition} +\defthm{defn}{Definition}{Definitions} +\theoremstyle{remark} +\defthm{rmk}{Remark}{Remarks} +\defthm{eg}{Example}{Examples} +\defthm{egs}{Examples}{Examples} +\defthm{notes}{Notes}{Notes} +% Number exercises within chapters, with their own counter. +\newtheorem{ex}{Exercise}[chapter] +\crefname{ex}{Exercise}{Exercises} + +% Display format for sections +\crefformat{section}{\S#2#1#3} +\Crefformat{section}{Section~#2#1#3} +\crefrangeformat{section}{\S\S#3#1#4--#5#2#6} +\Crefrangeformat{section}{Sections~#3#1#4--#5#2#6} +\crefmultiformat{section}{\S\S#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\Crefmultiformat{section}{Sections~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefrangemultiformat{section}{\S\S#3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6} +\Crefrangemultiformat{section}{Sections~#3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6} + +% Display format for appendices +\crefformat{appendix}{Appendix~#2#1#3} +\Crefformat{appendix}{Appendix~#2#1#3} +\crefrangeformat{appendix}{Appendices~#3#1#4--#5#2#6} +\Crefrangeformat{appendix}{Appendices~#3#1#4--#5#2#6} +\crefmultiformat{appendix}{Appendices~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\Crefmultiformat{appendix}{Appendices~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} +\crefrangemultiformat{appendix}{Appendices~#3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6} +\Crefrangemultiformat{appendix}{Appendices~#3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6}{, #3#1#4--#5#2#6}{ and~#3#1#4--#5#2#6} + +\crefname{part}{Part}{Parts} + +% Number subsubsections +\setcounter{secnumdepth}{5} + +% Display format for figures +\crefname{figure}{Figure}{Figures} + +%%%% EQUATION NUMBERING %%%% + +% The following hack uses the single theorem counter to number +% equations as well, so that we don't have both Theorem 1.1 and +% equation (1.1). +\let\c@equation\c@thm +\numberwithin{equation}{section} + + +%%%% ENUMERATE NUMBERING %%%% + +% Number the first level of enumerates as (i), (ii), ... +\renewcommand{\theenumi}{(\roman{enumi})} +\renewcommand{\labelenumi}{\theenumi} + + +%%%% MARGINS %%%% + +% This is a matter of personal preference, but I think the left +% margins on enumerates and itemizes are too wide. +\setitemize[1]{leftmargin=2em} +\setenumerate[1]{leftmargin=*} + +% Likewise that they are too spaced out. +\setitemize[1]{itemsep=-0.2em} +\setenumerate[1]{itemsep=-0.2em} + +%%% Notes %%% +\def\noteson{% +\gdef\note##1{\mbox{}\marginpar{\color{blue}\textasteriskcentered\ ##1}}} +\gdef\notesoff{\gdef\note##1{\null}} +\noteson + +\newcommand{\Coq}{\textsc{Coq}\xspace} +\newcommand{\Agda}{\textsc{Agda}\xspace} +\newcommand{\NuPRL}{\textsc{NuPRL}\xspace} + +%%%% CITATIONS %%%% + +% \let \cite \citep + +%%%% INDEX %%%% + +\newcommand{\footstyle}[1]{{\hyperpage{#1}}n} % If you index something that is in a footnote +\newcommand{\defstyle}[1]{\textbf{\hyperpage{#1}}} % Style for pageref to a definition + +\newcommand{\indexdef}[1]{\index{#1|defstyle}} % Index a definition +\newcommand{\indexfoot}[1]{\index{#1|footstyle}} % Index a term in a footnote +\newcommand{\indexsee}[2]{\index{#1|see{#2}}} % Index "see also" + + +%%%% Standard phrasing or spelling of common phrases %%%% + +\newcommand{\ZF}{Zermelo--Fraenkel} +\newcommand{\CZF}{Constructive \ZF{} Set Theory} + +\newcommand{\LEM}[1]{\ensuremath{\mathsf{LEM}_{#1}}\xspace} +\newcommand{\choice}[1]{\ensuremath{\mathsf{AC}_{#1}}\xspace} + +%%%% MISC %%%% + +\newcommand{\mentalpause}{\medskip} % Use for "mental" pause, instead of \smallskip or \medskip + +%% Use \symlabel instead of \label to mark a pageref that you need in the index of symbols +\newcounter{symindex} +\newcommand{\symlabel}[1]{\refstepcounter{symindex}\label{#1}} + +% Local Variables: +% mode: latex +% TeX-master: "hott-online" +% End: diff --git a/main.labelnumbers.first-edition b/main.labelnumbers.first-edition new file mode 100644 index 0000000000000000000000000000000000000000..0da6659c878582988f3beb6a8e1bf135dabfa0c3 --- /dev/null +++ b/main.labelnumbers.first-edition @@ -0,0 +1,1934 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\newlabel{analysis-bw-lpo}{11.5.9} +\newlabel{analysis-interval-ctb}{11.5.6} +\newlabel{axiom:funext}{2.9.3} +\newlabel{axiom:univalence}{2.10.3} +\newlabel{Blakers-Massey}{8.10.2} +\newlabel{card:exp}{10.2.6} +\newlabel{card:semiring}{10.2.4} +\newlabel{cha:basics}{2} +\newlabel{cha:category-theory}{9} +\newlabel{cha:equivalences}{4} +\newlabel{cha:hits}{6} +\newlabel{cha:hlevels}{7} +\newlabel{cha:homotopy}{8} +\newlabel{cha:induction}{5} +\newlabel{cha:logic}{3} +\newlabel{cha:preface}{} +\newlabel{cha:real-numbers}{11} +\newlabel{cha:rules}{A} +\newlabel{cha:set-math}{10} +\newlabel{cha:typetheory}{1} +\newlabel{classical-Heine-Borel}{11.5.11} +\newlabel{connectedtotruncated}{7.5.9} +\newlabel{contrfamtotalpostcompequiv}{4.9.3} +\newlabel{cor:Delta0sep}{10.5.9} +\newlabel{cor:freudenthal-equiv}{8.6.14} +\newlabel{cor:hom-fg}{2.4.4} +\newlabel{cor:omega-s1}{8.1.10} +\newlabel{cor:pi1s1}{8.1.11} +\newlabel{cor:pis2-hopf}{8.5.2} +\newlabel{cor:preservation-hlevels-weq}{7.1.5} +\newlabel{cor:sn-connected}{8.2.2} +\newlabel{cor:stability-spheres}{8.6.15} +\newlabel{cor:totrunc-is-connected}{7.5.8} +\newlabel{cor:transport-path-prepost}{2.11.2} +\newlabel{cor:trunc-prod}{7.3.8} +\newlabel{cor:trunc_prod}{7.7.3} +\newlabel{cor:UC}{3.9.2} +\newlabel{cref@analysis-bw-lpo}{[thm][9][11,5]11.5.9} +\newlabel{cref@analysis-interval-ctb}{[thm][6][11,5]11.5.6} +\newlabel{cref@axiom:funext}{[axiom][3][2,9]2.9.3} +\newlabel{cref@axiom:univalence}{[axiom][3][2,10]2.10.3} +\newlabel{cref@Blakers-Massey}{[thm][2][8,10]8.10.2} +\newlabel{cref@card:exp}{[lem][6][10,2]10.2.6} +\newlabel{cref@card:semiring}{[lem][4][10,2]10.2.4} +\newlabel{cref@cha:basics}{[chapter][2][]2} +\newlabel{cref@cha:category-theory}{[chapter][9][]9} +\newlabel{cref@cha:equivalences}{[chapter][4][]4} +\newlabel{cref@cha:hits}{[chapter][6][]6} +\newlabel{cref@cha:hlevels}{[chapter][7][]7} +\newlabel{cref@cha:homotopy}{[chapter][8][]8} +\newlabel{cref@cha:induction}{[chapter][5][]5} +\newlabel{cref@cha:logic}{[chapter][3][]3} +\newlabel{cref@cha:preface}{} +\newlabel{cref@cha:real-numbers}{[chapter][11][]11} +\newlabel{cref@cha:rules}{[appendix][1][2147483647]A} +\newlabel{cref@cha:set-math}{[chapter][10][]10} +\newlabel{cref@cha:typetheory}{[chapter][1][]1} +\newlabel{cref@classical-Heine-Borel}{[thm][11][11,5]11.5.11} +\newlabel{cref@connectedtotruncated}{[cor][9][7,5]7.5.9} +\newlabel{cref@contrfamtotalpostcompequiv}{[cor][3][4,9]4.9.3} +\newlabel{cref@cor:Delta0sep}{[cor][9][10,5]10.5.9} +\newlabel{cref@cor:freudenthal-equiv}{[cor][14][8,6]8.6.14} +\newlabel{cref@cor:hom-fg}{[cor][4][2,4]2.4.4} +\newlabel{cref@cor:omega-s1}{[cor][10][8,1]8.1.10} +\newlabel{cref@cor:pi1s1}{[cor][11][8,1]8.1.11} +\newlabel{cref@cor:pis2-hopf}{[cor][2][8,5]8.5.2} +\newlabel{cref@cor:preservation-hlevels-weq}{[cor][5][7,1]7.1.5} +\newlabel{cref@cor:sn-connected}{[cor][2][8,2]8.2.2} +\newlabel{cref@cor:stability-spheres}{[cor][15][8,6]8.6.15} +\newlabel{cref@cor:totrunc-is-connected}{[cor][8][7,5]7.5.8} +\newlabel{cref@cor:transport-path-prepost}{[lem][2][2,11]2.11.2} +\newlabel{cref@cor:trunc_prod}{[cor][3][7,7]7.7.3} +\newlabel{cref@cor:trunc-prod}{[thm][8][7,3]7.3.8} +\newlabel{cref@cor:UC}{[cor][2][3,9]3.9.2} +\newlabel{cref@ct:2cat}{[ex][5][9]9.5} +\newlabel{cref@ct:adjointification}{[lem][2][9,4]9.4.2} +\newlabel{cref@ct:adjprop2}{[cor][11][9,5]9.5.11} +\newlabel{cref@ct:adjprop}{[lem][2][9,3]9.3.2} +\newlabel{cref@ct:adj-repr}{[lem][10][9,5]9.5.10} +\newlabel{cref@ctb-uniformly-continuous-sup}{[thm][7][11,5]11.5.7} +\newlabel{cref@ct:cat-2cat}{[thm][16][9,4]9.4.16} +\newlabel{cref@ct:category}{[defn][6][9,1]9.1.6} +\newlabel{cref@ct:cat-eq-iso}{[lem][15][9,4]9.4.15} +\newlabel{cref@ct:cat-weq-eq}{[thm][4][9,9]9.9.4} +\newlabel{cref@ct:catweq}{[lem][7][9,4]9.4.7} +\newlabel{cref@ct:chaotic}{[eg][13][9,4]9.4.13} +\newlabel{cref@ct:discrete}{[eg][16][9,1]9.1.16} +\newlabel{cref@ct:eg:set}{[eg][7][9,1]9.1.7} +\newlabel{cref@ct:equiv}{[defn][1][9,4]9.4.1} +\newlabel{cref@ct:eqv-levelwise}{[lem][14][9,4]9.4.14} +\newlabel{cref@ct:esofull-precomp-ff}{[lem][2][9,9]9.9.2} +\newlabel{cref@ct:ex:hocat}{[ex][9][9]9.9} +\newlabel{cref@ct:ffeso}{[lem][5][9,4]9.4.5} +\newlabel{cref@ct:functor-assoc}{[lem][9][9,2]9.2.9} +\newlabel{cref@ct:functor-cat}{[thm][5][9,2]9.2.5} +\newlabel{cref@ct:functor}{[defn][1][9,2]9.2.1} +\newlabel{cref@ct:functorexpadj}{[lem][3][9,5]9.5.3} +\newlabel{cref@ct:functor-precat}{[defn][3][9,2]9.2.3} +\newlabel{cref@ct:fundgpd}{[eg][17][9,1]9.1.17} +\newlabel{cref@ct:galois}{[eg][3][9,6]9.6.3} +\newlabel{cref@ct:gaunt}{[eg][15][9,1]9.1.15} +\newlabel{cref@ct:groupoids}{[ex][6][9]9.6} +\newlabel{cref@ct:hilb}{[eg][7][9,7]9.7.7} +\newlabel{cref@ct:hocat}{[eg][7][9,9]9.9.7} +\newlabel{cref@ct:hoprecat}{[eg][18][9,1]9.1.18} +\newlabel{cref@ct:idtoisocompute}{[equation][10][9,1]9.1.10} +\newlabel{cref@ct:idtoiso}{[lem][4][9,1]9.1.4} +\newlabel{cref@ct:idtoiso-trans}{[lem][9][9,1]9.1.9} +\newlabel{cref@ct:idtounitary}{[lem][3][9,7]9.7.3} +\newlabel{cref@ct:interchange}{[lem][8][9,2]9.2.8} +\newlabel{cref@ct:isocat}{[defn][8][9,4]9.4.8} +\newlabel{cref@ct:isomorphism}{[defn][2][9,1]9.1.2} +\newlabel{cref@ct:isoprecat}{[lem][9][9,4]9.4.9} +\newlabel{cref@ct:isoprop}{[lem][3][9,1]9.1.3} +\newlabel{cref@ct:natiso}{[lem][4][9,2]9.2.4} +\newlabel{cref@ct:nattrans}{[defn][2][9,2]9.2.2} +\newlabel{cref@ct:obj-1type}{[lem][8][9,1]9.1.8} +\newlabel{cref@ct:opposite-category}{[defn][1][9,5]9.5.1} +\newlabel{cref@ct:orders}{[eg][14][9,1]9.1.14} +\newlabel{cref@ct:pentagon}{[lem][10][9,2]9.2.10} +\newlabel{cref@ct:pre2cat}{[ex][4][9]9.4} +\newlabel{cref@ct:precategory}{[defn][1][9,1]9.1.1} +\newlabel{cref@ct:precatset}{[eg][5][9,1]9.1.5} +\newlabel{cref@ct:rel}{[eg][19][9,1]9.1.19} +\newlabel{cref@ct:representable}{[defn][8][9,5]9.5.8} +\newlabel{cref@ct:representable-prop}{[thm][9][9,5]9.5.9} +\newlabel{cref@ct:rezk-fundgpd-trunc1}{[eg][6][9,9]9.9.6} +\newlabel{cref@ct:sig}{[defn][1][9,8]9.8.1} +\newlabel{cref@ct:sip-functor-cat}{[eg][3][9,8]9.8.3} +\newlabel{cref@ct:unitary}{[defn][2][9,7]9.7.2} +\newlabel{cref@ct:units}{[lem][11][9,2]9.2.11} +\newlabel{cref@ct:yoneda-embedding}{[cor][6][9,5]9.5.6} +\newlabel{cref@ct:yoneda-mono}{[cor][7][9,5]9.5.7} +\newlabel{cref@ct:yoneda}{[thm][4][9,5]9.5.4} +\newlabel{cref@dedekind-in-cut-as-le}{[lem][2][11,2]11.2.2} +\newlabel{cref@def:bisimulation}{[defn][4][10,5]10.5.4} +\newlabel{cref@def:hlevel}{[defn][1][7,1]7.1.1} +\newlabel{cref@def:loopspace}{[defn][8][2,1]2.1.8} +\newlabel{cref@defn:1type}{[defn][7][3,1]3.1.7} +\newlabel{cref@defn:accessibility}{[defn][1][10,3]10.3.1} +\newlabel{cref@defn:biinv}{[defn][1][4,3]4.3.1} +\newlabel{cref@defn:card}{[defn][1][10,2]10.2.1} +\newlabel{cref@defn:cauchy-approximation}{[defn][10][11,2]11.2.10} +\newlabel{cref@defn:cauchy-reals}{[defn][2][11,3]11.3.2} +\newlabel{cref@defn:cocone}{[defn][1][6,8]6.8.1} +\newlabel{cref@defn:complete-metric-space}{[defn][2][11,5]11.5.2} +\newlabel{cref@defn:contractible}{[defn][1][3,11]3.11.1} +\newlabel{cref@defn:decidable-equality}{[defn][3][3,4]3.4.3} +\newlabel{cref@defn:dedekind-reals}{[defn][1][11,2]11.2.1} +\newlabel{cref@defn:equivalence}{[defn][1][4,4]4.4.1} +\newlabel{cref@defn:fo-notion-of-structure}{[defn][4][9,8]9.8.4} +\newlabel{cref@defn:homotopy}{[defn][1][2,4]2.4.1} +\newlabel{cref@defn:homotopy-fiber}{[defn][4][4,2]4.2.4} +\newlabel{cref@defn:identity-systems}{[defn][1][5,8]5.8.1} +\newlabel{cref@defn:inductive-cover}{[defn][13][11,5]11.5.13} +\newlabel{cref@defn:inductive-cover-interval-1}{[enumi][5][](v)} +\newlabel{cref@defn:inductive-cover-interval-2}{[enumi][6][](vi)} +\newlabel{cref@defn:ishae}{[defn][1][4,2]4.2.1} +\newlabel{cref@defn:isprop}{[defn][1][3,3]3.3.1} +\newlabel{cref@defn:lcoh-rcoh}{[defn][10][4,2]4.2.10} +\newlabel{cref@defn:linv-rinv}{[defn][7][4,2]4.2.7} +\newlabel{cref@defn:lipschitz}{[defn][14][11,3]11.3.14} +\newlabel{cref@defn:logical-notation}{[defn][1][3,7]3.7.1} +\newlabel{cref@defn:metric-space}{[defn][1][11,5]11.5.1} +\newlabel{cref@defn:modal-image}{[defn][3][7,6]7.6.3} +\newlabel{cref@defn:modality}{[defn][5][7,7]7.7.5} +\newlabel{cref@defn:nalg}{[defn][1][5,4]5.4.1} +\newlabel{cref@defn:nhom}{[defn][2][5,4]5.4.2} +\newlabel{cref@defn:No-codes}{[thm][7][11,6]11.6.7} +\newlabel{cref@defn:RC-approx}{[thm][16][11,3]11.3.16} +\newlabel{cref@defn:reflective-subuniverse}{[defn][1][7,7]7.7.1} +\newlabel{cref@defn:retract}{[defn][2][4,7]4.7.2} +\newlabel{cref@defn:set}{[defn][1][3,1]3.1.1} +\newlabel{cref@defn:setof}{[lem][1][3,5]3.5.1} +\newlabel{cref@defn:surreals}{[defn][1][11,6]11.6.1} +\newlabel{cref@defn:total-bounded-metric-space}{[defn][3][11,5]11.5.3} +\newlabel{cref@defn:total-map}{[defn][5][4,7]4.7.5} +\newlabel{cref@defn:uniformly-continuous}{[defn][5][11,5]11.5.5} +\newlabel{cref@defn:V}{[defn][1][10,5]10.5.1} +\newlabel{cref@defn-Z}{[rmk][7][6,10]6.10.7} +\newlabel{cref@def-of-homotopy-groups}{[defn][1][8,0]8.0.1} +\newlabel{cref@def:pointedmap}{[defn][1][8,4]8.4.1} +\newlabel{cref@def:pointedtype}{[defn][7][2,1]2.1.7} +\newlabel{cref@def:simulation}{[defn][11][10,3]10.3.11} +\newlabel{cref@def:TypeOfElements}{[defn][7][10,5]10.5.7} +\newlabel{cref@def:VVquotient}{[defn][5][6,10]6.10.5} +\newlabel{cref@eg:circle}{[eg][6][8,7]8.7.6} +\newlabel{cref@eg:clvk}{[eg][13][8,7]8.7.13} +\newlabel{cref@eg:cofiber}{[eg][14][8,7]8.7.14} +\newlabel{cref@eg:concatequiv}{[eg][8][2,4]2.4.8} +\newlabel{cref@eg:idequiv}{[eg][7][2,4]2.4.7} +\newlabel{cref@eg:kg1}{[eg][17][8,7]8.7.17} +\newlabel{cref@eg:suspension}{[eg][7][8,7]8.7.7} +\newlabel{cref@eg:torus}{[eg][15][8,7]8.7.15} +\newlabel{cref@eg:unnatural-hit}{[eg][1][6,13]6.13.1} +\newlabel{cref@eg:wedge}{[eg][8][8,7]8.7.8} +\newlabel{cref@Eilenberg-Mac-Lane-Spaces}{[thm][3][8,10]8.10.3} +\newlabel{cref@epis-surj}{[lem][4][10,1]10.1.4} +\newlabel{cref@eq:ac}{[equation][1][3,8]3.8.1} +\newlabel{cref@eq:apd-to-ap}{[equation][7][2,3]2.3.7} +\newlabel{cref@eq:appxrec2}{[equation][24][11,3]11.3.24} +\newlabel{cref@eq:ap-to-apd}{[equation][6][2,3]2.3.6} +\newlabel{cref@eq:bfa-bga2}{[equation][11][8,7]8.7.11} +\newlabel{cref@eq:bfa-bga-comm}{[equation][2][8,7]8.7.2} +\newlabel{cref@eq:bfa-bga}{[equation][1][8,7]8.7.1} +\newlabel{cref@eq:cauchy-approx}{[equation][11][11,2]11.2.11} +\newlabel{cref@eq:cauchy-sequence}{[equation][9][11,2]11.2.9} +\newlabel{cref@eq:class-notation}{[equation][3][10,5]10.5.3} +\newlabel{cref@eq:composeconefunc}{[equation][4][7,4]7.4.4} +\newlabel{cref@eq:composeconeid}{[equation][3][7,4]7.4.3} +\newlabel{cref@eq:concatD}{[equation][3][2,1]2.1.3} +\newlabel{cref@eq:conetrunc}{[equation][11][7,4]7.4.11} +\newlabel{cref@eq:cover-pointwise}{[equation][12][11,5]11.5.12} +\newlabel{cref@eq:cover-pointwise-truncated}{[equation][10][11,5]11.5.10} +\newlabel{cref@eq:ct:gbar}{[equation][12][9,4]9.4.12} +\newlabel{cref@eq:ct:ipctri}{[equation][11][9,4]9.4.11} +\newlabel{cref@eq:ct:isoprecattri}{[equation][10][9,4]9.4.10} +\newlabel{cref@eq:dbl0}{[equation][1][1,10]1.10.1} +\newlabel{cref@eq:dbl-as-rec}{[equation][1][1,9]1.9.1} +\newlabel{cref@eq:dblsuc}{[equation][2][1,10]1.10.2} +\newlabel{cref@eq:decode}{[equation][5][8,7]8.7.5} +\newlabel{cref@eq:defn-pullback}{[equation][11][2,15]2.15.11} +\newlabel{cref@eq:depCauchyappx}{[equation][5][11,3]11.3.5} +\newlabel{cref@eq:dnshift}{[equation][11][3,11]3.11.11} +\newlabel{cref@eq:dpath}{[equation][2][6,2]6.2.2} +\newlabel{cref@eq:english-ac}{[equation][1][3,2]3.2.1} +\newlabel{cref@eq:epis-split}{[equation][3][3,8]3.8.3} +\newlabel{cref@eq:equality-semigroup-mult}{[subsection][2][]2.14.2} +\newlabel{cref@eq:eqv}{[equation][11][2,4]2.4.11} +\newlabel{cref@eq:example-comp}{[equation][6][5,6]5.6.6} +\newlabel{cref@eq:example-constructor}{[equation][4][5,6]5.6.4} +\newlabel{cref@eq:example-indhyp}{[equation][7][5,6]5.6.7} +\newlabel{cref@eq:example-rechyp}{[equation][5][5,6]5.6.5} +\newlabel{cref@eq:expldef}{[equation][1][1,2]1.2.1} +\newlabel{cref@eq:fake-recursor}{[equation][1][5,6]5.6.1} +\newlabel{cref@eq:ffprime-north}{[equation][5][6,5]6.5.5} +\newlabel{cref@eq:flattening-rectnd}{[equation][6][6,12]6.12.6} +\newlabel{cref@eq:fpaut}{[equation][3][3,2]3.2.3} +\newlabel{cref@eq:fpfaut}{[equation][4][3,2]3.2.4} +\newlabel{cref@eq:freudcode}{[equation][6][8,6]8.6.6} +\newlabel{cref@eq:freudcodeN}{[equation][7][8,6]8.6.7} +\newlabel{cref@eq:freudcodeS}{[equation][8][8,6]8.6.8} +\newlabel{cref@eq:freudcompute1}{[equation][11][8,6]8.6.11} +\newlabel{cref@eq:freudcompute2}{[equation][12][8,6]8.6.12} +\newlabel{cref@eq:freudenthal-for-spheres}{[equation][16][8,6]8.6.16} +\newlabel{cref@eq:freudgoal}{[equation][13][8,6]8.6.13} +\newlabel{cref@eq:freudmap}{[equation][9][8,6]8.6.9} +\newlabel{cref@eq:fullprop}{[equation][3][9,9]9.9.3} +\newlabel{cref@eq:happly}{[equation][2][2,9]2.9.2} +\newlabel{cref@eq:injective}{[equation][2][4,6]4.6.2} +\newlabel{cref@eq:inlinj}{[equation][1][2,12]2.12.1} +\newlabel{cref@eq:inlrdj}{[equation][3][2,12]2.12.3} +\newlabel{cref@eq:iscontrf}{[equation][2][4,4]4.4.2} +\newlabel{cref@eq:isequiv-invertible}{[equation][10][2,4]2.4.10} +\newlabel{cref@eq:Jconv}{[equation][1][2,0]2.0.1} +\newlabel{cref@eq:lambda-abstraction}{[equation][1][1,4]1.4.1} +\newlabel{cref@eq:ldn}{[equation][2][3,4]3.4.2} +\newlabel{cref@eq:lem}{[equation][1][3,4]3.4.1} +\newlabel{cref@eq:lpo}{[equation][8][11,5]11.5.8} +\newlabel{cref@eq:mapofspans-htpy}{[equation][9][7,4]7.4.9} +\newlabel{cref@eq:modaltype}{[equation][6][7,7]7.7.6} +\newlabel{cref@eq:NO-codes-transitivity}{[equation][9][11,6]11.6.9} +\newlabel{cref@eq:NO-codes-unstrict}{[equation][8][11,6]11.6.8} +\newlabel{cref@eq:noind1}{[equation][3][11,6]11.6.3} +\newlabel{cref@eq:NO-prec-def}{[equation][15][11,6]11.6.15} +\newlabel{cref@eq:NO-preceq-def}{[equation][14][11,6]11.6.14} +\newlabel{cref@eq:NO-prec-IHL}{[equation][12][11,6]11.6.12} +\newlabel{cref@eq:NO-prec-IHR}{[equation][13][11,6]11.6.13} +\newlabel{cref@eq:NO-prec-outer-IH}{[equation][10][11,6]11.6.10} +\newlabel{cref@eq:path-forall}{[equation][1][2,9]2.9.1} +\newlabel{cref@eq:path-lump}{[equation][10][2,15]2.15.10} +\newlabel{cref@eq:path-prod}{[equation][1][2,6]2.6.1} +\newlabel{cref@eq:path-prod-inverse}{[equation][3][2,6]2.6.3} +\newlabel{cref@eq:path-trunc-map}{[equation][11][7,3]7.3.11} +\newlabel{cref@eq:pi1s1-decode}{[equation][4][8,1]8.1.4} +\newlabel{cref@eq:pi1s1-encode}{[equation][3][8,1]8.1.3} +\newlabel{cref@eq:Pinj}{[equation][2][5,6]5.6.2} +\newlabel{cref@eq:polyfunc}{[equation][6][5,4]5.4.6} +\newlabel{cref@eq:prodeqv}{[equation][1][2,5]2.5.1} +\newlabel{cref@eq:prod-umpd-map}{[equation][4][2,15]2.15.4} +\newlabel{cref@eq:prod-ump-map}{[equation][1][2,15]2.15.1} +\newlabel{cref@eq:prod-ump-rt1}{[equation][3][2,15]2.15.3} +\newlabel{cref@eq:prod-ump-rt2}{[equation][8][2,15]2.15.8} +\newlabel{cref@eq:prop-up}{[equation][4][3,5]3.5.4} +\newlabel{cref@eq:qinvtype}{[equation][5][2,4]2.4.5} +\newlabel{cref@eq:quotient-when-canonical}{[equation][9][6,10]6.10.9} +\newlabel{cref@eq:RCappx1}{[equation][17][11,3]11.3.17} +\newlabel{cref@eq:RCappx2}{[equation][18][11,3]11.3.18} +\newlabel{cref@eq:RCappx3}{[equation][19][11,3]11.3.19} +\newlabel{cref@eq:RCappx4}{[equation][20][11,3]11.3.20} +\newlabel{cref@eq:RCappx-rtri-rll1}{[equation][29][11,3]11.3.29} +\newlabel{cref@eq:RCappx-rtri-rll2}{[equation][30][11,3]11.3.30} +\newlabel{cref@eq:RCappx-rtri-rll3}{[equation][31][11,3]11.3.31} +\newlabel{cref@eq:RCappx-rtri-rlr1}{[equation][27][11,3]11.3.27} +\newlabel{cref@eq:RCappx-rtri-rlr2}{[equation][28][11,3]11.3.28} +\newlabel{cref@eq:RCappx-rtri-rrl1}{[equation][25][11,3]11.3.25} +\newlabel{cref@eq:RCappx-rtri-rrl2}{[equation][26][11,3]11.3.26} +\newlabel{cref@eq:RC-cauchy}{[equation][3][11,3]11.3.3} +\newlabel{cref@eq:RC-path}{[equation][4][11,3]11.3.4} +\newlabel{cref@eq:rcsimind1}{[equation][6][11,3]11.3.6} +\newlabel{cref@eq:rcsimind2}{[equation][7][11,3]11.3.7} +\newlabel{cref@eq:RC-sim-ltri}{[equation][23][11,3]11.3.23} +\newlabel{cref@eq:RC-sim-recursion-extra}{[equation][13][11,3]11.3.13} +\newlabel{cref@eq:RC-sim-rtri}{[equation][22][11,3]11.3.22} +\newlabel{cref@eq:RD-linear-order}{[equation][3][11,2]11.2.3} +\newlabel{cref@eq:S1recindbase}{[equation][6][6,2]6.2.6} +\newlabel{cref@eq:S1recindloop}{[equation][7][6,2]6.2.7} +\newlabel{cref@eq:set-up}{[equation][3][3,5]3.5.3} +\newlabel{cref@eq:sigma-lump}{[equation][9][2,15]2.15.9} +\newlabel{cref@eq:sigma-ump-map}{[equation][6][2,15]2.15.6} +\newlabel{cref@eq:Snsusp}{[equation][2][6,5]6.5.2} +\newlabel{cref@eq:subset}{[equation][2][3,5]3.5.2} +\newlabel{cref@eq:suc-injective}{[equation][3][2,13]2.13.3} +\newlabel{cref@eq:sumcodefam}{[equation][4][2,12]2.12.4} +\newlabel{cref@eq:tautology1}{[equation][1][1,11]1.11.1} +\newlabel{cref@eq:tautology2}{[equation][2][1,11]1.11.2} +\newlabel{cref@eq:transport-arrow}{[equation][4][2,9]2.9.4} +\newlabel{cref@eq:transport-arrow-families}{[equation][5][2,9]2.9.5} +\newlabel{cref@eq:transport-semigroup-assoc}{[equation][3][2,14]2.14.3} +\newlabel{cref@eq:transport-semigroup-step1}{[equation][2][2,14]2.14.2} +\newlabel{cref@eq:trunc-htpy}{[equation][6][7,3]7.3.6} +\newlabel{cref@eq:trunc-nat}{[equation][4][7,3]7.3.4} +\newlabel{cref@eq:uatofeps}{[equation][7][4,9]4.9.7} +\newlabel{cref@eq:uatofesp}{[equation][6][4,9]4.9.6} +\newlabel{cref@eq:uidtoeqv}{[equation][2][2,10]2.10.2} +\newlabel{cref@eq:untruncated-linearity}{[equation][2][11,4]11.4.2} +\newlabel{cref@equ:prequired}{[equation][8][5,4]5.4.8} +\newlabel{cref@eq:V-path}{[equation][2][10,5]10.5.2} +\newlabel{cref@eq:yoneda}{[equation][5][9,5]9.5.5} +\newlabel{cref@eq:zero-not-succ}{[equation][2][2,13]2.13.2} +\newlabel{cref@ex:acconn}{[ex][10][7]7.10} +\newlabel{cref@ex:ackermann}{[ex][10][1]1.10} +\newlabel{cref@ex:acnm}{[ex][8][7]7.8} +\newlabel{cref@ex:acnm-surjset}{[ex][9][7]7.9} +\newlabel{cref@ex:ap-path-inversion}{[ex][6][8]8.6} +\newlabel{cref@ex:ap-sigma}{[ex][7][2]2.7} +\newlabel{cref@ex:basics:concat}{[ex][1][2]2.1} +\newlabel{cref@ex:bool}{[ex][4][5]5.4} +\newlabel{cref@ex:brck-qinv}{[ex][8][3]3.8} +\newlabel{cref@ex:choice-function}{[ex][10][10]10.10} +\newlabel{cref@ex:composition}{[ex][1][1]1.1} +\newlabel{cref@ex:connectivity-inductively}{[ex][6][7]7.6} +\newlabel{cref@ex:coprod-ump}{[ex][9][2]2.9} +\newlabel{cref@ex:cumhierhit}{[ex][11][10]10.11} +\newlabel{cref@ex:decidable-choice}{[ex][19][3]3.19} +\newlabel{cref@ex:disjoint-or}{[ex][7][3]3.7} +\newlabel{cref@ex:equality-reflection}{[ex][14][2]2.14} +\newlabel{cref@ex:equiv-concat}{[ex][6][2]2.6} +\newlabel{cref@ex:eqvboolbool}{[ex][13][2]2.13} +\newlabel{cref@ex:fin}{[ex][9][1]1.9} +\newlabel{cref@ex:finite-cover-lebesgue-number}{[ex][12][11]11.12} +\newlabel{cref@ex:free-monoid}{[ex][8][6]6.8} +\newlabel{cref@ex:HopfJr}{[ex][8][8]8.8} +\newlabel{cref@ex:impred-brck}{[ex][15][3]3.15} +\newlabel{cref@ex:isset-coprod}{[ex][2][3]3.2} +\newlabel{cref@ex:isset-sigma}{[ex][3][3]3.3} +\newlabel{cref@ex:lem-brck}{[ex][14][3]3.14} +\newlabel{cref@ex:lem-impred}{[ex][10][3]3.10} +\newlabel{cref@ex:lem-ldn}{[ex][18][3]3.18} +\newlabel{cref@ex:lem-mereprop}{[ex][6][3]3.6} +\newlabel{cref@ex:lemnm}{[ex][7][7]7.7} +\newlabel{cref@ex:loop2}{[ex][8][5]5.8} +\newlabel{cref@ex:loop}{[ex][7][5]5.7} +\newlabel{cref@ex:mean-value-theorem}{[ex][13][11]11.13} +\newlabel{cref@ex:metric-completion}{[ex][9][11]11.9} +\newlabel{cref@ex:neg-ldn}{[ex][11][1]1.11} +\newlabel{cref@ex:ninf-ord}{[ex][8][10]10.8} +\newlabel{cref@ex:not-not-lem}{[ex][13][1]1.13} +\newlabel{cref@ex:npaths}{[ex][4][2]2.4} +\newlabel{cref@ex:nspheres}{[ex][4][6]6.4} +\newlabel{cref@ex:ntype-from-nconn-const}{[ex][5][7]7.5} +\newlabel{cref@ex:ntypes-closed-under-wtypes}{[ex][3][7]7.3} +\newlabel{cref@ex:omit-contr2}{[ex][20][3]3.20} +\newlabel{cref@ex:one-function-two-recurrences}{[ex][3][5]5.3} +\newlabel{cref@ex:pm-to-ml}{[ex][7][1]1.7} +\newlabel{cref@ex:pointed-equivalences}{[ex][7][8]8.7} +\newlabel{cref@ex:prod-via-bool}{[ex][6][1]1.6} +\newlabel{cref@ex:prop-endocontr}{[ex][4][3]3.4} +\newlabel{cref@ex:prop-inhabcontr}{[ex][5][3]3.5} +\newlabel{cref@ex:prop-ord}{[ex][7][10]10.7} +\newlabel{cref@ex:prop-trunc-ind}{[ex][17][3]3.17} +\newlabel{cref@ex:pullback}{[ex][11][2]2.11} +\newlabel{cref@ex:pullback-pasting}{[ex][12][2]2.12} +\newlabel{cref@ex:qinv-autohtpy-no-univalence}{[ex][3][4]4.3} +\newlabel{cref@ex:RD-extended-reals}{[ex][2][11]11.2} +\newlabel{cref@ex:RD-interval-arithmetic}{[ex][4][11]11.4} +\newlabel{cref@ex:RD-lower-cuts}{[ex][3][11]11.3} +\newlabel{cref@ex:RD-lt-vs-le}{[ex][5][11]11.5} +\newlabel{cref@ex:reals-apart-neq-MP}{[ex][10][11]11.10} +\newlabel{cref@ex:reals-apart-zero-divisors}{[ex][11][11]11.11} +\newlabel{cref@ex:reals-non-constant-into-Z}{[ex][6][11]11.6} +\newlabel{cref@ex:rezk-vankampen}{[ex][11][9]9.11} +\newlabel{cref@ex:s2-colim-unit}{[ex][2][7]7.2} +\newlabel{cref@ex:same-recurrence-not-defeq}{[ex][2][5]5.2} +\newlabel{cref@ex:sigma-assoc}{[ex][10][2]2.10} +\newlabel{cref@ex:stack}{[ex][12][9]9.12} +\newlabel{cref@ex:subtFromPathInd}{[ex][15][1]1.15} +\newlabel{cref@ex:sum-via-bool}{[ex][5][1]1.5} +\newlabel{cref@ex:SuperHopf}{[ex][9][8]8.9} +\newlabel{cref@ex:suspS1}{[ex][2][6]6.2} +\newlabel{cref@ex:tautologies}{[ex][12][1]1.12} +\newlabel{cref@ex:torus}{[ex][1][6]6.1} +\newlabel{cref@ex:torus-s1-times-s1}{[ex][3][6]6.3} +\newlabel{cref@ex:traditional-archimedean}{[ex][7][11]11.7} +\newlabel{cref@ex:unique-fiber}{[ex][5][8]8.5} +\newlabel{cref@ex:unnatural-endomorphisms}{[ex][9][6]6.9} +\newlabel{cref@ex:unstable-octahedron}{[ex][4][4]4.4} +\newlabel{cref@ex:vksuspnopt}{[ex][11][8]8.11} +\newlabel{cref@ex:vksusppt}{[ex][10][8]8.10} +\newlabel{cref@ex:well-pointed}{[ex][3][10]10.3} +\newlabel{cref@ex:without-K}{[ex][14][1]1.14} +\newlabel{cref@fibwise-fiber-total-fiber-equiv}{[thm][6][4,7]4.7.6} +\newlabel{cref@fig:hub-and-spokes}{[figure][3][6]6.3} +\newlabel{cref@fig:spokes-no-hub}{[figure][4][6]6.4} +\newlabel{cref@fig:spokes-no-hub-ii}{[figure][5][6]6.5} +\newlabel{cref@fig:topS1ind}{[figure][1][6]6.1} +\newlabel{cref@fig:ttS1ind}{[figure][2][6]6.2} +\newlabel{cref@fig:winding}{[figure][1][8]8.1} +\newlabel{cref@inductive-cover-classical}{[thm][16][11,5]11.5.16} +\newlabel{cref@interval-Heine-Borel}{[cor][15][11,5]11.5.15} +\newlabel{cref@item:apfunctor-compose}{[enumi][3][](iii)} +\newlabel{cref@item:apfunctor-ct}{[enumi][1][](i)} +\newlabel{cref@item:apfunctor-opp}{[enumi][2][](ii)} +\newlabel{cref@item:autohtpy1}{[enumi][1][](i)} +\newlabel{cref@item:autohtpy2}{[enumi][2][](ii)} +\newlabel{cref@item:autohtpy3}{[enumi][3][](iii)} +\newlabel{cref@item:be1}{[enumi][1][](i)} +\newlabel{cref@item:be2}{[enumi][2][](ii)} +\newlabel{cref@item:be3}{[enumi][3][](iii)} +\newlabel{cref@item:beb1}{[enumi][1][](i)} +\newlabel{cref@item:beb2}{[enumi][2][](ii)} +\newlabel{cref@item:beb3}{[enumi][3][](iii)} +\newlabel{cref@item:cle-inj}{[enumi][1][](i)} +\newlabel{cref@item:cle-surj}{[enumi][2][](ii)} +\newlabel{cref@item:conntest1}{[enumi][1][](i)} +\newlabel{cref@item:conntest2}{[enumi][2][](ii)} +\newlabel{cref@item:conntest3}{[enumi][3][](iii)} +\newlabel{cref@item:contr}{[enumi][1][](i)} +\newlabel{cref@item:contr-eqv-unit}{[enumi][3][](iii)} +\newlabel{cref@item:contr-inhabited-prop}{[enumi][2][](ii)} +\newlabel{cref@item:conway1}{[enumi][1][](i)} +\newlabel{cref@item:conway2}{[enumi][2][](ii)} +\newlabel{cref@item:ct:ar1}{[enumi][1][](i)} +\newlabel{cref@item:ct:ar2}{[enumi][2][](ii)} +\newlabel{cref@item:ct:ffeso1}{[enumi][1][](i)} +\newlabel{cref@item:ct:ffeso2}{[enumi][2][](ii)} +\newlabel{cref@item:ct:ipc1}{[enumi][1][](i)} +\newlabel{cref@item:ct:ipc2}{[enumi][2][](ii)} +\newlabel{cref@item:ct:ipc3}{[enumi][3][](iii)} +\newlabel{cref@item:decode-encode-loop-iii}{[enumi][3][](iii)} +\newlabel{cref@item:decode-encode-loop-iv}{[enumi][4][](iv)} +\newlabel{cref@item:ed1}{[enumi][1][](i)} +\newlabel{cref@item:ed2}{[enumi][2][](ii)} +\newlabel{cref@item:ed3}{[enumi][3][](iii)} +\newlabel{cref@item:ed4}{[enumi][4][](iv)} +\newlabel{cref@item:eqvprop2}{[enumi][2][](ii)} +\newlabel{cref@item:eqvprop3}{[enumi][3][](iii)} +\newlabel{cref@item:eqvprop5}{[enumi][5][](v)} +\newlabel{cref@item:fibseq1}{[enumi][1][](i)} +\newlabel{cref@item:fibseq2}{[enumi][2][](ii)} +\newlabel{cref@item:fibseq3}{[enumi][3][](iii)} +\newlabel{cref@item:identity-systems1}{[enumi][1][](i)} +\newlabel{cref@item:identity-systems2}{[enumi][2][](ii)} +\newlabel{cref@item:identity-systems3}{[enumi][3][](iii)} +\newlabel{cref@item:identity-systems4}{[enumi][4][](iv)} +\newlabel{cref@item:mchr1}{[enumi][1][](i)} +\newlabel{cref@item:mchr2}{[enumi][2][](ii)} +\newlabel{cref@item:MLis1}{[enumi][1][](i)} +\newlabel{cref@item:MLis2}{[enumi][2][](ii)} +\newlabel{cref@item:MLis3}{[enumi][3][](iii)} +\newlabel{cref@item:MLis4}{[enumi][4][](iv)} +\newlabel{cref@item:MLis5}{[enumi][5][](v)} +\newlabel{cref@item:modal1}{[enumi][1][](i)} +\newlabel{cref@item:modal2}{[enumi][2][](ii)} +\newlabel{cref@item:modal3}{[enumi][3][](iii)} +\newlabel{cref@item:modal4}{[enumi][4][](iv)} +\newlabel{cref@item:mono1}{[enumi][1][](i)} +\newlabel{cref@item:mono2}{[enumi][3][](iii)} +\newlabel{cref@item:mono3}{[enumi][4][](iv)} +\newlabel{cref@item:mono4}{[enumi][2][](ii)} +\newlabel{cref@item:NO-le-refl}{[enumi][1][](i)} +\newlabel{cref@item:NO-lt-opt}{[enumi][2][](ii)} +\newlabel{cref@item:NO-rec-last}{[enumi][5][](v)} +\newlabel{cref@item:NO-rec-primary}{[enumi][1][](i)} +\newlabel{cref@item:omg1}{[enumi][1][](i)} +\newlabel{cref@item:omg4}{[enumi][4][](iv)} +\newlabel{cref@item:omitcontr1}{[enumi][1][](i)} +\newlabel{cref@item:omitcontr2}{[enumi][2][](ii)} +\newlabel{cref@item:orth-fact-2}{[enumi][2][](ii)} +\newlabel{cref@item:RCltopen1}{[enumi][1][](i)} +\newlabel{cref@item:RCltopen2}{[enumi][2][](ii)} +\newlabel{cref@item:rcrec3}{[enumi][3][](iii)} +\newlabel{cref@item:RC-sim-triangle}{[equation][35][11,3]11.3.35} +\newlabel{cref@item:reg1}{[enumi][1][](i)} +\newlabel{cref@item:reg2}{[enumi][2][](ii)} +\newlabel{cref@item:reg3}{[enumi][3][](iii)} +\newlabel{cref@item:rel1}{[enumi][1][](i)} +\newlabel{cref@item:rel2}{[enumi][2][](ii)} +\newlabel{cref@item:rel3}{[enumi][3][](iii)} +\newlabel{cref@item:sesinj}{[enumi][1][](i)} +\newlabel{cref@item:sesiso}{[enumi][3][](iii)} +\newlabel{cref@item:sessurj}{[enumi][2][](ii)} +\newlabel{cref@item:sigcmp}{[enumi][4][](iv)} +\newlabel{cref@item:sigid}{[enumi][3][](iii)} +\newlabel{cref@item:sim1}{[enumi][1][](i)} +\newlabel{cref@item:sim2}{[enumi][2][](ii)} +\newlabel{cref@item:wh0}{[enumi][1][](i)} +\newlabel{cref@item:whitehead01}{[enumi][1][](i)} +\newlabel{cref@item:whitehead02}{[enumi][2][](ii)} +\newlabel{cref@item:whk}{[enumi][2][](ii)} +\newlabel{cref@item:wop1}{[enumi][1][](i)} +\newlabel{cref@item:wop2}{[enumi][2][](ii)} +\newlabel{cref@lem:ap-functor}{[lem][2][2,2]2.2.2} +\newlabel{cref@lem:autohtpy}{[lem][2][4,1]4.1.2} +\newlabel{cref@lem:BisimEqualsId}{[lem][5][10,5]10.5.5} +\newlabel{cref@lem:coh-equiv}{[lem][2][4,2]4.2.2} +\newlabel{cref@lem:coh-hfib}{[lem][11][4,2]4.2.11} +\newlabel{cref@lem:coh-hprop}{[lem][12][4,2]4.2.12} +\newlabel{cref@lem:concat}{[lem][2][2,1]2.1.2} +\newlabel{cref@lem:connected-map-equiv-truncation}{[lem][14][7,5]7.5.14} +\newlabel{cref@lem:cuts-preserve-admissibility}{[lem][15][11,2]11.2.15} +\newlabel{cref@lem:equiv-iff-hprop}{[lem][3][3,3]3.3.3} +\newlabel{cref@lem:fibration-over-pushout}{[lem][3][8,5]8.5.3} +\newlabel{cref@lem:fullsep}{[lem][10][10,5]10.5.10} +\newlabel{cref@lem:func_retract_to_fiber_retract}{[lem][3][4,7]4.7.3} +\newlabel{cref@lem:hfiber_wrt_pullback}{[lem][8][7,6]7.6.8} +\newlabel{cref@lem:hfib}{[lem][5][4,2]4.2.5} +\newlabel{cref@lem:hlevel-if-inhab-hlevel}{[lem][8][7,2]7.2.8} +\newlabel{cref@lem:homotopy-induction-times-3}{[lem][4][5,5]5.5.4} +\newlabel{cref@lem:homotopy-props}{[lem][2][2,4]2.4.2} +\newlabel{cref@lem:hopf-construction}{[lem][7][8,5]8.5.7} +\newlabel{cref@lem:hspace-S1}{[lem][8][8,5]8.5.8} +\newlabel{cref@lem:htpy-natural}{[lem][3][2,4]2.4.3} +\newlabel{cref@lem:images_are_coequalizers}{[thm][5][10,1]10.1.5} +\newlabel{cref@lem:inv-hprop}{[lem][9][4,2]4.2.9} +\newlabel{cref@lem:mapdep}{[lem][4][2,3]2.3.4} +\newlabel{cref@lem:map}{[lem][1][2,2]2.2.1} +\newlabel{cref@lem:MonicSetPresent}{[lem][6][10,5]10.5.6} +\newlabel{cref@lem:nconnected_postcomp}{[lem][6][7,5]7.5.6} +\newlabel{cref@lem:nconnected_postcomp_variation}{[lem][12][7,5]7.5.12} +\newlabel{cref@lem:nconnected_to_leveln_to_equiv}{[lem][10][7,5]7.5.10} +\newlabel{cref@lem:normal-forms}{[lem][3][2147483647,1,4]A.4.3} +\newlabel{cref@lem:opp}{[lem][1][2,1]2.1.1} +\newlabel{cref@lem:pb_of_coeq_is_coeq}{[lem][6][10,1]10.1.6} +\newlabel{cref@lem:pik-nconnected}{[lem][2][8,3]8.3.2} +\newlabel{cref@lem:qinv-autohtpy}{[lem][1][4,1]4.1.1} +\newlabel{cref@lem:quotient-when-canonical-representatives}{[lem][8][6,10]6.10.8} +\newlabel{cref@lem:s1-decode-encode}{[lem][7][8,1]8.1.7} +\newlabel{cref@lem:s1-encode-decode}{[lem][8][8,1]8.1.8} +\newlabel{cref@lem:sets_exact}{[lem][8][10,1]10.1.8} +\newlabel{cref@lem:susp-loop-adj}{[lem][4][6,5]6.5.4} +\newlabel{cref@lem:transport}{[lem][1][2,3]2.3.1} +\newlabel{cref@lem:transport-s1-code}{[lem][2][8,1]8.1.2} +\newlabel{cref@lem:truncation-le}{[lem][15][7,3]7.3.15} +\newlabel{cref@lem:untruncated-linearity-reals-coincide}{[lem][1][11,4]11.4.1} +\newlabel{cref@mult-from-square}{[equation][45][11,3]11.3.45} +\newlabel{cref@notnotstable-equality-to-set}{[cor][3][7,2]7.2.3} +\newlabel{cref@ordered-field}{[defn][7][11,2]11.2.7} +\newlabel{cref@prop:factor_equiv_fiber}{[lem][5][7,6]7.6.5} +\newlabel{cref@prop:kernels_are_effective}{[thm][9][10,1]10.1.9} +\newlabel{cref@prop:lv_n_deptype_sec_equiv_by_precomp}{[thm][7][7,7]7.7.7} +\newlabel{cref@prop:nat-is-set}{[thm][6][7,2]7.2.6} +\newlabel{cref@prop:nconnected_tested_by_lv_n_dependent types}{[lem][7][7,5]7.5.7} +\newlabel{cref@prop:nconn_fiber_to_total}{[lem][13][7,5]7.5.13} +\newlabel{cref@prop:to_image_is_connected}{[lem][4][7,6]7.6.4} +\newlabel{cref@prop:trunc_of_prop_is_set}{[lem][13][10,1]10.1.13} +\newlabel{cref@RC-archimedean-ordered-field}{[thm][48][11,3]11.3.48} +\newlabel{cref@RC-archimedean}{[thm][41][11,3]11.3.41} +\newlabel{cref@RC-binary-nonexpanding-extension}{[lem][40][11,3]11.3.40} +\newlabel{cref@RC-continuous-eq}{[lem][39][11,3]11.3.39} +\newlabel{cref@RC-extend-Q-Lipschitz}{[lem][15][11,3]11.3.15} +\newlabel{cref@RC-initial-Cauchy-complete}{[thm][50][11,3]11.3.50} +\newlabel{cref@RC-lim-factor}{[lem][11][11,3]11.3.11} +\newlabel{cref@RC-lim-onto}{[lem][10][11,3]11.3.10} +\newlabel{cref@RC-Lipschitz-on-interval}{[ex][8][11]11.8} +\newlabel{cref@RC-sim-eqv-le}{[thm][44][11,3]11.3.44} +\newlabel{cref@RC-sim-rounded}{[equation][21][11,3]11.3.21} +\newlabel{cref@RC-squaring}{[thm][46][11,3]11.3.46} +\newlabel{cref@RD-archimedean-ordered-field}{[thm][8][11,2]11.2.8} +\newlabel{cref@RD-archimedean}{[thm][6][11,2]11.2.6} +\newlabel{cref@RD-cauchy-complete}{[thm][12][11,2]11.2.12} +\newlabel{cref@RD-dedekind-complete}{[cor][16][11,2]11.2.16} +\newlabel{cref@RD-final-field}{[thm][14][11,2]11.2.14} +\newlabel{cref@RD-inverse-apart-0}{[thm][4][11,2]11.2.4} +\newlabel{cref@reals-formal-topology-locally-compact}{[lem][14][11,5]11.5.14} +\newlabel{cref@reflectcommutespushout}{[thm][12][7,4]7.4.12} +\newlabel{cref@rmk:connectedness-indexing}{[rmk][3][7,5]7.5.3} +\newlabel{cref@rmk:defid}{[rmk][1][6,2]6.2.1} +\newlabel{cref@rmk:infty-group}{[rmk][2][6,11]6.11.2} +\newlabel{cref@rmk:introducing-new-concepts}{[rmk][1][1,5]1.5.1} +\newlabel{cref@rmk:naive}{[rmk][3][8,7]8.7.3} +\newlabel{cref@rmk:spokes-no-hub}{[rmk][1][6,7]6.7.1} +\newlabel{cref@rmk:true-neq-false}{[rmk][6][2,12]2.12.6} +\newlabel{cref@rmk:varies-along}{[rmk][4][6,2]6.2.4} +\newlabel{cref@S1-universal-cover}{[defn][1][8,1]8.1.1} +\newlabel{cref@sec:adjunctions}{[section][3][]9.3} +\newlabel{cref@sec:algebr-struct-cauchy}{[subsection][3][]11.3.3} +\newlabel{cref@sec:algebr-struct-dedek}{[subsection][1][]11.2.1} +\newlabel{cref@sec:appetizer-univalence}{[section][2][]5.2} +\newlabel{cref@sec:axiom-choice}{[section][8][]3.8} +\newlabel{cref@sec:axioms}{[section][1][]1.1} +\newlabel{cref@sec:basics-equivalences}{[section][4][]2.4} +\newlabel{cref@sec:basics-sets}{[section][1][]3.1} +\newlabel{cref@sec:better-vankampen}{[subsection][2][]8.7.2} +\newlabel{cref@sec:biinv}{[section][3][]4.3} +\newlabel{cref@sec:bool-nat}{[section][1][]5.1} +\newlabel{cref@sec:cardinals}{[section][2][]10.2} +\newlabel{cref@sec:cats}{[section][1][]9.1} +\newlabel{cref@sec:cauchy-reals-cauchy-complete}{[subsection][4][]11.3.4} +\newlabel{cref@sec:cauchy-reals}{[section][3][]11.3} +\newlabel{cref@sec:cell-complexes}{[section][6][]6.6} +\newlabel{cref@sec:circle}{[section][4][]6.4} +\newlabel{cref@sec:colimits}{[section][8][]6.8} +\newlabel{cref@sec:compactness-interval}{[section][5][]11.5} +\newlabel{cref@sec:comp-cauchy-dedek}{[section][4][]11.4} +\newlabel{cref@sec:computational}{[section][5][]2.5} +\newlabel{cref@sec:compute-cartprod}{[section][6][]2.6} +\newlabel{cref@sec:compute-coprod}{[section][12][]2.12} +\newlabel{cref@sec:compute-nat}{[section][13][]2.13} +\newlabel{cref@sec:compute-paths}{[section][11][]2.11} +\newlabel{cref@sec:compute-pi}{[section][9][]2.9} +\newlabel{cref@sec:compute-sigma}{[section][7][]2.7} +\newlabel{cref@sec:compute-unit}{[section][8][]2.8} +\newlabel{cref@sec:compute-universe}{[section][10][]2.10} +\newlabel{cref@sec:concluding-remarks}{[section][5][]4.5} +\newlabel{cref@sec:connectivity}{[section][5][]7.5} +\newlabel{cref@sec:conn-susp}{[section][2][]8.2} +\newlabel{cref@sec:constr-cauchy-reals}{[subsection][1][]11.3.1} +\newlabel{cref@sec:contractibility}{[section][11][]3.11} +\newlabel{cref@sec:contrf}{[section][4][]4.4} +\newlabel{cref@sec:coproduct-types}{[section][7][]1.7} +\newlabel{cref@sec:cumulative-hierarchy}{[section][5][]10.5} +\newlabel{cref@sec:dagger-categories}{[section][7][]9.7} +\newlabel{cref@sec:dedekind-reals}{[section][2][]11.2} +\newlabel{cref@sec:dependent-paths}{[section][2][]6.2} +\newlabel{cref@sec:disequality}{[subsection][3][]1.12.3} +\newlabel{cref@sec:equality-of-structures}{[section][14][]2.14} +\newlabel{cref@sec:equality}{[section][1][]2.1} +\newlabel{cref@sec:equivalences}{[section][4][]9.4} +\newlabel{cref@sec:equiv-closures}{[section][7][]4.7} +\newlabel{cref@sec:fiberwise-equivalences}{[section][7][]4.7} +\newlabel{cref@sec:fib-over-pushout}{[subsection][1][]8.5.1} +\newlabel{cref@sec:fibrations}{[section][3][]2.3} +\newlabel{cref@sec:field-rati-numb}{[section][1][]11.1} +\newlabel{cref@sec:finite-product-types}{[section][5][]1.5} +\newlabel{cref@sec:flattening}{[section][12][]6.12} +\newlabel{cref@sec:formal-prelim}{[appendix][1][2147483647]A} +\newlabel{cref@sec:free-algebras}{[section][11][]6.11} +\newlabel{cref@sec:freudenthal}{[section][6][]8.6} +\newlabel{cref@sec:function-types}{[section][2][]1.2} +\newlabel{cref@sec:functors}{[section][2][]2.2} +\newlabel{cref@sec:general-encode-decode}{[section][9][]8.9} +\newlabel{cref@sec:generalizations}{[section][7][]5.7} +\newlabel{cref@sec:hae}{[section][2][]4.2} +\newlabel{cref@sec:hedberg}{[section][2][]7.2} +\newlabel{cref@sec:hittruncations}{[section][9][]6.9} +\newlabel{cref@sec:hopf}{[section][5][]8.5} +\newlabel{cref@sec:hott-features}{[section][3][2147483647]A.3} +\newlabel{cref@sec:htpy-inductive}{[section][5][]5.5} +\newlabel{cref@sec:hubs-spokes}{[section][7][]6.7} +\newlabel{cref@sec:identity-systems}{[section][8][]5.8} +\newlabel{cref@sec:identity-types}{[section][12][]1.12} +\newlabel{cref@sec:image-factorization}{[section][6][]7.6} +\newlabel{cref@sec:image}{[subsection][2][]10.1.2} +\newlabel{cref@sec:inductive-types}{[section][9][]1.9} +\newlabel{cref@sec:induct-recurs-cauchy}{[subsection][2][]11.3.2} +\newlabel{cref@sec:initial-alg}{[section][4][]5.4} +\newlabel{cref@sec:interval}{[section][3][]6.3} +\newlabel{cref@sec:intro-hits}{[section][1][]6.1} +\newlabel{cref@sec:intuitionism}{[section][4][]3.4} +\newlabel{cref@sec:long-exact-sequence-homotopy-groups}{[section][4][]8.4} +\newlabel{cref@sec:modalities}{[section][7][]7.7} +\newlabel{cref@sec:mono-surj}{[section][6][]4.6} +\newlabel{cref@sec:more-formal-pi}{[subsection][4][2147483647]A.2.4} +\newlabel{cref@sec:more-formal-sigma}{[subsection][5][2147483647]A.2.5} +\newlabel{cref@sec:moreresults}{[section][10][]8.10} +\newlabel{cref@sec:naive-vankampen}{[subsection][1][]8.7.1} +\newlabel{cref@sec:naturality}{[section][13][]6.13} +\newlabel{cref@sec:n-types}{[section][1][]7.1} +\newlabel{cref@sec:object-classification}{[section][8][]4.8} +\newlabel{cref@sec:ordinals}{[section][3][]10.3} +\newlabel{cref@sec:pat}{[section][11][]1.11} +\newlabel{cref@sec:pattern-matching}{[section][10][]1.10} +\newlabel{cref@sec:pi1s1-classical-proof}{[subsection][2][]8.1.2} +\newlabel{cref@sec:pi1s1-idsys}{[subsection][6][]8.1.6} +\newlabel{cref@sec:pi1s1-initial-thoughts}{[subsection][1][]8.1.1} +\newlabel{cref@sec:pi1-s1-intro}{[section][1][]8.1} +\newlabel{cref@sec:pi1s1-universal-cover}{[subsection][3][]8.1.3} +\newlabel{cref@sec:pik-le-n}{[section][3][]8.3} +\newlabel{cref@sec:pi-types}{[section][4][]1.4} +\newlabel{cref@sec:piw-pretopos}{[section][1][]10.1} +\newlabel{cref@sec:pushouts}{[section][4][]7.4} +\newlabel{cref@sec:quasi-inverses}{[section][1][]4.1} +\newlabel{cref@sec:RD-cauchy-complete}{[subsection][2][]11.2.2} +\newlabel{cref@sec:RD-dedekind-complete}{[subsection][3][]11.2.3} +\newlabel{cref@sec:rezk}{[section][9][]9.9} +\newlabel{cref@sec:set-quotients}{[section][10][]6.10} +\newlabel{cref@sec:sigma-types}{[section][6][]1.6} +\newlabel{cref@sec:sip}{[section][8][]9.8} +\newlabel{cref@sec:strict-categories}{[section][6][]9.6} +\newlabel{cref@sec:strictly-positive}{[section][6][]5.6} +\newlabel{cref@sec:surreals}{[section][6][]11.6} +\newlabel{cref@sec:suspension}{[section][5][]6.5} +\newlabel{cref@sec:syntax-informally}{[section][1][2147483647]A.1} +\newlabel{cref@sec:syntax-more-formally}{[section][2][2147483647]A.2} +\newlabel{cref@sec:transfors}{[section][2][]9.2} +\newlabel{cref@sec:truncations}{[section][3][]7.3} +\newlabel{cref@sec:type-booleans}{[section][8][]1.8} +\newlabel{cref@sec:types-vs-sets}{[section][1][]1.1} +\newlabel{cref@sec:unique-choice}{[section][9][]3.9} +\newlabel{cref@sec:univalence-implies-funext}{[section][9][]4.9} +\newlabel{cref@sec:universal-properties}{[section][15][]2.15} +\newlabel{cref@sec:universes}{[section][3][]1.3} +\newlabel{cref@sec:van-kampen}{[section][7][]8.7} +\newlabel{cref@sec:wellorderings}{[section][4][]10.4} +\newlabel{cref@sec:whitehead}{[section][8][]8.8} +\newlabel{cref@sec:w-types}{[section][3][]5.3} +\newlabel{cref@sec:yoneda}{[section][5][]9.5} +\newlabel{cref@subsec:emacinsets}{[subsection][5][]10.1.5} +\newlabel{cref@subsec:general-remarks}{[cor][7][2147483647,1,4]A.4.7} +\newlabel{cref@subsec:hprops}{[section][3][]3.3} +\newlabel{cref@subsec:limits-sets}{[subsection][1][]10.1.1} +\newlabel{cref@subsec:logic-hprop}{[section][6][]3.6} +\newlabel{cref@subsec:pat?}{[section][2][]3.2} +\newlabel{cref@subsec:pi1s1-encode-decode}{[subsection][4][]8.1.4} +\newlabel{cref@subsec:pi1s1-homotopy-theory}{[subsection][5][]8.1.5} +\newlabel{cref@subsec:piw}{[subsection][4][]10.1.4} +\newlabel{cref@subsec:prop-subsets}{[section][5][]3.5} +\newlabel{cref@subsec:prop-trunc}{[section][7][]3.7} +\newlabel{cref@subsec:quotients}{[subsection][3][]10.1.3} +\newlabel{cref@subsec:when-trunc}{[section][10][]3.10} +\newlabel{cref@tab:homotopy-groups-of-spheres}{[table][1][8]8.1} +\newlabel{cref@tab:pov}{[table][1][0]1} +\newlabel{cref@tab:theorems}{[table][2][8]8.2} +\newlabel{cref@thm:1surj_to_surj_to_pem}{[thm][14][10,1]10.1.14} +\newlabel{cref@thm:ac-epis-split}{[lem][2][3,8]3.8.2} +\newlabel{cref@thm:allbool-trueorfalse}{[thm][1][1,8]1.8.1} +\newlabel{cref@thm:ap2}{[lem][4][6,4]6.4.4} +\newlabel{cref@thm:apd2}{[lem][6][6,4]6.4.6} +\newlabel{cref@thm:apd-const}{[lem][8][2,3]2.3.8} +\newlabel{cref@thm:ap-prod}{[thm][5][2,6]2.6.5} +\newlabel{cref@thm:ap-sigma-rect-path-pair}{[lem][7][6,12]6.12.7} +\newlabel{cref@thm:ap-transport}{[lem][11][2,3]2.3.11} +\newlabel{cref@thm:Cauchy-reals-are-a-set}{[thm][9][11,3]11.3.9} +\newlabel{cref@thm:conemap-funct}{[lem][10][7,4]7.4.10} +\newlabel{cref@thm:connected-pointed}{[lem][11][7,5]7.5.11} +\newlabel{cref@thm:conn-pik}{[cor][8][8,4]8.4.8} +\newlabel{cref@thm:conn-trunc-variable-ind}{[lem][1][8,6]8.6.1} +\newlabel{cref@thm:contr-contr}{[cor][5][3,11]3.11.5} +\newlabel{cref@thm:contr-forall}{[lem][6][3,11]3.11.6} +\newlabel{cref@thm:contr-hae}{[thm][6][4,2]4.2.6} +\newlabel{cref@thm:contr-hprop}{[lem][4][4,4]4.4.4} +\newlabel{cref@thm:contr-paths}{[lem][8][3,11]3.11.8} +\newlabel{cref@thm:contr-unit}{[lem][3][3,11]3.11.3} +\newlabel{cref@thm:conversion-preserves-typing}{[thm][1][2147483647,1,4]A.4.1} +\newlabel{cref@thm:covering-spaces}{[thm][4][8,10]8.10.4} +\newlabel{cref@thm:dpath-arrow}{[lem][6][2,9]2.9.6} +\newlabel{cref@thm:dpath-forall}{[lem][7][2,9]2.9.7} +\newlabel{cref@thm:dpath-path}{[thm][5][2,11]2.11.5} +\newlabel{cref@thm:EckmannHilton}{[thm][6][2,1]2.1.6} +\newlabel{cref@thm:encode-total-equiv}{[cor][13][8,1]8.1.13} +\newlabel{cref@thm:equiv-biinv-isequiv}{[cor][3][4,3]4.3.3} +\newlabel{cref@thm:equiv-compose-equiv}{[lem][8][4,2]4.2.8} +\newlabel{cref@thm:equiv-contr-hae}{[thm][5][4,4]4.4.5} +\newlabel{cref@thm:equiv-eqrel}{[lem][12][2,4]2.4.12} +\newlabel{cref@thm:equiv-induction}{[cor][5][5,8]5.8.5} +\newlabel{cref@thm:equiv-inhabcod}{[cor][6][4,4]4.4.6} +\newlabel{cref@thm:equiv-iso-adj}{[thm][3][4,2]4.2.3} +\newlabel{cref@thm:eta-sigma}{[cor][3][2,7]2.7.3} +\newlabel{cref@thm:ETCS}{[thm][15][10,1]10.1.15} +\newlabel{cref@thm:fiber-of-a-fibration}{[lem][1][4,8]4.8.1} +\newlabel{cref@thm:fiber-of-the-fiber}{[lem][4][8,4]8.4.4} +\newlabel{cref@thm:flattening}{[lem][2][6,12]6.12.2} +\newlabel{cref@thm:flattening-rect}{[lem][4][6,12]6.12.4} +\newlabel{cref@thm:flattening-rectnd-beta-ppt}{[lem][8][6,12]6.12.8} +\newlabel{cref@thm:flattening-rectnd}{[lem][5][6,12]6.12.5} +\newlabel{cref@thm:freegroup-nonset}{[rmk][8][6,11]6.11.8} +\newlabel{cref@thm:free-monoid}{[lem][5][6,11]6.11.5} +\newlabel{cref@thm:freudcode}{[defn][5][8,6]8.6.5} +\newlabel{cref@thm:freudenthal}{[thm][4][8,6]8.6.4} +\newlabel{cref@thm:freudlemma}{[lem][10][8,6]8.6.10} +\newlabel{cref@thm:hae-hprop}{[thm][13][4,2]4.2.13} +\newlabel{cref@thm:hedberg}{[thm][5][7,2]7.2.5} +\newlabel{cref@thm:hlevel-cumulative}{[thm][7][7,1]7.1.7} +\newlabel{cref@thm:hlevel-loops}{[thm][7][7,2]7.2.7} +\newlabel{cref@thm:hleveln-of-hlevelSn}{[thm][11][7,1]7.1.11} +\newlabel{cref@thm:hlevel-prod}{[thm][9][7,1]7.1.9} +\newlabel{cref@thm:h-level-retracts}{[thm][4][7,1]7.1.4} +\newlabel{cref@thm:homotopy-groups}{[eg][4][6,11]6.11.4} +\newlabel{cref@thm:h-set-refrel-in-paths-sets}{[thm][2][7,2]7.2.2} +\newlabel{cref@thm:h-set-uip-K}{[thm][1][7,2]7.2.1} +\newlabel{cref@thm:htpy-induction}{[cor][6][5,8]5.8.6} +\newlabel{cref@thm:identity-systems}{[thm][2][5,8]5.8.2} +\newlabel{cref@thm:inhabprop-eqvunit}{[lem][2][3,3]3.3.2} +\newlabel{cref@thm:injsurj}{[lem][9][10,2]10.2.9} +\newlabel{cref@thm:interval-funext}{[lem][2][6,3]6.3.2} +\newlabel{cref@thm:isaprop-isofhlevel}{[thm][10][7,1]7.1.10} +\newlabel{cref@thm:isntype-mono}{[thm][6][7,1]7.1.6} +\newlabel{cref@thm:isprop-biinv}{[thm][2][4,3]4.3.2} +\newlabel{cref@thm:isprop-forall}{[eg][2][3,6]3.6.2} +\newlabel{cref@thm:isprop-iscontr}{[lem][4][3,11]3.11.4} +\newlabel{cref@thm:isprop-isprop}{[lem][5][3,3]3.3.5} +\newlabel{cref@thm:isprop-isset}{[lem][5][3,3]3.3.5} +\newlabel{cref@thm:isset-forall}{[eg][6][3,1]3.1.6} +\newlabel{cref@thm:isset-is1type}{[lem][8][3,1]3.1.8} +\newlabel{cref@thm:isset-prod}{[eg][5][3,1]3.1.5} +\newlabel{cref@thm:kbar}{[lem][9][8,7]8.7.9} +\newlabel{cref@thm:lequiv-contr-hae}{[thm][3][4,4]4.4.3} +\newlabel{cref@thm:les}{[thm][6][8,4]8.4.6} +\newlabel{cref@thm:loop-nontrivial}{[lem][1][6,4]6.4.1} +\newlabel{cref@thm:looptothe}{[cor][13][6,10]6.10.13} +\newlabel{cref@thm:minusoneconn-surjective}{[lem][2][7,5]7.5.2} +\newlabel{cref@thm:ML-identity-systems}{[thm][4][5,8]5.8.4} +\newlabel{cref@thm:modal-char}{[thm][4][7,7]7.7.4} +\newlabel{cref@thm:modal-mono}{[lem][2][7,6]7.6.2} +\newlabel{cref@thm:mono}{[lem][1][10,1]10.1.1} +\newlabel{cref@thm:mono-surj-equiv}{[thm][3][4,6]4.6.3} +\newlabel{cref@thm:naive-van-kampen}{[thm][4][8,7]8.7.4} +\newlabel{cref@thm:nat-hinitial}{[thm][5][5,4]5.4.5} +\newlabel{cref@thm:nat-set}{[eg][4][3,1]3.1.4} +\newlabel{cref@thm:nat-uniq}{[thm][1][5,1]5.1.1} +\newlabel{cref@thm:nat-wf}{[eg][5][10,3]10.3.5} +\newlabel{cref@thm:nconn-to-ntype-const}{[cor][9][7,5]7.5.9} +\newlabel{cref@thm:nobject-classifier-appetizer}{[thm][3][4,8]4.8.3} +\newlabel{cref@thm:NO-encode-decode}{[thm][16][11,6]11.6.16} +\newlabel{cref@thm:no-higher-ac}{[lem][5][3,8]3.8.5} +\newlabel{cref@thm:NO-refl-opt}{[thm][4][11,6]11.6.4} +\newlabel{cref@thm:NO-set}{[cor][5][11,6]11.6.5} +\newlabel{cref@thm:NO-simplicity}{[thm][2][11,6]11.6.2} +\newlabel{cref@thm:not-dneg}{[thm][2][3,2]3.2.2} +\newlabel{cref@thm:not-lem}{[cor][7][3,2]3.2.7} +\newlabel{cref@thm:NO-unstrict-transitive}{[cor][17][11,6]11.6.17} +\newlabel{cref@thm:ntype-nloop}{[thm][9][7,2]7.2.9} +\newlabel{cref@thm:ntypes-sigma}{[thm][8][7,1]7.1.8} +\newlabel{cref@thm:object-classifier}{[thm][4][4,8]4.8.4} +\newlabel{cref@thm:omg}{[lem][4][2,1]2.1.4} +\newlabel{cref@thm:omit-contr}{[lem][9][3,11]3.11.9} +\newlabel{cref@thm:ordord}{[thm][20][10,3]10.3.20} +\newlabel{cref@thm:ordsucc}{[lem][21][10,3]10.3.21} +\newlabel{cref@thm:ordunion}{[lem][22][10,3]10.3.22} +\newlabel{cref@thm:orth-fact}{[thm][6][7,6]7.6.6} +\newlabel{cref@thm:path-coprod}{[thm][5][2,12]2.12.5} +\newlabel{cref@thm:path-lifting}{[lem][2][2,3]2.3.2} +\newlabel{cref@thm:path-nat}{[thm][1][2,13]2.13.1} +\newlabel{cref@thm:path-prod}{[thm][2][2,6]2.6.2} +\newlabel{cref@thm:path-sigma}{[thm][2][2,7]2.7.2} +\newlabel{cref@thm:paths-respects-equiv}{[thm][1][2,11]2.11.1} +\newlabel{cref@thm:path-subset}{[lem][1][3,5]3.5.1} +\newlabel{cref@thm:path-truncation}{[thm][12][7,3]7.3.12} +\newlabel{cref@thm:path-unit}{[thm][1][2,8]2.8.1} +\newlabel{cref@thm:pi1s1-decode}{[defn][6][8,1]8.1.6} +\newlabel{cref@thm:pik-conn}{[cor][5][8,8]8.8.5} +\newlabel{cref@thm:prod-umpd}{[thm][5][2,15]2.15.5} +\newlabel{cref@thm:prod-ump}{[thm][2][2,15]2.15.2} +\newlabel{cref@thm:prop-minusonetype}{[lem][10][3,11]3.11.10} +\newlabel{cref@thm:prop-set}{[lem][4][3,3]3.3.4} +\newlabel{cref@thm:pushout-ump}{[lem][2][6,8]6.8.2} +\newlabel{cref@thm:quotient-surjective}{[lem][2][6,10]6.10.2} +\newlabel{cref@thm:quotient-ump}{[lem][3][6,10]6.10.3} +\newlabel{cref@thm:RC-le-grow}{[lem][42][11,3]11.3.42} +\newlabel{cref@thm:RC-lt-open}{[lem][43][11,3]11.3.43} +\newlabel{cref@thm:RC-sim-characterization}{[thm][32][11,3]11.3.32} +\newlabel{cref@thm:RC-sim-lim}{[lem][36][11,3]11.3.36} +\newlabel{cref@thm:RC-sim-lim-term}{[lem][37][11,3]11.3.37} +\newlabel{cref@thm:RCsim-symmetric}{[lem][12][11,3]11.3.12} +\newlabel{cref@thm:refl-over-ntype-base}{[cor][10][7,3]7.3.10} +\newlabel{cref@thm:reflsubunv-forall}{[thm][2][7,7]7.7.2} +\newlabel{cref@thm:retract-contr}{[lem][7][3,11]3.11.7} +\newlabel{cref@thm:retract-equiv}{[thm][4][4,7]4.7.4} +\newlabel{cref@thm:retraction-quotient}{[cor][10][6,10]6.10.10} +\newlabel{cref@thm:S1-autohtpy}{[lem][2][6,4]6.4.2} +\newlabel{cref@thm:S1rec}{[lem][5][6,2]6.2.5} +\newlabel{cref@thm:S1ump}{[lem][9][6,2]6.2.9} +\newlabel{cref@thm:ses}{[lem][7][8,4]8.4.7} +\newlabel{cref@thm:set-pushout}{[lem][3][6,9]6.9.3} +\newlabel{cref@thm:set_regular}{[thm][5][10,1]10.1.5} +\newlabel{cref@thm:settopos}{[thm][12][10,1]10.1.12} +\newlabel{cref@thm:sign-induction}{[lem][12][6,10]6.10.12} +\newlabel{cref@thm:sip}{[thm][2][9,8]9.8.2} +\newlabel{cref@thm:stable-images}{[thm][9][7,6]7.6.9} +\newlabel{cref@thm:strong-normalization}{[thm][2][2147483647,1,4]A.4.2} +\newlabel{cref@thm:suspbool}{[lem][1][6,5]6.5.1} +\newlabel{cref@thm:suspension-increases-connectedness}{[thm][1][8,2]8.2.1} +\newlabel{cref@thm:total-fiber-equiv}{[thm][7][4,7]4.7.7} +\newlabel{cref@thm:total-space-of-the-fibers}{[lem][2][4,8]4.8.2} +\newlabel{cref@thm:transport2}{[lem][5][6,4]6.4.5} +\newlabel{cref@thm:transport-compose}{[lem][10][2,3]2.3.10} +\newlabel{cref@thm:transport-concat}{[lem][9][2,3]2.3.9} +\newlabel{cref@thm:transportequiv}{[eg][9][2,4]2.4.9} +\newlabel{cref@thm:transport-is-ap}{[lem][5][2,10]2.10.5} +\newlabel{cref@thm:transport-is-given}{[lem][1][6,12]6.12.1} +\newlabel{cref@thm:transport-path2}{[thm][4][2,11]2.11.4} +\newlabel{cref@thm:transport-path}{[thm][3][2,11]2.11.3} +\newlabel{cref@thm:trans-prod}{[thm][4][2,6]2.6.4} +\newlabel{cref@thm:trans-trivial}{[lem][5][2,3]2.3.5} +\newlabel{cref@thm:trunc0-ind}{[lem][1][6,9]6.9.1} +\newlabel{cref@thm:trunc0-lump}{[lem][2][6,9]6.9.2} +\newlabel{cref@thm:trunc-htpy}{[lem][5][7,3]7.3.5} +\newlabel{cref@thm:trunc-in-truncated-sigma}{[thm][9][7,3]7.3.9} +\newlabel{cref@thm:truncn-ind}{[thm][2][7,3]7.3.2} +\newlabel{cref@thm:trunc-reflective}{[lem][3][7,3]7.3.3} +\newlabel{cref@thm:ttac}{[thm][7][2,15]2.15.7} +\newlabel{cref@thm:two-out-of-three}{[thm][1][4,7]4.7.1} +\newlabel{cref@thm:type-is-not-a-set}{[eg][9][3,1]3.1.9} +\newlabel{cref@thm:van-Kampen}{[thm][12][8,7]8.7.12} +\newlabel{cref@thm:VisCST}{[thm][8][10,5]10.5.8} +\newlabel{cref@thm:wedge-connectivity}{[lem][2][8,6]8.6.2} +\newlabel{cref@thm:wellorder}{[thm][3][10,4]10.4.3} +\newlabel{cref@thm:wfcat}{[cor][15][10,3]10.3.15} +\newlabel{cref@thm:wfmin}{[lem][8][10,3]10.3.8} +\newlabel{cref@thm:wfrec}{[lem][7][10,3]10.3.7} +\newlabel{cref@thm:w-hinit}{[thm][7][5,4]5.4.7} +\newlabel{cref@thm:whitehead0}{[thm][1][8,8]8.8.1} +\newlabel{cref@thm:whitehead1}{[cor][2][8,8]8.8.2} +\newlabel{cref@thm:whitehead-contr}{[cor][4][8,8]8.8.4} +\newlabel{cref@thm:whiteheadn}{[thm][3][8,8]8.8.3} +\newlabel{cref@thm:wop}{[thm][4][10,4]10.4.4} +\newlabel{cref@thm:wtype-wf}{[eg][6][10,3]10.3.6} +\newlabel{cref@thm:w-uniq}{[thm][1][5,3]5.3.1} +\newlabel{cref@thm:zfc}{[thm][11][10,5]10.5.11} +\newlabel{cref@transport-Sigma}{[thm][4][2,7]2.7.4} +\newlabel{cref@UA-eqv-hom-eqv}{[lem][2][4,9]4.9.2} +\newlabel{cref@uatowfe}{[thm][4][4,9]4.9.4} +\newlabel{cref@weakfunext}{[defn][1][4,9]4.9.1} +\newlabel{cref@wfetofe}{[thm][5][4,9]4.9.5} +\newlabel{cref@when-reals-coincide}{[cor][3][11,4]11.4.3} +\newlabel{cref@Z-quotient-by-canonical-representatives}{[rmk][11][6,10]6.10.11} +\newlabel{ct:2cat}{9.5} +\newlabel{ct:adjointification}{9.4.2} +\newlabel{ct:adjprop2}{9.5.11} +\newlabel{ct:adjprop}{9.3.2} +\newlabel{ct:adj-repr}{9.5.10} +\newlabel{ctb-uniformly-continuous-sup}{11.5.7} +\newlabel{ct:cat-2cat}{9.4.16} +\newlabel{ct:category}{9.1.6} +\newlabel{ct:cat-eq-iso}{9.4.15} +\newlabel{ct:catweq}{9.4.7} +\newlabel{ct:cat-weq-eq}{9.9.4} +\newlabel{ct:chaotic}{9.4.13} +\newlabel{ct:discrete}{9.1.16} +\newlabel{ct:eg:set}{9.1.7} +\newlabel{ct:equiv}{9.4.1} +\newlabel{ct:eqv-levelwise}{9.4.14} +\newlabel{ct:esofull-precomp-ff}{9.9.2} +\newlabel{ct:ex:hocat}{9.9} +\newlabel{ct:ffeso}{9.4.5} +\newlabel{ct:functor}{9.2.1} +\newlabel{ct:functor-assoc}{9.2.9} +\newlabel{ct:functor-cat}{9.2.5} +\newlabel{ct:functorexpadj}{9.5.3} +\newlabel{ct:functor-precat}{9.2.3} +\newlabel{ct:fundgpd}{9.1.17} +\newlabel{ct:galois}{9.6.3} +\newlabel{ct:gaunt}{9.1.15} +\newlabel{ct:groupoids}{9.6} +\newlabel{ct:hilb}{9.7.7} +\newlabel{ct:hocat}{9.9.7} +\newlabel{ct:hoprecat}{9.1.18} +\newlabel{ct:idtoiso}{9.1.4} +\newlabel{ct:idtoisocompute}{9.1.10} +\newlabel{ct:idtoiso-trans}{9.1.9} +\newlabel{ct:idtounitary}{9.7.3} +\newlabel{ct:interchange}{9.2.8} +\newlabel{ct:isocat}{9.4.8} +\newlabel{ct:isomorphism}{9.1.2} +\newlabel{ct:isoprecat}{9.4.9} +\newlabel{ct:isoprop}{9.1.3} +\newlabel{ct:natiso}{9.2.4} +\newlabel{ct:nattrans}{9.2.2} +\newlabel{ct:obj-1type}{9.1.8} +\newlabel{ct:opposite-category}{9.5.1} +\newlabel{ct:orders}{9.1.14} +\newlabel{ct:pentagon}{9.2.10} +\newlabel{ct:pre2cat}{9.4} +\newlabel{ct:precategory}{9.1.1} +\newlabel{ct:precatset}{9.1.5} +\newlabel{ct:rel}{9.1.19} +\newlabel{ct:representable}{9.5.8} +\newlabel{ct:representable-prop}{9.5.9} +\newlabel{ct:rezk-fundgpd-trunc1}{9.9.6} +\newlabel{ct:sig}{9.8.1} +\newlabel{ct:sip-functor-cat}{9.8.3} +\newlabel{ct:unitary}{9.7.2} +\newlabel{ct:units}{9.2.11} +\newlabel{ct:yoneda}{9.5.4} +\newlabel{ct:yoneda-embedding}{9.5.6} +\newlabel{ct:yoneda-mono}{9.5.7} +\newlabel{dedekind-in-cut-as-le}{11.2.2} +\newlabel{def:bisimulation}{10.5.4} +\newlabel{def:hlevel}{7.1.1} +\newlabel{def:loopspace}{2.1.8} +\newlabel{defn:1type}{3.1.7} +\newlabel{defn:accessibility}{10.3.1} +\newlabel{defn:biinv}{4.3.1} +\newlabel{defn:card}{10.2.1} +\newlabel{defn:cauchy-approximation}{11.2.10} +\newlabel{defn:cauchy-reals}{11.3.2} +\newlabel{defn:cocone}{6.8.1} +\newlabel{defn:complete-metric-space}{11.5.2} +\newlabel{defn:contractible}{3.11.1} +\newlabel{defn:decidable-equality}{3.4.3} +\newlabel{defn:dedekind-reals}{11.2.1} +\newlabel{defn:equivalence}{4.4.1} +\newlabel{defn:fo-notion-of-structure}{9.8.4} +\newlabel{defn:homotopy}{2.4.1} +\newlabel{defn:homotopy-fiber}{4.2.4} +\newlabel{defn:identity-systems}{5.8.1} +\newlabel{defn:inductive-cover}{11.5.13} +\newlabel{defn:inductive-cover-interval-1}{(v)} +\newlabel{defn:inductive-cover-interval-2}{(vi)} +\newlabel{defn:ishae}{4.2.1} +\newlabel{defn:isprop}{3.3.1} +\newlabel{defn:lcoh-rcoh}{4.2.10} +\newlabel{defn:linv-rinv}{4.2.7} +\newlabel{defn:lipschitz}{11.3.14} +\newlabel{defn:logical-notation}{3.7.1} +\newlabel{defn:metric-space}{11.5.1} +\newlabel{defn:modal-image}{7.6.3} +\newlabel{defn:modality}{7.7.5} +\newlabel{defn:nalg}{5.4.1} +\newlabel{defn:nhom}{5.4.2} +\newlabel{defn:No-codes}{11.6.7} +\newlabel{defn:RC-approx}{11.3.16} +\newlabel{defn:reflective-subuniverse}{7.7.1} +\newlabel{defn:retract}{4.7.2} +\newlabel{defn:set}{3.1.1} +\newlabel{defn:setof}{3.5} +\newlabel{defn:surreals}{11.6.1} +\newlabel{defn:total-bounded-metric-space}{11.5.3} +\newlabel{defn:total-map}{4.7.5} +\newlabel{defn:uniformly-continuous}{11.5.5} +\newlabel{defn:V}{10.5.1} +\newlabel{defn-Z}{6.10.7} +\newlabel{def-of-homotopy-groups}{8.0.1} +\newlabel{def:pointedmap}{8.4.1} +\newlabel{def:pointedtype}{2.1.7} +\newlabel{def:simulation}{10.3.11} +\newlabel{def:TypeOfElements}{10.5.7} +\newlabel{def:VVquotient}{6.10.5} +\newlabel{eg:circle}{8.7.6} +\newlabel{eg:clvk}{8.7.13} +\newlabel{eg:cofiber}{8.7.14} +\newlabel{eg:concatequiv}{2.4.8} +\newlabel{eg:idequiv}{2.4.7} +\newlabel{eg:kg1}{8.7.17} +\newlabel{eg:suspension}{8.7.7} +\newlabel{eg:torus}{8.7.15} +\newlabel{eg:unnatural-hit}{6.13.1} +\newlabel{eg:wedge}{8.7.8} +\newlabel{Eilenberg-Mac-Lane-Spaces}{8.10.3} +\newlabel{epis-surj}{10.1.4} +\newlabel{eq:ac}{3.8.1} +\newlabel{eq:apd-to-ap}{2.3.7} +\newlabel{eq:appxrec2}{11.3.24} +\newlabel{eq:ap-to-apd}{2.3.6} +\newlabel{eq:bfa-bga2}{8.7.11} +\newlabel{eq:bfa-bga}{8.7.1} +\newlabel{eq:bfa-bga-comm}{8.7.2} +\newlabel{eq:cauchy-approx}{11.2.11} +\newlabel{eq:cauchy-sequence}{11.2.9} +\newlabel{eq:class-notation}{10.5.3} +\newlabel{eq:composeconefunc}{7.4.4} +\newlabel{eq:composeconeid}{7.4.3} +\newlabel{eq:concatD}{2.1.3} +\newlabel{eq:conetrunc}{7.4.11} +\newlabel{eq:cover-pointwise}{11.5.12} +\newlabel{eq:cover-pointwise-truncated}{11.5.10} +\newlabel{eq:ct:gbar}{9.4.12} +\newlabel{eq:ct:ipctri}{9.4.11} +\newlabel{eq:ct:isoprecattri}{9.4.10} +\newlabel{eq:dbl0}{1.10.1} +\newlabel{eq:dbl-as-rec}{1.9.1} +\newlabel{eq:dblsuc}{1.10.2} +\newlabel{eq:decode}{8.7.5} +\newlabel{eq:defn-pullback}{2.15.11} +\newlabel{eq:depCauchyappx}{11.3.5} +\newlabel{eq:dnshift}{3.11.11} +\newlabel{eq:dpath}{6.2.2} +\newlabel{eq:english-ac}{3.2.1} +\newlabel{eq:epis-split}{3.8.3} +\newlabel{eq:equality-semigroup-mult}{2.14.2} +\newlabel{eq:eqv}{2.4.11} +\newlabel{eq:example-comp}{5.6.6} +\newlabel{eq:example-constructor}{5.6.4} +\newlabel{eq:example-indhyp}{5.6.7} +\newlabel{eq:example-rechyp}{5.6.5} +\newlabel{eq:expldef}{1.2.1} +\newlabel{eq:fake-recursor}{5.6.1} +\newlabel{eq:ffprime-north}{6.5.5} +\newlabel{eq:flattening-rectnd}{6.12.6} +\newlabel{eq:fpaut}{3.2.3} +\newlabel{eq:fpfaut}{3.2.4} +\newlabel{eq:freudcode}{8.6.6} +\newlabel{eq:freudcodeN}{8.6.7} +\newlabel{eq:freudcodeS}{8.6.8} +\newlabel{eq:freudcompute1}{8.6.11} +\newlabel{eq:freudcompute2}{8.6.12} +\newlabel{eq:freudenthal-for-spheres}{8.6.16} +\newlabel{eq:freudgoal}{8.6.13} +\newlabel{eq:freudmap}{8.6.9} +\newlabel{eq:fullprop}{9.9.3} +\newlabel{eq:happly}{2.9.2} +\newlabel{eq:injective}{4.6.2} +\newlabel{eq:inlinj}{2.12.1} +\newlabel{eq:inlrdj}{2.12.3} +\newlabel{eq:iscontrf}{4.4.2} +\newlabel{eq:isequiv-invertible}{2.4.10} +\newlabel{eq:Jconv}{2.0.1} +\newlabel{eq:lambda-abstraction}{1.4.1} +\newlabel{eq:ldn}{3.4.2} +\newlabel{eq:lem}{3.4.1} +\newlabel{eq:lpo}{11.5.8} +\newlabel{eq:mapofspans-htpy}{7.4.9} +\newlabel{eq:modaltype}{7.7.6} +\newlabel{eq:NO-codes-transitivity}{11.6.9} +\newlabel{eq:NO-codes-unstrict}{11.6.8} +\newlabel{eq:noind1}{11.6.3} +\newlabel{eq:NO-prec-def}{11.6.15} +\newlabel{eq:NO-preceq-def}{11.6.14} +\newlabel{eq:NO-prec-IHL}{11.6.12} +\newlabel{eq:NO-prec-IHR}{11.6.13} +\newlabel{eq:NO-prec-outer-IH}{11.6.10} +\newlabel{eq:path-forall}{2.9.1} +\newlabel{eq:path-lump}{2.15.10} +\newlabel{eq:path-prod}{2.6.1} +\newlabel{eq:path-prod-inverse}{2.6.3} +\newlabel{eq:path-trunc-map}{7.3.11} +\newlabel{eq:pi1s1-decode}{8.1.4} +\newlabel{eq:pi1s1-encode}{8.1.3} +\newlabel{eq:Pinj}{5.6.2} +\newlabel{eq:polyfunc}{5.4.6} +\newlabel{eq:prodeqv}{2.5.1} +\newlabel{eq:prod-umpd-map}{2.15.4} +\newlabel{eq:prod-ump-map}{2.15.1} +\newlabel{eq:prod-ump-rt1}{2.15.3} +\newlabel{eq:prod-ump-rt2}{2.15.8} +\newlabel{eq:prop-up}{3.5.4} +\newlabel{eq:qinvtype}{2.4.5} +\newlabel{eq:quotient-when-canonical}{6.10.9} +\newlabel{eq:RCappx1}{11.3.17} +\newlabel{eq:RCappx2}{11.3.18} +\newlabel{eq:RCappx3}{11.3.19} +\newlabel{eq:RCappx4}{11.3.20} +\newlabel{eq:RCappx-rtri-rll1}{11.3.29} +\newlabel{eq:RCappx-rtri-rll2}{11.3.30} +\newlabel{eq:RCappx-rtri-rll3}{11.3.31} +\newlabel{eq:RCappx-rtri-rlr1}{11.3.27} +\newlabel{eq:RCappx-rtri-rlr2}{11.3.28} +\newlabel{eq:RCappx-rtri-rrl1}{11.3.25} +\newlabel{eq:RCappx-rtri-rrl2}{11.3.26} +\newlabel{eq:RC-cauchy}{11.3.3} +\newlabel{eq:RC-path}{11.3.4} +\newlabel{eq:rcsimind1}{11.3.6} +\newlabel{eq:rcsimind2}{11.3.7} +\newlabel{eq:RC-sim-ltri}{11.3.23} +\newlabel{eq:RC-sim-recursion-extra}{11.3.13} +\newlabel{eq:RC-sim-rtri}{11.3.22} +\newlabel{eq:RD-linear-order}{11.2.3} +\newlabel{eq:S1recindbase}{6.2.6} +\newlabel{eq:S1recindloop}{6.2.7} +\newlabel{eq:set-up}{3.5.3} +\newlabel{eq:sigma-lump}{2.15.9} +\newlabel{eq:sigma-ump-map}{2.15.6} +\newlabel{eq:Snsusp}{6.5.2} +\newlabel{eq:subset}{3.5.2} +\newlabel{eq:suc-injective}{2.13.3} +\newlabel{eq:sumcodefam}{2.12.4} +\newlabel{eq:tautology1}{1.11.1} +\newlabel{eq:tautology2}{1.11.2} +\newlabel{eq:transport-arrow}{2.9.4} +\newlabel{eq:transport-arrow-families}{2.9.5} +\newlabel{eq:transport-semigroup-assoc}{2.14.3} +\newlabel{eq:transport-semigroup-step1}{2.14.2} +\newlabel{eq:trunc-htpy}{7.3.6} +\newlabel{eq:trunc-nat}{7.3.4} +\newlabel{eq:uatofeps}{4.9.7} +\newlabel{eq:uatofesp}{4.9.6} +\newlabel{eq:uidtoeqv}{2.10.2} +\newlabel{eq:untruncated-linearity}{11.4.2} +\newlabel{equ:prequired}{5.4.8} +\newlabel{eq:V-path}{10.5.2} +\newlabel{eq:yoneda}{9.5.5} +\newlabel{eq:zero-not-succ}{2.13.2} +\newlabel{ex:acconn}{7.10} +\newlabel{ex:ackermann}{1.10} +\newlabel{ex:acnm}{7.8} +\newlabel{ex:acnm-surjset}{7.9} +\newlabel{ex:ap-path-inversion}{8.6} +\newlabel{ex:ap-sigma}{2.7} +\newlabel{ex:basics:concat}{2.1} +\newlabel{ex:bool}{5.4} +\newlabel{ex:brck-qinv}{3.8} +\newlabel{ex:choice-function}{10.10} +\newlabel{ex:composition}{1.1} +\newlabel{ex:connectivity-inductively}{7.6} +\newlabel{ex:coprod-ump}{2.9} +\newlabel{ex:cumhierhit}{10.11} +\newlabel{ex:decidable-choice}{3.19} +\newlabel{ex:disjoint-or}{3.7} +\newlabel{ex:equality-reflection}{2.14} +\newlabel{ex:equiv-concat}{2.6} +\newlabel{ex:eqvboolbool}{2.13} +\newlabel{ex:fin}{1.9} +\newlabel{ex:finite-cover-lebesgue-number}{11.12} +\newlabel{ex:free-monoid}{6.8} +\newlabel{ex:HopfJr}{8.8} +\newlabel{ex:impred-brck}{3.15} +\newlabel{ex:isset-coprod}{3.2} +\newlabel{ex:isset-sigma}{3.3} +\newlabel{ex:lem-brck}{3.14} +\newlabel{ex:lem-impred}{3.10} +\newlabel{ex:lem-ldn}{3.18} +\newlabel{ex:lem-mereprop}{3.6} +\newlabel{ex:lemnm}{7.7} +\newlabel{ex:loop2}{5.8} +\newlabel{ex:loop}{5.7} +\newlabel{ex:mean-value-theorem}{11.13} +\newlabel{ex:metric-completion}{11.9} +\newlabel{ex:neg-ldn}{1.11} +\newlabel{ex:ninf-ord}{10.8} +\newlabel{ex:not-not-lem}{1.13} +\newlabel{ex:npaths}{2.4} +\newlabel{ex:nspheres}{6.4} +\newlabel{ex:ntype-from-nconn-const}{7.5} +\newlabel{ex:ntypes-closed-under-wtypes}{7.3} +\newlabel{ex:omit-contr2}{3.20} +\newlabel{ex:one-function-two-recurrences}{5.3} +\newlabel{ex:pm-to-ml}{1.7} +\newlabel{ex:pointed-equivalences}{8.7} +\newlabel{ex:prod-via-bool}{1.6} +\newlabel{ex:prop-endocontr}{3.4} +\newlabel{ex:prop-inhabcontr}{3.5} +\newlabel{ex:prop-ord}{10.7} +\newlabel{ex:prop-trunc-ind}{3.17} +\newlabel{ex:pullback}{2.11} +\newlabel{ex:pullback-pasting}{2.12} +\newlabel{ex:qinv-autohtpy-no-univalence}{4.3} +\newlabel{ex:RD-extended-reals}{11.2} +\newlabel{ex:RD-interval-arithmetic}{11.4} +\newlabel{ex:RD-lower-cuts}{11.3} +\newlabel{ex:RD-lt-vs-le}{11.5} +\newlabel{ex:reals-apart-neq-MP}{11.10} +\newlabel{ex:reals-apart-zero-divisors}{11.11} +\newlabel{ex:reals-non-constant-into-Z}{11.6} +\newlabel{ex:rezk-vankampen}{9.11} +\newlabel{ex:s2-colim-unit}{7.2} +\newlabel{ex:same-recurrence-not-defeq}{5.2} +\newlabel{ex:sigma-assoc}{2.10} +\newlabel{ex:stack}{9.12} +\newlabel{ex:subtFromPathInd}{1.15} +\newlabel{ex:sum-via-bool}{1.5} +\newlabel{ex:SuperHopf}{8.9} +\newlabel{ex:suspS1}{6.2} +\newlabel{ex:tautologies}{1.12} +\newlabel{ex:torus}{6.1} +\newlabel{ex:torus-s1-times-s1}{6.3} +\newlabel{ex:traditional-archimedean}{11.7} +\newlabel{ex:unique-fiber}{8.5} +\newlabel{ex:unnatural-endomorphisms}{6.9} +\newlabel{ex:unstable-octahedron}{4.4} +\newlabel{ex:vksuspnopt}{8.11} +\newlabel{ex:vksusppt}{8.10} +\newlabel{ex:well-pointed}{10.3} +\newlabel{ex:without-K}{1.14} +\newlabel{fibwise-fiber-total-fiber-equiv}{4.7.6} +\newlabel{fig:hub-and-spokes}{6.3} +\newlabel{fig:spokes-no-hub}{6.4} +\newlabel{fig:spokes-no-hub-ii}{6.5} +\newlabel{fig:topS1ind}{6.1} +\newlabel{fig:ttS1ind}{6.2} +\newlabel{fig:winding}{8.1} +\newlabel{inductive-cover-classical}{11.5.16} +\newlabel{interval-Heine-Borel}{11.5.15} +\newlabel{item:apfunctor-compose}{(iii)} +\newlabel{item:apfunctor-ct}{(i)} +\newlabel{item:apfunctor-opp}{(ii)} +\newlabel{item:autohtpy1}{(i)} +\newlabel{item:autohtpy2}{(ii)} +\newlabel{item:autohtpy3}{(iii)} +\newlabel{item:be1}{(i)} +\newlabel{item:be2}{(ii)} +\newlabel{item:be3}{(iii)} +\newlabel{item:beb1}{(i)} +\newlabel{item:beb2}{(ii)} +\newlabel{item:beb3}{(iii)} +\newlabel{item:cle-inj}{(i)} +\newlabel{item:cle-surj}{(ii)} +\newlabel{item:conntest1}{(i)} +\newlabel{item:conntest2}{(ii)} +\newlabel{item:conntest3}{(iii)} +\newlabel{item:contr-eqv-unit}{(iii)} +\newlabel{item:contr}{(i)} +\newlabel{item:contr-inhabited-prop}{(ii)} +\newlabel{item:conway1}{(i)} +\newlabel{item:conway2}{(ii)} +\newlabel{item:ct:ar1}{(i)} +\newlabel{item:ct:ar2}{(ii)} +\newlabel{item:ct:ffeso1}{(i)} +\newlabel{item:ct:ffeso2}{(ii)} +\newlabel{item:ct:ipc1}{(i)} +\newlabel{item:ct:ipc2}{(ii)} +\newlabel{item:ct:ipc3}{(iii)} +\newlabel{item:decode-encode-loop-iii}{(iii)} +\newlabel{item:decode-encode-loop-iv}{(iv)} +\newlabel{item:ed1}{(i)} +\newlabel{item:ed2}{(ii)} +\newlabel{item:ed3}{(iii)} +\newlabel{item:ed4}{(iv)} +\newlabel{item:eqvprop2}{(ii)} +\newlabel{item:eqvprop3}{(iii)} +\newlabel{item:eqvprop5}{(v)} +\newlabel{item:fibseq1}{(i)} +\newlabel{item:fibseq2}{(ii)} +\newlabel{item:fibseq3}{(iii)} +\newlabel{item:identity-systems1}{(i)} +\newlabel{item:identity-systems2}{(ii)} +\newlabel{item:identity-systems3}{(iii)} +\newlabel{item:identity-systems4}{(iv)} +\newlabel{item:mchr1}{(i)} +\newlabel{item:mchr2}{(ii)} +\newlabel{item:MLis1}{(i)} +\newlabel{item:MLis2}{(ii)} +\newlabel{item:MLis3}{(iii)} +\newlabel{item:MLis4}{(iv)} +\newlabel{item:MLis5}{(v)} +\newlabel{item:modal1}{(i)} +\newlabel{item:modal2}{(ii)} +\newlabel{item:modal3}{(iii)} +\newlabel{item:modal4}{(iv)} +\newlabel{item:mono1}{(i)} +\newlabel{item:mono2}{(iii)} +\newlabel{item:mono3}{(iv)} +\newlabel{item:mono4}{(ii)} +\newlabel{item:NO-le-refl}{(i)} +\newlabel{item:NO-lt-opt}{(ii)} +\newlabel{item:NO-rec-last}{(v)} +\newlabel{item:NO-rec-primary}{(i)} +\newlabel{item:omg1}{(i)} +\newlabel{item:omg4}{(iv)} +\newlabel{item:omitcontr1}{(i)} +\newlabel{item:omitcontr2}{(ii)} +\newlabel{item:orth-fact-2}{(ii)} +\newlabel{item:RCltopen1}{(i)} +\newlabel{item:RCltopen2}{(ii)} +\newlabel{item:rcrec3}{(iii)} +\newlabel{item:RC-sim-triangle}{11.3.35} +\newlabel{item:reg1}{(i)} +\newlabel{item:reg2}{(ii)} +\newlabel{item:reg3}{(iii)} +\newlabel{item:rel1}{(i)} +\newlabel{item:rel2}{(ii)} +\newlabel{item:rel3}{(iii)} +\newlabel{item:sesinj}{(i)} +\newlabel{item:sesiso}{(iii)} +\newlabel{item:sessurj}{(ii)} +\newlabel{item:sigcmp}{(iv)} +\newlabel{item:sigid}{(iii)} +\newlabel{item:sim1}{(i)} +\newlabel{item:sim2}{(ii)} +\newlabel{item:wh0}{(i)} +\newlabel{item:whitehead01}{(i)} +\newlabel{item:whitehead02}{(ii)} +\newlabel{item:whk}{(ii)} +\newlabel{item:wop1}{(i)} +\newlabel{item:wop2}{(ii)} +\newlabel{lem:ap-functor}{2.2.2} +\newlabel{lem:autohtpy}{4.1.2} +\newlabel{lem:BisimEqualsId}{10.5.5} +\newlabel{lem:coh-equiv}{4.2.2} +\newlabel{lem:coh-hfib}{4.2.11} +\newlabel{lem:coh-hprop}{4.2.12} +\newlabel{lem:concat}{2.1.2} +\newlabel{lem:connected-map-equiv-truncation}{7.5.14} +\newlabel{lem:cuts-preserve-admissibility}{11.2.15} +\newlabel{lem:equiv-iff-hprop}{3.3.3} +\newlabel{lem:fibration-over-pushout}{8.5.3} +\newlabel{lem:fullsep}{10.5.10} +\newlabel{lem:func_retract_to_fiber_retract}{4.7.3} +\newlabel{lem:hfib}{4.2.5} +\newlabel{lem:hfiber_wrt_pullback}{7.6.8} +\newlabel{lem:hlevel-if-inhab-hlevel}{7.2.8} +\newlabel{lem:homotopy-induction-times-3}{5.5.4} +\newlabel{lem:homotopy-props}{2.4.2} +\newlabel{lem:hopf-construction}{8.5.7} +\newlabel{lem:hspace-S1}{8.5.8} +\newlabel{lem:htpy-natural}{2.4.3} +\newlabel{lem:images_are_coequalizers}{10.1.5} +\newlabel{lem:inv-hprop}{4.2.9} +\newlabel{lem:map}{2.2.1} +\newlabel{lem:mapdep}{2.3.4} +\newlabel{lem:MonicSetPresent}{10.5.6} +\newlabel{lem:nconnected_postcomp}{7.5.6} +\newlabel{lem:nconnected_postcomp_variation}{7.5.12} +\newlabel{lem:nconnected_to_leveln_to_equiv}{7.5.10} +\newlabel{lem:normal-forms}{A.4.3} +\newlabel{lem:opp}{2.1.1} +\newlabel{lem:pb_of_coeq_is_coeq}{10.1.6} +\newlabel{lem:pik-nconnected}{8.3.2} +\newlabel{lem:qinv-autohtpy}{4.1.1} +\newlabel{lem:quotient-when-canonical-representatives}{6.10.8} +\newlabel{lem:s1-decode-encode}{8.1.7} +\newlabel{lem:s1-encode-decode}{8.1.8} +\newlabel{lem:sets_exact}{10.1.8} +\newlabel{lem:susp-loop-adj}{6.5.4} +\newlabel{lem:transport}{2.3.1} +\newlabel{lem:transport-s1-code}{8.1.2} +\newlabel{lem:truncation-le}{7.3.15} +\newlabel{lem:untruncated-linearity-reals-coincide}{11.4.1} +\newlabel{mult-from-square}{11.3.45} +\newlabel{notnotstable-equality-to-set}{7.2.3} +\newlabel{ordered-field}{11.2.7} +\newlabel{prop:factor_equiv_fiber}{7.6.5} +\newlabel{prop:kernels_are_effective}{10.1.9} +\newlabel{prop:lv_n_deptype_sec_equiv_by_precomp}{7.7.7} +\newlabel{prop:nat-is-set}{7.2.6} +\newlabel{prop:nconnected_tested_by_lv_n_dependent types}{7.5.7} +\newlabel{prop:nconn_fiber_to_total}{7.5.13} +\newlabel{prop:to_image_is_connected}{7.6.4} +\newlabel{prop:trunc_of_prop_is_set}{10.1.13} +\newlabel{RC-archimedean}{11.3.41} +\newlabel{RC-archimedean-ordered-field}{11.3.48} +\newlabel{RC-binary-nonexpanding-extension}{11.3.40} +\newlabel{RC-continuous-eq}{11.3.39} +\newlabel{RC-extend-Q-Lipschitz}{11.3.15} +\newlabel{RC-initial-Cauchy-complete}{11.3.50} +\newlabel{RC-lim-factor}{11.3.11} +\newlabel{RC-lim-onto}{11.3.10} +\newlabel{RC-Lipschitz-on-interval}{11.8} +\newlabel{RC-sim-eqv-le}{11.3.44} +\newlabel{RC-sim-rounded}{11.3.21} +\newlabel{RC-squaring}{11.3.46} +\newlabel{RD-archimedean}{11.2.6} +\newlabel{RD-archimedean-ordered-field}{11.2.8} +\newlabel{RD-cauchy-complete}{11.2.12} +\newlabel{RD-dedekind-complete}{11.2.16} +\newlabel{RD-final-field}{11.2.14} +\newlabel{RD-inverse-apart-0}{11.2.4} +\newlabel{reals-formal-topology-locally-compact}{11.5.14} +\newlabel{reflectcommutespushout}{7.4.12} +\newlabel{rmk:connectedness-indexing}{7.5.3} +\newlabel{rmk:defid}{6.2.1} +\newlabel{rmk:infty-group}{6.11.2} +\newlabel{rmk:introducing-new-concepts}{1.5.1} +\newlabel{rmk:naive}{8.7.3} +\newlabel{rmk:spokes-no-hub}{6.7.1} +\newlabel{rmk:true-neq-false}{2.12.6} +\newlabel{rmk:varies-along}{6.2.4} +\newlabel{S1-universal-cover}{8.1.1} +\newlabel{sec:adjunctions}{9.3} +\newlabel{sec:algebr-struct-cauchy}{11.3.3} +\newlabel{sec:algebr-struct-dedek}{11.2.1} +\newlabel{sec:appetizer-univalence}{5.2} +\newlabel{sec:axiom-choice}{3.8} +\newlabel{sec:axioms}{1.1} +\newlabel{sec:basics-equivalences}{2.4} +\newlabel{sec:basics-sets}{3.1} +\newlabel{sec:better-vankampen}{8.7.2} +\newlabel{sec:biinv}{4.3} +\newlabel{sec:bool-nat}{5.1} +\newlabel{sec:cardinals}{10.2} +\newlabel{sec:cats}{9.1} +\newlabel{sec:cauchy-reals}{11.3} +\newlabel{sec:cauchy-reals-cauchy-complete}{11.3.4} +\newlabel{sec:cell-complexes}{6.6} +\newlabel{sec:circle}{6.4} +\newlabel{sec:colimits}{6.8} +\newlabel{sec:compactness-interval}{11.5} +\newlabel{sec:comp-cauchy-dedek}{11.4} +\newlabel{sec:computational}{2.5} +\newlabel{sec:compute-cartprod}{2.6} +\newlabel{sec:compute-coprod}{2.12} +\newlabel{sec:compute-nat}{2.13} +\newlabel{sec:compute-paths}{2.11} +\newlabel{sec:compute-pi}{2.9} +\newlabel{sec:compute-sigma}{2.7} +\newlabel{sec:compute-unit}{2.8} +\newlabel{sec:compute-universe}{2.10} +\newlabel{sec:concluding-remarks}{4.5} +\newlabel{sec:connectivity}{7.5} +\newlabel{sec:conn-susp}{8.2} +\newlabel{sec:constr-cauchy-reals}{11.3.1} +\newlabel{sec:contractibility}{3.11} +\newlabel{sec:contrf}{4.4} +\newlabel{sec:coproduct-types}{1.7} +\newlabel{sec:cumulative-hierarchy}{10.5} +\newlabel{sec:dagger-categories}{9.7} +\newlabel{sec:dedekind-reals}{11.2} +\newlabel{sec:dependent-paths}{6.2} +\newlabel{sec:disequality}{1.12.3} +\newlabel{sec:equality}{2.1} +\newlabel{sec:equality-of-structures}{2.14} +\newlabel{sec:equivalences}{9.4} +\newlabel{sec:equiv-closures}{4.7} +\newlabel{sec:fiberwise-equivalences}{4.7} +\newlabel{sec:fib-over-pushout}{8.5.1} +\newlabel{sec:fibrations}{2.3} +\newlabel{sec:field-rati-numb}{11.1} +\newlabel{sec:finite-product-types}{1.5} +\newlabel{sec:flattening}{6.12} +\newlabel{sec:formal-prelim}{A} +\newlabel{sec:free-algebras}{6.11} +\newlabel{sec:freudenthal}{8.6} +\newlabel{sec:function-types}{1.2} +\newlabel{sec:functors}{2.2} +\newlabel{sec:general-encode-decode}{8.9} +\newlabel{sec:generalizations}{5.7} +\newlabel{sec:hae}{4.2} +\newlabel{sec:hedberg}{7.2} +\newlabel{sec:hittruncations}{6.9} +\newlabel{sec:hopf}{8.5} +\newlabel{sec:hott-features}{A.3} +\newlabel{sec:htpy-inductive}{5.5} +\newlabel{sec:hubs-spokes}{6.7} +\newlabel{sec:identity-systems}{5.8} +\newlabel{sec:identity-types}{1.12} +\newlabel{sec:image}{10.1.2} +\newlabel{sec:image-factorization}{7.6} +\newlabel{sec:inductive-types}{1.9} +\newlabel{sec:induct-recurs-cauchy}{11.3.2} +\newlabel{sec:initial-alg}{5.4} +\newlabel{sec:interval}{6.3} +\newlabel{sec:intro-hits}{6.1} +\newlabel{sec:intuitionism}{3.4} +\newlabel{sec:long-exact-sequence-homotopy-groups}{8.4} +\newlabel{sec:modalities}{7.7} +\newlabel{sec:mono-surj}{4.6} +\newlabel{sec:more-formal-pi}{A.2.4} +\newlabel{sec:more-formal-sigma}{A.2.5} +\newlabel{sec:moreresults}{8.10} +\newlabel{sec:naive-vankampen}{8.7.1} +\newlabel{sec:naturality}{6.13} +\newlabel{sec:n-types}{7.1} +\newlabel{sec:object-classification}{4.8} +\newlabel{sec:ordinals}{10.3} +\newlabel{sec:pat}{1.11} +\newlabel{sec:pattern-matching}{1.10} +\newlabel{sec:pi1s1-classical-proof}{8.1.2} +\newlabel{sec:pi1s1-idsys}{8.1.6} +\newlabel{sec:pi1s1-initial-thoughts}{8.1.1} +\newlabel{sec:pi1-s1-intro}{8.1} +\newlabel{sec:pi1s1-universal-cover}{8.1.3} +\newlabel{sec:pik-le-n}{8.3} +\newlabel{sec:pi-types}{1.4} +\newlabel{sec:piw-pretopos}{10.1} +\newlabel{sec:pushouts}{7.4} +\newlabel{sec:quasi-inverses}{4.1} +\newlabel{sec:RD-cauchy-complete}{11.2.2} +\newlabel{sec:RD-dedekind-complete}{11.2.3} +\newlabel{sec:rezk}{9.9} +\newlabel{sec:set-quotients}{6.10} +\newlabel{sec:sigma-types}{1.6} +\newlabel{sec:sip}{9.8} +\newlabel{sec:strict-categories}{9.6} +\newlabel{sec:strictly-positive}{5.6} +\newlabel{sec:surreals}{11.6} +\newlabel{sec:suspension}{6.5} +\newlabel{sec:syntax-informally}{A.1} +\newlabel{sec:syntax-more-formally}{A.2} +\newlabel{sec:transfors}{9.2} +\newlabel{sec:truncations}{7.3} +\newlabel{sec:type-booleans}{1.8} +\newlabel{sec:types-vs-sets}{1.1} +\newlabel{sec:unique-choice}{3.9} +\newlabel{sec:univalence-implies-funext}{4.9} +\newlabel{sec:universal-properties}{2.15} +\newlabel{sec:universes}{1.3} +\newlabel{sec:van-kampen}{8.7} +\newlabel{sec:wellorderings}{10.4} +\newlabel{sec:whitehead}{8.8} +\newlabel{sec:w-types}{5.3} +\newlabel{sec:yoneda}{9.5} +\newlabel{subsec:emacinsets}{10.1.5} +\newlabel{subsec:general-remarks}{A.4} +\newlabel{subsec:hprops}{3.3} +\newlabel{subsec:limits-sets}{10.1.1} +\newlabel{subsec:logic-hprop}{3.6} +\newlabel{subsec:pat?}{3.2} +\newlabel{subsec:pi1s1-encode-decode}{8.1.4} +\newlabel{subsec:pi1s1-homotopy-theory}{8.1.5} +\newlabel{subsec:piw}{10.1.4} +\newlabel{subsec:prop-subsets}{3.5} +\newlabel{subsec:prop-trunc}{3.7} +\newlabel{subsec:quotients}{10.1.3} +\newlabel{subsec:when-trunc}{3.10} +\newlabel{tab:homotopy-groups-of-spheres}{8.1} +\newlabel{tab:pov}{1} +\newlabel{tab:theorems}{8.2} +\newlabel{thm:1surj_to_surj_to_pem}{10.1.14} +\newlabel{thm:ac-epis-split}{3.8.2} +\newlabel{thm:allbool-trueorfalse}{1.8.1} +\newlabel{thm:ap2}{6.4.4} +\newlabel{thm:apd2}{6.4.6} +\newlabel{thm:apd-const}{2.3.8} +\newlabel{thm:ap-prod}{2.6.5} +\newlabel{thm:ap-sigma-rect-path-pair}{6.12.7} +\newlabel{thm:ap-transport}{2.3.11} +\newlabel{thm:Cauchy-reals-are-a-set}{11.3.9} +\newlabel{thm:conemap-funct}{7.4.10} +\newlabel{thm:connected-pointed}{7.5.11} +\newlabel{thm:conn-pik}{8.4.8} +\newlabel{thm:conn-trunc-variable-ind}{8.6.1} +\newlabel{thm:contr-contr}{3.11.5} +\newlabel{thm:contr-forall}{3.11.6} +\newlabel{thm:contr-hae}{4.2.6} +\newlabel{thm:contr-hprop}{4.4.4} +\newlabel{thm:contr-paths}{3.11.8} +\newlabel{thm:contr-unit}{3.11.3} +\newlabel{thm:conversion-preserves-typing}{A.4.1} +\newlabel{thm:covering-spaces}{8.10.4} +\newlabel{thm:dpath-arrow}{2.9.6} +\newlabel{thm:dpath-forall}{2.9.7} +\newlabel{thm:dpath-path}{2.11.5} +\newlabel{thm:EckmannHilton}{2.1.6} +\newlabel{thm:encode-total-equiv}{8.1.13} +\newlabel{thm:equiv-biinv-isequiv}{4.3.3} +\newlabel{thm:equiv-compose-equiv}{4.2.8} +\newlabel{thm:equiv-contr-hae}{4.4.5} +\newlabel{thm:equiv-eqrel}{2.4.12} +\newlabel{thm:equiv-induction}{5.8.5} +\newlabel{thm:equiv-inhabcod}{4.4.6} +\newlabel{thm:equiv-iso-adj}{4.2.3} +\newlabel{thm:eta-sigma}{2.7.3} +\newlabel{thm:ETCS}{10.1.15} +\newlabel{thm:fiber-of-a-fibration}{4.8.1} +\newlabel{thm:fiber-of-the-fiber}{8.4.4} +\newlabel{thm:flattening}{6.12.2} +\newlabel{thm:flattening-rect}{6.12.4} +\newlabel{thm:flattening-rectnd}{6.12.5} +\newlabel{thm:flattening-rectnd-beta-ppt}{6.12.8} +\newlabel{thm:freegroup-nonset}{6.11.8} +\newlabel{thm:free-monoid}{6.11.5} +\newlabel{thm:freudcode}{8.6.5} +\newlabel{thm:freudenthal}{8.6.4} +\newlabel{thm:freudlemma}{8.6.10} +\newlabel{thm:hae-hprop}{4.2.13} +\newlabel{thm:hedberg}{7.2.5} +\newlabel{thm:hlevel-cumulative}{7.1.7} +\newlabel{thm:hlevel-loops}{7.2.7} +\newlabel{thm:hleveln-of-hlevelSn}{7.1.11} +\newlabel{thm:hlevel-prod}{7.1.9} +\newlabel{thm:h-level-retracts}{7.1.4} +\newlabel{thm:homotopy-groups}{6.11.4} +\newlabel{thm:h-set-refrel-in-paths-sets}{7.2.2} +\newlabel{thm:h-set-uip-K}{7.2.1} +\newlabel{thm:htpy-induction}{5.8.6} +\newlabel{thm:identity-systems}{5.8.2} +\newlabel{thm:inhabprop-eqvunit}{3.3.2} +\newlabel{thm:injsurj}{10.2.9} +\newlabel{thm:interval-funext}{6.3.2} +\newlabel{thm:isaprop-isofhlevel}{7.1.10} +\newlabel{thm:isntype-mono}{7.1.6} +\newlabel{thm:isprop-biinv}{4.3.2} +\newlabel{thm:isprop-forall}{3.6.2} +\newlabel{thm:isprop-iscontr}{3.11.4} +\newlabel{thm:isprop-isprop}{3.3.5} +\newlabel{thm:isprop-isset}{3.3.5} +\newlabel{thm:isset-forall}{3.1.6} +\newlabel{thm:isset-is1type}{3.1.8} +\newlabel{thm:isset-prod}{3.1.5} +\newlabel{thm:kbar}{8.7.9} +\newlabel{thm:lequiv-contr-hae}{4.4.3} +\newlabel{thm:les}{8.4.6} +\newlabel{thm:loop-nontrivial}{6.4.1} +\newlabel{thm:looptothe}{6.10.13} +\newlabel{thm:minusoneconn-surjective}{7.5.2} +\newlabel{thm:ML-identity-systems}{5.8.4} +\newlabel{thm:modal-char}{7.7.4} +\newlabel{thm:modal-mono}{7.6.2} +\newlabel{thm:mono}{10.1.1} +\newlabel{thm:mono-surj-equiv}{4.6.3} +\newlabel{thm:naive-van-kampen}{8.7.4} +\newlabel{thm:nat-hinitial}{5.4.5} +\newlabel{thm:nat-set}{3.1.4} +\newlabel{thm:nat-uniq}{5.1.1} +\newlabel{thm:nat-wf}{10.3.5} +\newlabel{thm:nconn-to-ntype-const}{7.5.9} +\newlabel{thm:nobject-classifier-appetizer}{4.8.3} +\newlabel{thm:NO-encode-decode}{11.6.16} +\newlabel{thm:no-higher-ac}{3.8.5} +\newlabel{thm:NO-refl-opt}{11.6.4} +\newlabel{thm:NO-set}{11.6.5} +\newlabel{thm:NO-simplicity}{11.6.2} +\newlabel{thm:not-dneg}{3.2.2} +\newlabel{thm:not-lem}{3.2.7} +\newlabel{thm:NO-unstrict-transitive}{11.6.17} +\newlabel{thm:ntype-nloop}{7.2.9} +\newlabel{thm:ntypes-sigma}{7.1.8} +\newlabel{thm:object-classifier}{4.8.4} +\newlabel{thm:omg}{2.1.4} +\newlabel{thm:omit-contr}{3.11.9} +\newlabel{thm:ordord}{10.3.20} +\newlabel{thm:ordsucc}{10.3.21} +\newlabel{thm:ordunion}{10.3.22} +\newlabel{thm:orth-fact}{7.6.6} +\newlabel{thm:path-coprod}{2.12.5} +\newlabel{thm:path-lifting}{2.3.2} +\newlabel{thm:path-nat}{2.13.1} +\newlabel{thm:path-prod}{2.6.2} +\newlabel{thm:path-sigma}{2.7.2} +\newlabel{thm:paths-respects-equiv}{2.11.1} +\newlabel{thm:path-subset}{3.5.1} +\newlabel{thm:path-truncation}{7.3.12} +\newlabel{thm:path-unit}{2.8.1} +\newlabel{thm:pi1s1-decode}{8.1.6} +\newlabel{thm:pik-conn}{8.8.5} +\newlabel{thm:prod-ump}{2.15.2} +\newlabel{thm:prod-umpd}{2.15.5} +\newlabel{thm:prop-minusonetype}{3.11.10} +\newlabel{thm:prop-set}{3.3.4} +\newlabel{thm:pushout-ump}{6.8.2} +\newlabel{thm:quotient-surjective}{6.10.2} +\newlabel{thm:quotient-ump}{6.10.3} +\newlabel{thm:RC-le-grow}{11.3.42} +\newlabel{thm:RC-lt-open}{11.3.43} +\newlabel{thm:RC-sim-characterization}{11.3.32} +\newlabel{thm:RC-sim-lim}{11.3.36} +\newlabel{thm:RC-sim-lim-term}{11.3.37} +\newlabel{thm:RCsim-symmetric}{11.3.12} +\newlabel{thm:refl-over-ntype-base}{7.3.10} +\newlabel{thm:reflsubunv-forall}{7.7.2} +\newlabel{thm:retract-contr}{3.11.7} +\newlabel{thm:retract-equiv}{4.7.4} +\newlabel{thm:retraction-quotient}{6.10.10} +\newlabel{thm:S1-autohtpy}{6.4.2} +\newlabel{thm:S1rec}{6.2.5} +\newlabel{thm:S1ump}{6.2.9} +\newlabel{thm:ses}{8.4.7} +\newlabel{thm:set-pushout}{6.9.3} +\newlabel{thm:set_regular}{10.1.5} +\newlabel{thm:settopos}{10.1.12} +\newlabel{thm:sign-induction}{6.10.12} +\newlabel{thm:sip}{9.8.2} +\newlabel{thm:stable-images}{7.6.9} +\newlabel{thm:strong-normalization}{A.4.2} +\newlabel{thm:suspbool}{6.5.1} +\newlabel{thm:suspension-increases-connectedness}{8.2.1} +\newlabel{thm:total-fiber-equiv}{4.7.7} +\newlabel{thm:total-space-of-the-fibers}{4.8.2} +\newlabel{thm:transport2}{6.4.5} +\newlabel{thm:transport-compose}{2.3.10} +\newlabel{thm:transport-concat}{2.3.9} +\newlabel{thm:transportequiv}{2.4.9} +\newlabel{thm:transport-is-ap}{2.10.5} +\newlabel{thm:transport-is-given}{6.12.1} +\newlabel{thm:transport-path}{2.11.3} +\newlabel{thm:transport-path2}{2.11.4} +\newlabel{thm:trans-prod}{2.6.4} +\newlabel{thm:trans-trivial}{2.3.5} +\newlabel{thm:trunc0-ind}{6.9.1} +\newlabel{thm:trunc0-lump}{6.9.2} +\newlabel{thm:trunc-htpy}{7.3.5} +\newlabel{thm:trunc-in-truncated-sigma}{7.3.9} +\newlabel{thm:truncn-ind}{7.3.2} +\newlabel{thm:trunc-reflective}{7.3.3} +\newlabel{thm:ttac}{2.15.7} +\newlabel{thm:two-out-of-three}{4.7.1} +\newlabel{thm:type-is-not-a-set}{3.1.9} +\newlabel{thm:van-Kampen}{8.7.12} +\newlabel{thm:VisCST}{10.5.8} +\newlabel{thm:wedge-connectivity}{8.6.2} +\newlabel{thm:wellorder}{10.4.3} +\newlabel{thm:wfcat}{10.3.15} +\newlabel{thm:wfmin}{10.3.8} +\newlabel{thm:wfrec}{10.3.7} +\newlabel{thm:w-hinit}{5.4.7} +\newlabel{thm:whitehead0}{8.8.1} +\newlabel{thm:whitehead1}{8.8.2} +\newlabel{thm:whitehead-contr}{8.8.4} +\newlabel{thm:whiteheadn}{8.8.3} +\newlabel{thm:wop}{10.4.4} +\newlabel{thm:wtype-wf}{10.3.6} +\newlabel{thm:w-uniq}{5.3.1} +\newlabel{thm:zfc}{10.5.11} +\newlabel{transport-Sigma}{2.7.4} +\newlabel{UA-eqv-hom-eqv}{4.9.2} +\newlabel{uatowfe}{4.9.4} +\newlabel{weakfunext}{4.9.1} +\newlabel{wfetofe}{4.9.5} +\newlabel{when-reals-coincide}{11.4.3} +\newlabel{Z-quotient-by-canonical-representatives}{6.10.11} diff --git a/main.tex b/main.tex new file mode 100644 index 0000000000000000000000000000000000000000..dfb6b459c1f2a9ed965ce3f8aef590636648e89b --- /dev/null +++ b/main.tex @@ -0,0 +1,335 @@ +% THIS IS NOT THE FILE YOU SHOULD PROCESS. IT IS THE "MAIN" FILE, +% BUT IT GETS INCLUDED BY ONE OF THE hott-xxx.tex FILES. THOSE ARE +% THE MAIN ONES. + +% DOCUMENT CLASS +\documentclass[\OPTfontsize]{book} + +\PassOptionsToPackage{table}{xcolor} + +\usepackage{etex} % We're running out of registers and dimensions, or some such + +% PAGE GEOMETRY +\usepackage[papersize={\OPTpagesize}, + twoside, + includehead, + top=\OPTtopmargin, + bottom=\OPTbottommargin, + inner=\OPTinnermargin, + outer=\OPToutermargin, + bindingoffset=\OPTbindingoffset]{geometry} + +% HYPERLINKING AND PDF METADATA +\usepackage[backref=page, + colorlinks, + citecolor=linkcolor, + linkcolor=linkcolor, + urlcolor=linkcolor, + unicode, + pdfauthor={Univalent Foundations Program}, + pdftitle={Homotopy Type Theory: Univalent Foundations of Mathematics}, + pdfsubject={Mathematics}, + pdfkeywords={type theory, homotopy theory, univalence axiom}]{hyperref} +\renewcommand{\backref}[1]{} +\renewcommand{\backrefalt}[4]{% + \ifcase #1 % + (No citations.) + \or + (Cited on page\ #2.) + \else + (Cited on pages\ #2.) + \fi} + +% OTHER PACKAGES + +% Use this package and stick \layout somewhere in the text to see +% page margins, text size and width etc. Useful for debugging page format. +\usepackage{layout} + +%%% Because Germans have umlauts and Slavs have even stranger ways of mangling letters +\usepackage[utf8]{inputenc} + +%%% For table {tab:theorems} +\usepackage{pifont} + +%%% Multi-Columns for long lists of names +\usepackage{multicol} + +%%% Set the fonts +\usepackage{mathpazo} +\usepackage[scaled=0.95]{helvet} +\usepackage{courier} +\linespread{1.05} % Palatino looks better with this + +\usepackage{ifpdf} + +\usepackage{graphicx} +\DeclareGraphicsExtensions{.png} +\input{bmpsize-hack} % for bounding boxes in dvi mode +\usepackage{comment} + +\usepackage{fancyhdr} % To set headers and footers + +\usepackage{nextpage} % So we can jump to odd-numbered pages + +\usepackage{amssymb,amsmath,amsthm,stmaryrd,mathrsfs,wasysym} +\usepackage{enumitem,mathtools,xspace} +\usepackage{xstring} % For generating singluars and plurals in \backref + +\usepackage{xcolor} % For colored cells in tables we need \cellcolor +\usepackage{wallpaper} % For the background image on the cover page + +\usepackage{booktabs} % For nice tables +\usepackage{array} % For nice tables + +\definecolor{linkcolor}{rgb}{\OPTlinkcolor} +\usepackage{aliascnt} +\usepackage[capitalize]{cleveref} +\usepackage[all,2cell,cmtip]{xy} +\UseAllTwocells +\usepackage{braket} % used for \setof{ ... } macro + +\usepackage{tikz} +\usetikzlibrary{decorations.pathmorphing,arrows} + +\usepackage{etoolbox} % hacking commands for TOC + +\usepackage{mathpartir} % for formal.tex appendix, section 3 + +\usepackage[numbered]{bookmark} % add chapter/section numbers to the toc in the pdf metadata + +\input{macros} + +%%%% Indexing +\usepackage{makeidx} +\makeindex + +%%%% Header and footers +\pagestyle{fancyplain} +\setlength{\headheight}{15pt} +\renewcommand{\chaptermark}[1]{\markboth{\textsc{Chapter \thechapter. #1}}{}} +\renewcommand{\sectionmark}[1]{\markright{\textsc{\thesection\ #1}}} + +\lhead[\fancyplain{}{{\thepage}}]% + {\fancyplain{}{\nouppercase{\rightmark}}} +\rhead[\fancyplain{}{\nouppercase{\leftmark}}]% + {\fancyplain{}{\thepage}} +\cfoot[]{} +\lfoot[]{} +\rfoot[]{} + +%%%% Chapter & part style +\usepackage[raggedright]{titlesec} +\titleformat{\part}[display]{\fontsize{\OPTpartfont}{\OPTpartfont}\fontseries{m}\fontshape{sc}\selectfont}{\hfil\partname\ \Roman{part}}{\OPTpartskip}{\fontsize{\OPTparttitlefont}{\OPTparttitlefont}\fontseries{b}\fontshape{sc}\selectfont\hfil} +\titleformat{\chapter}[display]{\fontsize{\OPTchapterfont}{\OPTchapterfont}\fontseries{m}\fontshape{it}\selectfont}{\chaptertitlename\ \thechapter}{\OPTchapterskip}{\fontsize{\OPTchaptertitlefont}{\OPTchaptertitlefont}\fontseries{b}\fontshape{n}\selectfont} + +% Patch bug in titlesec 2.10.1 +\makeatletter +\@ifpackagelater{titlesec}{2016/03/21}{% + % Package titlesec is on version 2.10.2 or higher, nothing to do +}{\@ifpackagelater{titlesec}{2016/03/15}{% + % Package titlesec on version 2.10.1, patch accordingly + \usepackage{etoolbox}% + \patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}{}{}% + \patchcmd{\ttlh@hang}{\noindent}{}{}{}% + }{% Package titlesec is on version 2.10.0 or lower, nothing to do % +}} +\makeatother + +% To avoid compiling stuff other than what you're working on right +% now, uncomment the following command and give your file as its +% argument. +%\includeonly{} + +% For some reason \pagecolor overlays the cover image, +% unless we use it once before the document starts. +\definecolor{covercolor}{cmyk}{\OPTcovercolor} +\definecolor{covertext}{cmyk}{\OPTcovertextcolor} +\pagecolor{white} +\ifpdf +\nopagecolor +\fi + +% Make a new page for each exercise, if the option is set +\ifdef{\OPTexerciseperpage} + { + \BeforeBeginEnvironment{ex}{\newpage} + }{} + +\begin{document} + +% NB: This does not actually appear anywhere because we have +% a custom title page. +\title{Homotopy Type Theory: Univalent Foundations of Mathematics} +\author{The Univalent Foundations Program} + + +\frontmatter % Turn on arabic page numbers and unnumbered chapters + +% Half-title, title, copyright page do not have displayed page numbers +\pagestyle{empty} + +\include{front} %%% Title page and copyright + +\cleartooddpage + +% Add Preface to PDF Metadata but not printed TOC +\hypertarget{preface}{} +\bookmark[dest=preface]{Preface} + +% Preface and TOC have arabic numbers +\pagestyle{fancyplain} + +\include{preface} + +\cleartooddpage[\thispagestyle{empty}] + +% Add TOC to PDF Metadata but not printed TOC +\hypertarget{toc}{} +\bookmark[dest=toc]{Table of Contents} + +\setcounter{tocdepth}{1} % chapters and sections for the toc +\tableofcontents +\setcounter{tocdepth}{2} % chapters, sections, and subsections for the + % metadata of the pdf +\cleartooddpage[\thispagestyle{empty}] + +\mainmatter % Turn on roman page numbers and numbered chapters + +% Turn on headers and footers for mainmatter (must appear after \cleartooddpage) +\pagestyle{fancyplain} + +\include{introduction} + +\part{Foundations} +\label{part:foundations} + +\include{preliminaries} + +\include{basics} + +\include{logic} + +\include{equivalences} + +\include{induction} + +\include{hits} + +\include{hlevels} + +\cleartooddpage[\thispagestyle{empty}] % Needed for correct TOC +\part{Mathematics} +\label{part:mathematics} + +\include{homotopy} + +\include{categories} + +\include{setmath} + +\include{reals} + +%%%% Appendix + +\cleartooddpage[\thispagestyle{empty}] % Needed for correct TOC +\phantomsection % Needed for correct TOC also +\part*{Appendix} + +% We use magic to get the appendix look like Bibliography and Index + +\appendix + +\renewcommand{\chaptermark}[1]{\markboth{\textsc{Appendix. \thechapter. #1}}{}} +\renewcommand{\sectionmark}[1]{\markright{\textsc{\thesection\ #1}}} + +\include{formal} + +% Joke +\nocite{Angiuli13} +\nocite{BauerAcceptanceVideo} + +%%%% Bibliography +\bibliographystyle{halpha} +\phantomsection % black magic to get TOC to point to correct page +\addcontentsline{toc}{part}{\bibname} +\markboth{}{\textsc{Bibliography}} +{\renewcommand{\markboth}[2]{} % Prevent bibliography from resetting the header to something silly +\OPTbibliographyfont +\bibliography{references}} + +\cleartooddpage[\thispagestyle{empty}] + +%%%% Index of symbols + +\include{symbols} + +\cleartooddpage[\thispagestyle{empty}] + +%%%%% Index of terms + +%% Global cross-references for index +\indexsee{principle}{axiom} +\indexsee{number!real}{real numbers} +\indexsee{abelian group}{group, abelian} +\indexsee{sequence!Cauchy}{Cauchy sequence} +\indexsee{adjunction}{adjoint functor} +\indexsee{higher topos}{$(\infty,1)$-topos} +\indexsee{topos!higher}{$(\infty,1)$-topos} +\indexsee{source!of a function}{domain} +\indexsee{target!of a function}{codomain} +\indexsee{type!truncation of}{truncation} +\indexsee{propositional!truncation}{truncation} +\indexsee{proof-relevant mathematics}{mathematics, proof-relevant} +\indexsee{classical!mathematics}{mathematics, classical} +\indexsee{classical!logic}{logic} +\indexsee{constructive!mathematics}{mathematics, constructive} +\indexsee{constructive!logic}{logic} +\indexsee{intuitionistic logic}{logic} +\indexsee{definition!inductive}{type, inductive} +\indexsee{inductive!definition}{type, inductive} +\indexsee{bounded!totally}{totally bounded} +\indexsee{sum!of numbers}{addition} +\indexsee{continuous map}{function, continuous} +\indexsee{function!continuity of@``continuity'' of}{``continuity''} +\indexsee{function!functoriality of@``functoriality'' of}{``functoriality''} +\indexsee{codes}{encode-decode method} +\indexsee{inequality}{order} +\indexsee{Coq@\Coq}{proof assistant} +\indexsee{Agda@\Agda}{proof assistant} +\indexsee{NuPRL@\NuPRL}{proof assistant} +\indexsee{generator!of an inductive type}{constructor} +\indexsee{groupoid!.infinity-@$\infty$-}{$\infty$-groupoid} +\indexsee{higher groupoid}{$\infty$-groupoid} +\indexsee{hierarchy!of n-types@of $n$-types}{$n$-type} +\indexsee{homotopy!n-type@$n$-type}{$n$-type} +\indexsee{homotopy!theory, classical}{classical homotopy theory} +\indexsee{homotopy!fiber}{fiber} +\indexsee{homotopy!limit}{limit of types} +\indexsee{homotopy!colimit}{colimit of types} +\indexsee{implementation}{proof assistant} +\indexsee{notation, abuse of}{abuse of notation} +\indexsee{language, abuse of}{abuse of language} +\indexsee{operator!induction}{induction principle} +\indexsee{operator!modal}{modality} +\indexsee{commutative!group}{group, abelian} +\indexsee{countable axiom of choice}{axiom of choice, countable} + +% tell the index to get itself into the table of contents +\phantomsection % black magic to get TOC to point to correct page +\addcontentsline{toc}{part}{Index} +\markboth{}{\textsc{Index}} +\renewcommand{\markboth}[2]{} +{\OPTindexfont +\setlength{\columnsep}{\OPTindexcolumnsep} +\printindex} + +% The back cover +\include{back} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "hott-online" +%%% End: diff --git a/mark-errata b/mark-errata new file mode 100644 index 0000000000000000000000000000000000000000..61db43c8755dfb76a550aeb398624794c3cae9e4 --- /dev/null +++ b/mark-errata @@ -0,0 +1,7 @@ +#!/bin/bash + +for COMMIT in $( git blame errata.tex | grep -o '% merge of.\+' | grep -o '[^ ]\+$' ); do + MERGE=$(git log "$COMMIT..master" --ancestry-path --merges --oneline -- | grep -o '^[^ ]\+' | xargs git describe | sed s'/first-edition-//g' | tail -n 1) + echo "Marking $COMMIT as $MERGE" + sed -i "s/% merge of $COMMIT/$MERGE/g" errata.tex +done diff --git a/opt-a4.tex b/opt-a4.tex new file mode 100644 index 0000000000000000000000000000000000000000..823bd2079c2d6d4383eae3bd78c4c22d20becb5e --- /dev/null +++ b/opt-a4.tex @@ -0,0 +1,99 @@ +%%% FORMATTING OPTIONS FOR A4 SIZE +%%% This file gets included by the hott-xxx.tex files. + +% MACROS FOR FINE TUNING +\newcommand{\narrowbreak}{} +\newcommand{\narrowamp}{} +\newcommand{\narrowequation}[1]{$#1$} +\newenvironment{narrowmultline}{\csname equation\endcsname}{\csname endequation\endcsname} +\newenvironment{narrowmultline*}{\csname equation*\endcsname}{\csname endequation*\endcsname} + +% FONTS +\def\OPTfontsize{11pt} % Font size + +% PAGE FORMAT +% +% These settings are for A4 format +\def\OPTpagesize{210mm,297mm} % Page size +\def\OPTtopmargin{1in} % Margin at the top of the page +\def\OPTbottommargin{1in} % Margin at the bottom of the page +\def\OPTbindingoffset{0.35in} % Extra offset on the inner side + +% Tweak the margins so the textwidth is the same as in the letter version +% +% The letter margins are: +% +% \def\OPTinnermargin{0.75in} % Margin on the inner side of the page +% \def\OPToutermargin{1.0in} % Margin on the outer side of the page +% +% and half the difference between 8.5in and 210mm is 2.95mm + +\newskip\innermarginskip +\innermarginskip=0.75in +\advance\innermarginskip by -2.95mm +\edef\OPTinnermargin{\the\innermarginskip} + +\newskip\outermarginskip +\outermarginskip=1.0in +\advance\outermarginskip by -2.95mm +\edef\OPToutermargin{\the\outermarginskip} + +% FORMATTING OF COVER PAGE +\def\OPTcoverwidth{8.45in} % width of text on cover page +\def\OPTcoverheight{10.95in} % height of text on cover page +\def\OPTtopskip{43pt} % Skip at top of cover and back page (with units) +\def\OPTbotskip{43pt} % Skip at bottom of cover and back page (with units) +\def\OPTcovertitlefont{74.5} % Size of title font (no unit, pt assumed) +\def\OPTcovertitleskip{24pt} % Skip between title and subtitle (with units) +\def\OPTcoversubtitlefont{27} % Size of subtitle font (no unit, pt assumed) +\def\OPTcoverauthorfont{22} % Size of author font (no unit, pt assumed) +\def\OPTcoverauthorskip{8pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF BACK COVER PAGE +\def\OPTbacktitlefont{\LARGE} % Size of "From the introduction" and "Get this book ..." +\def\OPTbackfont{\large} % Size of text font + +% FORMATTING OF BASTARD TITLE, IF PRESENT +% (see opt-no-bastard.tex and opt-bastard.tex) +\def\OPTbastardtitlefont{22} +\def\OPTbastardsubtitlefont{15} +\def\OPTbastardwidth{0.40\textwidth} % Width of bastard title +\def\OPTbastardtitleskip{8pt} + +% FORMATTING OF TITLE PAGE +\def\OPTtitletitlefont{37} % Size of title font (no unit, pt assumed) +\def\OPTtitletitleskip{10pt} % Skip between title and subtitle (with units) +\def\OPTtitlesubtitlefont{25} % Size of subtitle font (no unit, pt assumed) +\def\OPTtitlewidth{0.65\textwidth} % Width of title +\def\OPTtitleskip{30pt} % Skip between title and author (with units) +\def\OPTtitleauthorfont{18} % Size of author font (no unit, pt assumed) +\def\OPTtitleauthorskip{6pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF PART PAGE +\def\OPTpartfont{40} % Size of "Part X" (without unit, pt assumed) +\def\OPTpartskip{20pt} % Skip between Part and title (with unit) +\def\OPTparttitlefont{60} % Size of part title (without unit, pt assumed) + +% FORMATTING OF CHAPTER TITLE +\def\OPTchapterfont{23} % Size of "Chapter X" +\def\OPTchapterskip{20pt} % Skip between Chapter and title +\def\OPTchaptertitlefont{35} % Size of chapter title + +% FORMATTING OF PREFACE +\def\OPTprefacecols{3} % Number of columns when listing people in Preface + +% GETTING RID OF THE WIDOW ON PAGE 2 IN LETTER FORMAT +\def\OPTwidow{\enlargethispage{\baselineskip}} + +% FORMATTING OF TABLE 1 IN INTRODUCTION +\def\OPTsmalltable{} + +% FORMATTING OF TABLE 8.1 OF HOMOTOPY GROUPS OF SPHERES +\newcommand{\OPTspherescolwidth}{30pt} + +% FORMATTING THE BIBLIOGRAPHY +\newcommand{\OPTbibliographyfont}{\small} + +% FORMATTING OF INDEX +\newcommand{\OPTindexfont}{\small} % size of font in the index +\newcommand{\OPTindexcolumnsep}{20.0pt} % column separation in index (default is 10.0pt) diff --git a/opt-bastard.tex b/opt-bastard.tex new file mode 100644 index 0000000000000000000000000000000000000000..23d5facff3b24f3b27a09bb466a710c51acb2548 --- /dev/null +++ b/opt-bastard.tex @@ -0,0 +1,3 @@ +% Include a bastard title +\newif\ifOPTbastard +\OPTbastardtrue diff --git a/opt-black-white.tex b/opt-black-white.tex new file mode 100644 index 0000000000000000000000000000000000000000..5411f96e015533df26991c04581545c7cde3c087 --- /dev/null +++ b/opt-black-white.tex @@ -0,0 +1,35 @@ +% Options for black & white book + +% BACKGROUND OF COVER PAGE +\def\OPTcovercolor{0,0,0,0} +\def\OPTcovertextcolor{0,0,0,1} + +% COVER IMAGE +\def\OPTlofrontimage{cover-lores-front-bw} +\def\OPTlobackimage{cover-lores-back-bw} +\def\OPThifrontimage{cover-hires-front-bw} +\def\OPThibackimage{cover-hires-back-bw} + +% LINK COLORS +\def\OPTlinkcolor{0,0,0} % RGB components for clickable links + +% PICTURE COLORS +\def\OPTblue{black} +\def\OPTred{black} +\def\OPTpurple{black} + +% COLORS FOR TABLE 8.1 +\def\OPTcolormodel{gray} +\def\OPTcolxA{0.95} +\def\OPTcolxB{0.75} +\def\OPTcolxC{0.85} +\def\OPTcolxD{0.95} +\def\OPTcolxE{0.75} +\def\OPTcolxF{0.85} +\def\OPTcolxG{0.95} +\def\OPTcolxH{0.75} +\def\OPTcolxI{0.85} +\def\OPTcolxJ{0.95} +\def\OPTcolxK{0.75} +\def\OPTcolxL{0.85} +\def\OPTcolxM{0.95} diff --git a/opt-color.tex b/opt-color.tex new file mode 100644 index 0000000000000000000000000000000000000000..569c56e6c1e3a17f91ec2efd3cd5383430ac43bf --- /dev/null +++ b/opt-color.tex @@ -0,0 +1,35 @@ +% Options for color book + +% BACKGROUND OF COVER PAGE +\def\OPTcovercolor{0.375,0,0,0.625} % CMYK +\def\OPTcovertextcolor{0,0,0,0.125} + +% COVER IMAGE +\def\OPTlofrontimage{cover-lores-front} +\def\OPTlobackimage{cover-lores-back} +\def\OPThifrontimage{cover-hires-front} +\def\OPThibackimage{cover-hires-back} + +% LINK COLORS +\def\OPTlinkcolor{0,0.45,0} % RGB components for clickable links + +% PICTURE COLORS +\def\OPTblue{blue} +\def\OPTred{red} +\def\OPTpurple{purple} + +% COLORS FOR TABLE 8.1 +\def\OPTcolormodel{rgb} +\def\OPTcolxA{1., 0.85, 0.85} +\def\OPTcolxB{1., 0.988462, 0.85} +\def\OPTcolxC{0.873077, 1., 0.85} +\def\OPTcolxD{0.85, 1., 0.965385} +\def\OPTcolxE{0.85, 0.896154, 1.} +\def\OPTcolxF{0.942308, 0.85, 1.} +\def\OPTcolxG{1., 0.85, 0.919231} +\def\OPTcolxH{1., 0.919231, 0.85} +\def\OPTcolxI{0.942308, 1., 0.85} +\def\OPTcolxJ{0.85, 1., 0.896154} +\def\OPTcolxK{0.85, 0.965385, 1.} +\def\OPTcolxL{0.873077, 0.85, 1.} +\def\OPTcolxM{1., 0.85, 0.988462} diff --git a/opt-cover.tex b/opt-cover.tex new file mode 100644 index 0000000000000000000000000000000000000000..e72a629cc89e945d92f16f2eb0ad2727a8140fcf --- /dev/null +++ b/opt-cover.tex @@ -0,0 +1,3 @@ +% Include cover +\newif\ifOPTcover +\OPTcovertrue diff --git a/opt-ebook-narrow.tex b/opt-ebook-narrow.tex new file mode 100644 index 0000000000000000000000000000000000000000..adbaf069914d45a3c4f62eb641e6bf953d9dd278 --- /dev/null +++ b/opt-ebook-narrow.tex @@ -0,0 +1,84 @@ +%%% FORMATTING OPTIONS FOR EBOOK SIZE. +%%% This file gets included by the hott-xxx.tex files. + +% MACROS FOR FINE TUNING +\newcommand{\narrowbreak}{\\} +\newcommand{\narrowamp}{&} +\newcommand{\narrowequation}[1]{\begin{equation*}#1\end{equation*}} +\newenvironment{narrowmultline*}{\csname multline*\endcsname}{\csname endmultline*\endcsname} +\newenvironment{narrowmultline}{\csname multline\endcsname}{\csname endmultline\endcsname} + +% FONTS +\def\OPTfontsize{10pt} % Font size +\delimiterfactor=800 + +% PAGE FORMAT +% +% These settings are for letter format +\def\OPTpagesize{4.8in,8.5in} % Page size +\def\OPTtopmargin{0.2in} % Margin at the top of the page +\def\OPTbottommargin{0.2in} % Margin at the bottom of the page +\def\OPTinnermargin{0.2in} % Margin on the inner side of the page +\def\OPTbindingoffset{0.0in} % Extra offset on the inner side +\def\OPToutermargin{0.2in} % Margin on the outer side of the page + +% FORMATTING OF COVER PAGE +\def\OPTcoverwidth{4.75in} % width of text on cover page +\def\OPTcoverheight{8.45in} % height of text on cover page +\def\OPTtopskip{35pt} % Skip at top of cover and back page (with units) +\def\OPTbotskip{35pt} % Skip at bottom of cover and back page (with units) +\def\OPTcovertitlefont{48} % Size of title font (no unit, pt assumed) +\def\OPTcoverspinefont{22} % Size of title font on the book spine (no unit, pt assumed) +\def\OPTcovertitleskip{18pt} % Skip between title and subtitle (with units) +\def\OPTcoversubtitlefont{18} % Size of subtitle font (no unit, pt assumed) +\def\OPTcoverauthorfont{14} % Size of author font (no unit, pt assumed) +\def\OPTcoverauthorskip{6pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF BACK COVER PAGE +\def\OPTbacktitlefont{\large} % Size of "From the introduction" and "Get this book ..." +\def\OPTbackfont{\small} % Size of text font + +% FORMATTING OF BASTARD TITLE, IF PRESENT +% (see opt-no-bastard.tex and opt-bastard.tex) +\def\OPTbastardtitlefont{17} +\def\OPTbastardsubtitlefont{11} +\def\OPTbastardwidth{0.42\textwidth} % Width of bastard title +\def\OPTbastardtitleskip{6pt} + +% FORMATTING OF TITLE PAGE +\def\OPTtitletitlefont{22} % Size of title font (no unit, pt assumed) +\def\OPTtitletitleskip{7pt} % Skip between title and subtitle (with units) +\def\OPTtitlesubtitlefont{15} % Size of subtitle font (no unit, pt assumed) +\def\OPTtitlewidth{0.65\textwidth} % Width of title +\def\OPTtitleskip{21pt} % Skip between title and author (with units) +\def\OPTtitleauthorfont{13} % Size of author font (no unit, pt assumed) +\def\OPTtitleauthorskip{4pt} % Skip betewen first and second line of author (with units) + +% PART FONTS +\def\OPTpartfont{28} % Size of "Part X" (without unit, pt assumed) +\def\OPTpartskip{14pt} % Skip between Part and title (with unit) +\def\OPTparttitlefont{42} % Size of part title (without unit, pt assumed) + +% FORMATTING OF CHAPTER TITLE +\def\OPTchapterfont{20} % Size of "Chapter X" (without unit, pt assumed) +\def\OPTchapterskip{14pt} % Skip between Chapter and title (with unit) +\def\OPTchaptertitlefont{24} % Size of chapter title (without unit, pt assumed) + +% FORMATTING OF PREFACE +\def\OPTprefacecols{2} % Number of columns when listing people in Preface + +% GETTING RID OF THE WIDOW ON PAGE 2 IN LETTER FORMAT +\def\OPTwidow{} + +% FORMATTING OF TABLE 1 IN INTRODUCTION +\def\OPTsmalltable{\small} + +% FORMATTING OF TABLE 8.1 OF HOMOTOPY GROUPS OF SPHERES +\newcommand{\OPTspherescolwidth}{20pt} + +% FORMATTING THE BIBLIOGRAPHY +\newcommand{\OPTbibliographyfont}{\small} + +% FORMATTING OF INDEX +\newcommand{\OPTindexfont}{\footnotesize} % size of font in the index +\newcommand{\OPTindexcolumnsep}{15.0pt} % column separation in index (default is 10.0pt) diff --git a/opt-ebook-wide.tex b/opt-ebook-wide.tex new file mode 100644 index 0000000000000000000000000000000000000000..ddfa77ed36c7c096971b1a82726952af92550f69 --- /dev/null +++ b/opt-ebook-wide.tex @@ -0,0 +1,84 @@ +%%% FORMATTING OPTIONS FOR EBOOK SIZE. +%%% This file gets included by the hott-xxx.tex files. + +% MACROS FOR FINE TUNING +\newcommand{\narrowbreak}{\\} +\newcommand{\narrowamp}{&} +\newcommand{\narrowequation}[1]{\begin{equation*}#1\end{equation*}} +\newenvironment{narrowmultline*}{\csname multline*\endcsname}{\csname endmultline*\endcsname} +\newenvironment{narrowmultline}{\csname multline\endcsname}{\csname endmultline\endcsname} + +% FONTS +\def\OPTfontsize{10pt} % Font size +\delimiterfactor=800 + +% PAGE FORMAT +% +% These settings are for letter format +\def\OPTpagesize{4.8in,6.3in} % Page size +\def\OPTtopmargin{0.2in} % Margin at the top of the page +\def\OPTbottommargin{0.2in} % Margin at the bottom of the page +\def\OPTinnermargin{0.2in} % Margin on the inner side of the page +\def\OPTbindingoffset{0.0in} % Extra offset on the inner side +\def\OPToutermargin{0.2in} % Margin on the outer side of the page + +% FORMATTING OF COVER PAGE +\def\OPTcoverwidth{4.75in} % width of text on cover page +\def\OPTcoverheight{6.25in} % height of text on cover page +\def\OPTtopskip{35pt} % Skip at top of cover and back page (with units) +\def\OPTbotskip{35pt} % Skip at bottom of cover and back page (with units) +\def\OPTcovertitlefont{48} % Size of title font (no unit, pt assumed) +\def\OPTcoverspinefont{22} % Size of title font on the book spine (no unit, pt assumed) +\def\OPTcovertitleskip{18pt} % Skip between title and subtitle (with units) +\def\OPTcoversubtitlefont{18} % Size of subtitle font (no unit, pt assumed) +\def\OPTcoverauthorfont{14} % Size of author font (no unit, pt assumed) +\def\OPTcoverauthorskip{6pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF BACK COVER PAGE +\def\OPTbacktitlefont{\large} % Size of "From the introduction" and "Get this book ..." +\def\OPTbackfont{\small} % Size of text font + +% FORMATTING OF BASTARD TITLE, IF PRESENT +% (see opt-no-bastard.tex and opt-bastard.tex) +\def\OPTbastardtitlefont{17} +\def\OPTbastardsubtitlefont{11} +\def\OPTbastardwidth{0.42\textwidth} % Width of bastard title +\def\OPTbastardtitleskip{6pt} + +% FORMATTING OF TITLE PAGE +\def\OPTtitletitlefont{22} % Size of title font (no unit, pt assumed) +\def\OPTtitletitleskip{7pt} % Skip between title and subtitle (with units) +\def\OPTtitlesubtitlefont{15} % Size of subtitle font (no unit, pt assumed) +\def\OPTtitlewidth{0.65\textwidth} % Width of title +\def\OPTtitleskip{21pt} % Skip between title and author (with units) +\def\OPTtitleauthorfont{13} % Size of author font (no unit, pt assumed) +\def\OPTtitleauthorskip{4pt} % Skip betewen first and second line of author (with units) + +% PART FONTS +\def\OPTpartfont{28} % Size of "Part X" (without unit, pt assumed) +\def\OPTpartskip{14pt} % Skip between Part and title (with unit) +\def\OPTparttitlefont{42} % Size of part title (without unit, pt assumed) + +% FORMATTING OF CHAPTER TITLE +\def\OPTchapterfont{20} % Size of "Chapter X" (without unit, pt assumed) +\def\OPTchapterskip{14pt} % Skip between Chapter and title (with unit) +\def\OPTchaptertitlefont{24} % Size of chapter title (without unit, pt assumed) + +% FORMATTING OF PREFACE +\def\OPTprefacecols{2} % Number of columns when listing people in Preface + +% GETTING RID OF THE WIDOW ON PAGE 2 IN LETTER FORMAT +\def\OPTwidow{} + +% FORMATTING OF TABLE 1 IN INTRODUCTION +\def\OPTsmalltable{\small} + +% FORMATTING OF TABLE 8.1 OF HOMOTOPY GROUPS OF SPHERES +\newcommand{\OPTspherescolwidth}{20pt} + +% FORMATTING THE BIBLIOGRAPHY +\newcommand{\OPTbibliographyfont}{\small} + +% FORMATTING OF INDEX +\newcommand{\OPTindexfont}{\footnotesize} % size of font in the index +\newcommand{\OPTindexcolumnsep}{15.0pt} % column separation in index (default is 10.0pt) diff --git a/opt-ebook.tex b/opt-ebook.tex new file mode 100644 index 0000000000000000000000000000000000000000..5bfbc87aa73f48c9138c094713d45ec797a8cc8d --- /dev/null +++ b/opt-ebook.tex @@ -0,0 +1,85 @@ +%%% FORMATTING OPTIONS FOR EBOOK SIZE. +%%$ THIS IS ACTUALLY USTRADE SIZE WITH SMALL MARGINS. +%%% This file gets included by the hott-xxx.tex files. + +% MACROS FOR FINE TUNING +\newcommand{\narrowbreak}{\\} +\newcommand{\narrowamp}{&} +\newcommand{\narrowequation}[1]{\begin{equation*}#1\end{equation*}} +\newenvironment{narrowmultline*}{\csname multline*\endcsname}{\csname endmultline*\endcsname} +\newenvironment{narrowmultline}{\csname multline\endcsname}{\csname endmultline\endcsname} + +% FONTS +\def\OPTfontsize{10pt} % Font size +\delimiterfactor=800 + +% PAGE FORMAT +% +% These settings are for letter format +\def\OPTpagesize{4.8in,7.9in} % Page size +\def\OPTtopmargin{0.2in} % Margin at the top of the page +\def\OPTbottommargin{0.2in} % Margin at the bottom of the page +\def\OPTinnermargin{0.2in} % Margin on the inner side of the page +\def\OPTbindingoffset{0.0in} % Extra offset on the inner side +\def\OPToutermargin{0.2in} % Margin on the outer side of the page + +% FORMATTING OF COVER PAGE +\def\OPTcoverwidth{4.75in} % width of text on cover page +\def\OPTcoverheight{7.85in} % height of text on cover page +\def\OPTtopskip{35pt} % Skip at top of cover and back page (with units) +\def\OPTbotskip{35pt} % Skip at bottom of cover and back page (with units) +\def\OPTcovertitlefont{48} % Size of title font (no unit, pt assumed) +\def\OPTcoverspinefont{22} % Size of title font on the book spine (no unit, pt assumed) +\def\OPTcovertitleskip{18pt} % Skip between title and subtitle (with units) +\def\OPTcoversubtitlefont{18} % Size of subtitle font (no unit, pt assumed) +\def\OPTcoverauthorfont{14} % Size of author font (no unit, pt assumed) +\def\OPTcoverauthorskip{6pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF BACK COVER PAGE +\def\OPTbacktitlefont{\large} % Size of "From the introduction" and "Get this book ..." +\def\OPTbackfont{\small} % Size of text font + +% FORMATTING OF BASTARD TITLE, IF PRESENT +% (see opt-no-bastard.tex and opt-bastard.tex) +\def\OPTbastardtitlefont{17} +\def\OPTbastardsubtitlefont{11} +\def\OPTbastardwidth{0.42\textwidth} % Width of bastard title +\def\OPTbastardtitleskip{6pt} + +% FORMATTING OF TITLE PAGE +\def\OPTtitletitlefont{22} % Size of title font (no unit, pt assumed) +\def\OPTtitletitleskip{7pt} % Skip between title and subtitle (with units) +\def\OPTtitlesubtitlefont{15} % Size of subtitle font (no unit, pt assumed) +\def\OPTtitlewidth{0.65\textwidth} % Width of title +\def\OPTtitleskip{21pt} % Skip between title and author (with units) +\def\OPTtitleauthorfont{13} % Size of author font (no unit, pt assumed) +\def\OPTtitleauthorskip{4pt} % Skip betewen first and second line of author (with units) + +% PART FONTS +\def\OPTpartfont{28} % Size of "Part X" (without unit, pt assumed) +\def\OPTpartskip{14pt} % Skip between Part and title (with unit) +\def\OPTparttitlefont{42} % Size of part title (without unit, pt assumed) + +% FORMATTING OF CHAPTER TITLE +\def\OPTchapterfont{20} % Size of "Chapter X" (without unit, pt assumed) +\def\OPTchapterskip{14pt} % Skip between Chapter and title (with unit) +\def\OPTchaptertitlefont{24} % Size of chapter title (without unit, pt assumed) + +% FORMATTING OF PREFACE +\def\OPTprefacecols{2} % Number of columns when listing people in Preface + +% GETTING RID OF THE WIDOW ON PAGE 2 IN LETTER FORMAT +\def\OPTwidow{} + +% FORMATTING OF TABLE 1 IN INTRODUCTION +\def\OPTsmalltable{\small} + +% FORMATTING OF TABLE 8.1 OF HOMOTOPY GROUPS OF SPHERES +\newcommand{\OPTspherescolwidth}{20pt} + +% FORMATTING THE BIBLIOGRAPHY +\newcommand{\OPTbibliographyfont}{\small} + +% FORMATTING OF INDEX +\newcommand{\OPTindexfont}{\footnotesize} % size of font in the index +\newcommand{\OPTindexcolumnsep}{15.0pt} % column separation in index (default is 10.0pt) diff --git a/opt-exerciseperpage.tex b/opt-exerciseperpage.tex new file mode 100644 index 0000000000000000000000000000000000000000..7a4361377253097e8e4a2271ffa47e5f35c65663 --- /dev/null +++ b/opt-exerciseperpage.tex @@ -0,0 +1 @@ +\def\OPTexerciseperpage{} % Put \newpage at the beginning of each exercise diff --git a/opt-letter.tex b/opt-letter.tex new file mode 100644 index 0000000000000000000000000000000000000000..11b28c638a091ddac8dbf17d31a7fe51ea8deafc --- /dev/null +++ b/opt-letter.tex @@ -0,0 +1,82 @@ +%%% FORMATTING OPTIONS FOR LETTER SIZE +%%% This file gets included by the hott-xxx.tex files. + +% MACROS FOR FINE TUNING +\newcommand{\narrowbreak}{} +\newcommand{\narrowamp}{} +\newcommand{\narrowequation}[1]{$#1$} +\newenvironment{narrowmultline}{\csname equation\endcsname}{\csname endequation\endcsname} +\newenvironment{narrowmultline*}{\csname equation*\endcsname}{\csname endequation*\endcsname} + +% FONTS +\def\OPTfontsize{11pt} % Font size + +% PAGE FORMAT +% +% These settings are for letter format +\def\OPTpagesize{8.5in,11in} % Page size +\def\OPTtopmargin{1in} % Margin at the top of the page +\def\OPTbottommargin{1in} % Margin at the bottom of the page +\def\OPTinnermargin{0.75in} % Margin on the inner side of the page +\def\OPTbindingoffset{0.35in} % Extra offset on the inner side +\def\OPToutermargin{1.0in} % Margin on the outer side of the page + +% FORMATTING OF COVER PAGE +\def\OPTcoverwidth{8.45in} % width of text on cover page +\def\OPTcoverheight{10.95in} % height of text on cover page +\def\OPTtopskip{43pt} % Skip at top of cover and back page (with units) +\def\OPTbotskip{43pt} % Skip at bottom of cover and back page (with units) +\def\OPTcovertitlefont{74.5} % Size of title font (no unit, pt assumed) +\def\OPTcovertitleskip{24pt} % Skip between title and subtitle (with units) +\def\OPTcoversubtitlefont{27} % Size of subtitle font (no unit, pt assumed) +\def\OPTcoverauthorfont{22} % Size of author font (no unit, pt assumed) +\def\OPTcoverauthorskip{8pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF BACK COVER PAGE +\def\OPTbacktitlefont{\LARGE} % Size of "From the introduction" and "Get this book ..." +\def\OPTbackfont{\large} % Size of text font + +% FORMATTING OF BASTARD TITLE, IF PRESENT +% (see opt-no-bastard.tex and opt-bastard.tex) +\def\OPTbastardtitlefont{22} +\def\OPTbastardsubtitlefont{15} +\def\OPTbastardwidth{0.40\textwidth} % Width of bastard title +\def\OPTbastardtitleskip{8pt} + +% FORMATTING OF TITLE PAGE +\def\OPTtitletitlefont{37} % Size of title font (no unit, pt assumed) +\def\OPTtitletitleskip{10pt} % Skip between title and subtitle (with units) +\def\OPTtitlesubtitlefont{25} % Size of subtitle font (no unit, pt assumed) +\def\OPTtitlewidth{0.65\textwidth} % Width of title +\def\OPTtitleskip{30pt} % Skip between title and author (with units) +\def\OPTtitleauthorfont{18} % Size of author font (no unit, pt assumed) +\def\OPTtitleauthorskip{6pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF PART PAGE +\def\OPTpartfont{40} % Size of "Part X" (without unit, pt assumed) +\def\OPTpartskip{20pt} % Skip between Part and title (with unit) +\def\OPTparttitlefont{60} % Size of part title (without unit, pt assumed) + +% FORMATTING OF CHAPTER TITLE +\def\OPTchapterfont{23} % Size of "Chapter X" +\def\OPTchapterskip{20pt} % Skip between Chapter and title +\def\OPTchaptertitlefont{35} % Size of chapter title + +% FORMATTING OF PREFACE +\def\OPTprefacecols{3} % Number of columns when listing people in Preface + +% GETTING RID OF THE WIDOW ON PAGE 2 IN LETTER FORMAT +\def\OPTwidow{\enlargethispage{\baselineskip}} + +% FORMATTING OF TABLE 1 IN INTRODUCTION +\def\OPTsmalltable{} + +% FORMATTING OF TABLE 8.1 OF HOMOTOPY GROUPS OF SPHERES +\newcommand{\OPTspherescolwidth}{30pt} + +% FORMATTING THE BIBLIOGRAPHY +\newcommand{\OPTbibliographyfont}{\small} + +% FORMATTING OF INDEX +\newcommand{\OPTindexfont}{\small} % size of font in the index +\newcommand{\OPTindexcolumnsep}{20.0pt} % column separation in index (default is 10.0pt) diff --git a/opt-no-bastard.tex b/opt-no-bastard.tex new file mode 100644 index 0000000000000000000000000000000000000000..e5f7d588da15ef025bf1e2824704dbf39c490015 --- /dev/null +++ b/opt-no-bastard.tex @@ -0,0 +1,3 @@ +% Do not include a bastard title +\newif\ifOPTbastard +\OPTbastardfalse diff --git a/opt-no-cover.tex b/opt-no-cover.tex new file mode 100644 index 0000000000000000000000000000000000000000..74f1125f6275e4e22c80bce86d836c75cd14ca0a --- /dev/null +++ b/opt-no-cover.tex @@ -0,0 +1,3 @@ +% Do not include cover +\newif\ifOPTcover +\OPTcoverfalse diff --git a/opt-ustrade.tex b/opt-ustrade.tex new file mode 100644 index 0000000000000000000000000000000000000000..1d4febec40f20f111845c9474ed1532ea89cd4ee --- /dev/null +++ b/opt-ustrade.tex @@ -0,0 +1,84 @@ +%%% FORMATTING OPTIONS FOR USTRADE SIZE +%%% This file gets included by the hott-xxx.tex files. + +% MACROS FOR FINE TUNING +\newcommand{\narrowbreak}{\\} +\newcommand{\narrowamp}{&} +\newcommand{\narrowequation}[1]{\begin{equation*}#1\end{equation*}} +\newenvironment{narrowmultline*}{\csname multline*\endcsname}{\csname endmultline*\endcsname} +\newenvironment{narrowmultline}{\csname multline\endcsname}{\csname endmultline\endcsname} + +% FONTS +\def\OPTfontsize{10pt} % Font size +\delimiterfactor=800 + +% PAGE FORMAT +% +% These settings are for letter format +\def\OPTpagesize{6in,9in} % Page size +\def\OPTtopmargin{0.75in} % Margin at the top of the page +\def\OPTbottommargin{0.75in} % Margin at the bottom of the page +\def\OPTinnermargin{0.5in} % Margin on the inner side of the page +\def\OPTbindingoffset{0.35in} % Extra offset on the inner side +\def\OPToutermargin{0.75in} % Margin on the outer side of the page + +% FORMATTING OF COVER PAGE +%\def\OPTcoverwidth{8.45in} % width of text on cover page, not used for US trade +%\def\OPTcoverheight{10.95in} % height of text on cover page +\def\OPTtopskip{35pt} % Skip at top of cover and back page (with units) +\def\OPTbotskip{35pt} % Skip at bottom of cover and back page (with units) +\def\OPTcovertitlefont{61} % Size of title font (no unit, pt assumed) +\def\OPTcoverspinefont{32} % Size of title font on the book spine (no unit, pt assumed) +\def\OPTcovertitleskip{20pt} % Skip between title and subtitle (with units) +\def\OPTcoversubtitlefont{22} % Size of subtitle font (no unit, pt assumed) +\def\OPTcoverauthorfont{18} % Size of author font (no unit, pt assumed) +\def\OPTcoverauthorskip{6pt} % Skip betewen first and second line of author (with units) + +% FORMATTING OF BACK COVER PAGE +\def\OPTbacktitlefont{\Large} % Size of "From the introduction" and "Get this book ..." +\def\OPTbackfont{\normalsize} % Size of text font + +% FORMATTING OF BASTARD TITLE, IF PRESENT +% (see opt-no-bastard.tex and opt-bastard.tex) +\def\OPTbastardtitlefont{17} +\def\OPTbastardsubtitlefont{11} +\def\OPTbastardwidth{0.42\textwidth} % Width of bastard title +\def\OPTbastardtitleskip{6pt} + +% FORMATTING OF TITLE PAGE +\def\OPTtitletitlefont{26} % Size of title font (no unit, pt assumed) +\def\OPTtitletitleskip{7pt} % Skip between title and subtitle (with units) +\def\OPTtitlesubtitlefont{17} % Size of subtitle font (no unit, pt assumed) +\def\OPTtitlewidth{0.65\textwidth} % Width of title +\def\OPTtitleskip{21pt} % Skip between title and author (with units) +\def\OPTtitleauthorfont{13} % Size of author font (no unit, pt assumed) +\def\OPTtitleauthorskip{4pt} % Skip betewen first and second line of author (with units) + +% PART FONTS +\def\OPTpartfont{28} % Size of "Part X" (without unit, pt assumed) +\def\OPTpartskip{14pt} % Skip between Part and title (with unit) +\def\OPTparttitlefont{42} % Size of part title (without unit, pt assumed) + +% FORMATTING OF CHAPTER TITLE +\def\OPTchapterfont{20} % Size of "Chapter X" (without unit, pt assumed) +\def\OPTchapterskip{14pt} % Skip between Chapter and title (with unit) +\def\OPTchaptertitlefont{24} % Size of chapter title (without unit, pt assumed) + +% FORMATTING OF PREFACE +\def\OPTprefacecols{2} % Number of columns when listing people in Preface + +% GETTING RID OF THE WIDOW ON PAGE 2 IN LETTER FORMAT +\def\OPTwidow{} + +% FORMATTING OF TABLE 1 IN INTRODUCTION +\def\OPTsmalltable{\small} + +% FORMATTING OF TABLE 8.1 OF HOMOTOPY GROUPS OF SPHERES +\newcommand{\OPTspherescolwidth}{20pt} + +% FORMATTING THE BIBLIOGRAPHY +\newcommand{\OPTbibliographyfont}{\small} + +% FORMATTING OF INDEX +\newcommand{\OPTindexfont}{\footnotesize} % size of font in the index +\newcommand{\OPTindexcolumnsep}{15.0pt} % column separation in index (default is 10.0pt) diff --git a/other/frequency.py b/other/frequency.py new file mode 100644 index 0000000000000000000000000000000000000000..153999d6dd1fca12b425ebd8e59ff851a03422c5 --- /dev/null +++ b/other/frequency.py @@ -0,0 +1,10008 @@ +# Frequent English words, frequencies per billion words +# obtained from http://en.wiktionary.org/ + +frequencies = { + "the" : 56271872, + "of" : 33950064, + "and" : 29944184, + "to" : 25956096, + "in" : 17420636, + "i" : 11764797, + "that" : 11073318, + "was" : 10078245, + "his" : 8799755, + "he" : 8397205, + "it" : 8058110, + "with" : 7725512, + "is" : 7557477, + "for" : 7097981, + "as" : 7037543, + "had" : 6139336, + "you" : 6048903, + "not" : 5741803, + "be" : 5662527, + "her" : 5202501, + "on" : 5113263, + "at" : 5091841, + "by" : 5061050, + "which" : 4580906, + "have" : 4346500, + "or" : 4228287, + "from" : 4108111, + "this" : 4015425, + "him" : 3971997, + "but" : 3894211, + "all" : 3703342, + "she" : 3415846, + "they" : 3340398, + "were" : 3323884, + "my" : 3277699, + "are" : 3224178, + "me" : 3027134, + "one" : 2832569, + "their" : 2820265, + "so" : 2802481, + "an" : 2641417, + "said" : 2637136, + "them" : 2509917, + "we" : 2491655, + "who" : 2472663, + "would" : 2400858, + "been" : 2357654, + "will" : 2320022, + "no" : 2241145, + "when" : 1980046, + "there" : 1961200, + "if" : 1951102, + "more" : 1899787, + "out" : 1875351, + "up" : 1792712, + "into" : 1703963, + "do" : 1680164, + "any" : 1665366, + "your" : 1658553, + "what" : 1605908, + "has" : 1602329, + "man" : 1573117, + "could" : 1571110, + "other" : 1533530, + "than" : 1508779, + "our" : 1498473, + "some" : 1476767, + "very" : 1462382, + "time" : 1449681, + "upon" : 1424595, + "about" : 1414687, + "may" : 1400642, + "its" : 1373270, + "only" : 1318367, + "now" : 1317723, + "like" : 1280625, + "little" : 1273589, + "then" : 1255636, + "can" : 1210074, + "should" : 1192154, + "made" : 1188501, + "did" : 1185720, + "us" : 1171742, + "such" : 1136757, + "a" : 1135294, + "great" : 1120163, + "before" : 1117089, + "must" : 1108116, + "two" : 1093366, + "these" : 1090510, + "see" : 1084286, + "know" : 1075612, + "over" : 1056659, + "much" : 1021822, + "down" : 989808, + "after" : 978575, + "first" : 978196, + "mr|mr" : 974419, + "good" : 966602, + "men" : 923053, + "own" : 922130, + "never" : 899673, + "most" : 889691, + "old" : 887917, + "shall" : 883846, + "day" : 882331, + "where" : 881975, + "those" : 878621, + "came" : 873144, + "come" : 873007, + "himself" : 863478, + "way" : 860027, + "work" : 829823, + "life" : 825485, + "without" : 819684, + "go" : 816536, + "make" : 807600, + "well" : 799596, + "through" : 792925, + "being" : 792220, + "long" : 791686, + "say" : 788124, + "might" : 787455, + "how" : 770603, + "am" : 761957, + "too" : 758856, + "even" : 750750, + "def" : 748992, + "again" : 745230, + "many" : 744168, + "back" : 740270, + "here" : 729829, + "think" : 715780, + "every" : 704444, + "people" : 701741, + "went" : 690186, + "same" : 689376, + "last" : 680833, + "thought" : 674623, + "away" : 673810, + "under" : 671168, + "take" : 656486, + "found" : 654512, + "hand" : 648227, + "eyes" : 647788, + "still" : 640067, + "place" : 621773, + "while" : 613918, + "just" : 610168, + "also" : 608042, + "young" : 591821, + "yet" : 588615, + "though" : 570877, + "against" : 569459, + "things" : 567559, + "get" : 564674, + "ever" : 559207, + "give" : 554003, + "god" : 552668, + "years" : 547420, + "off" : 545832, + "face" : 544251, + "nothing" : 541692, + "right" : 536737, + "once" : 534154, + "another" : 533985, + "left" : 531797, + "part" : 526137, + "saw" : 520922, + "house" : 517564, + "world" : 517557, + "head" : 512481, + "three" : 502146, + "took" : 501669, + "new" : 498040, + "love" : 496496, + "always" : 495834, + "mrs" : 495443, + "put" : 495189, + "night" : 484878, + "each" : 484599, + "king" : 479849, + "between" : 479034, + "tell" : 475277, + "mind" : 470313, + "heart" : 467157, + "few" : 466338, + "because" : 465587, + "thing" : 461472, + "whom" : 458312, + "far" : 456267, + "seemed" : 447884, + "looked" : 447491, + "called" : 445602, + "whole" : 435059, + "de" : 433393, + "set" : 432637, + "both" : 432491, + "got" : 432016, + "find" : 431120, + "done" : 430389, + "heard" : 429972, + "look" : 428871, + "name" : 427021, + "days" : 426104, + "told" : 424696, + "let" : 424320, + "lord" : 422407, + "country" : 420788, + "asked" : 420044, + "going" : 419315, + "seen" : 418862, + "better" : 416463, + "p" : 415673, + "having" : 415355, + "home" : 413499, + "knew" : 413101, + "side" : 405810, + "something" : 398727, + "moment" : 390988, + "father" : 387790, + "among" : 387549, + "course" : 385303, + "hands" : 385081, + "woman" : 384156, + "enough" : 382266, + "words" : 380328, + "mother" : 373898, + "soon" : 373813, + "full" : 371831, + "end" : 369761, + "gave" : 369036, + "room" : 366719, + "almost" : 366630, + "small" : 359970, + "thou" : 355857, + "cannot" : 355656, + "water" : 355467, + "want" : 354212, + "however" : 352828, + "light" : 351253, + "quite" : 350537, + "brought" : 349925, + "nor" : 349691, + "word" : 349685, + "whose" : 344377, + "given" : 344141, + "door" : 342388, + "best" : 337544, + "turned" : 337367, + "taken" : 335210, + "does" : 334332, + "use" : 333883, + "morning" : 330567, + "myself" : 328630, + "gutenberg" : 328324, + "felt" : 326524, + "until" : 326391, + "since" : 326386, + "power" : 326243, + "themselves" : 325793, + "used" : 325791, + "rather" : 325719, + "began" : 325327, + "present" : 324509, + "voice" : 322870, + "others" : 322643, + "white" : 322465, + "works" : 318937, + "less" : 316490, + "money" : 315642, + "next" : 313167, + "poor" : 311818, + "death" : 309653, + "stood" : 308025, + "form" : 307506, + "within" : 307223, + "together" : 304955, + "till" : 304735, + "thy" : 304489, + "large" : 304240, + "matter" : 301283, + "kind" : 298191, + "often" : 296798, + "certain" : 296795, + "herself" : 295916, + "year" : 295745, + "friend" : 295078, + "half" : 293866, + "order" : 293593, + "round" : 291647, + "true" : 291427, + "anything" : 289997, + "keep" : 289304, + "sent" : 287876, + "wife" : 286847, + "means" : 284431, + "believe" : 281965, + "passed" : 279864, + "feet" : 279821, + "near" : 278870, + "public" : 278365, + "state" : 277682, + "son" : 277227, + "hundred" : 275990, + "children" : 275607, + "thus" : 275221, + "hope" : 273746, + "alone" : 272173, + "above" : 271641, + "case" : 271588, + "dear" : 270503, + "thee" : 269414, + "says" : 268542, + "person" : 267878, + "high" : 266672, + "read" : 265947, + "city" : 265138, + "already" : 264662, + "received" : 264606, + "fact" : 263613, + "gone" : 263585, + "girl" : 262689, + "known" : 262571, + "hear" : 260746, + "times" : 260596, + "least" : 259916, + "perhaps" : 257964, + "sure" : 255885, + "indeed" : 255789, + "english" : 255212, + "open" : 254373, + "body" : 252812, + "itself" : 251252, + "along" : 251163, + "land" : 249677, + "return" : 249533, + "leave" : 249063, + "air" : 247480, + "nature" : 246792, + "answered" : 246251, + "either" : 244426, + "law" : 244138, + "help" : 243712, + "lay" : 242753, + "point" : 242269, + "child" : 242201, + "letter" : 242178, + "four" : 242099, + "wish" : 241091, + "fire" : 240652, + "cried" : 240280, + "2" : 240009, + "women" : 239735, + "speak" : 239025, + "number" : 238734, + "therefore" : 238281, + "hour" : 237964, + "friends" : 237481, + "held" : 235474, + "free" : 235012, + "war" : 234544, + "during" : 233771, + "several" : 233197, + "business" : 233158, + "whether" : 230819, + "er" : 230485, + "manner" : 230401, + "second" : 230300, + "reason" : 229940, + "replied" : 229913, + "united" : 226953, + "call" : 226661, + "general" : 226391, + "why" : 226216, + "behind" : 226205, + "became" : 224811, + "john" : 224569, + "become" : 224326, + "dead" : 224049, + "earth" : 222546, + "boy" : 222315, + "lost" : 222264, + "forth" : 220598, + "thousand" : 218623, + "looking" : 218510, + "i'll" : 218372, + "family" : 218118, + "soul" : 217840, + "feel" : 216356, + "coming" : 215147, + "england" : 214339, + "spirit" : 213257, + "question" : 213124, + "care" : 213072, + "truth" : 212548, + "ground" : 212369, + "really" : 211722, + "rest" : 211668, + "mean" : 211299, + "different" : 211043, + "making" : 210031, + "possible" : 209099, + "fell" : 208344, + "towards" : 208199, + "human" : 206740, + "kept" : 206329, + "short" : 206216, + "town" : 205687, + "following" : 205653, + "need" : 204955, + "cause" : 204686, + "met" : 203956, + "evening" : 203331, + "returned" : 202041, + "five" : 201451, + "strong" : 200224, + "able" : 200145, + "french" : 199969, + "live" : 199658, + "lady" : 199560, + "subject" : 198566, + "sn" : 198498, + "answer" : 198187, + "sea" : 198128, + "fear" : 196739, + "understand" : 196729, + "hard" : 196458, + "terms" : 196252, + "doubt" : 195905, + "around" : 195594, + "ask" : 194903, + "arms" : 194298, + "turn" : 192763, + "sense" : 192719, + "seems" : 192229, + "black" : 191272, + "bring" : 191148, + "followed" : 190649, + "beautiful" : 190563, + "close" : 188915, + "dark" : 188316, + "hold" : 186609, + "character" : 186256, + "sort" : 186136, + "sight" : 185862, + "ten" : 184612, + "show" : 184074, + "party" : 184068, + "fine" : 183059, + "ye" : 182978, + "ready" : 181866, + "story" : 180998, + "common" : 180061, + "book" : 179739, + "electronic" : 179347, + "talk" : 178877, + "account" : 178452, + "mark" : 178084, + "interest" : 178001, + "written" : 177232, + "can't" : 176728, + "bed" : 176635, + "necessary" : 176467, + "age" : 176320, + "else" : 175980, + "force" : 175520, + "idea" : 174236, + "longer" : 173897, + "art" : 173544, + "spoke" : 172990, + "across" : 172901, + "brother" : 172692, + "early" : 172467, + "ought" : 171690, + "sometimes" : 171309, + "line" : 170962, + "saying" : 170695, + "table" : 170143, + "appeared" : 169913, + "river" : 169470, + "continued" : 169086, + "eye" : 168723, + "ety" : 168713, + "sun" : 168545, + "information" : 168408, + "later" : 167805, + "everything" : 166395, + "reached" : 165752, + "suddenly" : 164850, + "past" : 164703, + "hours" : 164326, + "strange" : 164147, + "deep" : 163819, + "change" : 163514, + "miles" : 163341, + "feeling" : 163269, + "act" : 162869, + "meet" : 162687, + "paid" : 162605, + "further" : 162327, + "purpose" : 162154, + "happy" : 162105, + "added" : 161953, + "seem" : 161549, + "taking" : 160626, + "blood" : 160547, + "rose" : 159794, + "south" : 158664, + "beyond" : 158344, + "cold" : 158204, + "neither" : 158200, + "forward" : 157578, + "view" : 157416, + "i've" : 157210, + "position" : 156851, + "sound" : 156616, + "none" : 155743, + "entered" : 155480, + "clear" : 155472, + "road" : 154977, + "late" : 154840, + "stand" : 154582, + "suppose" : 154536, + "la" : 154457, + "daughter" : 154261, + "real" : 154046, + "nearly" : 154001, + "mine" : 153940, + "laws" : 153830, + "knowledge" : 153829, + "comes" : 153299, + "toward" : 152972, + "bad" : 152889, + "cut" : 152625, + "copy" : 151661, + "husband" : 151651, + "six" : 151612, + "france" : 151108, + "living" : 151043, + "peace" : 150281, + "didn't" : 149696, + "low" : 149690, + "north" : 149601, + "remember" : 149323, + "effect" : 148795, + "natural" : 148744, + "pretty" : 148124, + "fall" : 147435, + "fair" : 147401, + "service" : 146483, + "below" : 146062, + "except" : 145998, + "american" : 145980, + "hair" : 145817, + "london" : 145606, + "laid" : 145490, + "pass" : 145440, + "led" : 145393, + "copyright" : 145244, + "doing" : 145131, + "army" : 144925, + "run" : 144688, + "horse" : 144022, + "future" : 143658, + "opened" : 143625, + "pleasure" : 142952, + "history" : 141958, + "west" : 141745, + "pay" : 141597, + "red" : 141588, + "an'" : 141517, + "4" : 141402, + "hath" : 141246, + "note" : 140679, + "although" : 140667, + "wanted" : 140608, + "gold" : 139711, + "makes" : 139167, + "desire" : 138288, + "play" : 138228, + "master" : 137871, + "office" : 136616, + "tried" : 136507, + "front" : 136296, + "big" : 136265, + "dr" : 135902, + "lived" : 135512, + "certainly" : 135386, + "wind" : 134689, + "receive" : 134351, + "attention" : 134257, + "government" : 134075, + "unto" : 134048, + "church" : 133975, + "strength" : 133771, + "length" : 133663, + "company" : 133159, + "placed" : 133084, + "paper" : 133030, + "letters" : 132785, + "probably" : 132560, + "glad" : 132368, + "important" : 132288, + "especially" : 132096, + "greater" : 132045, + "yourself" : 131617, + "fellow" : 131509, + "bear" : 131397, + "opinion" : 130867, + "window" : 130590, + "ran" : 130394, + "faith" : 130376, + "ago" : 130255, + "agreement" : 130079, + "charge" : 129644, + "beauty" : 129586, + "lips" : 129473, + "remained" : 129411, + "arm" : 129325, + "latter" : 129276, + "duty" : 129116, + "send" : 129075, + "distance" : 129046, + "silence" : 128067, + "foot" : 128053, + "wild" : 127758, + "object" : 127468, + "die" : 127167, + "save" : 126799, + "gentleman" : 126761, + "trees" : 126469, + "green" : 126431, + "trouble" : 125885, + "smile" : 125830, + "books" : 125827, + "wrong" : 125401, + "various" : 125006, + "sleep" : 124634, + "persons" : 123820, + "blockquote" : 123703, + "happened" : 123421, + "particular" : 123182, + "drew" : 122264, + "minutes" : 122201, + "hardly" : 121603, + "walked" : 121276, + "chief" : 121207, + "chance" : 120739, + "according" : 120733, + "beginning" : 120733, + "action" : 120590, + "deal" : 120186, + "loved" : 120145, + "visit" : 119807, + "thinking" : 119753, + "follow" : 119666, + "standing" : 119506, + "knows" : 119114, + "try" : 118860, + "presence" : 118852, + "heavy" : 118834, + "sweet" : 118754, + "plain" : 118641, + "donations" : 118443, + "immediately" : 118250, + "wrote" : 118114, + "mouth" : 117921, + "rich" : 117386, + "thoughts" : 117251, + "months" : 116955, + "u" : 116586, + "won't" : 116568, + "afraid" : 116467, + "paris" : 116402, + "single" : 115905, + "joy" : 115788, + "enemy" : 115195, + "broken" : 115006, + "unless" : 114054, + "states" : 113807, + "ship" : 113611, + "condition" : 113578, + "carry" : 113357, + "exclaimed" : 113352, + "including" : 113104, + "filled" : 112921, + "seeing" : 112889, + "influence" : 112447, + "write" : 112285, + "boys" : 112125, + "appear" : 112044, + "outside" : 111849, + "secret" : 111678, + "parts" : 111194, + "please" : 111114, + "appearance" : 110932, + "evil" : 110898, + "march" : 110834, + "george" : 110754, + "whatever" : 110549, + "slowly" : 110500, + "tears" : 110314, + "horses" : 110296, + "places" : 110250, + "caught" : 110061, + "stay" : 109894, + "instead" : 109837, + "struck" : 109662, + "blue" : 109449, + "york" : 109354, + "impossible" : 109330, + "period" : 109160, + "sister" : 108983, + "battle" : 108781, + "school" : 108701, + "mary" : 108633, + "raised" : 108580, + "occasion" : 108544, + "married" : 108419, + "man's" : 108346, + "former" : 108299, + "food" : 108140, + "youth" : 108097, + "learned" : 108072, + "merely" : 108034, + "reach" : 107787, + "system" : 107496, + "twenty" : 107475, + "dinner" : 107414, + "quiet" : 107167, + "easily" : 107012, + "moved" : 106996, + "afterwards" : 106992, + "giving" : 106981, + "walk" : 106858, + "stopped" : 106661, + "laughed" : 106591, + "language" : 106445, + "expression" : 106415, + "week" : 106184, + "hall" : 106108, + "danger" : 105775, + "property" : 105765, + "wonder" : 105588, + "usual" : 105412, + "figure" : 105403, + "born" : 104938, + "court" : 104606, + "generally" : 104448, + "grew" : 104326, + "showed" : 104205, + "getting" : 103981, + "ancient" : 103755, + "respect" : 103497, + "third" : 103468, + "worth" : 103346, + "simple" : 102885, + "tree" : 102872, + "leaving" : 102830, + "remain" : 102801, + "society" : 102355, + "fight" : 102206, + "wall" : 102124, + "result" : 102039, + "heaven" : 101875, + "william" : 101780, + "started" : 101771, + "command" : 101717, + "tone" : 101569, + "regard" : 101139, + "expected" : 101117, + "mere" : 101061, + "month" : 101037, + "beside" : 100710, + "silent" : 100695, + "perfect" : 100522, + "experience" : 100504, + "street" : 100499, + "writing" : 100292, + "goes" : 100235, + "circumstances" : 100166, + "entirely" : 99803.2, + "fresh" : 99654.4, + "duke" : 99561.9, + "covered" : 99439.2, + "bound" : 99304.7, + "east" : 99220.9, + "wood" : 99157.6, + "stone" : 99073.7, + "quickly" : 98994.6, + "notice" : 98872.0, + "bright" : 98773.9, + "christ" : 98758.1, + "boat" : 98756.5, + "noble" : 98714.6, + "meant" : 98705.1, + "somewhat" : 98651.3, + "sudden" : 98497.8, + "value" : 98232.8, + "c." : 97991.5, + "direction" : 97628.3, + "chair" : 97567.4, + "due" : 97353.0, + "support" : 97334.0, + "tom" : 97093.5, + "date" : 96908.4, + "waiting" : 96834.8, + "christian" : 96735.9, + "village" : 96681.3, + "lives" : 96547.6, + "reading" : 96465.4, + "agree" : 96413.9, + "lines" : 96198.0, + "considered" : 96182.9, + "field" : 96170.3, + "observed" : 96110.1, + "scarcely" : 95979.6, + "wished" : 95538.2, + "wait" : 95523.9, + "greatest" : 95398.1, + "permission" : 95391.0, + "success" : 95371.2, + "piece" : 95303.2, + "british" : 95149.7, + "ex" : 95127.6, + "charles" : 95049.2, + "formed" : 94978.0, + "speaking" : 94833.3, + "trying" : 94706.7, + "conversation" : 94578.5, + "proper" : 94480.4, + "hill" : 94379.1, + "music" : 94284.2, + "opportunity" : 94123.6, + "that's" : 93912.4, + "german" : 93866.5, + "afternoon" : 93839.6, + "cry" : 93675.0, + "cost" : 93470.1, + "allowed" : 93398.1, + "girls" : 93384.7, + "considerable" : 93235.2, + "c" : 92990.7, + "broke" : 92800.8, + "honour" : 92446.4, + "seven" : 92292.1, + "private" : 92260.5, + "sit" : 92217.0, + "news" : 92204.3, + "top" : 91995.5, + "scene" : 91985.2, + "discovered" : 91968.6, + "marriage" : 91937.7, + "step" : 91592.0, + "garden" : 91392.6, + "race" : 91305.6, + "begin" : 91207.5, + "per" : 91115.7, + "individual" : 90923.5, + "sitting" : 90632.3, + "learn" : 90513.7, + "political" : 90412.4, + "difficult" : 90385.5, + "bit" : 90352.3, + "speech" : 90319.0, + "henry" : 90034.2, + "lie" : 89756.5, + "cast" : 89723.3, + "eat" : 89650.5, + "authority" : 89562.7, + "etc." : 89480.4, + "floor" : 89151.3, + "ill" : 89125.2, + "ways" : 88381.5, + "officers" : 88207.5, + "offered" : 88164.0, + "original" : 88133.9, + "happiness" : 88005.0, + "flowers" : 87879.2, + "produced" : 87876.0, + "summer" : 87793.7, + "provide" : 87573.0, + "study" : 87538.2, + "religion" : 87445.6, + "picture" : 87340.4, + "walls" : 87300.1, + "personal" : 87235.2, + "america" : 87195.6, + "watch" : 87073.8, + "pleased" : 86744.7, + "leaves" : 86702.0, + "declared" : 86560.4, + "hot" : 86478.9, + "understood" : 86271.6, + "effort" : 86256.6, + "prepared" : 86240.7, + "escape" : 86157.7, + "attempt" : 86132.4, + "supposed" : 86122.1, + "killed" : 86020.0, + "fast" : 86008.1, + "author" : 85992.3, + "indian" : 85940.9, + "brown" : 85875.2, + "determined" : 85873.7, + "pain" : 85833.3, + "spring" : 85777.9, + "takes" : 85761.3, + "drawn" : 85701.2, + "soldiers" : 85694.1, + "houses" : 85488.4, + "beneath" : 85453.6, + "talking" : 85391.1, + "turning" : 85325.4, + "century" : 85256.6, + "steps" : 84796.1, + "intended" : 84789.0, + "soft" : 84783.5, + "straight" : 84750.2, + "matters" : 84637.1, + "likely" : 84636.3, + "corner" : 84584.1, + "trademark" : 84518.4, + "justice" : 84500.2, + "simply" : 84365.0, + "produce" : 84323.0, + "trust" : 84298.5, + "appears" : 84153.7, + "rome" : 84141.1, + "laugh" : 84072.2, + "forget" : 84004.2, + "europe" : 83940.9, + "passage" : 83908.5, + "eight" : 83853.9, + "closed" : 83814.3, + "ourselves" : 83716.2, + "gives" : 83639.5, + "dress" : 83486.0, + "passing" : 83482.1, + "terrible" : 83421.9, + "required" : 83248.7, + "medium" : 83151.4, + "efforts" : 83147.4, + "sake" : 83124.5, + "breath" : 83075.4, + "wise" : 83039.0, + "ladies" : 82918.0, + "possession" : 82883.2, + "pleasant" : 82839.7, + "perfectly" : 82830.9, + "o'" : 82761.3, + "memory" : 82725.7, + "usually" : 82644.2, + "grave" : 82623.7, + "fixed" : 82566.7, + "modern" : 82562.0, + "spot" : 82338.9, + "troops" : 82223.4, + "rise" : 82126.8, + "break" : 82118.1, + "fifty" : 82035.1, + "island" : 81974.9, + "meeting" : 81962.3, + "camp" : 81899.8, + "nation" : 81890.3, + "existence" : 81804.1, + "reply" : 81671.1, + "i'd" : 81624.5, + "copies" : 81479.7, + "sky" : 81457.5, + "touch" : 81396.6, + "equal" : 81392.7, + "fortune" : 81232.1, + "v." : 81207.5, + "shore" : 81109.4, + "domain" : 81056.4, + "named" : 80756.6, + "situation" : 80651.4, + "looks" : 80463.1, + "promise" : 80426.7, + "orders" : 80294.6, + "degree" : 80293.8, + "middle" : 80239.2, + "winter" : 80239.2, + "plan" : 80069.9, + "spent" : 80046.2, + "allow" : 79876.1, + "pale" : 79860.2, + "conduct" : 79819.9, + "running" : 79752.6, + "religious" : 79751.1, + "surprise" : 79635.6, + "minute" : 79605.5, + "roman" : 79482.1, + "cases" : 79432.2, + "shot" : 79425.1, + "lead" : 79418.8, + "move" : 79376.1, + "names" : 79366.6, + "stop" : 79301.7, + "higher" : 79280.3, + "et" : 79225.0, + "father's" : 79201.2, + "threw" : 79179.1, + "worse" : 79163.2, + "built" : 79110.2, + "spoken" : 79085.7, + "glass" : 79053.3, + "board" : 78858.7, + "vain" : 78809.6, + "affairs" : 78788.3, + "instance" : 78564.4, + "safe" : 78317.5, + "loss" : 78305.7, + "doctor" : 78281.9, + "offer" : 78246.3, + "class" : 78173.5, + "complete" : 78039.8, + "access" : 77716.3, + "lower" : 77368.2, + "wouldn't" : 77327.0, + "repeated" : 77300.1, + "forms" : 77286.7, + "darkness" : 77261.4, + "military" : 77249.5, + "warm" : 77220.2, + "drink" : 77183.8, + "passion" : 77028.0, + "ones" : 76976.6, + "physical" : 76974.2, + "example" : 76922.8, + "ears" : 76672.0, + "questions" : 76596.8, + "start" : 76592.9, + "lying" : 76560.4, + "smiled" : 76547.8, + "keeping" : 76541.4, + "spite" : 76495.5, + "shown" : 76402.2, + "directly" : 76333.4, + "james" : 76067.5, + "hart" : 76059.6, + "serious" : 75990.8, + "hat" : 75918.0, + "dog" : 75874.5, + "silver" : 75859.5, + "sufficient" : 75856.3, + "main" : 75850.0, + "mentioned" : 75813.6, + "servant" : 75473.4, + "pride" : 75429.9, + "crowd" : 75422.0, + "train" : 75404.6, + "wonderful" : 75347.6, + "moral" : 75253.5, + "instant" : 75209.9, + "associated" : 75153.0, + "path" : 75150.6, + "greek" : 75128.5, + "meaning" : 74981.3, + "fit" : 74906.9, + "ordered" : 74834.2, + "lot" : 74745.6, + "he's" : 74505.0, + "proved" : 74438.6, + "obliged" : 74413.3, + "enter" : 74391.9, + "rule" : 74378.5, + "sword" : 74342.9, + "attack" : 74293.0, + "seat" : 74266.1, + "game" : 74220.2, + "health" : 74210.7, + "paragraph" : 74195.7, + "statement" : 74053.3, + "social" : 74035.9, + "refund" : 73914.1, + "sorry" : 73906.2, + "courage" : 73882.4, + "members" : 73833.4, + "grace" : 73826.3, + "official" : 73755.1, + "dream" : 73726.6, + "worthy" : 73622.1, + "rock" : 73581.8, + "jack" : 73527.2, + "provided" : 73443.3, + "special" : 73437.8, + "shook" : 73338.9, + "request" : 73327.8, + "mighty" : 73313.6, + "glance" : 73302.5, + "heads" : 73281.2, + "movement" : 73266.9, + "fee" : 73232.9, + "share" : 73182.3, + "expect" : 73178.3, + "couldn't" : 73076.3, + "dollars" : 72925.9, + "spread" : 72890.3, + "opposite" : 72815.2, + "glory" : 72644.3, + "twelve" : 72570.7, + "space" : 72550.2, + "engaged" : 72545.4, + "peter" : 72509.0, + "wine" : 72450.5, + "ordinary" : 72404.6, + "mountains" : 72333.4, + "taste" : 72268.5, + "iron" : 72252.7, + "isn't" : 72166.5, + "distribute" : 72160.9, + "trade" : 72098.4, + "consider" : 72033.5, + "greatly" : 71894.3, + "accepted" : 71888.0, + "forced" : 71884.8, + "advantage" : 71878.5, + "ideas" : 71849.2, + "decided" : 71766.1, + "using" : 71751.9, + "officer" : 71744.0, + "rate" : 71688.6, + "clothes" : 71654.6, + "sign" : 71582.6, + "feelings" : 71558.9, + "native" : 71399.1, + "promised" : 71195.7, + "judge" : 71190.2, + "difference" : 71072.3, + "working" : 71042.3, + "anxious" : 71040.7, + "marry" : 70948.9, + "captain" : 70861.9, + "finished" : 70763.8, + "extent" : 70649.8, + "watched" : 70643.5, + "curious" : 70641.1, + "foreign" : 70609.5, + "besides" : 70524.9, + "method" : 70513.0, + "excellent" : 70452.9, + "confidence" : 70414.1, + "marked" : 70264.6, + "'em" : 70256.7, + "jesus" : 70228.2, + "exactly" : 70213.1, + "importance" : 70066.8, + "finally" : 70018.5, + "bill" : 69973.4, + "vast" : 69861.1, + "prove" : 69854.0, + "fancy" : 69771.7, + "quick" : 69761.4, + "yes" : 69731.3, + "sought" : 69666.5, + "prevent" : 69664.1, + "neck" : 69634.8, + "hearts" : 69628.5, + "liberty" : 69603.2, + "interesting" : 69601.6, + "sides" : 69594.5, + "legal" : 69532.8, + "gentlemen" : 69507.5, + "dry" : 69442.6, + "serve" : 69414.9, + "aside" : 69368.2, + "pure" : 69287.5, + "concerning" : 69279.6, + "forgotten" : 69212.4, + "lose" : 69115.8, + "powers" : 69073.1, + "possessed" : 68995.6, + "thrown" : 68931.5, + "evidence" : 68904.6, + "distant" : 68882.5, + "michael" : 68874.5, + "progress" : 68830.2, + "similar" : 68603.2, + "narrow" : 68505.9, + "altogether" : 68471.9, + "building" : 68394.3, + "page" : 68234.5, + "particularly" : 68193.4, + "knowing" : 68050.2, + "weeks" : 67942.6, + "settled" : 67880.1, + "holding" : 67815.2, + "mountain" : 67762.2, + "search" : 67660.2, + "sad" : 67596.1, + "sin" : 67589.7, + "lies" : 67551.0, + "proud" : 67492.4, + "pieces" : 67423.6, + "clearly" : 67318.4, + "price" : 67277.2, + "ships" : 67259.0, + "thirty" : 67229.0, + "sick" : 67152.2, + "honest" : 67088.2, + "shut" : 67063.6, + "talked" : 66998.0, + "bank" : 66981.4, + "fate" : 66946.5, + "dropped" : 66940.2, + "judgment" : 66827.9, + "conditions" : 66803.4, + "king's" : 66590.5, + "accept" : 66498.8, + "hills" : 66475.8, + "removed" : 66429.1, + "forest" : 66263.0, + "measure" : 66262.2, + "species" : 66220.3, + "seek" : 66141.2, + "highest" : 66066.0, + "otherwise" : 66054.9, + "stream" : 66003.5, + "honor" : 65994.0, + "carefully" : 65960.0, + "obtained" : 65884.1, + "ear" : 65819.2, + "bread" : 65708.4, + "bottom" : 65645.1, + "additional" : 65640.4, + "presented" : 65615.9, + "aid" : 65581.1, + "fingers" : 65564.4, + "q" : 65556.5, + "remembered" : 65554.2, + "choose" : 65396.7, + "agreed" : 65284.4, + "animal" : 65255.1, + "events" : 65118.2, + "there's" : 65017.8, + "fully" : 64982.2, + "delight" : 64971.9, + "rights" : 64836.6, + "amount" : 64720.3, + "obtain" : 64706.1, + "tax" : 64658.6, + "servants" : 64642.0, + "sons" : 64592.9, + "cross" : 64403.8, + "shoulders" : 64397.5, + "thick" : 64364.3, + "points" : 64311.3, + "stranger" : 64270.9, + "woods" : 64227.4, + "facts" : 64155.4, + "dare" : 64055.0, + "grow" : 64005.1, + "creature" : 63988.5, + "hung" : 63988.5, + "rain" : 63905.4, + "false" : 63861.1, + "tall" : 63854.8, + "gate" : 63851.6, + "nations" : 63793.9, + "created" : 63774.9, + "refused" : 63774.9, + "quietly" : 63767.8, + "surface" : 63717.1, + "freely" : 63711.6, + "holy" : 63709.2, + "streets" : 63695.0, + "blow" : 63577.9, + "july" : 63558.1, + "regarded" : 63536.0, + "fashion" : 63526.5, + "report" : 63492.5, + "coast" : 63479.8, + "daily" : 63422.8, + "file" : 63420.5, + "shoulder" : 63340.6, + "surprised" : 63312.9, + "faces" : 63252.7, + "succeeded" : 63179.2, + "birds" : 63162.6, + "distribution" : 63155.4, + "royal" : 63124.6, + "song" : 63090.6, + "wealth" : 63067.6, + "comfort" : 63064.5, + "failed" : 63013.0, + "freedom" : 62979.8, + "peculiar" : 62951.3, + "anyone" : 62941.8, + "advance" : 62895.1, + "gentle" : 62856.4, + "surely" : 62831.1, + "animals" : 62815.2, + "waited" : 62808.1, + "secure" : 62770.9, + "desired" : 62740.1, + "grass" : 62726.6, + "touched" : 62649.9, + "occupied" : 62645.1, + "draw" : 62587.4, + "stage" : 62536.0, + "portion" : 62479.8, + "expressed" : 62460.0, + "opening" : 62316.0, + "june" : 62288.3, + "spirits" : 62147.5, + "fish" : 62138.0, + "tongue" : 62119.8, + "capital" : 62114.3, + "angry" : 61966.4, + "growing" : 61954.5, + "served" : 61954.5, + "carriage" : 61920.5, + "weather" : 61892.8, + "breast" : 61786.0, + "presently" : 61503.5, + "snow" : 61384.9, + "david" : 61377.8, + "papers" : 61338.2, + "necessity" : 61325.5, + "practice" : 61313.7, + "claim" : 61248.0, + "hast" : 61220.3, + "education" : 61160.2, + "sharp" : 61096.9, + "prince" : 60998.8, + "permitted" : 60987.7, + "group" : 60983.0, + "enemies" : 60982.2, + "robert" : 60967.2, + "played" : 60926.0, + "throughout" : 60896.7, + "pity" : 60858.0, + "expense" : 60836.6, + "yours" : 60770.2, + "million" : 60752.8, + "add" : 60647.5, + "pray" : 60553.4, + "taught" : 60553.4, + "explained" : 60525.7, + "tired" : 60525.7, + "leading" : 60475.9, + "kill" : 60435.5, + "shadow" : 60402.3, + "companion" : 60384.9, + "weight" : 60339.8, + "mass" : 60298.6, + "established" : 60226.7, + "suffered" : 60210.0, + "gray" : 60200.5, + "brave" : 60085.0, + "thin" : 60068.4, + "satisfied" : 60044.7, + "check" : 60002.0, + "virtue" : 59979.0, + "golden" : 59969.5, + "numerous" : 59925.2, + "frequently" : 59873.8, + "famous" : 59843.0, + "telling" : 59831.9, + "powerful" : 59634.9, + "alive" : 59632.5, + "waters" : 59569.2, + "national" : 59565.3, + "weak" : 59510.7, + "divine" : 59479.8, + "material" : 59413.4, + "principal" : 59406.2, + "gathered" : 59324.8, + "suggested" : 59261.5, + "frank" : 59180.8, + "valley" : 59172.1, + "guess" : 59171.3, + "finding" : 59160.2, + "yellow" : 59051.8, + "heat" : 58979.8, + "remains" : 58941.1, + "bent" : 58939.5, + "seized" : 58899.1, + "guard" : 58892.8, + "equally" : 58840.6, + "naturally" : 58811.3, + "box" : 58805.8, + "remarkable" : 58805.8, + "gods" : 58789.2, + "moon" : 58760.7, + "slight" : 58710.8, + "style" : 58699.8, + "pointed" : 58669.7, + "saved" : 58632.5, + "windows" : 58556.6, + "crossed" : 58551.8, + "louis" : 58498.8, + "pounds" : 58458.5, + "ain't" : 58451.3, + "evidently" : 58378.6, + "principle" : 58369.9, + "immediate" : 58268.6, + "willing" : 58218.0, + "consequence" : 58195.8, + "richard" : 58188.7, + "principles" : 58148.3, + "characters" : 58140.4, + "paul" : 58106.4, + "season" : 58088.2, + "remarked" : 58020.2, + "science" : 57960.1, + "tender" : 57959.3, + "worked" : 57946.6, + "grown" : 57772.6, + "whispered" : 57721.1, + "interested" : 57714.8, + "quarter" : 57661.0, + "midst" : 57518.6, + "liked" : 57509.9, + "advanced" : 57495.7, + "apparently" : 57471.1, + "bore" : 57458.5, + "pwh" : 57456.9, + "active" : 57449.0, + "noticed" : 57389.6, + "aware" : 57388.9, + "thomas" : 57341.4, + "uncle" : 57326.4, + "list" : 57295.5, + "dangerous" : 57292.3, + "august" : 57283.6, + "calm" : 57251.2, + "genius" : 57225.1, + "sacred" : 57211.6, + "kingdom" : 57199.0, + "entire" : 57187.9, + "popular" : 57115.1, + "unknown" : 57040.8, + "nice" : 57038.4, + "habit" : 57035.2, + "spanish" : 56981.4, + "familiar" : 56835.1, + "reader" : 56832.7, + "published" : 56807.4, + "direct" : 56755.2, + "handsome" : 56748.8, + "you'll" : 56740.1, + "joined" : 56737.0, + "actually" : 56699.0, + "kings" : 56630.2, + "sd" : 56603.3, + "posted" : 56561.3, + "approach" : 56555.8, + "washington" : 56527.3, + "hearing" : 56509.9, + "needed" : 56455.3, + "increased" : 56113.5, + "walking" : 56094.6, + "twice" : 55893.6, + "throw" : 55850.1, + "intellectual" : 55849.3, + "appointed" : 55847.7, + "wisdom" : 55827.2, + "ceased" : 55810.5, + "truly" : 55776.5, + "numbers" : 55771.8, + "demanded" : 55718.0, + "priest" : 55667.3, + "wounded" : 55666.6, + "sorrow" : 55657.1, + "drive" : 55626.2, + "fault" : 55610.4, + "listened" : 55604.1, + "palace" : 55599.3, + "affair" : 55588.2, + "contact" : 55576.4, + "distinguished" : 55568.5, + "station" : 55551.0, + "beat" : 55452.9, + "distributed" : 55431.6, + "e" : 55405.5, + "listen" : 55400.7, + "italy" : 55327.9, + "fool" : 55324.0, + "becomes" : 55307.4, + "watching" : 55264.7, + "hurt" : 55227.5, + "wants" : 55209.3, + "express" : 55193.5, + "occurred" : 55186.3, + "favour" : 55161.8, + "height" : 55161.8, + "size" : 55123.0, + "edge" : 55074.8, + "subjects" : 55021.8, + "task" : 54999.6, + "follows" : 54945.8, + "interests" : 54938.7, + "nine" : 54922.9, + "sympathy" : 54921.3, + "burst" : 54920.5, + "putting" : 54835.9, + "dressed" : 54816.9, + "lifted" : 54796.3, + "hopes" : 54772.6, + "suffer" : 54764.7, + "noise" : 54731.4, + "smiling" : 54720.4, + "rode" : 54627.8, + "tells" : 54559.0, + "minds" : 54524.9, + "farther" : 54471.1, + "literature" : 54426.1, + "vessel" : 54407.9, + "affection" : 54381.0, + "suffering" : 54363.6, + "proceeded" : 54343.8, + "flesh" : 54333.5, + "advice" : 54172.9, + "grand" : 54172.9, + "carrying" : 54168.9, + "legs" : 54149.2, + "spain" : 54147.6, + "post" : 54054.2, + "collection" : 54031.3, + "empty" : 54020.2, + "rank" : 54009.9, + "storm" : 54009.1, + "god's" : 53975.9, + "imagine" : 53930.8, + "wore" : 53915.0, + "duties" : 53904.7, + "admitted" : 53846.2, + "countries" : 53834.3, + "pocket" : 53783.7, + "arrival" : 53776.5, + "imagination" : 53768.6, + "driven" : 53753.6, + "loud" : 53742.5, + "sentence" : 53699.0, + "lovely" : 53673.7, + "extraordinary" : 53589.0, + "november" : 53551.8, + "december" : 53541.6, + "happen" : 53527.3, + "absence" : 53502.8, + "breakfast" : 53488.6, + "population" : 53423.7, + "thank" : 53413.4, + "rules" : 53386.5, + "inhabitants" : 53168.1, + "series" : 53157.9, + "laughing" : 53113.6, + "address" : 53096.2, + "relief" : 53061.3, + "bird" : 52958.5, + "owner" : 52920.5, + "impression" : 52901.5, + "satisfaction" : 52896.8, + "coat" : 52869.9, + "prepare" : 52846.2, + "relations" : 52841.4, + "shape" : 52710.9, + "birth" : 52703.0, + "rapidly" : 52677.6, + "smoke" : 52676.9, + "january" : 52657.1, + "mother's" : 52657.1, + "machine" : 52618.3, + "content" : 52615.1, + "consideration" : 52606.4, + "accompanied" : 52581.1, + "regular" : 52519.4, + "moving" : 52512.3, + "stands" : 52512.3, + "wholly" : 52482.2, + "teeth" : 52449.0, + "busy" : 52407.1, + "treated" : 52378.6, + "burning" : 52322.4, + "shame" : 52312.9, + "quality" : 52292.4, + "bay" : 52212.5, + "discover" : 52201.4, + "inside" : 52123.1, + "brain" : 52105.7, + "soil" : 52100.9, + "completely" : 52050.3, + "message" : 52049.5, + "ring" : 52000.4, + "resolved" : 51981.4, + "calling" : 51950.6, + "phrase" : 51940.3, + "acts" : 51907.1, + "mention" : 51888.9, + "square" : 51832.7, + "pair" : 51818.5, + "won" : 51798.7, + "title" : 51777.3, + "understanding" : 51713.3, + "sunday" : 51687.9, + "fruit" : 51674.5, + "mad" : 51668.9, + "forces" : 51593.8, + "included" : 51591.4, + "tea" : 51547.1, + "rocks" : 51540.0, + "nearer" : 51456.1, + "slaves" : 51427.7, + "falling" : 51396.0, + "absolutely" : 51394.4, + "slow" : 51380.2, + "bearing" : 51315.3, + "mercy" : 51306.6, + "larger" : 51297.9, + "explain" : 51285.2, + "contain" : 51210.9, + "grief" : 51205.3, + "soldier" : 51200.6, + "wasn't" : 51135.7, + "countenance" : 51077.2, + "previous" : 51055.8, + "explanation" : 51050.3, + "welcome" : 51009.1, + "proposed" : 51006.8, + "prayer" : 50987.8, + "stars" : 50977.5, + "germany" : 50905.5, + "belief" : 50725.9, + "informed" : 50691.1, + "moments" : 50676.1, + "poetry" : 50673.7, + "constant" : 50650.8, + "buy" : 50619.9, + "final" : 50604.9, + "faithful" : 50587.5, + "ride" : 50551.9, + "policy" : 50464.8, + "supper" : 50460.9, + "drawing" : 50447.4, + "excitement" : 50435.6, + "dying" : 50335.1, + "demand" : 50257.6, + "fighting" : 50245.7, + "fields" : 50201.4, + "drove" : 50184.8, + "upper" : 50168.2, + "sum" : 50041.6, + "philip" : 49999.7, + "motion" : 49955.4, + "assistance" : 49929.2, + "forty" : 49903.1, + "april" : 49899.2, + "stones" : 49887.3, + "edward" : 49840.6, + "fees" : 49820.1, + "kindly" : 49809.8, + "dignity" : 49803.5, + "catch" : 49718.8, + "october" : 49715.6, + "seated" : 49654.7, + "knees" : 49642.1, + "amongst" : 49628.6, + "current" : 49580.4, + "sending" : 49578.8, + "parties" : 49574.0, + "objects" : 49571.7, + "gained" : 49550.3, + "bitter" : 49544.8, + "possibly" : 49520.2, + "slave" : 49489.4, + "separate" : 49480.7, + "loose" : 49427.7, + "text" : 49423.7, + "receiving" : 49391.3, + "worst" : 49369.1, + "sold" : 49339.1, + "don" : 49305.0, + "credit" : 49262.3, + "chosen" : 49225.9, + "hoped" : 49174.5, + "printed" : 49171.3, + "terror" : 49161.1, + "features" : 49124.7, + "fond" : 49101.7, + "control" : 49074.0, + "capable" : 49070.1, + "fifteen" : 49002.8, + "doesn't" : 48968.0, + "firm" : 48962.5, + "superior" : 48948.2, + "cruel" : 48839.1, + "spiritual" : 48809.8, + "harry" : 48809.0, + "splendid" : 48752.0, + "proof" : 48702.2, + "pressed" : 48635.7, + "sooner" : 48619.1, + "join" : 48614.4, + "process" : 48561.4, + "crime" : 48528.9, + "dust" : 48502.8, + "instantly" : 48494.9, + "lands" : 48475.9, + "relation" : 48472.8, + "doors" : 48413.4, + "concerned" : 48411.1, + "deeply" : 48404.7, + "practical" : 48402.4, + "colour" : 48371.5, + "sing" : 48331.2, + "destroy" : 48261.5, + "anger" : 48238.6, + "distributing" : 48223.6, + "results" : 48202.2, + "increase" : 48197.5, + "reasons" : 48062.2, + "nose" : 48059.8, + "friendly" : 48021.0, + "entrance" : 47983.8, + "rooms" : 47962.5, + "admit" : 47956.2, + "supply" : 47924.5, + "clean" : 47921.3, + "useful" : 47849.4, + "yesterday" : 47824.0, + "delicate" : 47818.5, + "fail" : 47778.1, + "continue" : 47737.8, + "remove" : 47699.0, + "addressed" : 47673.7, + "choice" : 47671.3, + "huge" : 47619.9, + "needs" : 47619.1, + "wear" : 47608.8, + "blind" : 47599.4, + "unable" : 47589.1, + "cover" : 47574.0, + "double" : 47550.3, + "victory" : 47530.5, + "dozen" : 47519.4, + "constantly" : 47490.2, + "level" : 47487.8, + "india" : 47392.1, + "release" : 47389.7, + "rough" : 47332.7, + "ended" : 47325.6, + "shows" : 47324.0, + "fly" : 47316.9, + "praise" : 47267.9, + "devil" : 47254.4, + "ahead" : 47194.3, + "smith" : 47190.3, + "connected" : 47128.6, + "degrees" : 47110.4, + "gain" : 47094.6, + "addition" : 47084.3, + "committed" : 47063.0, + "chamber" : 47055.8, + "notes" : 47051.9, + "italian" : 47021.8, + "gradually" : 46902.4, + "acquaintance" : 46877.8, + "bought" : 46854.1, + "souls" : 46847.0, + "mission" : 46837.5, + "sacrifice" : 46810.6, + "cities" : 46797.1, + "mistake" : 46768.7, + "exercise" : 46752.0, + "conscience" : 46747.3, + "based" : 46717.2, + "car" : 46691.1, + "buried" : 46646.8, + "theory" : 46621.5, + "commanded" : 46561.4, + "nobody" : 46560.6, + "minister" : 46464.9, + "closely" : 46446.7, + "energy" : 46407.9, + "dick" : 46399.2, + "bare" : 46386.5, + "fought" : 46382.6, + "partly" : 46369.9, + "mistress" : 46298.7, + "hate" : 46287.7, + "arose" : 46271.0, + "playing" : 46253.6, + "color" : 46252.1, + "lake" : 46240.2, + "safety" : 46193.5, + "provisions" : 46145.2, + "description" : 46112.0, + "asleep" : 46108.9, + "centre" : 46093.8, + "faint" : 46085.1, + "thinks" : 46053.5, + "parents" : 46044.8, + "escaped" : 46024.2, + "careful" : 45995.7, + "enjoy" : 45987.8, + "drop" : 45918.2, + "brilliant" : 45799.5, + "brief" : 45788.4, + "bringing" : 45758.4, + "worship" : 45744.1, + "goods" : 45735.4, + "tale" : 45733.1, + "skin" : 45696.7, + "roof" : 45695.9, + "grey" : 45689.6, + "highly" : 45680.1, + "crown" : 45638.1, + "castle" : 45581.2, + "excited" : 45567.7, + "throne" : 45558.2, + "stated" : 45524.2, + "despair" : 45463.3, + "ease" : 45457.8, + "attached" : 45447.5, + "total" : 45438.8, + "kindness" : 45424.5, + "mile" : 45375.5, + "citizens" : 45309.8, + "circle" : 45281.3, + "dull" : 45281.3, + "extreme" : 45269.5, + "clouds" : 45264.7, + "figures" : 45251.3, + "intention" : 45248.1, + "prison" : 45241.0, + "term" : 45215.7, + "assured" : 45181.6, + "hidden" : 45123.9, + "thoroughly" : 45123.1, + "cup" : 45107.3, + "member" : 45100.2, + "civil" : 44958.5, + "apply" : 44943.5, + "labor" : 44925.3, + "everywhere" : 44877.1, + "intelligence" : 44856.5, + "strike" : 44825.6, + "fairly" : 44822.5, + "comply" : 44817.7, + "fellows" : 44813.0, + "haven't" : 44742.6, + "event" : 44675.3, + "gently" : 44659.5, + "connection" : 44629.4, + "protection" : 44625.5, + "conscious" : 44568.5, + "edition" : 44551.1, + "directed" : 44487.0, + "pulled" : 44473.6, + "flight" : 44454.6, + "evident" : 44453.8, + "surrounded" : 44441.1, + "wishes" : 44411.9, + "yards" : 44411.9, + "voices" : 44401.6, + "weary" : 44397.6, + "couple" : 44368.4, + "variety" : 44354.1, + "whilst" : 44316.1, + "volume" : 44293.2, + "details" : 44279.0, + "older" : 44260.0, + "requirements" : 44256.0, + "custom" : 44253.6, + "apart" : 44248.1, + "bow" : 44208.5, + "awful" : 44175.3, + "everybody" : 44135.8, + "labour" : 44127.9, + "asking" : 44097.8, + "lover" : 44066.9, + "showing" : 44052.7, + "introduced" : 44021.8, + "suit" : 43998.9, + "becoming" : 43985.4, + "composed" : 43982.3, + "plans" : 43978.3, + "rendered" : 43966.5, + "pictures" : 43960.1, + "lest" : 43949.8, + "volunteers" : 43949.8, + "singing" : 43942.7, + "eager" : 43919.0, + "precious" : 43892.9, + "paused" : 43885.0, + "require" : 43847.0, + "meat" : 43838.3, + "whenever" : 43837.5, + "milk" : 43784.5, + "dogs" : 43682.4, + "successful" : 43611.2, + "plants" : 43609.7, + "vision" : 43605.7, + "rare" : 43603.3, + "granted" : 43561.4, + "raise" : 43533.7, + "egypt" : 43529.8, + "manners" : 43503.6, + "cousin" : 43494.9, + "you've" : 43454.6, + "development" : 43431.7, + "arthur" : 43405.5, + "obs" : 43402.4, + "cool" : 43305.1, + "trial" : 43233.9, + "learning" : 43177.7, + "approached" : 43176.9, + "bridge" : 43143.7, + "abroad" : 43081.2, + "devoted" : 43071.7, + "paying" : 43055.9, + "literary" : 43044.0, + "writer" : 42938.0, + "fn" : 42935.6, + "israel" : 42903.2, + "disappeared" : 42899.2, + "interrupted" : 42888.9, + "stock" : 42862.8, + "readers" : 42829.6, + "dreadful" : 42801.9, + "female" : 42767.9, + "protect" : 42699.1, + "accustomed" : 42696.7, + "virginia" : 42695.1, + "type" : 42657.9, + "recognized" : 42656.3, + "salt" : 42649.2, + "destroyed" : 42641.3, + "signs" : 42635.0, + "innocent" : 42613.6, + "temper" : 42601.8, + "plenty" : 42597.0, + "pope" : 42596.2, + "avoid" : 42559.0, + "hurried" : 42480.7, + "represented" : 42461.7, + "favor" : 42434.8, + "mental" : 42347.0, + "attitude" : 42329.6, + "returning" : 42271.9, + "admiration" : 42255.2, + "brothers" : 42245.0, + "anxiety" : 42233.9, + "queen" : 42223.6, + "teach" : 42216.5, + "count" : 42207.8, + "curiosity" : 42203.8, + "solemn" : 42188.8, + "causes" : 42152.4, + "vessels" : 42102.5, + "compelled" : 42082.0, + "dance" : 42075.7, + "hotel" : 42072.5, + "wicked" : 42017.9, + "fled" : 41992.6, + "kissed" : 41987.0, + "guns" : 41921.4, + "fill" : 41911.9, + "visible" : 41884.2, + "younger" : 41825.7, + "guide" : 41750.5, + "earnest" : 41745.7, + "actual" : 41729.1, + "companions" : 41728.3, + "prisoner" : 41725.2, + "miserable" : 41704.6, + "lad" : 41692.0, + "harm" : 41617.6, + "views" : 41499.7, + "irish" : 41490.2, + "utterly" : 41479.9, + "ends" : 41431.7, + "shop" : 41349.4, + "stairs" : 41339.1, + "pardon" : 41335.1, + "gay" : 41319.3, + "beg" : 41312.2, + "seldom" : 41303.5, + "kinds" : 41287.7, + "record" : 41281.4, + "fat" : 41278.2, + "sand" : 41232.3, + "violent" : 41203.8, + "branches" : 41195.1, + "inquired" : 41185.6, + "iv" : 41152.4, + "september" : 41145.3, + "worn" : 41117.6, + "ireland" : 41105.7, + "flat" : 41104.1, + "departure" : 41101.0, + "delivered" : 41099.4, + "gift" : 41080.4, + "ruin" : 41073.3, + "skill" : 41029.8, + "cattle" : 40983.1, + "equipment" : 40935.6, + "temple" : 40926.1, + "calls" : 40860.5, + "earlier" : 40843.1, + "license" : 40827.2, + "visited" : 40818.5, + "en" : 40812.2, + "consent" : 40810.6, + "sufficiently" : 40787.7, + "natives" : 40772.7, + "wound" : 40752.1, + "laughter" : 40713.3, + "contained" : 40691.2, + "perceived" : 40691.2, + "scattered" : 40669.8, + "whence" : 40661.1, + "rushed" : 40657.9, + "chiefly" : 40639.0, + "bold" : 40614.4, + "anywhere" : 40597.0, + "witness" : 40545.6, + "foolish" : 40523.4, + "helped" : 40487.8, + "kitchen" : 40483.9, + "sell" : 40483.9, + "anybody" : 40479.1, + "self" : 40477.6, + "extremely" : 40476.0, + "treatment" : 40449.1, + "throat" : 40414.3, + "dreams" : 40383.4, + "patient" : 40380.2, + "speed" : 40372.3, + "growth" : 40351.0, + "quantity" : 40347.8, + "latin" : 40314.6, + "immense" : 40278.2, + "conclusion" : 40262.4, + "computer" : 40222.0, + "affected" : 40214.1, + "severe" : 40200.7, + "excuse" : 40180.9, + "triumph" : 40169.8, + "origin" : 40165.1, + "joseph" : 40161.1, + "slept" : 40160.3, + "eternal" : 40157.1, + "thine" : 40157.1, + "audience" : 40127.9, + "pages" : 40117.6, + "sounds" : 40089.1, + "swift" : 40080.4, + "limited" : 40060.6, + "wings" : 40014.0, + "stepped" : 39957.0, + "services" : 39933.3, + "library" : 39915.9, + "remaining" : 39911.9, + "containing" : 39908.7, + "base" : 39900.8, + "confusion" : 39871.6, + "win" : 39858.9, + "maid" : 39847.8, + "charming" : 39846.2, + "editions" : 39843.1, + "attended" : 39842.3, + "softly" : 39831.2, + "reality" : 39813.0, + "performed" : 39808.3, + "glorious" : 39774.2, + "likewise" : 39757.6, + "site" : 39722.8, + "sail" : 39713.3, + "frightened" : 39697.5, + "acquainted" : 39660.3, + "unhappy" : 39660.3, + "feared" : 39591.5, + "article" : 39586.7, + "prisoners" : 39576.5, + "store" : 39566.2, + "adopted" : 39561.4, + "shalt" : 39534.5, + "remark" : 39519.5, + "cook" : 39479.1, + "thousands" : 39463.3, + "pause" : 39426.1, + "inclined" : 39411.1, + "convinced" : 39401.6, + "band" : 39397.7, + "valuable" : 39324.1, + "hence" : 39316.2, + "desert" : 39278.2, + "effects" : 39257.6, + "kiss" : 39251.3, + "plant" : 39201.5, + "ice" : 39198.3, + "ball" : 39180.9, + "stick" : 39108.1, + "absolute" : 39093.1, + "readily" : 39085.2, + "behold" : 39051.1, + "fierce" : 39048.0, + "argument" : 38991.0, + "observe" : 38990.2, + "blessed" : 38967.3, + "bosom" : 38956.2, + "rage" : 38949.1, + "striking" : 38941.2, + "discovery" : 38883.4, + "creatures" : 38875.5, + "shouted" : 38859.7, + "guilty" : 38836.7, + "related" : 38810.6, + "setting" : 38686.4, + "forgot" : 38668.2, + "punishment" : 38650.8, + "gun" : 38632.6, + "slightly" : 38629.5, + "articles" : 38575.7, + "police" : 38557.5, + "mysterious" : 38550.4, + "extended" : 38536.1, + "confess" : 38535.3, + "shade" : 38527.4, + "murder" : 38525.0, + "emotion" : 38510.0, + "destruction" : 38505.3, + "wondered" : 38474.4, + "increasing" : 38463.3, + "hide" : 38423.8, + "expedition" : 38402.4, + "horror" : 38361.3, + "local" : 38355.7, + "expenses" : 38353.4, + "ignorant" : 38321.7, + "doctrine" : 38303.5, + "generous" : 38301.1, + "range" : 38284.5, + "host" : 38240.2, + "wet" : 38201.5, + "cloud" : 38187.2, + "mystery" : 38185.6, + "ed" : 38165.9, + "waste" : 38164.3, + "changes" : 38156.4, + "possess" : 38151.6, + "consciousness" : 38142.1, + "february" : 38131.1, + "trembling" : 38110.5, + "disease" : 38039.3, + "formerly" : 38037.7, + "spend" : 38033.7, + "production" : 38021.1, + "source" : 38004.5, + "mankind" : 37996.6, + "universal" : 37991.8, + "deck" : 37965.7, + "sees" : 37923.0, + "habits" : 37913.5, + "estate" : 37878.7, + "aunt" : 37832.8, + "reign" : 37816.2, + "humble" : 37795.6, + "compliance" : 37787.7, + "delay" : 37771.1, + "shining" : 37764.0, + "reported" : 37740.2, + "hers" : 37736.3, + "unfortunate" : 37731.5, + "midnight" : 37703.8, + "listening" : 37700.7, + "flower" : 37688.8, + "hero" : 37673.8, + "accomplished" : 37666.7, + "doth" : 37665.1, + "classes" : 37658.7, + "thanks" : 37642.1, + "banks" : 37623.1, + "philosophy" : 37611.3, + "belong" : 37593.9, + "finger" : 37580.4, + "comfortable" : 37542.5, + "market" : 37529.0, + "cap" : 37514.8, + "waves" : 37462.5, + "woman's" : 37437.2, + "glanced" : 37392.9, + "troubled" : 37376.3, + "difficulties" : 37338.3, + "picked" : 37330.4, + "european" : 37324.9, + "purposes" : 37314.6, + "somewhere" : 37273.5, + "delighted" : 37264.0, + "pushed" : 37259.2, + "press" : 37241.8, + "household" : 37219.7, + "fleet" : 37214.9, + "baby" : 37208.6, + "region" : 37161.9, + "lately" : 37158.7, + "uttered" : 37142.1, + "exact" : 37133.4, + "image" : 37131.9, + "ages" : 37127.1, + "murmured" : 37113.7, + "melancholy" : 37112.9, + "suspicion" : 37107.3, + "bowed" : 37089.9, + "refuse" : 37051.9, + "elizabeth" : 37040.9, + "staff" : 37036.1, + "liability" : 37032.2, + "we'll" : 37019.5, + "enjoyed" : 36985.5, + "stretched" : 36973.6, + "gaze" : 36916.7, + "belonged" : 36888.2, + "ashamed" : 36880.3, + "reward" : 36873.2, + "meal" : 36778.2, + "blame" : 36775.0, + "nodded" : 36767.1, + "status" : 36747.4, + "opinions" : 36725.2, + "indicate" : 36699.1, + "poem" : 36654.0, + "savage" : 36642.9, + "arise" : 36635.0, + "voyage" : 36628.7, + "misery" : 36563.8, + "guests" : 36562.2, + "painted" : 36515.6, + "attend" : 36513.2, + "afford" : 36482.3, + "donate" : 36471.3, + "job" : 36450.7, + "proceed" : 36439.6, + "loves" : 36414.3, + "forehead" : 36382.6, + "regret" : 36381.9, + "plainly" : 36355.7, + "risk" : 36336.8, + "ad" : 36312.2, + "lighted" : 36312.2, + "angel" : 36288.5, + "rapid" : 36285.3, + "distinct" : 36267.9, + "doubtless" : 36256.1, + "properly" : 36256.1, + "wit" : 36238.7, + "fame" : 36237.9, + "singular" : 36221.3, + "error" : 36182.5, + "utmost" : 36158.0, + "methods" : 36155.6, + "reputation" : 36155.6, + "appeal" : 36123.2, + "she's" : 36120.8, + "w" : 36088.3, + "strongly" : 36080.4, + "margaret" : 36006.9, + "lack" : 35996.6, + "breaking" : 35977.6, + "dawn" : 35959.4, + "violence" : 35957.8, + "fatal" : 35917.5, + "render" : 35896.1, + "career" : 35881.1, + "design" : 35854.2, + "displayed" : 35848.6, + "gets" : 35843.1, + "commercial" : 35830.4, + "forgive" : 35809.9, + "lights" : 35807.5, + "agreeable" : 35805.1, + "suggestion" : 35777.4, + "utter" : 35777.4, + "sheep" : 35725.2, + "resolution" : 35703.9, + "spare" : 35671.4, + "patience" : 35631.9, + "domestic" : 35618.4, + "concluded" : 35542.5, + "'tis" : 35536.9, + "farm" : 35520.3, + "reference" : 35509.2, + "chinese" : 35506.1, + "exist" : 35494.2, + "corn" : 35491.8, + "approaching" : 35449.1, + "alike" : 35448.3, + "mounted" : 35384.2, + "jane" : 35352.6, + "issue" : 35310.7, + "key" : 35281.4, + "providing" : 35281.4, + "majority" : 35276.6, + "measures" : 35270.3, + "towns" : 35240.2, + "flame" : 35233.1, + "boston" : 35180.9, + "dared" : 35177.7, + "ignorance" : 35152.4, + "reduced" : 35122.4, + "occasionally" : 35100.2, + "y" : 35094.7, + "weakness" : 35090.7, + "furnished" : 35089.1, + "china" : 35058.3, + "priests" : 35025.1, + "flying" : 34986.3, + "cloth" : 34966.5, + "gazed" : 34953.9, + "profit" : 34932.5, + "fourth" : 34923.8, + "bell" : 34920.6, + "hitherto" : 34911.1, + "benefit" : 34854.2, + "movements" : 34847.1, + "eagerly" : 34842.3, + "acted" : 34841.5, + "urged" : 34841.5, + "ascii" : 34791.7, + "disposed" : 34790.9, + "electronically" : 34761.6, + "atmosphere" : 34748.2, + "chapter" : 34699.9, + "begged" : 34626.3, + "helen" : 34619.2, + "hole" : 34616.8, + "invited" : 34593.1, + "borne" : 34548.8, + "departed" : 34546.4, + "catholic" : 34522.7, + "files" : 34514.0, + "reasonable" : 34512.4, + "sugar" : 34501.3, + "replacement" : 34483.9, + "sigh" : 34454.7, + "humanity" : 34419.1, + "thrust" : 34395.3, + "frame" : 34362.9, + "opposition" : 34350.2, + "disk" : 34347.1, + "haste" : 34328.9, + "lonely" : 34328.1, + "artist" : 34290.1, + "knight" : 34282.2, + "quarters" : 34277.4, + "charm" : 34223.6, + "substance" : 34163.5, + "rolled" : 34154.0, + "email" : 34145.3, + "flung" : 34144.5, + "celebrated" : 34143.7, + "division" : 34136.6, + "slavery" : 34114.5, + "verse" : 34107.3, + "decision" : 34067.8, + "probable" : 34063.8, + "painful" : 34042.5, + "governor" : 34023.5, + "forever" : 33999.7, + "turns" : 33988.7, + "branch" : 33961.0, + "ocean" : 33958.6, + "rear" : 33947.5, + "leader" : 33937.2, + "delightful" : 33915.1, + "stared" : 33876.3, + "boats" : 33808.3, + "keen" : 33788.5, + "disposition" : 33779.8, + "senses" : 33722.1, + "occasions" : 33700.7, + "readable" : 33692.8, + "beloved" : 33687.3, + "inches" : 33684.1, + "bones" : 33679.3, + "enthusiasm" : 33648.5, + "materials" : 33589.9, + "luck" : 33588.4, + "derived" : 33575.7, + "managed" : 33479.2, + "community" : 33464.9, + "apparent" : 33464.2, + "preserved" : 33454.7, + "magnificent" : 33434.9, + "hurry" : 33396.1, + "scheme" : 33393.7, + "oil" : 33392.2, + "thence" : 33382.7, + "reaching" : 33374.8, + "dim" : 33362.1, + "wretched" : 33290.1, + "hanging" : 33275.9, + "pipe" : 33218.1, + "useless" : 33215.7, + "nevertheless" : 33203.1, + "print" : 33203.1, + "smooth" : 33167.5, + "solid" : 33148.5, + "pursued" : 33135.0, + "necessarily" : 33108.1, + "build" : 33084.4, + "attempted" : 33080.5, + "centuries" : 33059.9, + "eggs" : 33059.9, + "equivalent" : 33033.8, + "hastily" : 33032.2, + "burned" : 33008.5, + "you'd" : 33008.5, + "recent" : 33000.5, + "oh" : 32957.0, + "travel" : 32951.5, + "cries" : 32925.4, + "noon" : 32919.9, + "crying" : 32901.7, + "generations" : 32858.9, + "located" : 32835.2, + "cabin" : 32809.1, + "announcement" : 32782.2, + "britain" : 32752.9, + "compared" : 32731.6, + "handed" : 32720.5, + "cease" : 32714.2, + "smaller" : 32668.3, + "circumstance" : 32666.7, + "tent" : 32665.1, + "frequent" : 32616.8, + "alarm" : 32602.6, + "nervous" : 32602.6, + "beast" : 32586.8, + "what's" : 32580.5, + "aloud" : 32565.4, + "independent" : 32519.5, + "gates" : 32509.3, + "distinction" : 32502.9, + "essential" : 32487.9, + "observation" : 32472.9, + "stronger" : 32455.5, + "recovered" : 32450.7, + "belonging" : 32404.8, + "loving" : 32402.4, + "masters" : 32388.2, + "writers" : 32341.5, + "cf." : 32326.5, + "permanent" : 32324.9, + "mortal" : 32284.6, + "stern" : 32284.6, + "gratitude" : 32278.2, + "preserve" : 32248.2, + "burden" : 32242.6, + "aspect" : 32240.3, + "millions" : 32199.1, + "merry" : 32182.5, + "knife" : 32177.8, + "dread" : 32133.5, + "clever" : 32114.5, + "applicable" : 32052.0, + "district" : 32050.4, + "shadows" : 32038.5, + "jim" : 32031.4, + "silk" : 32029.8, + "failure" : 32022.7, + "links" : 32009.3, + "cent" : 31995.0, + "sentiment" : 31990.3, + "amid" : 31980.0, + "profits" : 31968.9, + "agent" : 31949.1, + "finds" : 31934.9, + "russia" : 31928.6, + "bade" : 31920.6, + "russian" : 31857.4, + "desperate" : 31847.9, + "union" : 31834.4, + "imagined" : 31804.4, + "contempt" : 31802.0, + "raising" : 31786.2, + "lords" : 31775.1, + "hell" : 31770.3, + "separated" : 31752.1, + "grant" : 31743.4, + "seriously" : 31736.3, + "tribes" : 31726.8, + "hit" : 31725.2, + "enormous" : 31700.7, + "defective" : 31696.0, + "conviction" : 31688.8, + "secured" : 31688.8, + "mixed" : 31679.4, + "insisted" : 31661.2, + "wooden" : 31632.7, + "prefer" : 31621.6, + "prayers" : 31606.6, + "fever" : 31586.8, + "selected" : 31568.6, + "daughters" : 31553.6, + "treat" : 31550.4, + "warning" : 31522.7, + "flew" : 31518.0, + "speaks" : 31489.5, + "developed" : 31472.9, + "impulse" : 31472.9, + "slipped" : 31472.1, + "ours" : 31465.0, + "johnson" : 31408.8, + "mistaken" : 31390.6, + "damages" : 31382.7, + "ambition" : 31356.6, + "resumed" : 31351.8, + "christmas" : 31347.9, + "yield" : 31347.1, + "ideal" : 31343.1, + "schools" : 31335.2, + "confirmed" : 31324.1, + "descended" : 31322.5, + "rush" : 31290.9, + "falls" : 31268.0, + "deny" : 31254.5, + "calculated" : 31233.2, + "correct" : 31211.8, + "perform" : 31210.2, + "hadn't" : 31207.0, + "somehow" : 31184.9, + "accordingly" : 31181.7, + "stayed" : 31165.9, + "acquired" : 31144.5, + "counsel" : 31135.1, + "distress" : 31131.9, + "sins" : 31105.0, + "notion" : 31102.6, + "discussion" : 31093.9, + "constitution" : 31085.2, + "anne" : 31055.9, + "hundreds" : 31006.1, + "instrument" : 31001.3, + "firmly" : 30976.0, + "actions" : 30971.3, + "steady" : 30965.7, + "remarks" : 30933.3, + "empire" : 30925.4, + "elements" : 30909.6, + "idle" : 30891.4, + "pen" : 30885.8, + "entering" : 30872.4, + "online" : 30872.4, + "africa" : 30843.1, + "permit" : 30835.2, + "th'" : 30812.3, + "tide" : 30803.6, + "vol" : 30800.4, + "leaned" : 30798.8, + "college" : 30750.6, + "maintain" : 30737.9, + "sovereign" : 30706.3, + "tail" : 30699.9, + "generation" : 30695.2, + "crowded" : 30692.8, + "fears" : 30679.4, + "nights" : 30650.9, + "limitation" : 30643.8, + "tied" : 30625.6, + "horrible" : 30622.4, + "cat" : 30600.2, + "displaying" : 30545.7, + "port" : 30537.7, + "male" : 30525.9, + "experienced" : 30487.9, + "opposed" : 30485.5, + "treaty" : 30483.2, + "contents" : 30481.6, + "rested" : 30450.7, + "mode" : 30448.3, + "poured" : 30431.7, + "les" : 30400.1, + "occur" : 30399.3, + "seeking" : 30389.0, + "practically" : 30323.3, + "abandoned" : 30312.3, + "reports" : 30295.7, + "eleven" : 30294.1, + "sank" : 30292.5, + "begins" : 30288.5, + "founded" : 30249.0, + "brings" : 30244.2, + "trace" : 30238.7, + "instinct" : 30233.9, + "collected" : 30227.6, + "scotland" : 30202.3, + "characteristic" : 30186.5, + "chose" : 30184.1, + "cheerful" : 30177.0, + "tribe" : 30165.9, + "costs" : 30125.6, + "threatened" : 30120.8, + "arrangement" : 30110.5, + "western" : 30106.6, + "sang" : 30102.6, + "beings" : 30093.1, + "sam" : 30027.5, + "pressure" : 30019.6, + "politics" : 30010.8, + "sorts" : 29999.8, + "shelter" : 29992.7, + "rude" : 29987.1, + "scientific" : 29984.0, + "revealed" : 29965.0, + "winds" : 29930.9, + "riding" : 29915.1, + "scenes" : 29905.6, + "shake" : 29900.9, + "industry" : 29891.4, + "claims" : 29884.3, + "pp." : 29884.3, + "merit" : 29862.9, + "profession" : 29855.0, + "lamp" : 29830.5, + "interview" : 29817.0, + "territory" : 29813.1, + "sleeping" : 29806.7, + "sex" : 29802.8, + "coffee" : 29791.7, + "devotion" : 29791.7, + "thereof" : 29758.5, + "creation" : 29755.3, + "trail" : 29747.4, + "romans" : 29746.6, + "supported" : 29741.9, + "requires" : 29704.7, + "fathers" : 29703.9, + "prospect" : 29680.9, + "obey" : 29679.4, + "alexander" : 29667.5, + "shone" : 29662.0, + "operation" : 29642.2, + "northern" : 29598.7, + "nurse" : 29567.8, + "profound" : 29544.1, + "hungry" : 29534.6, + "scott" : 29470.5, + "sisters" : 29453.1, + "assure" : 29451.5, + "exceedingly" : 29445.2, + "match" : 29445.2, + "wrath" : 29406.4, + "continually" : 29405.6, + "rest." : 29404.0, + "gifts" : 29381.1, + "folly" : 29369.2, + "chain" : 29362.9, + "uniform" : 29359.0, + "debt" : 29346.3, + "teaching" : 29345.5, + "venture" : 29333.6, + "execution" : 29331.3, + "shoes" : 29324.1, + "mood" : 29319.4, + "crew" : 29317.0, + "perceive" : 29302.0, + "accounts" : 29288.5, + "eating" : 29284.6, + "multitude" : 29272.7, + "declare" : 29260.1, + "yard" : 29253.7, + "o'er" : 29218.1, + "astonishment" : 29188.1, + "version" : 29178.6, + "vague" : 29158.0, + "odd" : 29121.6, + "grateful" : 29103.4, + "nearest" : 29094.7, + "infinite" : 29093.9, + "elsewhere" : 29086.0, + "copying" : 29053.6, + "apartment" : 29045.7, + "activity" : 29037.0, + "wives" : 29022.7, + "parted" : 29014.0, + "security" : 29002.2, + "cared" : 28977.6, + "sensible" : 28974.5, + "owing" : 28972.1, + "martin" : 28942.0, + "saturday" : 28923.8, + "cottage" : 28919.1, + "jews" : 28880.3, + "leaning" : 28852.6, + "capacity" : 28840.8, + "joe" : 28833.6, + "settle" : 28821.0, + "referred" : 28805.2, + "francis" : 28802.8, + "holder" : 28802.0, + "involved" : 28795.7, + "sunshine" : 28794.1, + "dutch" : 28790.1, + "council" : 28741.1, + "princes" : 28733.2, + "ate" : 28730.0, + "examination" : 28722.1, + "steel" : 28720.5, + "strangers" : 28717.3, + "beheld" : 28689.7, + "test" : 28684.1, + "noted" : 28678.6, + "slightest" : 28678.6, + "widow" : 28660.4, + "charity" : 28623.2, + "realized" : 28608.2, + "element" : 28584.4, + "shed" : 28565.4, + "errors" : 28560.7, + "communication" : 28547.2, + "reflection" : 28544.9, + "attacked" : 28530.6, + "organization" : 28527.5, + "maintained" : 28505.3, + "restored" : 28491.1, + "folks" : 28478.4, + "concealed" : 28468.1, + "accordance" : 28450.7, + "heavens" : 28450.7, + "star" : 28433.3, + "examined" : 28407.2, + "deeds" : 28369.2, + "wordforms" : 28357.4, + "somebody" : 28352.6, + "incident" : 28345.5, + "oath" : 28324.1, + "guest" : 28321.0, + "bar" : 28297.3, + "row" : 28295.7, + "poverty" : 28267.2, + "bottle" : 28240.3, + "prevented" : 28237.9, + "bless" : 28226.8, + "stir" : 28214.2, + "intense" : 28207.1, + "completed" : 28162.0, + "quarrel" : 28149.3, + "touching" : 28146.9, + "inner" : 28146.1, + "available" : 28136.7, + "fix" : 28136.7, + "resistance" : 28131.9, + "unusual" : 28120.8, + "deed" : 28114.5, + "derive" : 28109.8, + "hollow" : 28106.6, + "suspected" : 28105.8, + "contains" : 28103.4, + "sighed" : 28101.8, + "province" : 28082.9, + "deserted" : 28082.1, + "establishment" : 28072.6, + "vote" : 28063.9, + "muttered" : 28043.3, + "thither" : 28028.3, + "oxford" : 28020.4, + "cavalry" : 28018.8, + "lofty" : 28017.2, + "endure" : 27969.7, + "succeed" : 27952.3, + "leg" : 27931.0, + "bid" : 27910.4, + "alice" : 27885.9, + "hated" : 27883.5, + "civilization" : 27878.7, + "u.s." : 27877.2, + "acting" : 27874.0, + "landed" : 27866.9, + "christians" : 27862.1, + "passions" : 27855.0, + "interior" : 27851.1, + "scarce" : 27839.2, + "lightly" : 27830.5, + "disturbed" : 27825.7, + "rev" : 27821.8, + "supreme" : 27819.4, + "hang" : 27813.9, + "notwithstanding" : 27812.3, + "shock" : 27777.5, + "exception" : 27775.9, + "offering" : 27766.4, + "display" : 27765.6, + "strain" : 27765.6, + "drank" : 27750.6, + "confined" : 27737.9, + "o" : 27727.6, + "exhausted" : 27713.4, + "poets" : 27693.6, + "sounded" : 27690.5, + "aim" : 27679.4, + "critical" : 27665.9, + "jerusalem" : 27662.0, + "directions" : 27660.4, + "negro" : 27637.4, + "fearful" : 27624.0, + "standard" : 27611.3, + "studied" : 27586.0, + "bag" : 27579.7, + "n" : 27563.9, + "buildings" : 27546.5, + "consequences" : 27544.1, + "commenced" : 27534.6, + "deeper" : 27506.1, + "repeat" : 27504.5, + "driving" : 27495.8, + "beasts" : 27484.8, + "track" : 27484.0, + "rid" : 27457.1, + "holds" : 27452.3, + "residence" : 27445.2, + "steadily" : 27404.1, + "intimate" : 27403.3, + "drinking" : 27385.1, + "swear" : 27380.3, + "treasure" : 27351.1, + "fun" : 27345.5, + "throwing" : 27340.0, + "apt" : 27321.0, + "enterprise" : 27321.0, + "queer" : 27302.0, + "seed" : 27296.5, + "tower" : 27285.4, + "runs" : 27276.7, + "defend" : 27261.7, + "favourite" : 27258.5, + "desires" : 27249.0, + "heavily" : 27238.7, + "assembled" : 27230.0, + "existed" : 27221.3, + "depends" : 27216.6, + "poems" : 27210.2, + "hesitated" : 27208.7, + "stuff" : 27203.9, + "section" : 27202.3, + "settlement" : 27201.5, + "staring" : 27199.2, + "sole" : 27191.2, + "roads" : 27188.9, + "plate" : 27174.6, + "mexico" : 27162.8, + "overcome" : 27160.4, + "pains" : 27159.6, + "performing" : 27141.4, + "dwell" : 27132.7, + "grounds" : 27110.5, + "taxes" : 27100.3, + "marble" : 27081.3, + "recently" : 27076.5, + "tones" : 27064.7, + "ability" : 27037.8, + "awake" : 27037.8, + "walter" : 27037.8, + "wave" : 27034.6, + "shaking" : 27018.0, + "folk" : 26996.6, + "possibility" : 26961.0, + "butter" : 26960.2, + "fury" : 26960.2, + "marched" : 26915.9, + "moses" : 26908.8, + "writes" : 26901.7, + "issued" : 26897.7, + "sailed" : 26858.2, + "instructions" : 26838.4, + "hatred" : 26834.4, + "pursuit" : 26832.9, + "pull" : 26815.5, + "furniture" : 26789.3, + "additions" : 26788.6, + "hid" : 26783.0, + "rope" : 26781.4, + "vi" : 26770.4, + "adventure" : 26767.2, + "royalty" : 26757.7, + "vanished" : 26753.7, + "arts" : 26748.2, + "elder" : 26727.6, + "signal" : 26715.8, + "wanting" : 26696.0, + "supplied" : 26694.4, + "feast" : 26689.7, + "safely" : 26650.1, + "burn" : 26627.2, + "describe" : 26605.8, + "references" : 26602.6, + "lesson" : 26592.4, + "annual" : 26582.9, + "card" : 26574.2, + "passes" : 26556.0, + "application" : 26542.5, + "intelligent" : 26535.4, + "county" : 26518.8, + "beaten" : 26513.2, + "presents" : 26511.7, + "format" : 26507.7, + "flow" : 26504.5, + "sixty" : 26488.7, + "scale" : 26480.8, + "damage" : 26479.2, + "marks" : 26478.4, + "obtaining" : 26468.9, + "moreover" : 26447.6, + "commerce" : 26403.3, + "startled" : 26381.1, + "southern" : 26375.6, + "consequently" : 26362.1, + "outer" : 26352.6, + "belongs" : 26350.3, + "ben" : 26346.3, + "wrought" : 26343.9, + "average" : 26342.4, + "naked" : 26341.6, + "conducted" : 26318.6, + "rivers" : 26306.8, + "songs" : 26299.6, + "obvious" : 26283.8, + "foundation" : 26269.6, + "concern" : 26239.5, + "ceremony" : 26230.0, + "magic" : 26210.2, + "campaign" : 26203.9, + "hunting" : 26202.3, + "carolina" : 26199.2, + "liberal" : 26184.1, + "whisper" : 26184.1, + "largely" : 26177.0, + "commonly" : 26158.8, + "torn" : 26151.7, + "exists" : 26145.4, + "contributions" : 26143.0, + "hunt" : 26139.8, + "teacher" : 26128.8, + "christianity" : 26112.9, + "lawyer" : 26093.2, + "operations" : 26091.6, + "detail" : 26089.2, + "shortly" : 26070.2, + "caesar" : 26043.3, + "wondering" : 26040.9, + "leaders" : 26037.0, + "blessing" : 26023.5, + "princess" : 26022.7, + "he'd" : 26014.8, + "altar" : 26013.2, + "tenderness" : 26013.2, + "tiny" : 25980.0, + "web" : 25971.3, + "cardinal" : 25968.9, + "sharply" : 25962.6, + "regiment" : 25926.2, + "chest" : 25915.1, + "distinctly" : 25914.4, + "purple" : 25912.0, + "creating" : 25910.4, + "gather" : 25905.7, + "depth" : 25902.5, + "indignation" : 25876.4, + "performance" : 25870.8, + "election" : 25863.7, + "prosperity" : 25843.9, + "gloomy" : 25825.7, + "conception" : 25822.6, + "clerk" : 25785.4, + "decide" : 25779.1, + "drunk" : 25774.3, + "victim" : 25770.4, + "reflected" : 25768.8, + "pour" : 25765.6, + "preceding" : 25764.0, + "individuals" : 25759.3, + "gazing" : 25737.9, + "absurd" : 25718.9, + "lift" : 25715.0, + "gesture" : 25714.2, + "armies" : 25710.2, + "limbs" : 25667.5, + "manage" : 25667.5, + "brethren" : 25642.2, + "hugh" : 25616.1, + "plays" : 25582.1, + "hastened" : 25580.5, + "dragged" : 25533.0, + "motive" : 25512.5, + "whatsoever" : 25421.5, + "pointing" : 25416.7, + "verses" : 25411.2, + "pronounced" : 25410.4, + "exchange" : 25408.0, + "definite" : 25393.8, + "emperor" : 25366.9, + "tendency" : 25363.7, + "remote" : 25339.2, + "finish" : 25337.6, + "flag" : 25313.9, + "boots" : 25307.6, + "enabled" : 25290.1, + "administration" : 25289.4, + "denied" : 25283.8, + "churches" : 25279.1, + "rarely" : 25251.4, + "earnestly" : 25212.6, + "considering" : 25210.2, + "previously" : 25203.9, + "ugly" : 25169.9, + "bears" : 25165.9, + "signed" : 25156.4, + "genuine" : 25153.3, + "harmless" : 25150.1, + "mingled" : 25120.1, + "obedience" : 25107.4, + "walks" : 25103.4, + "training" : 25071.0, + "badly" : 25045.7, + "feed" : 25028.3, + "central" : 25010.1, + "contrast" : 25009.3, + "relieved" : 24995.8, + "romance" : 24988.7, + "mississippi" : 24987.9, + "structure" : 24976.1, + "payment" : 24963.4, + "pace" : 24960.2, + "passages" : 24957.9, + "succession" : 24955.5, + "persuaded" : 24952.3, + "sources" : 24952.3, + "inquiry" : 24950.0, + "inspired" : 24932.6, + "angels" : 24925.4, + "roll" : 24922.3, + "wilt" : 24907.2, + "inch" : 24887.5, + "troubles" : 24878.8, + "perfection" : 24870.1, + "lee" : 24850.3, + "wherever" : 24845.5, + "owe" : 24817.8, + "handle" : 24805.2, + "advantages" : 24802.8, + "trip" : 24790.2, + "shoot" : 24775.9, + "fortunate" : 24755.3, + "newspaper" : 24752.2, + "employment" : 24726.1, + "fitted" : 24721.3, + "refuge" : 24717.4, + "misfortune" : 24711.0, + "providence" : 24702.3, + "owns" : 24692.8, + "cutting" : 24671.5, + "beard" : 24658.8, + "stirred" : 24654.1, + "tear" : 24653.3, + "dan" : 24639.8, + "resist" : 24634.3, + "bob" : 24620.1, + "depths" : 24612.9, + "maiden" : 24599.5, + "determine" : 24596.3, + "commission" : 24594.0, + "merchant" : 24578.9, + "whereas" : 24576.5, + "crossing" : 24575.0, + "independence" : 24561.5, + "lively" : 24553.6, + "breeze" : 24552.0, + "provinces" : 24533.8, + "jean" : 24520.4, + "virtues" : 24516.4, + "conceived" : 24510.1, + "relative" : 24507.7, + "solitary" : 24481.6, + "smell" : 24476.1, + "wandering" : 24466.6, + "thereby" : 24465.0, + "eighteen" : 24454.7, + "locked" : 24438.1, + "provision" : 24386.7, + "courts" : 24372.4, + "eaten" : 24366.9, + "historical" : 24366.9, + "regarding" : 24365.3, + "florence" : 24349.5, + "preferred" : 24349.5, + "pick" : 24343.2, + "ruined" : 24340.0, + "wherein" : 24337.6, + "vanity" : 24324.2, + "condemned" : 24297.3, + "deliver" : 24296.5, + "unexpected" : 24270.4, + "desk" : 24263.3, + "gross" : 24261.7, + "lane" : 24259.3, + "happens" : 24249.0, + "represent" : 24244.3, + "billy" : 24241.9, + "root" : 24241.9, + "holland" : 24220.5, + "mud" : 24215.0, + "respectable" : 24197.6, + "cleared" : 24196.8, + "feels" : 24189.7, + "fruits" : 24181.8, + "testimony" : 24178.6, + "milton" : 24177.8, + "existing" : 24176.2, + "bride" : 24170.7, + "rang" : 24165.2, + "ranks" : 24146.2, + "responsibility" : 24110.6, + "beating" : 24105.8, + "disappointed" : 24102.7, + "suitable" : 24099.5, + "depend" : 24080.5, + "judges" : 24065.5, + "giant" : 24050.4, + "grasp" : 24039.4, + "arrive" : 24036.2, + "simplicity" : 24033.8, + "autumn" : 24030.7, + "absent" : 24029.9, + "legally" : 24015.6, + "veil" : 24014.0, + "gloom" : 23980.8, + "doubtful" : 23956.3, + "suspect" : 23953.1, + "weapons" : 23950.8, + "limits" : 23919.9, + "determination" : 23918.3, + "feeble" : 23902.5, + "prophet" : 23900.1, + "shak" : 23892.2, + "gathering" : 23868.5, + "basis" : 23866.1, + "examine" : 23826.5, + "corrupt" : 23785.4, + "payments" : 23779.9, + "returns" : 23775.1, + "laying" : 23756.9, + "prize" : 23749.0, + "instances" : 23733.2, + "greeks" : 23730.8, + "d" : 23730.0, + "they're" : 23719.0, + "theatre" : 23711.0, + "purchase" : 23704.7, + "comparison" : 23702.3, + "composition" : 23694.4, + "rival" : 23688.9, + "someone" : 23680.2, + "realize" : 23669.1, + "defeat" : 23665.2, + "demands" : 23635.9, + "foe" : 23628.8, + "shared" : 23620.1, + "consists" : 23616.9, + "studies" : 23614.5, + "balance" : 23609.8, + "intercourse" : 23609.0, + "id" : 23605.0, + "forming" : 23571.0, + "slender" : 23570.2, + "coach" : 23561.5, + "criminal" : 23556.8, + "knocked" : 23553.6, + "silly" : 23553.6, + "humour" : 23550.4, + "masses" : 23542.5, + "indifferent" : 23541.0, + "recall" : 23534.6, + "occupation" : 23529.1, + "discourse" : 23524.3, + "keeps" : 23523.5, + "regions" : 23516.4, + "intervals" : 23510.9, + "assist" : 23508.5, + "novel" : 23506.1, + "intellect" : 23493.5, + "leads" : 23492.7, + "hither" : 23489.5, + "tales" : 23483.2, + "sale" : 23476.9, + "revenge" : 23465.8, + "lucy" : 23459.5, + "yonder" : 23446.8, + "resources" : 23435.7, + "jealous" : 23421.5, + "we're" : 23376.4, + "wheel" : 23376.4, + "invitation" : 23368.5, + "narrative" : 23365.3, + "risen" : 23364.5, + "burnt" : 23335.3, + "sentiments" : 23335.3, + "inferior" : 23327.3, + "amusement" : 23320.2, + "marie" : 23309.9, + "flash" : 23304.4, + "recognize" : 23302.8, + "swiftly" : 23299.7, + "portrait" : 23294.9, + "create" : 23259.3, + "summoned" : 23245.9, + "suggest" : 23241.1, + "induced" : 23229.2, + "conflict" : 23227.7, + "fed" : 23220.5, + "curse" : 23215.8, + "disappointment" : 23215.8, + "helpless" : 23213.4, + "preparing" : 23208.7, + "construction" : 23205.5, + "lincoln" : 23183.4, + "zeal" : 23168.3, + "responsible" : 23160.4, + "indicated" : 23152.5, + "groups" : 23150.1, + "positive" : 23135.1, + "germans" : 23128.8, + "attracted" : 23124.0, + "vengeance" : 23121.6, + "fort" : 23113.7, + "club" : 23099.5, + "cure" : 23094.0, + "stout" : 23094.0, + "missed" : 23090.0, + "gracious" : 23082.1, + "include" : 23071.0, + "flood" : 23042.5, + "satisfy" : 23040.2, + "agony" : 23033.0, + "respects" : 23020.4, + "ventured" : 23020.4, + "implied" : 23018.8, + "maria" : 23010.1, + "stupid" : 22992.7, + "seas" : 22991.9, + "spaniards" : 22987.9, + "grain" : 22985.6, + "enjoyment" : 22982.4, + "wearing" : 22981.6, + "indifference" : 22936.5, + "conceal" : 22933.4, + "horizon" : 22922.3, + "pleasures" : 22903.3, + "therein" : 22901.7, + "precisely" : 22900.1, + "canada" : 22872.4, + "day's" : 22868.5, + "assume" : 22844.8, + "registered" : 22844.8, + "estimate" : 22841.6, + "steep" : 22823.4, + "route" : 22808.4, + "gardens" : 22789.4, + "visitor" : 22780.7, + "closer" : 22770.4, + "harmony" : 22753.0, + "non" : 22749.0, + "thunder" : 22749.0, + "wire" : 22741.1, + "graceful" : 22736.4, + "crept" : 22735.6, + "greece" : 22734.0, + "childhood" : 22726.9, + "knee" : 22696.0, + "saddle" : 22691.3, + "supplies" : 22683.4, + "weeping" : 22673.1, + "mostly" : 22658.0, + "paragraphs" : 22647.8, + "unconscious" : 22647.0, + "mutual" : 22639.8, + "scorn" : 22638.3, + "grows" : 22628.0, + "external" : 22592.4, + "agents" : 22586.8, + "software" : 22586.1, + "institutions" : 22584.5, + "losing" : 22575.0, + "universe" : 22574.2, + "clock" : 22548.9, + "attempts" : 22547.3, + "instruction" : 22538.6, + "injury" : 22525.9, + "roots" : 22522.8, + "receipt" : 22519.6, + "jumped" : 22518.8, + "dearest" : 22502.2, + "sore" : 22499.8, + "earliest" : 22496.7, + "finest" : 22488.0, + "enable" : 22482.4, + "discipline" : 22480.8, + "motives" : 22465.8, + "fastened" : 22454.7, + "introduction" : 22446.0, + "converted" : 22419.9, + "wilderness" : 22419.1, + "confused" : 22416.0, + "fancied" : 22410.4, + "offices" : 22410.4, + "slip" : 22402.5, + "revolution" : 22396.2, + "wedding" : 22374.8, + "girl's" : 22366.1, + "farmer" : 22364.5, + "silently" : 22363.7, + "fires" : 22362.2, + "wept" : 22355.0, + "behalf" : 22346.3, + "reckon" : 22346.3, + "responded" : 22333.7, + "uncertain" : 22328.9, + "neglected" : 22328.1, + "stroke" : 22326.6, + "exquisite" : 22305.2, + "engagement" : 22298.9, + "dirty" : 22289.4, + "rolling" : 22286.2, + "platform" : 22282.3, + "messenger" : 22272.0, + "privilege" : 22260.9, + "admirable" : 22255.4, + "offers" : 22252.2, + "mischief" : 22247.4, + "physician" : 22245.1, + "imposed" : 22228.5, + "organized" : 22222.1, + "covering" : 22208.7, + "student" : 22207.1, + "daring" : 22198.4, + "cave" : 22174.7, + "wars" : 22170.7, + "convey" : 22166.7, + "he'll" : 22163.6, + "sincere" : 22162.0, + "tradition" : 22160.4, + "gravely" : 22153.3, + "combined" : 22149.3, + "gallant" : 22122.4, + "sensation" : 22120.9, + "travelling" : 22120.1, + "charges" : 22089.2, + "submit" : 22087.6, + "tragedy" : 22082.1, + "specific" : 22075.0, + "commander" : 22064.7, + "inn" : 22059.2, + "stiff" : 22057.6, + "accompany" : 22056.8, + "score" : 22052.0, + "virgin" : 22052.0, + "farewell" : 22033.0, + "paradise" : 22014.9, + "villages" : 22012.5, + "hunger" : 21975.3, + "trembled" : 21947.6, + "favorite" : 21929.4, + "criticism" : 21925.5, + "proprietary" : 21921.5, + "customs" : 21915.2, + "cotton" : 21910.4, + "ruth" : 21907.3, + "hospital" : 21895.4, + "restrictions" : 21881.2, + "outward" : 21868.5, + "impressed" : 21857.4, + "blows" : 21851.1, + "plains" : 21847.1, + "flashed" : 21836.8, + "rent" : 21836.8, + "prey" : 21827.4, + "owed" : 21813.1, + "longing" : 21804.4, + "musical" : 21803.6, + "satisfactory" : 21803.6, + "ridiculous" : 21802.8, + "sheet" : 21798.1, + "disgrace" : 21776.7, + "colored" : 21769.6, + "shouldn't" : 21767.2, + "originally" : 21762.5, + "samuel" : 21760.1, + "wages" : 21755.4, + "papa" : 21749.8, + "gas" : 21748.2, + "inevitable" : 21741.1, + "extensive" : 21735.6, + "leisure" : 21729.3, + "deadly" : 21718.2, + "chin" : 21717.4, + "claimed" : 21713.4, + "glow" : 21707.1, + "husband's" : 21703.9, + "emotions" : 21695.2, + "adam" : 21681.8, + "jealousy" : 21661.2, + "leaf" : 21659.6, + "publication" : 21649.3, + "englishman" : 21647.8, + "allah" : 21647.0, + "jones" : 21635.1, + "hostile" : 21631.9, + "wandered" : 21621.7, + "railway" : 21615.3, + "translation" : 21607.4, + "procession" : 21575.8, + "betrayed" : 21573.4, + "pound" : 21572.6, + "admired" : 21561.5, + "elected" : 21552.0, + "pierre" : 21522.8, + "sunk" : 21519.6, + "ruins" : 21516.4, + "eastern" : 21515.6, + "roses" : 21511.7, + "citizen" : 21498.2, + "reminded" : 21497.4, + "deceived" : 21495.9, + "tables" : 21432.6, + "beach" : 21431.8, + "starting" : 21427.8, + "funeral" : 21414.4, + "arrested" : 21412.0, + "flour" : 21409.6, + "feature" : 21404.1, + "correspondence" : 21403.3, + "consisted" : 21398.6, + "counted" : 21397.8, + "reserve" : 21391.4, + "proceedings" : 21381.2, + "roar" : 21378.8, + "romantic" : 21377.2, + "twenty-five" : 21374.8, + "hut" : 21374.0, + "strangely" : 21361.4, + "absorbed" : 21357.4, + "propose" : 21352.7, + "seats" : 21348.7, + "bark" : 21347.1, + "reception" : 21339.2, + "pleasing" : 21334.5, + "attained" : 21329.7, + "wake" : 21326.6, + "research" : 21323.4, + "prayed" : 21309.2, + "monarch" : 21306.8, + "clothing" : 21300.5, + "dollar" : 21293.3, + "illness" : 21291.8, + "calmly" : 21282.3, + "obeyed" : 21275.9, + "heartily" : 21268.8, + "pressing" : 21264.9, + "daylight" : 21264.1, + "warriors" : 21243.5, + "jest" : 21238.7, + "abruptly" : 21222.1, + "washed" : 21200.8, + "comment" : 21197.6, + "metal" : 21196.0, + "preparations" : 21193.7, + "nerves" : 21177.8, + "solution" : 21177.8, + "pretended" : 21173.1, + "sixteen" : 21166.0, + "assembly" : 21155.7, + "tobacco" : 21154.1, + "entity" : 21142.2, + "dwelling" : 21136.7, + "depart" : 21135.9, + "swung" : 21134.3, + "bitterly" : 21130.4, + "alteration" : 21128.0, + "colony" : 21126.4, + "disclaimers" : 21124.8, + "wing" : 21122.5, + "peaceful" : 21120.9, + "lion" : 21119.3, + "opportunities" : 21097.9, + "alarmed" : 21090.8, + "furnish" : 21090.0, + "resting" : 21086.9, + "accused" : 21084.5, + "culture" : 21083.7, + "writings" : 21073.4, + "dwelt" : 21071.0, + "conquered" : 21067.1, + "trick" : 21052.8, + "trusted" : 21049.7, + "column" : 21046.5, + "financial" : 21028.3, + "cunning" : 21027.5, + "preparation" : 21022.0, + "drama" : 21014.9, + "joke" : 21010.1, + "entertained" : 21003.0, + "mist" : 20999.0, + "hypertext" : 20994.3, + "shell" : 20981.6, + "medicine" : 20972.9, + "proofread" : 20964.2, + "nest" : 20950.0, + "reverence" : 20947.6, + "situated" : 20945.2, + "yielded" : 20942.9, + "conceive" : 20938.9, + "appointment" : 20934.2, + "lessons" : 20897.8, + "fetch" : 20895.4, + "tomb" : 20895.4, + "candle" : 20894.6, + "offence" : 20882.7, + "coarse" : 20870.1, + "heap" : 20866.1, + "mixture" : 20863.8, + "homes" : 20847.9, + "model" : 20843.2, + "men's" : 20819.4, + "defect" : 20818.7, + "destined" : 20814.7, + "occasional" : 20813.1, + "fourteen" : 20803.6, + "hint" : 20802.0, + "knights" : 20795.7, + "solicit" : 20783.8, + "dreamed" : 20774.4, + "objection" : 20756.2, + "craft" : 20753.8, + "acid" : 20752.2, + "namely" : 20747.5, + "asia" : 20744.3, + "neglect" : 20734.8, + "data" : 20722.9, + "weapon" : 20717.4, + "confessed" : 20715.0, + "arrangements" : 20709.5, + "repose" : 20701.6, + "complying" : 20700.0, + "copied" : 20700.0, + "pink" : 20698.4, + "user" : 20696.0, + "heels" : 20695.2, + "grandfather" : 20692.1, + "other's" : 20690.5, + "income" : 20679.4, + "i.e." : 20661.2, + "regards" : 20650.1, + "streams" : 20649.4, + "vigorous" : 20633.5, + "accepting" : 20628.8, + "bishop" : 20628.8, + "lightning" : 20622.5, + "authors" : 20613.8, + "flames" : 20613.8, + "observations" : 20602.7, + "compressed" : 20599.5, + "sport" : 20588.4, + "powder" : 20587.6, + "beds" : 20576.6, + "orange" : 20573.4, + "painting" : 20559.2, + "shout" : 20548.9, + "austria" : 20499.0, + "bath" : 20495.9, + "careless" : 20495.1, + "chap" : 20493.5, + "derivative" : 20492.7, + "roused" : 20491.1, + "primitive" : 20488.8, + "doorway" : 20487.2, + "climbed" : 20484.8, + "volumes" : 20479.3, + "vulgar" : 20448.4, + "arguments" : 20441.3, + "1st" : 20440.5, + "sunset" : 20435.0, + "convenient" : 20431.0, + "mail" : 20423.9, + "recalled" : 20419.1, + "wrapped" : 20419.1, + "abode" : 20409.6, + "planted" : 20405.7, + "paint" : 20381.2, + "surrender" : 20362.2, + "establish" : 20357.4, + "mild" : 20353.5, + "promptly" : 20342.4, + "appearing" : 20328.2, + "department" : 20315.5, + "parish" : 20302.8, + "stephen" : 20288.6, + "nay" : 20246.7, + "lit" : 20243.5, + "handkerchief" : 20229.3, + "basket" : 20219.8, + "easier" : 20216.6, + "deserve" : 20213.4, + "quit" : 20213.4, + "assurance" : 20212.6, + "mirror" : 20210.3, + "plot" : 20208.7, + "yer" : 20196.8, + "upward" : 20192.9, + "sadly" : 20191.3, + "secretary" : 20190.5, + "adding" : 20187.3, + "modest" : 20185.7, + "dish" : 20176.3, + "cares" : 20161.2, + "straw" : 20158.9, + "net" : 20152.5, + "advised" : 20146.2, + "heavenly" : 20124.0, + "largest" : 20119.3, + "proceeding" : 20107.4, + "impatient" : 20085.3, + "wounds" : 20076.6, + "warmth" : 20071.8, + "certainty" : 20053.6, + "restless" : 20048.1, + "meantime" : 20043.3, + "rays" : 20040.2, + "salvation" : 20031.5, + "lovers" : 20030.7, + "experiment" : 20024.4, + "shores" : 20017.2, + "today" : 20016.4, + "tremendous" : 20006.2, + "afforded" : 20004.6, + "moonlight" : 20002.2, + "intend" : 19999.0, + "california" : 19991.1, + "cultivated" : 19976.9, + "flushed" : 19971.4, + "shakespeare" : 19966.6, + "newspapers" : 19953.2, + "rocky" : 19916.8, + "pious" : 19900.9, + "wont" : 19900.9, + "steam" : 19892.2, + "improvement" : 19883.5, + "garments" : 19878.8, + "ned" : 19874.8, + "treasury" : 19873.3, + "merchants" : 19868.5, + "perpetual" : 19866.9, + "trained" : 19866.9, + "products" : 19866.1, + "affectionate" : 19858.2, + "dispute" : 19854.3, + "visitors" : 19847.9, + "poison" : 19814.7, + "proposition" : 19793.3, + "maybe" : 19771.2, + "rifle" : 19769.6, + "warned" : 19767.2, + "parting" : 19751.4, + "shield" : 19736.4, + "erected" : 19722.9, + "employ" : 19722.1, + "prevailed" : 19721.4, + "talent" : 19714.2, + "rises" : 19713.4, + "climate" : 19693.7, + "chairs" : 19690.5, + "searched" : 19689.7, + "unlike" : 19687.3, + "recover" : 19681.0, + "mate" : 19655.7, + "arrange" : 19648.6, + "fortunes" : 19647.0, + "puzzled" : 19639.1, + "committee" : 19637.5, + "aged" : 19628.8, + "ohio" : 19605.1, + "ashes" : 19593.2, + "ghost" : 19563.9, + "b" : 19549.7, + "promises" : 19547.3, + "bushes" : 19541.0, + "effective" : 19525.9, + "distinguish" : 19508.5, + "manifest" : 19496.7, + "comparatively" : 19486.4, + "esteem" : 19478.5, + "blew" : 19452.4, + "revelation" : 19451.6, + "wash" : 19425.5, + "recognition" : 19417.6, + "confession" : 19405.7, + "clay" : 19398.6, + "nonsense" : 19375.6, + "trunk" : 19374.8, + "management" : 19371.7, + "undoubtedly" : 19371.7, + "dried" : 19369.3, + "dorothy" : 19360.6, + "chiefs" : 19347.1, + "coal" : 19337.7, + "stolen" : 19337.7, + "earthly" : 19335.3, + "restore" : 19332.1, + "indirectly" : 19327.4, + "lasted" : 19324.2, + "selfish" : 19316.3, + "renewed" : 19313.9, + "canoe" : 19310.8, + "protest" : 19307.6, + "vice" : 19294.1, + "races" : 19291.0, + "deemed" : 19279.1, + "temporary" : 19278.3, + "pile" : 19276.7, + "frederick" : 19263.3, + "chapel" : 19251.4, + "moderate" : 19245.9, + "spell" : 19236.4, + "massachusetts" : 19235.6, + "upright" : 19228.5, + "quoted" : 19226.9, + "area" : 19226.1, + "bone" : 19221.4, + "solitude" : 19215.8, + "instruments" : 19215.0, + "formal" : 19211.9, + "students" : 19209.5, + "greatness" : 19206.3, + "struggling" : 19192.1, + "monday" : 19175.5, + "reproach" : 19173.1, + "altered" : 19167.6, + "grim" : 19161.2, + "leaped" : 19157.3, + "venice" : 19153.3, + "federal" : 19149.4, + "questioned" : 19147.0, + "editor" : 19143.0, + "desirable" : 19141.5, + "acknowledge" : 19137.5, + "motionless" : 19137.5, + "remedy" : 19135.9, + "bestowed" : 19130.4, + "pursue" : 19121.7, + "representative" : 19117.7, + "pole" : 19116.9, + "gladly" : 19111.4, + "linen" : 19109.8, + "vital" : 19099.5, + "sink" : 19096.4, + "pacific" : 19093.2, + "hopeless" : 19090.0, + "dangers" : 19087.7, + "gratefully" : 19087.7, + "president" : 19068.7, + "travelled" : 19061.5, + "ward" : 19060.8, + "nephew" : 19041.8, + "ms" : 19038.6, + "cheer" : 19029.9, + "bloody" : 19023.6, + "siege" : 19020.4, + "commands" : 19005.4, + "justified" : 19003.8, + "atlantic" : 18995.1, + "stomach" : 18991.9, + "improved" : 18971.4, + "admire" : 18965.0, + "openly" : 18962.7, + "sailors" : 18961.1, + "abide" : 18940.5, + "advancing" : 18937.3, + "forests" : 18927.1, + "records" : 18920.7, + "polly" : 18909.6, + "recorded" : 18908.9, + "modification" : 18904.9, + "dramatic" : 18897.8, + "statements" : 18891.5, + "upstairs" : 18873.3, + "varied" : 18858.2, + "letting" : 18857.4, + "wilson" : 18857.4, + "comrades" : 18855.9, + "sets" : 18848.7, + "descent" : 18847.9, + "whither" : 18847.9, + "envy" : 18837.7, + "load" : 18836.9, + "pretend" : 18834.5, + "folded" : 18829.0, + "brass" : 18824.2, + "internal" : 18823.4, + "furious" : 18820.3, + "curtain" : 18816.3, + "healthy" : 18814.7, + "obscure" : 18810.0, + "summit" : 18806.0, + "alas" : 18755.4, + "fifth" : 18753.0, + "center" : 18747.5, + "faced" : 18734.8, + "cheap" : 18723.7, + "saints" : 18722.9, + "colonel" : 18721.4, + "egyptian" : 18719.0, + "contest" : 18707.9, + "owned" : 18702.4, + "adventures" : 18700.8, + "exclusion" : 18688.1, + "seize" : 18670.7, + "chances" : 18669.9, + "springs" : 18661.2, + "alter" : 18660.4, + "landing" : 18659.7, + "fence" : 18652.5, + "leagues" : 18642.2, + "glimpse" : 18634.3, + "statue" : 18632.0, + "contract" : 18625.6, + "luxury" : 18614.6, + "artillery" : 18598.7, + "doubts" : 18597.2, + "saving" : 18594.8, + "fro" : 18586.9, + "string" : 18586.1, + "combination" : 18582.9, + "awakened" : 18575.8, + "faded" : 18573.4, + "arrest" : 18570.3, + "protected" : 18568.7, + "temperature" : 18567.1, + "strict" : 18564.7, + "contented" : 18563.9, + "professional" : 18563.9, + "intent" : 18559.2, + "brother's" : 18548.9, + "injured" : 18548.9, + "neighborhood" : 18546.5, + "andrew" : 18543.4, + "abundance" : 18541.0, + "smoking" : 18541.0, + "yourselves" : 18529.9, + "medical" : 18527.5, + "garrison" : 18525.9, + "likes" : 18508.5, + "corps" : 18503.8, + "heroic" : 18497.5, + "inform" : 18494.3, + "wife's" : 18488.8, + "retained" : 18477.7, + "agitation" : 18469.0, + "nobles" : 18462.7, + "prominent" : 18457.1, + "institution" : 18454.0, + "judged" : 18441.3, + "embrace" : 18431.0, + "wheels" : 18427.8, + "closing" : 18397.8, + "damaged" : 18391.5, + "pack" : 18390.7, + "affections" : 18389.1, + "eldest" : 18389.1, + "anguish" : 18382.8, + "surrounding" : 18381.2, + "obviously" : 18376.4, + "strictly" : 18366.1, + "capture" : 18344.0, + "drops" : 18339.2, + "inquire" : 18336.1, + "ample" : 18328.2, + "remainder" : 18325.8, + "justly" : 18324.2, + "recollection" : 18324.2, + "deer" : 18321.0, + "answers" : 18317.9, + "bedroom" : 18311.6, + "purely" : 18310.0, + "bush" : 18306.8, + "plunged" : 18299.7, + "thyself" : 18296.5, + "joint" : 18291.8, + "refer" : 18275.9, + "expecting" : 18274.4, + "madam" : 18271.2, + "railroad" : 18264.9, + "spake" : 18253.8, + "respecting" : 18252.2, + "jan" : 18250.6, + "columns" : 18248.3, + "weep" : 18242.7, + "identify" : 18232.4, + "discharge" : 18215.8, + "bench" : 18207.1, + "ralph" : 18196.0, + "heir" : 18192.9, + "oak" : 18186.6, + "rescue" : 18177.1, + "limit" : 18168.4, + "unpleasant" : 18163.6, + "anxiously" : 18159.7, + "innocence" : 18153.3, + "awoke" : 18151.7, + "expectation" : 18145.4, + "incomplete" : 18143.8, + "program" : 18109.8, + "reserved" : 18096.4, + "secretly" : 18083.7, + "we've" : 18079.7, + "invention" : 18079.0, + "faults" : 18075.8, + "disagreeable" : 18074.2, + "piano" : 18074.2, + "defeated" : 18073.4, + "charms" : 18072.6, + "purse" : 18067.9, + "persuade" : 18066.3, + "deprived" : 18063.1, + "electric" : 18058.4, + "endless" : 18058.4, + "interval" : 18054.4, + "chase" : 18052.8, + "heroes" : 18052.1, + "invisible" : 18048.9, + "well-known" : 18044.9, + "occupy" : 18038.6, + "jacob" : 18036.2, + "gown" : 18026.0, + "cruelty" : 18021.2, + "lock" : 18018.0, + "lowest" : 18007.8, + "hesitation" : 18003.8, + "withdrew" : 18003.8, + "proposal" : 18001.4, + "destiny" : 17999.1, + "recognised" : 17998.3, + "commons" : 17995.1, + "foul" : 17994.3, + "loaded" : 17991.9, + "amidst" : 17989.6, + "titles" : 17984.8, + "ancestors" : 17984.0, + "types" : 17972.2, + "commanding" : 17959.5, + "madness" : 17954.7, + "happily" : 17954.0, + "assigned" : 17951.6, + "declined" : 17932.6, + "temptation" : 17932.6, + "lady's" : 17929.4, + "subsequent" : 17917.6, + "jewels" : 17912.8, + "breathed" : 17910.4, + "willingly" : 17906.5, + "youthful" : 17906.5, + "bells" : 17904.1, + "spectacle" : 17903.3, + "uneasy" : 17897.8, + "shine" : 17896.2, + "formidable" : 17893.0, + "stately" : 17892.2, + "machinery" : 17886.7, + "fragments" : 17875.6, + "rushing" : 17859.0, + "attractive" : 17857.4, + "product" : 17857.4, + "economic" : 17854.3, + "sickness" : 17847.9, + "uses" : 17822.6, + "dashed" : 17819.5, + "engine" : 17817.1, + "ashore" : 17813.9, + "dates" : 17805.2, + "theirs" : 17793.4, + "adv" : 17783.1, + "clasped" : 17773.6, + "international" : 17772.8, + "leather" : 17768.8, + "spared" : 17758.5, + "crushed" : 17753.0, + "interfere" : 17748.3, + "subtle" : 17745.9, + "waved" : 17743.5, + "slope" : 17739.6, + "floating" : 17737.2, + "worry" : 17730.1, + "effected" : 17725.3, + "passengers" : 17723.7, + "violently" : 17715.8, + "donation" : 17715.0, + "steamer" : 17714.2, + "witnesses" : 17712.7, + "specified" : 17710.3, + "learnt" : 17698.4, + "stores" : 17677.9, + "designed" : 17666.8, + "guessed" : 17654.9, + "roger" : 17654.9, + "timber" : 17654.1, + "talents" : 17639.9, + "heed" : 17636.7, + "jackson" : 17631.2, + "murdered" : 17629.6, + "vivid" : 17628.0, + "woe" : 17614.6, + "calculate" : 17612.2, + "killing" : 17608.2, + "laura" : 17605.9, + "savages" : 17603.5, + "wasted" : 17600.3, + "trifle" : 17584.5, + "funny" : 17576.6, + "pockets" : 17560.0, + "philosopher" : 17552.9, + "insult" : 17544.2, + "den" : 17543.4, + "representation" : 17541.0, + "incapable" : 17538.6, + "eloquence" : 17537.0, + "dine" : 17526.7, + "temples" : 17526.0, + "ann" : 17521.2, + "sensitive" : 17519.6, + "robin" : 17518.8, + "appetite" : 17507.0, + "wishing" : 17501.4, + "picturesque" : 17495.9, + "douglas" : 17494.3, + "courtesy" : 17472.2, + "flowing" : 17467.4, + "remembrance" : 17465.8, + "lawyers" : 17464.2, + "sphere" : 17464.2, + "murmur" : 17463.5, + "elegant" : 17460.3, + "honourable" : 17453.2, + "stopping" : 17452.4, + "guilt" : 17440.5, + "welfare" : 17437.3, + "avoided" : 17429.4, + "fishing" : 17423.9, + "perish" : 17420.7, + "sober" : 17416.0, + "steal" : 17415.2, + "delicious" : 17401.0, + "infant" : 17393.8, + "lip" : 17393.0, + "norman" : 17392.3, + "offended" : 17392.3, + "dost" : 17373.3, + "memories" : 17358.2, + "wheat" : 17354.3, + "japanese" : 17343.2, + "humor" : 17342.4, + "exhibited" : 17329.0, + "encounter" : 17321.8, + "footsteps" : 17314.7, + "marquis" : 17308.4, + "smiles" : 17302.1, + "amiable" : 17294.9, + "twilight" : 17290.2, + "arrows" : 17287.8, + "consisting" : 17287.0, + "park" : 17285.4, + "retire" : 17280.7, + "economy" : 17278.3, + "sufferings" : 17276.7, + "secrets" : 17276.0, + "na" : 17275.2, + "halted" : 17268.0, + "govern" : 17262.5, + "favourable" : 17260.9, + "colors" : 17248.3, + "translated" : 17245.9, + "stretch" : 17245.1, + "formation" : 17240.4, + "immortal" : 17234.8, + "gallery" : 17233.2, + "parallel" : 17233.2, + "lean" : 17230.1, + "tempted" : 17229.3, + "frontier" : 17228.5, + "continent" : 17226.1, + "knock" : 17221.4, + "impatience" : 17210.3, + "unity" : 17210.3, + "dealing" : 17192.9, + "prohibition" : 17169.9, + "decent" : 17166.8, + "fiery" : 17163.6, + "images" : 17163.6, + "tie" : 17162.8, + "punished" : 17161.2, + "submitted" : 17161.2, + "julia" : 17140.7, + "albert" : 17127.2, + "rejoined" : 17126.4, + "speedily" : 17125.6, + "consented" : 17122.5, + "major" : 17113.8, + "preliminary" : 17113.8, + "cell" : 17112.2, + "void" : 17112.2, + "placing" : 17111.4, + "prudence" : 17103.5, + "egg" : 17096.4, + "amazement" : 17090.0, + "border" : 17086.9, + "artificial" : 17080.5, + "hereafter" : 17075.8, + "fanny" : 17065.5, + "crimes" : 17063.1, + "breathe" : 17060.0, + "exempt" : 17056.8, + "anchor" : 17037.8, + "chicago" : 17037.8, + "sits" : 17036.2, + "purchased" : 17032.3, + "eminent" : 17031.5, + "neighbors" : 17029.1, + "glowing" : 17016.5, + "sunlight" : 17008.6, + "examples" : 17006.2, + "exercised" : 17005.4, + "wealthy" : 17003.8, + "seeming" : 16999.1, + "bonaparte" : 16995.1, + "shouting" : 16994.3, + "thanked" : 16992.7, + "illustrious" : 16985.6, + "curiously" : 16984.8, + "inspiration" : 16984.0, + "seeds" : 16983.2, + "naval" : 16971.4, + "foes" : 16954.8, + "everyone" : 16950.8, + "longed" : 16944.5, + "abundant" : 16940.5, + "doubted" : 16936.6, + "painter" : 16933.4, + "greeted" : 16931.0, + "erect" : 16929.4, + "glasses" : 16926.3, + "meanwhile" : 16926.3, + "shooting" : 16918.4, + "athens" : 16914.4, + "wagon" : 16913.6, + "lend" : 16903.3, + "lent" : 16901.7, + "crisis" : 16892.3, + "undertake" : 16885.9, + "particulars" : 16872.5, + "eh" : 16870.9, + "veins" : 16869.3, + "polite" : 16864.6, + "anna" : 16863.0, + "experiences" : 16859.0, + "seal" : 16858.2, + "header" : 16850.3, + "clergy" : 16848.7, + "mount" : 16843.2, + "array" : 16834.5, + "corners" : 16834.5, + "magazine" : 16833.7, + "loudly" : 16832.1, + "bitterness" : 16825.8, + "texas" : 16816.3, + "guardian" : 16813.1, + "searching" : 16811.6, + "rejected" : 16802.1, + "harsh" : 16801.3, + "includes" : 16800.5, + "boldly" : 16791.8, + "maurice" : 16791.8, + "kate" : 16790.2, + "lunch" : 16786.2, + "pine" : 16785.5, + "shells" : 16783.9, + "seconds" : 16783.1, + "despite" : 16779.1, + "hoping" : 16776.7, + "injustice" : 16768.0, + "expressions" : 16766.5, + "flies" : 16766.5, + "push" : 16757.0, + "tight" : 16756.2, + "problems" : 16753.0, + "landscape" : 16749.1, + "sue" : 16742.7, + "protested" : 16739.6, + "scarlet" : 16734.8, + "abandon" : 16734.0, + "artistic" : 16721.4, + "mainly" : 16720.6, + "measured" : 16688.9, + "loyal" : 16683.4, + "boiling" : 16681.8, + "desirous" : 16644.6, + "suited" : 16644.6, + "alliance" : 16641.5, + "advise" : 16635.1, + "waist" : 16634.3, + "sinking" : 16631.2, + "apprehension" : 16616.1, + "stable" : 16611.4, + "gregory" : 16607.4, + "maximum" : 16592.4, + "commit" : 16590.0, + "hideous" : 16575.0, + "hamilton" : 16571.1, + "sweetness" : 16566.3, + "dismissed" : 16563.9, + "tore" : 16560.8, + "affect" : 16558.4, + "shaken" : 16556.0, + "evils" : 16552.1, + "unworthy" : 16547.3, + "significance" : 16544.9, + "modified" : 16531.5, + "miracle" : 16529.9, + "lieu" : 16522.0, + "peasant" : 16519.6, + "considerably" : 16501.4, + "observing" : 16495.9, + "conveyed" : 16494.3, + "resemblance" : 16475.3, + "extend" : 16473.0, + "riches" : 16471.4, + "personally" : 16466.6, + "morality" : 16455.5, + "rebellion" : 16450.8, + "thread" : 16435.8, + "dumb" : 16431.8, + "inclination" : 16427.9, + "forbidden" : 16427.1, + "copper" : 16426.3, + "differences" : 16418.4, + "sailor" : 16411.2, + "requested" : 16408.1, + "alfred" : 16401.8, + "response" : 16401.8, + "promoting" : 16398.6, + "imperial" : 16392.3, + "blank" : 16390.7, + "purity" : 16382.8, + "victor" : 16382.8, + "bending" : 16376.4, + "solemnly" : 16363.0, + "twenty-four" : 16363.0, + "minor" : 16356.7, + "del" : 16353.5, + "crimson" : 16348.7, + "republic" : 16343.2, + "teachers" : 16332.9, + "ma'am" : 16329.8, + "danced" : 16326.6, + "bargain" : 16325.8, + "dealt" : 16321.8, + "fatigue" : 16319.5, + "telephone" : 16317.9, + "cents" : 16317.1, + "whip" : 16310.8, + "adams" : 16303.7, + "dislike" : 16280.7, + "witnessed" : 16265.7, + "infantry" : 16260.9, + "acres" : 16254.6, + "checked" : 16253.8, + "countrymen" : 16252.2, + "enemy's" : 16249.9, + "companies" : 16249.1, + "normal" : 16248.3, + "shirt" : 16247.5, + "addresses" : 16243.5, + "introduce" : 16242.7, + "sofa" : 16237.2, + "mothers" : 16235.6, + "sweep" : 16222.2, + "conversion" : 16219.8, + "sketch" : 16215.0, + "african" : 16205.6, + "deserved" : 16204.0, + "answering" : 16200.0, + "virtuous" : 16198.4, + "persian" : 16176.3, + "anyway" : 16169.9, + "thief" : 16152.5, + "driver" : 16147.8, + "retain" : 16145.4, + "constructed" : 16144.6, + "daniel" : 16143.8, + "ut" : 16132.8, + "philadelphia" : 16130.4, + "conspicuous" : 16129.6, + "channel" : 16126.4, + "nobility" : 16124.1, + "edith" : 16114.6, + "berlin" : 16113.8, + "editing" : 16105.9, + "cambridge" : 16103.5, + "declaration" : 16094.8, + "guards" : 16094.8, + "personality" : 16088.5, + "smallest" : 16080.6, + "excess" : 16077.4, + "separation" : 16075.8, + "disgust" : 16071.8, + "ha" : 16062.4, + "accomplish" : 16054.4, + "speeches" : 16054.4, + "herbert" : 16053.7, + "convent" : 16048.1, + "rightly" : 16044.2, + "suspended" : 16042.6, + "reform" : 16035.5, + "mob" : 16028.3, + "thirst" : 16027.5, + "unnecessary" : 16021.2, + "treasures" : 16018.8, + "asks" : 16018.1, + "viewed" : 16016.5, + "designs" : 16004.6, + "gleam" : 16000.6, + "threatening" : 15999.1, + "palm" : 15994.3, + "missouri" : 15992.7, + "filling" : 15984.0, + "quoth" : 15980.9, + "fur" : 15978.5, + "fortnight" : 15973.0, + "holes" : 15972.2, + "addressing" : 15970.6, + "frightful" : 15954.8, + "encourage" : 15954.0, + "speaker" : 15945.3, + "tribute" : 15944.5, + "procure" : 15935.8, + "frankly" : 15931.0, + "recommended" : 15913.6, + "relieve" : 15912.0, + "intentions" : 15910.5, + "unjust" : 15909.7, + "legislation" : 15904.1, + "project" : 15894.6, + "threshold" : 15894.6, + "merits" : 15893.8, + "morrow" : 15885.1, + "traces" : 15885.1, + "induce" : 15883.6, + "spear" : 15882.0, + "inward" : 15873.3, + "pupils" : 15863.8, + "corresponding" : 15859.0, + "fairy" : 15854.3, + "conclude" : 15850.3, + "clung" : 15846.4, + "neat" : 15845.6, + "lucky" : 15834.5, + "lap" : 15823.4, + "session" : 15822.6, + "torture" : 15818.7, + "damp" : 15814.7, + "ridge" : 15802.1, + "spoil" : 15785.5, + "liable" : 15784.7, + "swords" : 15780.7, + "hearty" : 15778.3, + "bc" : 15774.4, + "abraham" : 15769.6, + "thoughtful" : 15768.8, + "traveller" : 15764.9, + "chains" : 15760.9, + "favorable" : 15760.1, + "tin" : 15755.4, + "imp." : 15748.3, + "strongest" : 15748.3, + "horace" : 15745.1, + "dependent" : 15738.0, + "couch" : 15736.4, + "bills" : 15732.5, + "warrant" : 15731.7, + "complaint" : 15722.2, + "endeavour" : 15721.4, + "sails" : 15716.6, + "dined" : 15705.6, + "convention" : 15701.6, + "guarded" : 15696.1, + "angle" : 15694.5, + "widely" : 15692.1, + "illinois" : 15677.9, + "charlotte" : 15677.1, + "endeavoured" : 15677.1, + "ardent" : 15674.7, + "cow" : 15670.0, + "mill" : 15668.4, + "victims" : 15667.6, + "prejudice" : 15666.0, + "foremost" : 15665.2, + "map" : 15665.2, + "probability" : 15656.5, + "porch" : 15645.4, + "lieutenant" : 15641.5, + "surprising" : 15633.6, + "fountain" : 15632.0, + "sustained" : 15630.4, + "appropriate" : 15626.4, + "ford" : 15620.9, + "clara" : 15616.2, + "assisted" : 15615.4, + "lewis" : 15615.4, + "rejoice" : 15609.8, + "extending" : 15608.2, + "marvellous" : 15601.1, + "clothed" : 15597.2, + "jew" : 15579.8, + "collar" : 15568.7, + "bands" : 15567.9, + "confident" : 15563.1, + "hasty" : 15560.0, + "nigh" : 15557.6, + "organ" : 15557.6, + "prose" : 15545.0, + "privileges" : 15533.1, + "selection" : 15523.6, + "inquiries" : 15522.8, + "codes" : 15510.1, + "replace" : 15496.7, + "saint" : 15492.7, + "districts" : 15491.9, + "deliberately" : 15481.7, + "awe" : 15474.5, + "beforehand" : 15470.6, + "strife" : 15470.6, + "released" : 15468.2, + "compare" : 15466.6, + "beer" : 15465.0, + "retorted" : 15461.9, + "relate" : 15459.5, + "cheerfully" : 15448.4, + "pistol" : 15448.4, + "presume" : 15447.6, + "velvet" : 15446.1, + "wretch" : 15446.1, + "susan" : 15438.2, + "pennsylvania" : 15432.6, + "stirring" : 15430.2, + "righteousness" : 15429.4, + "missing" : 15428.7, + "fain" : 15427.1, + "facing" : 15425.5, + "fashionable" : 15425.5, + "producing" : 15420.7, + "peoples" : 15416.8, + "positively" : 15408.9, + "reasoning" : 15402.5, + "gravity" : 15401.8, + "disturb" : 15393.1, + "sermon" : 15389.1, + "exchanged" : 15385.1, + "partner" : 15379.6, + "brains" : 15374.1, + "lowered" : 15372.5, + "association" : 15365.4, + "estates" : 15352.7, + "abuse" : 15338.5, + "flock" : 15329.8, + "niece" : 15329.8, + "languages" : 15325.0, + "asserted" : 15321.1, + "bodily" : 15318.7, + "notions" : 15315.5, + "oliver" : 15313.2, + "faculty" : 15304.4, + "cannon" : 15302.1, + "thirteen" : 15290.2, + "sailing" : 15289.4, + "rings" : 15285.5, + "smart" : 15284.7, + "possessions" : 15280.7, + "disciples" : 15272.0, + "petty" : 15271.2, + "widest" : 15253.0, + "divisions" : 15252.2, + "prudent" : 15248.3, + "caution" : 15246.7, + "justify" : 15239.6, + "awhile" : 15236.4, + "boxes" : 15233.2, + "manuscript" : 15228.5, + "cigar" : 15225.3, + "warrior" : 15223.0, + "impressions" : 15221.4, + "aught" : 15217.4, + "lifting" : 15217.4, + "inaccurate" : 15212.7, + "tidings" : 15207.9, + "friday" : 15206.3, + "liquid" : 15202.4, + "staying" : 15202.4, + "concept" : 15191.3, + "creek" : 15186.6, + "lo" : 15173.1, + "brush" : 15172.3, + "download" : 15171.5, + "specially" : 15168.4, + "cream" : 15166.8, + "meetings" : 15162.0, + "jump" : 15159.7, + "unwilling" : 15158.9, + "adapted" : 15157.3, + "practised" : 15157.3, + "combat" : 15151.8, + "subdued" : 15151.8, + "jewish" : 15144.6, + "innumerable" : 15141.5, + "blowing" : 15139.9, + "extra" : 15138.3, + "civilized" : 15130.4, + "invented" : 15123.3, + "japan" : 15120.9, + "pitch" : 15109.8, + "cliff" : 15107.5, + "crowned" : 15092.4, + "portions" : 15090.8, + "awkward" : 15086.9, + "horrid" : 15085.3, + "pulling" : 15067.1, + "appreciate" : 15065.5, + "communicated" : 15060.8, + "kentucky" : 15056.8, + "jury" : 15050.5, + "encountered" : 15046.5, + "attacks" : 15041.8, + "monster" : 15031.5, + "simon" : 15022.0, + "maintaining" : 15021.2, + "sites" : 15019.6, + "frozen" : 15015.7, + "invariably" : 15010.9, + "dies" : 15009.4, + "survive" : 15007.8, + "literally" : 15005.4, + "consolation" : 14994.3, + "m" : 14994.3, + "phenomena" : 14994.3, + "pot" : 14993.5, + "ellen" : 14984.0, + "briefly" : 14979.3, + "rice" : 14975.3, + "planned" : 14974.5, + "barbara" : 14966.6, + "respected" : 14958.7, + "sublime" : 14954.0, + "dropping" : 14948.4, + "guy" : 14945.3, + "behaviour" : 14940.5, + "desolate" : 14938.9, + "penny" : 14935.0, + "adopt" : 14934.2, + "replaced" : 14933.4, + "revenue" : 14923.1, + "formats" : 14918.4, + "hired" : 14912.8, + "regularly" : 14904.9, + "infringement" : 14893.8, + "curtains" : 14892.3, + "eagerness" : 14883.6, + "helping" : 14882.8, + "investigation" : 14882.8, + "constitutional" : 14878.8, + "insist" : 14878.8, + "occurs" : 14875.7, + "fools" : 14871.7, + "inheritance" : 14870.9, + "latest" : 14868.5, + "leap" : 14866.2, + "games" : 14846.4, + "apple" : 14840.1, + "visiting" : 14840.1, + "travellers" : 14836.1, + "experiments" : 14830.6, + "hasn't" : 14830.6, + "pupil" : 14830.6, + "enjoying" : 14829.0, + "totally" : 14821.9, + "twisted" : 14821.9, + "discuss" : 14813.9, + "firing" : 14802.9, + "background" : 14801.3, + "subscribe" : 14795.0, + "tenderly" : 14786.3, + "transcribe" : 14783.1, + "descend" : 14779.9, + "differ" : 14772.0, + "majesty's" : 14763.3, + "avail" : 14758.6, + "disaster" : 14756.2, + "bet" : 14753.8, + "periodic" : 14750.7, + "bull" : 14749.1, + "entertainment" : 14748.3, + "computers" : 14743.5, + "cursed" : 14738.0, + "raw" : 14734.0, + "fulfilled" : 14732.5, + "georgia" : 14728.5, + "virus" : 14726.9, + "log" : 14726.1, + "skies" : 14707.9, + "scotch" : 14706.4, + "embraced" : 14705.6, + "hospitality" : 14703.2, + "faintly" : 14701.6, + "solomon" : 14690.5, + "robbed" : 14689.7, + "cart" : 14688.9, + "influences" : 14686.6, + "ascended" : 14682.6, + "incidents" : 14682.6, + "childish" : 14674.7, + "robe" : 14668.4, + "aboard" : 14658.1, + "resembling" : 14657.3, + "reflect" : 14652.6, + "dominion" : 14649.4, + "dreary" : 14644.6, + "serving" : 14639.1, + "complexion" : 14636.7, + "engage" : 14624.1, + "tents" : 14620.9, + "herd" : 14619.3, + "attain" : 14618.5, + "collect" : 14617.0, + "disclaims" : 14617.0, + "pan" : 14614.6, + "relatives" : 14613.8, + "borrowed" : 14610.6, + "convert" : 14601.9, + "outline" : 14598.8, + "blown" : 14594.8, + "comprehend" : 14578.2, + "peasants" : 14575.8, + "opera" : 14571.9, + "assault" : 14568.7, + "deceive" : 14566.3, + "doctrines" : 14560.0, + "representatives" : 14555.2, + "dedicated" : 14553.7, + "struggled" : 14548.1, + "officials" : 14545.8, + "hiding" : 14540.2, + "paths" : 14537.8, + "backs" : 14533.9, + "prominently" : 14518.1, + "prices" : 14517.3, + "procured" : 14517.3, + "mourning" : 14510.1, + "compliment" : 14505.4, + "heights" : 14503.0, + "approval" : 14502.2, + "gasped" : 14495.1, + "breadth" : 14492.0, + "withdraw" : 14488.8, + "tune" : 14473.8, + "compassion" : 14470.6, + "polished" : 14468.2, + "latitude" : 14463.5, + "dishes" : 14461.1, + "parent" : 14461.1, + "contrived" : 14459.5, + "delicacy" : 14459.5, + "projected" : 14456.4, + "akin" : 14454.0, + "f" : 14452.4, + "betray" : 14448.4, + "traced" : 14446.9, + "resentment" : 14432.6, + "indemnify" : 14431.8, + "pseud" : 14428.7, + "sacrifices" : 14418.4, + "disguise" : 14416.0, + "transcription" : 14410.5, + "document" : 14408.1, + "neighbour" : 14405.7, + "squire" : 14402.6, + "punish" : 14393.9, + "bars" : 14391.5, + "glittering" : 14390.7, + "tossed" : 14388.3, + "block" : 14383.6, + "lots" : 14375.7, + "worldly" : 14370.1, + "muscles" : 14367.0, + "elbow" : 14365.4, + "obligation" : 14359.8, + "trifling" : 14359.8, + "decline" : 14357.5, + "attachment" : 14356.7, + "ambitious" : 14355.9, + "filename" : 14351.1, + "artists" : 14341.6, + "bloom" : 14341.6, + "holiday" : 14340.8, + "brute" : 14335.3, + "repair" : 14329.8, + "fist" : 14325.8, + "recollect" : 14324.2, + "eagle" : 14313.9, + "honorable" : 14313.9, + "significant" : 14309.2, + "barren" : 14302.9, + "functions" : 14296.5, + "guided" : 14289.4, + "dense" : 14283.9, + "fiction" : 14277.6, + "viz." : 14273.6, + "adds" : 14270.4, + "rows" : 14270.4, + "recommend" : 14264.1, + "suspicious" : 14261.7, + "resulting" : 14257.8, + "seventy" : 14257.0, + "shillings" : 14253.8, + "educational" : 14252.2, + "duly" : 14247.5, + "governed" : 14246.7, + "scripture" : 14237.2, + "upwards" : 14235.6, + "sworn" : 14234.0, + "nicholas" : 14226.9, + "horn" : 14226.1, + "brook" : 14225.3, + "fund" : 14222.2, + "vienna" : 14213.5, + "lodge" : 14209.5, + "infinitely" : 14207.9, + "clergyman" : 14207.1, + "marshal" : 14206.4, + "ruled" : 14205.6, + "fiercely" : 14200.0, + "portuguese" : 14200.0, + "costume" : 14192.9, + "pit" : 14192.1, + "disorder" : 14188.2, + "sheer" : 14184.2, + "exalted" : 14179.5, + "fare" : 14175.5, + "applause" : 14173.9, + "chaucer" : 14166.8, + "remind" : 14161.3, + "binary" : 14155.7, + "packed" : 14141.5, + "pillow" : 14140.7, + "jersey" : 14139.1, + "abbey" : 14136.7, + "nowhere" : 14135.2, + "anyhow" : 14125.7, + "agitated" : 14122.5, + "marching" : 14122.5, + "catching" : 14121.7, + "el" : 14119.3, + "grasped" : 14117.7, + "arrow" : 14115.4, + "tend" : 14113.8, + "carved" : 14109.8, + "fitting" : 14108.3, + "bonds" : 14105.9, + "instructed" : 14105.9, + "elaborate" : 14101.1, + "corpse" : 14095.6, + "bewildered" : 14088.5, + "essence" : 14071.9, + "positions" : 14071.9, + "emily" : 14067.1, + "edited" : 14063.9, + "continues" : 14062.4, + "harold" : 14056.8, + "elevation" : 14055.2, + "realm" : 14041.8, + "debts" : 14032.3, + "glancing" : 14027.6, + "shops" : 14013.3, + "complained" : 14008.6, + "loyalty" : 14001.4, + "coin" : 13996.7, + "clad" : 13992.0, + "staircase" : 13988.8, + "documents" : 13976.9, + "interpreted" : 13969.8, + "4th" : 13969.0, + "extremity" : 13966.6, + "accord" : 13965.1, + "sally" : 13963.5, + "lace" : 13960.3, + "tremble" : 13957.9, + "exile" : 13955.6, + "gospel" : 13947.7, + "mechanical" : 13947.7, + "successfully" : 13943.7, + "scholar" : 13932.6, + "wonders" : 13923.9, + "arab" : 13920.0, + "temperament" : 13920.0, + "expressing" : 13918.4, + "fred" : 13917.6, + "trap" : 13917.6, + "spots" : 13914.4, + "awaiting" : 13910.5, + "potatoes" : 13909.7, + "likeness" : 13902.6, + "harbour" : 13898.6, + "proofs" : 13885.2, + "jolly" : 13883.6, + "contributed" : 13879.6, + "wits" : 13876.5, + "generosity" : 13869.3, + "ruler" : 13866.2, + "lawrence" : 13858.3, + "cake" : 13856.7, + "lamps" : 13855.9, + "crazy" : 13852.7, + "sincerity" : 13852.7, + "entertain" : 13851.1, + "madame" : 13849.6, + "sir" : 13849.6, + "faculties" : 13845.6, + "hesitate" : 13840.1, + "deepest" : 13836.9, + "seventeen" : 13830.6, + "lordship" : 13817.9, + "greeting" : 13808.4, + "feminine" : 13805.2, + "monstrous" : 13802.9, + "tongues" : 13799.7, + "barely" : 13795.8, + "3d" : 13785.5, + "mansion" : 13784.7, + "facility" : 13783.9, + "praised" : 13779.1, + "warranties" : 13776.0, + "sarah" : 13775.2, + "happier" : 13772.8, + "indicating" : 13772.0, + "rob" : 13764.1, + "gigantic" : 13763.3, + "honey" : 13760.9, + "ladder" : 13757.8, + "ending" : 13754.6, + "wales" : 13754.6, + "swallowed" : 13751.5, + "sunny" : 13747.5, + "knelt" : 13743.5, + "tyranny" : 13742.7, + "decree" : 13739.6, + "stake" : 13738.0, + "divide" : 13734.0, + "dreaming" : 13734.0, + "proclaimed" : 13732.5, + "dignified" : 13730.9, + "tread" : 13729.3, + "mines" : 13724.6, + "viewing" : 13723.8, + "defense" : 13723.0, + "oldest" : 13720.6, + "incredible" : 13718.2, + "bidding" : 13711.9, + "brick" : 13711.9, + "arch" : 13707.1, + "everlasting" : 13703.2, + "elect" : 13700.0, + "sprung" : 13696.9, + "harder" : 13688.2, + "winding" : 13686.6, + "deductible" : 13684.2, + "magistrate" : 13681.8, + "respective" : 13679.5, + "liquor" : 13676.3, + "imitation" : 13670.0, + "shy" : 13670.0, + "perished" : 13669.2, + "prime" : 13666.0, + "studying" : 13662.8, + "eighty" : 13661.3, + "hebrew" : 13658.1, + "unfortunately" : 13656.5, + "licensed" : 13654.9, + "fog" : 13651.0, + "coloured" : 13648.6, + "bits" : 13647.0, + "consult" : 13642.3, + "moves" : 13642.3, + "r" : 13642.3, + "warn" : 13639.9, + "taylor" : 13638.3, + "vile" : 13616.2, + "depended" : 13612.2, + "phil" : 13609.8, + "legend" : 13609.0, + "locations" : 13604.3, + "shallow" : 13602.7, + "doom" : 13601.1, + "dreaded" : 13595.6, + "encouragement" : 13592.4, + "impatiently" : 13575.8, + "scent" : 13567.9, + "varieties" : 13567.1, + "irregular" : 13555.2, + "battles" : 13554.5, + "compass" : 13543.4, + "neighbouring" : 13538.6, + "bliss" : 13536.3, + "harvest" : 13533.9, + "promotion" : 13533.1, + "stove" : 13519.6, + "faithfully" : 13518.9, + "anthony" : 13517.3, + "excellence" : 13515.7, + "transfer" : 13515.7, + "awaited" : 13511.7, + "heathen" : 13510.9, + "poetic" : 13510.9, + "consulted" : 13509.4, + "illustrated" : 13507.0, + "gilbert" : 13501.5, + "br" : 13497.5, + "fundamental" : 13496.7, + "bundle" : 13492.0, + "rebel" : 13481.7, + "cultivation" : 13478.5, + "joys" : 13478.5, + "rigid" : 13476.9, + "tragic" : 13468.2, + "review" : 13462.7, + "representing" : 13459.5, + "flowed" : 13455.6, + "brows" : 13454.0, + "whereupon" : 13451.6, + "terribly" : 13438.2, + "melted" : 13435.8, + "venerable" : 13435.8, + "towers" : 13434.2, + "cooking" : 13432.6, + "mustn't" : 13422.3, + "suspicions" : 13420.8, + "old-fashioned" : 13419.2, + "oppressed" : 13418.4, + "australia" : 13413.6, + "friend's" : 13412.1, + "revolt" : 13411.3, + "swell" : 13407.3, + "improve" : 13405.7, + "williams" : 13405.7, + "describes" : 13403.4, + "goddess" : 13401.8, + "wreck" : 13393.1, + "tennessee" : 13392.3, + "convince" : 13384.4, + "sentences" : 13377.2, + "bowl" : 13376.5, + "radiant" : 13367.8, + "prussia" : 13364.6, + "westward" : 13357.5, + "indignant" : 13355.9, + "refined" : 13345.6, + "unseen" : 13344.8, + "illustration" : 13340.9, + "pertaining" : 13333.7, + "swamp" : 13330.6, + "austrian" : 13329.0, + "saxon" : 13325.0, + "congregation" : 13323.4, + "nerve" : 13321.1, + "undertaking" : 13321.1, + "disclaimer" : 13317.1, + "characteristics" : 13302.9, + "stare" : 13291.8, + "specimens" : 13291.0, + "ascertain" : 13288.6, + "pledge" : 13287.1, + "earn" : 13286.3, + "warfare" : 13285.5, + "supposing" : 13279.9, + "subsequently" : 13279.1, + "attending" : 13278.4, + "angrily" : 13273.6, + "select" : 13268.9, + "animated" : 13267.3, + "industrial" : 13267.3, + "hurriedly" : 13259.4, + "manhood" : 13257.0, + "quantities" : 13246.7, + "interpretation" : 13245.9, + "dressing" : 13242.0, + "rejoiced" : 13241.2, + "edinburgh" : 13238.8, + "catherine" : 13236.4, + "challenge" : 13236.4, + "produces" : 13236.4, + "forbid" : 13235.6, + "gang" : 13234.8, + "boiled" : 13233.3, + "shouts" : 13231.7, + "so-called" : 13229.3, + "theme" : 13229.3, + "thankful" : 13227.7, + "admission" : 13226.9, + "enters" : 13218.2, + "elevated" : 13217.4, + "frenchman" : 13208.7, + "pool" : 13204.8, + "terrified" : 13203.2, + "lads" : 13202.4, + "persisted" : 13189.7, + "conference" : 13185.0, + "equality" : 13183.4, + "genus" : 13180.3, + "didst" : 13176.3, + "newly" : 13172.3, + "generals" : 13171.5, + "surroundings" : 13162.1, + "sorrows" : 13158.9, + "occasioned" : 13154.1, + "invasion" : 13151.0, + "workmen" : 13147.0, + "monks" : 13145.4, + "sends" : 13145.4, + "turkish" : 13144.7, + "discretion" : 13141.5, + "pattern" : 13139.9, + "reveal" : 13139.1, + "endured" : 13128.8, + "resolve" : 13128.0, + "columbia" : 13121.7, + "preach" : 13120.9, + "exceeding" : 13119.3, + "ringing" : 13117.0, + "triumphant" : 13117.0, + "defiance" : 13113.8, + "errand" : 13105.1, + "woke" : 13104.3, + "grandmother" : 13103.5, + "weighed" : 13095.6, + "wool" : 13092.4, + "orleans" : 13080.6, + "communicate" : 13078.2, + "strikes" : 13075.8, + "promising" : 13066.3, + "scenery" : 13066.3, + "righteous" : 13065.5, + "essentially" : 13064.0, + "oppose" : 13060.8, + "joyous" : 13053.7, + "specimen" : 13052.9, + "doctors" : 13049.7, + "eloquent" : 13045.0, + "manager" : 13045.0, + "organs" : 13043.4, + "sticks" : 13042.6, + "drag" : 13041.0, + "haunted" : 13041.0, + "chorus" : 13040.2, + "rational" : 13025.2, + "crop" : 13023.6, + "processing" : 13023.6, + "accurate" : 13018.9, + "wolf" : 13010.9, + "adorned" : 13009.4, + "sheets" : 13007.8, + "resort" : 13006.2, + "refusal" : 13002.2, + "bond" : 12999.1, + "vicinity" : 12992.8, + "preacher" : 12990.4, + "sympathetic" : 12988.0, + "casting" : 12987.2, + "opens" : 12982.5, + "prophets" : 12980.1, + "horns" : 12978.5, + "warmly" : 12976.1, + "salary" : 12970.6, + "continuous" : 12965.9, + "satan" : 12962.7, + "continual" : 12959.5, + "defended" : 12959.5, + "breaks" : 12958.7, + "workers" : 12957.9, + "lantern" : 12957.2, + "balls" : 12955.6, + "rod" : 12955.6, + "blaze" : 12952.4, + "examining" : 12951.6, + "naples" : 12951.6, + "peculiarly" : 12950.0, + "vegetables" : 12950.0, + "ingenious" : 12948.4, + "excite" : 12942.1, + "howard" : 12937.4, + "horseback" : 12935.8, + "re-use" : 12923.1, + "louisiana" : 12921.6, + "farmers" : 12920.0, + "wildly" : 12919.2, + "mouths" : 12916.8, + "carpet" : 12912.8, + "sadness" : 12910.5, + "customary" : 12904.1, + "circles" : 12903.4, + "aren't" : 12895.4, + "wonderfully" : 12891.5, + "max" : 12889.9, + "juan" : 12885.9, + "successor" : 12871.7, + "allied" : 12869.3, + "ceiling" : 12863.8, + "confirmation" : 12855.9, + "glances" : 12855.1, + "diamonds" : 12851.1, + "goal" : 12848.0, + "representations" : 12845.6, + "cash" : 12840.1, + "vacant" : 12837.7, + "antiquity" : 12829.8, + "despise" : 12826.6, + "lawn" : 12817.9, + "they'll" : 12817.9, + "appealed" : 12814.0, + "turkey" : 12811.6, + "texts" : 12809.2, + "neighbor" : 12805.3, + "spreading" : 12802.9, + "discharged" : 12792.6, + "phrases" : 12791.8, + "ultimate" : 12785.5, + "tastes" : 12781.5, + "submission" : 12779.1, + "entry" : 12775.2, + "rachel" : 12769.7, + "blush" : 12760.2, + "monument" : 12757.8, + "hardy" : 12756.2, + "thorough" : 12755.4, + "ein" : 12753.8, + "ecclesiastical" : 12751.5, + "fertile" : 12745.1, + "exciting" : 12744.3, + "captive" : 12738.8, + "severity" : 12736.4, + "considerations" : 12735.6, + "shew" : 12734.8, + "faster" : 12730.9, + "louise" : 12726.1, + "grandeur" : 12723.0, + "winning" : 12716.6, + "solely" : 12713.5, + "globe" : 12709.5, + "malice" : 12708.7, + "echoed" : 12706.4, + "lodging" : 12692.9, + "conservative" : 12692.1, + "throng" : 12691.3, + "prosperous" : 12688.2, + "whistle" : 12685.0, + "floated" : 12671.6, + "transferred" : 12667.6, + "declaring" : 12662.1, + "reckoned" : 12655.7, + "cheese" : 12654.9, + "bite" : 12653.4, + "thoughtfully" : 12652.6, + "breach" : 12643.1, + "enthusiastic" : 12642.3, + "cars" : 12638.3, + "downstairs" : 12638.3, + "allowing" : 12631.2, + "invite" : 12629.6, + "adjoining" : 12620.1, + "dusk" : 12618.5, + "cathedral" : 12617.0, + "truths" : 12616.2, + "plague" : 12612.2, + "sandy" : 12609.8, + "boil" : 12606.7, + "caroline" : 12603.5, + "beautifully" : 12600.4, + "inhabited" : 12600.4, + "tomorrow" : 12600.4, + "exclamation" : 12599.6, + "finishing" : 12590.9, + "shocked" : 12589.3, + "escort" : 12588.5, + "forgetting" : 12584.5, + "hanged" : 12582.9, + "hats" : 12576.6, + "mirth" : 12576.6, + "uncomfortable" : 12574.2, + "connecticut" : 12571.1, + "bows" : 12568.7, + "pierced" : 12562.4, + "harbor" : 12561.6, + "tricks" : 12560.0, + "rubbed" : 12559.2, + "apparatus" : 12556.0, + "mysteries" : 12541.0, + "honesty" : 12537.9, + "negroes" : 12535.5, + "concerns" : 12529.9, + "wander" : 12529.9, + "assert" : 12528.4, + "ceremonies" : 12528.4, + "sacrificed" : 12520.4, + "utterance" : 12518.1, + "dismay" : 12513.3, + "fright" : 12510.2, + "rail" : 12509.4, + "reflections" : 12508.6, + "crops" : 12501.5, + "pushing" : 12498.3, + "proves" : 12496.7, + "jimmy" : 12495.1, + "pathetic" : 12493.5, + "imperfect" : 12487.2, + "haughty" : 12481.7, + "navy" : 12481.7, + "fortress" : 12478.5, + "hurrying" : 12476.9, + "x" : 12474.6, + "blessings" : 12471.4, + "attempting" : 12466.6, + "insects" : 12465.9, + "selling" : 12456.4, + "appreciation" : 12455.6, + "suppressed" : 12446.1, + "acquire" : 12444.5, + "offensive" : 12443.7, + "ripe" : 12435.0, + "dresses" : 12432.6, + "reigned" : 12427.9, + "coldly" : 12417.6, + "candles" : 12412.1, + "km" : 12409.7, + "sixth" : 12398.6, + "blazing" : 12397.8, + "youngest" : 12395.4, + "mask" : 12394.7, + "florida" : 12393.9, + "lecture" : 12393.9, + "parlor" : 12393.9, + "decidedly" : 12392.3, + "whereby" : 12390.7, + "gordon" : 12386.0, + "reverend" : 12386.0, + "successive" : 12385.2, + "perception" : 12383.6, + "buffalo" : 12381.2, + "sire" : 12378.8, + "quitted" : 12375.7, + "keys" : 12374.9, + "develop" : 12373.3, + "function" : 12358.3, + "morals" : 12356.7, + "damned" : 12355.1, + "vexed" : 12345.6, + "2d" : 12344.8, + "pouring" : 12340.9, + "bullet" : 12333.7, + "excessive" : 12332.9, + "bind" : 12325.8, + "identical" : 12325.0, + "cliffs" : 12317.9, + "tools" : 12312.4, + "byron" : 12309.2, + "mexican" : 12308.4, + "piety" : 12308.4, + "superstition" : 12304.5, + "git" : 12302.9, + "substantial" : 12302.9, + "bulk" : 12293.4, + "prevail" : 12293.4, + "wiser" : 12291.8, + "preaching" : 12284.7, + "prolonged" : 12284.7, + "annoyed" : 12276.0, + "westminster" : 12275.2, + "splendour" : 12273.6, + "remembering" : 12272.0, + "richmond" : 12259.4, + "upset" : 12251.5, + "cab" : 12250.7, + "bunch" : 12244.3, + "pencil" : 12243.5, + "subjected" : 12243.5, + "vegetable" : 12241.2, + "exhibit" : 12238.8, + "emerged" : 12237.2, + "cooked" : 12235.6, + "hay" : 12233.3, + "kansas" : 12233.3, + "gale" : 12226.9, + "preached" : 12226.9, + "arnold" : 12219.0, + "trousers" : 12217.4, + "debate" : 12213.5, + "dated" : 12204.0, + "tumult" : 12204.0, + "corruption" : 12202.4, + "summons" : 12201.6, + "comrade" : 12193.7, + "eternity" : 12193.7, + "hears" : 12193.7, + "lingered" : 12188.2, + "propriety" : 12187.4, + "stillness" : 12185.8, + "partial" : 12182.6, + "welcomed" : 12182.6, + "cabinet" : 12178.7, + "proceeds" : 12177.9, + "vow" : 12176.3, + "quaint" : 12174.7, + "soup" : 12173.9, + "beef" : 12170.8, + "rests" : 12165.2, + "slay" : 12164.4, + "surgeon" : 12163.6, + "irresistible" : 12158.9, + "sealed" : 12149.4, + "repeating" : 12146.2, + "needn't" : 12144.7, + "allowance" : 12143.1, + "undertaken" : 12136.7, + "treachery" : 12135.2, + "posts" : 12131.2, + "borders" : 12128.8, + "attendant" : 12127.3, + "unite" : 12123.3, + "murderer" : 12120.9, + "owners" : 12116.2, + "nm" : 12115.4, + "sweeping" : 12114.6, + "unconsciously" : 12108.3, + "blade" : 12101.9, + "saviour" : 12099.6, + "theories" : 12099.6, + "graham" : 12098.8, + "behaved" : 12096.4, + "pleaded" : 12095.6, + "spy" : 12094.8, + "possesses" : 12094.0, + "lawful" : 12091.7, + "tommy" : 12091.7, + "seasons" : 12090.1, + "withdrawn" : 12090.1, + "reckless" : 12086.9, + "factory" : 12086.1, + "shades" : 12083.7, + "gossip" : 12080.6, + "seventh" : 12079.0, + "attendance" : 12075.0, + "robes" : 12071.9, + "journal" : 12065.5, + "systems" : 12063.2, + "dryden" : 12060.0, + "maine" : 12059.2, + "token" : 12054.5, + "intimacy" : 12049.7, + "abstract" : 12048.9, + "machines" : 12048.1, + "bestow" : 12037.1, + "chanced" : 12036.3, + "locks" : 12027.6, + "honestly" : 12026.0, + "legitimate" : 12026.0, + "accent" : 12023.6, + "symptoms" : 12017.3, + "votes" : 12011.7, + "ragged" : 12010.2, + "thursday" : 12009.4, + "manifested" : 12008.6, + "fidelity" : 12006.2, + "swinging" : 12000.7, + "descending" : 11999.9, + "sincerely" : 11999.9, + "bred" : 11995.9, + "whereof" : 11995.9, + "indies" : 11994.3, + "novels" : 11990.4, + "league" : 11988.8, + "failing" : 11984.1, + "succeeding" : 11981.7, + "santa" : 11979.3, + "approve" : 11976.9, + "cautiously" : 11976.1, + "miller" : 11974.6, + "afflicted" : 11972.2, + "lodgings" : 11972.2, + "petition" : 11965.1, + "traffic" : 11963.5, + "sparkling" : 11957.2, + "limb" : 11955.6, + "architecture" : 11951.6, + "disposal" : 11936.6, + "carriages" : 11929.5, + "crack" : 11929.5, + "kindred" : 11927.1, + "naught" : 11927.1, + "ornament" : 11921.6, + "slew" : 11916.8, + "steward" : 11911.3, + "fantastic" : 11905.7, + "evolution" : 11901.0, + "patiently" : 11901.0, + "reverse" : 11896.2, + "survey" : 11890.7, + "dug" : 11889.1, + "amuse" : 11881.2, + "stretching" : 11879.6, + "isaac" : 11874.1, + "forthwith" : 11873.3, + "contemporary" : 11869.3, + "foliage" : 11867.8, + "receives" : 11865.4, + "scandal" : 11861.4, + "donors" : 11858.3, + "deliberate" : 11855.9, + "influenced" : 11855.1, + "intolerable" : 11851.1, + "hearth" : 11849.6, + "symbol" : 11847.2, + "governments" : 11844.8, + "repaired" : 11844.8, + "pleasantly" : 11837.7, + "homage" : 11836.1, + "victorious" : 11835.3, + "columbus" : 11831.4, + "recovery" : 11830.6, + "defined" : 11829.8, + "attendants" : 11828.2, + "modesty" : 11824.2, + "diana" : 11821.1, + "washing" : 11817.9, + "pavement" : 11815.5, + "unnatural" : 11814.8, + "decisive" : 11811.6, + "wisely" : 11806.1, + "precise" : 11799.7, + "negative" : 11798.9, + "occurrence" : 11798.1, + "snatched" : 11796.6, + "shaft" : 11795.0, + "linked" : 11793.4, + "festival" : 11792.6, + "exclusively" : 11788.6, + "jove" : 11788.6, + "wickedness" : 11785.5, + "visions" : 11782.3, + "maggie" : 11779.9, + "rosy" : 11777.6, + "carelessly" : 11776.0, + "stem" : 11775.2, + "corporation" : 11772.0, + "dec" : 11771.2, + "feeding" : 11771.2, + "allen" : 11767.3, + "cows" : 11762.5, + "schemes" : 11754.6, + "preference" : 11753.8, + "urge" : 11753.8, + "husbands" : 11752.3, + "labours" : 11751.5, + "shrill" : 11750.7, + "exercises" : 11746.7, + "sovereignty" : 11745.1, + "reduce" : 11740.4, + "distressed" : 11731.7, + "clearing" : 11730.1, + "removal" : 11727.7, + "dean" : 11725.4, + "scottish" : 11722.2, + "assertion" : 11719.8, + "accessible" : 11718.2, + "comedy" : 11718.2, + "flush" : 11718.2, + "code" : 11715.9, + "philosophers" : 11713.5, + "adequate" : 11711.1, + "vaguely" : 11711.1, + "treason" : 11709.5, + "hunter" : 11702.4, + "chambers" : 11697.7, + "split" : 11695.3, + "yielding" : 11692.9, + "newsletter" : 11691.3, + "snake" : 11689.0, + "pub" : 11685.8, + "historian" : 11681.8, + "ass" : 11678.7, + "intensity" : 11678.7, + "democracy" : 11669.2, + "battery" : 11668.4, + "draws" : 11666.8, + "netherlands" : 11666.8, + "creed" : 11666.0, + "liking" : 11666.0, + "luke" : 11655.7, + "tyrant" : 11654.2, + "strove" : 11647.8, + "attraction" : 11647.0, + "slaughter" : 11647.0, + "dismal" : 11639.1, + "deposited" : 11636.0, + "assent" : 11632.8, + "cups" : 11632.8, + "concert" : 11628.8, + "downward" : 11620.1, + "canal" : 11616.2, + "evenings" : 11612.2, + "wax" : 11612.2, + "detective" : 11609.1, + "fancies" : 11604.3, + "spoiled" : 11604.3, + "revolver" : 11599.6, + "murray" : 11598.0, + "earned" : 11586.1, + "analysis" : 11582.2, + "finer" : 11579.0, + "paces" : 11575.8, + "roaring" : 11573.5, + "prompt" : 11570.3, + "paperwork" : 11568.7, + "wherefore" : 11567.9, + "emphasis" : 11560.8, + "sharing" : 11551.3, + "delayed" : 11550.5, + "inherited" : 11549.7, + "bronze" : 11545.0, + "waking" : 11542.6, + "garment" : 11541.8, + "redistributing" : 11541.8, + "wholesome" : 11537.9, + "remorse" : 11537.1, + "plato" : 11535.5, + "morris" : 11533.1, + "stooped" : 11527.6, + "dew" : 11524.4, + "monk" : 11522.8, + "thrill" : 11522.0, + "hue" : 11515.7, + "exclusive" : 11507.8, + "funds" : 11507.8, + "porter" : 11503.0, + "uncommon" : 11502.3, + "dash" : 11496.7, + "strained" : 11494.3, + "confounded" : 11492.8, + "swim" : 11492.8, + "strip" : 11488.0, + "middle-aged" : 11483.3, + "ultimately" : 11481.7, + "team" : 11477.7, + "missionary" : 11476.9, + "esteemed" : 11461.9, + "tracks" : 11446.9, + "envelope" : 11444.5, + "whoever" : 11443.7, + "expensive" : 11442.9, + "headquarters" : 11442.1, + "cherished" : 11440.5, + "brandy" : 11429.5, + "startling" : 11427.1, + "homer" : 11426.3, + "talks" : 11425.5, + "acute" : 11422.4, + "cigarette" : 11417.6, + "motor" : 11417.6, + "embarrassed" : 11413.6, + "janet" : 11407.3, + "volunteer" : 11402.6, + "offspring" : 11401.8, + "network" : 11397.8, + "reaches" : 11397.8, + "indispensable" : 11397.0, + "plane" : 11393.9, + "reaction" : 11392.3, + "regiments" : 11385.2, + "g" : 11383.6, + "sums" : 11380.4, + "partially" : 11379.6, + "prejudices" : 11375.7, + "proudly" : 11370.1, + "baggage" : 11364.6, + "terrace" : 11360.6, + "deaf" : 11358.3, + "allusion" : 11357.5, + "grip" : 11357.5, + "juice" : 11354.3, + "isabel" : 11346.4, + "resigned" : 11346.4, + "humility" : 11343.2, + "benjamin" : 11330.6, + "blast" : 11330.6, + "ministry" : 11329.8, + "sexual" : 11329.8, + "nile" : 11329.0, + "diameter" : 11327.4, + "troop" : 11325.8, + "onward" : 11316.3, + "crowds" : 11313.2, + "marrying" : 11309.2, + "tightly" : 11309.2, + "sullen" : 11302.1, + "brutal" : 11301.3, + "axe" : 11300.5, + "holmes" : 11293.4, + "penalty" : 11292.6, + "tops" : 11290.2, + "diamond" : 11283.1, + "boards" : 11274.4, + "corridor" : 11274.4, + "endowed" : 11266.5, + "strengthened" : 11266.5, + "cells" : 11248.3, + "proportions" : 11246.7, + "alternate" : 11242.8, + "echo" : 11242.0, + "restraint" : 11241.2, + "trials" : 11240.4, + "reads" : 11239.6, + "identity" : 11238.8, + "headed" : 11238.0, + "softened" : 11237.2, + "quivering" : 11231.7, + "stages" : 11230.1, + "sway" : 11225.4, + "poetical" : 11224.6, + "objected" : 11222.2, + "screen" : 11220.6, + "professed" : 11216.7, + "dirt" : 11215.9, + "ascertained" : 11215.1, + "era" : 11213.5, + "wider" : 11208.0, + "ambassador" : 11205.6, + "constituted" : 11205.6, + "breed" : 11204.0, + "interference" : 11204.0, + "eyebrows" : 11197.7, + "shapes" : 11197.7, + "afar" : 11192.9, + "consist" : 11183.4, + "acceptance" : 11180.3, + "displays" : 11176.3, + "flashing" : 11176.3, + "hunted" : 11173.1, + "beauties" : 11172.4, + "lazy" : 11172.4, + "shrewd" : 11170.0, + "extravagant" : 11169.2, + "momentary" : 11169.2, + "cordial" : 11166.8, + "engineer" : 11166.0, + "rapidity" : 11166.0, + "nov" : 11163.6, + "halt" : 11158.9, + "alternative" : 11158.1, + "devils" : 11156.5, + "stamp" : 11154.9, + "compact" : 11152.6, + "whites" : 11147.0, + "breathless" : 11146.2, + "encoding" : 11146.2, + "drift" : 11145.5, + "disappear" : 11141.5, + "roared" : 11138.3, + "revived" : 11136.8, + "counter" : 11134.4, + "venus" : 11128.8, + "imaginary" : 11128.0, + "diminished" : 11127.3, + "honoured" : 11123.3, + "5th" : 11111.4, + "despatched" : 11111.4, + "objections" : 11111.4, + "ray" : 11110.6, + "climbing" : 11105.1, + "attract" : 11103.5, + "astonishing" : 11099.6, + "competition" : 11097.2, + "suggestions" : 11096.4, + "ink" : 11082.2, + "oft" : 11076.6, + "crystal" : 11074.3, + "shower" : 11074.3, + "diseases" : 11067.1, + "ferdinand" : 11065.5, + "obedient" : 11062.4, + "draught" : 11061.6, + "wondrous" : 11057.6, + "await" : 11049.7, + "armour" : 11048.9, + "massive" : 11048.1, + "bottles" : 11047.4, + "kin" : 11045.8, + "cellar" : 11045.0, + "falsehood" : 11041.8, + "pillars" : 11041.0, + "edgar" : 11038.7, + "philosophical" : 11033.1, + "martha" : 11031.5, + "worlds" : 11022.0, + "memorable" : 11015.7, + "jacques" : 11011.0, + "detected" : 11007.8, + "stealing" : 11006.2, + "noisy" : 11004.6, + "henceforth" : 10996.7, + "cicero" : 10995.1, + "laden" : 10992.0, + "frost" : 10986.4, + "device" : 10984.9, + "glare" : 10984.9, + "touches" : 10984.1, + "senate" : 10981.7, + "lasting" : 10979.3, + "communion" : 10976.9, + "transport" : 10976.2, + "constantinople" : 10975.4, + "coffin" : 10973.8, + "eventually" : 10973.0, + "johnny" : 10973.0, + "enclosed" : 10970.6, + "forgiveness" : 10970.6, + "awfully" : 10966.7, + "clinging" : 10947.7, + "darkened" : 10946.9, + "contemplation" : 10944.5, + "termed" : 10944.5, + "manufacture" : 10942.1, + "swallow" : 10935.0, + "commonplace" : 10931.1, + "nancy" : 10929.5, + "resembled" : 10927.9, + "she'd" : 10927.1, + "labors" : 10922.4, + "contracted" : 10921.6, + "inscription" : 10921.6, + "comfortably" : 10905.7, + "indulge" : 10901.0, + "indulgence" : 10898.6, + "bravely" : 10892.3, + "kneeling" : 10890.7, + "yea" : 10888.3, + "keenly" : 10886.8, + "exhibition" : 10884.4, + "agricultural" : 10881.2, + "enlightened" : 10879.6, + "quest" : 10878.1, + "compliments" : 10874.9, + "crest" : 10868.6, + "extension" : 10865.4, + "uneasiness" : 10856.7, + "constitute" : 10851.2, + "inflicted" : 10850.4, + "lakes" : 10848.0, + "swing" : 10845.6, + "meadow" : 10836.1, + "noblest" : 10836.1, + "downloading" : 10834.5, + "complex" : 10826.6, + "controversy" : 10824.3, + "freed" : 10819.5, + "resignation" : 10819.5, + "tempest" : 10818.7, + "guidance" : 10817.9, + "prospects" : 10816.3, + "humbly" : 10811.6, + "lined" : 10809.2, + "serene" : 10804.5, + "shrugged" : 10797.4, + "honours" : 10796.6, + "roughly" : 10796.6, + "checks" : 10795.0, + "remarkably" : 10789.4, + "dainty" : 10784.7, + "overhead" : 10783.1, + "commencement" : 10778.4, + "singularly" : 10776.8, + "brightness" : 10761.0, + "oppression" : 10760.2, + "repeatedly" : 10759.4, + "conspiracy" : 10755.4, + "restrain" : 10751.5, + "splendor" : 10742.8, + "preservation" : 10740.4, + "pub" : 10739.6, + "pepper" : 10738.0, + "basin" : 10736.4, + "creeping" : 10735.6, + "matthew" : 10730.9, + "publicly" : 10729.3, + "percy" : 10725.4, + "continuing" : 10723.8, + "grove" : 10721.4, + "calamity" : 10719.8, + "pony" : 10715.1, + "vigour" : 10715.1, + "melody" : 10711.1, + "profitable" : 10711.1, + "descendants" : 10710.3, + "hire" : 10704.8, + "speculation" : 10704.0, + "discoveries" : 10699.3, + "accepts" : 10698.5, + "drunken" : 10698.5, + "candidate" : 10696.9, + "principally" : 10694.5, + "worried" : 10692.1, + "obstinate" : 10689.0, + "hasten" : 10686.6, + "foreigners" : 10682.6, + "elderly" : 10681.1, + "overwhelmed" : 10681.1, + "instincts" : 10677.9, + "telegraph" : 10670.8, + "russell" : 10662.9, + "university" : 10661.3, + "ghastly" : 10660.5, + "patron" : 10659.7, + "varying" : 10658.1, + "barbarous" : 10655.7, + "celestial" : 10655.7, + "t'" : 10654.2, + "patriotism" : 10653.4, + "modify" : 10649.4, + "earnestness" : 10647.0, + "exertion" : 10646.2, + "fox" : 10645.5, + "refusing" : 10643.1, + "horsemen" : 10639.1, + "inspection" : 10634.4, + "stations" : 10633.6, + "grieved" : 10632.0, + "louder" : 10632.0, + "bursting" : 10625.7, + "regretted" : 10620.9, + "mournful" : 10615.4, + "pursuing" : 10612.2, + "traitor" : 10609.1, + "associations" : 10601.9, + "cautious" : 10598.0, + "foundations" : 10598.0, + "stamped" : 10598.0, + "prior" : 10597.2, + "undertook" : 10594.0, + "telegram" : 10592.5, + "beggar" : 10591.7, + "chimney" : 10590.9, + "complicated" : 10586.9, + "davis" : 10586.1, + "striving" : 10586.1, + "magistrates" : 10584.5, + "converse" : 10582.2, + "graces" : 10581.4, + "wiped" : 10575.8, + "oars" : 10572.7, + "apology" : 10571.1, + "scared" : 10571.1, + "imprisonment" : 10569.5, + "eastward" : 10567.9, + "substitute" : 10565.6, + "yahweh" : 10560.8, + "handful" : 10557.6, + "usage" : 10556.1, + "lodged" : 10551.3, + "of." : 10551.3, + "villain" : 10551.3, + "banished" : 10541.8, + "restoration" : 10541.0, + "serpent" : 10538.7, + "hedge" : 10534.7, + "k" : 10534.7, + "jurisdiction" : 10532.3, + "captains" : 10530.7, + "settlers" : 10530.7, + "gaining" : 10530.0, + "valiant" : 10530.0, + "primary" : 10525.2, + "storms" : 10525.2, + "beam" : 10522.8, + "victoria" : 10522.8, + "tour" : 10512.5, + "prophecy" : 10510.2, + "spectacles" : 10510.2, + "obsolete" : 10507.0, + "buying" : 10502.3, + "shepherd" : 10500.7, + "wells" : 10500.7, + "harriet" : 10496.7, + "exaggerated" : 10495.1, + "heated" : 10494.4, + "penetrated" : 10493.6, + "travels" : 10492.0, + "earl" : 10489.6, + "hereditary" : 10488.8, + "ali" : 10488.0, + "supernatural" : 10486.4, + "competent" : 10482.5, + "piled" : 10481.7, + "hostess" : 10480.1, + "agriculture" : 10478.5, + "boughs" : 10476.2, + "urgent" : 10476.2, + "gratified" : 10475.4, + "suffice" : 10474.6, + "ports" : 10473.0, + "drifted" : 10470.6, + "accuracy" : 10465.9, + "deceased" : 10465.9, + "circular" : 10463.5, + "securing" : 10458.7, + "possibilities" : 10455.6, + "rhine" : 10454.8, + "alert" : 10451.6, + "neighboring" : 10442.9, + "democratic" : 10440.6, + "quebec" : 10440.6, + "bud" : 10439.8, + "accounted" : 10431.9, + "aided" : 10427.1, + "augustus" : 10425.5, + "blanket" : 10425.5, + "hail" : 10423.9, + "pretence" : 10422.4, + "beams" : 10417.6, + "andy" : 10416.8, + "pig" : 10416.0, + "shaped" : 10408.1, + "oven" : 10407.3, + "rounded" : 10406.5, + "ivory" : 10400.2, + "northward" : 10395.5, + "isolated" : 10390.7, + "policeman" : 10382.0, + "aug" : 10381.2, + "conventional" : 10380.4, + "babylon" : 10378.1, + "dusty" : 10378.1, + "bishops" : 10374.1, + "complaints" : 10372.5, + "stripped" : 10370.1, + "plead" : 10367.8, + "hinder" : 10365.4, + "8vo" : 10363.0, + "cord" : 10355.1, + "flows" : 10351.9, + "personage" : 10351.9, + "classical" : 10351.2, + "alongside" : 10349.6, + "wrongs" : 10348.0, + "extract" : 10345.6, + "rewarded" : 10343.2, + "lungs" : 10334.5, + "lighter" : 10332.2, + "kisses" : 10331.4, + "serves" : 10329.8, + "pint" : 10324.3, + "forgiven" : 10322.7, + "sternly" : 10321.1, + "proclamation" : 10320.3, + "realised" : 10320.3, + "pipes" : 10316.3, + "arising" : 10314.0, + "pitched" : 10314.0, + "tube" : 10310.8, + "observer" : 10308.4, + "smote" : 10308.4, + "avenue" : 10302.9, + "elephant" : 10298.9, + "burke" : 10297.4, + "footing" : 10295.8, + "statesman" : 10295.8, + "rebels" : 10292.6, + "nails" : 10291.0, + "wears" : 10290.2, + "doomed" : 10289.4, + "edges" : 10283.9, + "esther" : 10278.4, + "indiana" : 10276.0, + "affecting" : 10274.4, + "stormy" : 10274.4, + "bee" : 10268.9, + "bury" : 10267.3, + "efficient" : 10266.5, + "mix" : 10266.5, + "supporting" : 10266.5, + "actor" : 10261.8, + "disturbance" : 10261.0, + "sweat" : 10260.2, + "executive" : 10258.6, + "seemingly" : 10258.6, + "tenth" : 10252.3, + "blossoms" : 10250.7, + "ethel" : 10247.5, + "folds" : 10245.1, + "painfully" : 10245.1, + "polish" : 10245.1, + "shudder" : 10240.4, + "oe." : 10235.6, + "roofs" : 10229.3, + "comparative" : 10222.2, + "begging" : 10216.7, + "imposing" : 10216.7, + "notable" : 10213.5, + "invested" : 10209.5, + "imprisoned" : 10208.0, + "mute" : 10199.3, + "amy" : 10196.9, + "cage" : 10195.3, + "esq" : 10195.3, + "pg" : 10192.1, + "cured" : 10190.6, + "cargo" : 10187.4, + "prof." : 10185.8, + "negotiations" : 10181.9, + "assented" : 10180.3, + "jail" : 10180.3, + "skilful" : 10180.3, + "ideals" : 10178.7, + "conferred" : 10177.1, + "resulted" : 10171.6, + "illusion" : 10169.2, + "torment" : 10167.6, + "troublesome" : 10162.1, + "crowns" : 10158.9, + "feb" : 10155.7, + "repentance" : 10152.6, + "blankets" : 10151.0, + "proprietor" : 10144.7, + "uncertainty" : 10144.7, + "concentrated" : 10143.9, + "mediterranean" : 10143.9, + "covers" : 10141.5, + "scream" : 10140.7, + "compromise" : 10137.5, + "respectful" : 10137.5, + "chariot" : 10136.8, + "ammunition" : 10136.0, + "bonnet" : 10135.2, + "secondary" : 10132.8, + "persia" : 10126.5, + "persecution" : 10122.5, + "lesser" : 10120.1, + "assistant" : 10119.4, + "saluted" : 10116.2, + "fits" : 10112.2, + "indulged" : 10111.4, + "springing" : 10109.1, + "cane" : 10106.7, + "fold" : 10106.7, + "boundary" : 10105.1, + "valued" : 10101.9, + "she'll" : 10099.6, + "rugged" : 10098.8, + "aloft" : 10098.0, + "thieves" : 10093.2, + "parlour" : 10091.7, + "indebted" : 10090.1, + "tons" : 10088.5, + "processes" : 10085.3, + "dave" : 10078.2, + "moore" : 10076.6, + "argue" : 10074.3, + "dearly" : 10056.1, + "logic" : 10054.5, + "panic" : 10047.4, + "restrained" : 10045.8, + "lb" : 10043.4, + "vainly" : 10043.4, + "weariness" : 10041.0, + "enlarged" : 10036.3, + "franklin" : 10035.5, + "tasted" : 10033.9, + "rural" : 10030.0, + "torrent" : 10030.0, + "resolute" : 10026.8, + "refrain" : 10024.4, + "kissing" : 10021.3, + "gorgeous" : 10015.7, + "meets" : 10015.7, + "circulation" : 10014.9, + "passionately" : 10009.4, + "inasmuch" : 10005.4, + "unexpectedly" : 10004.6, + "stress" : 10002.3, + "consumption" : 9999.94, + "groan" : 9995.98, + "suits" : 9994.40, + "sustain" : 9993.61, + "hosts" : 9987.28, + "crash" : 9985.70, + "resemble" : 9984.11, + "epoch" : 9979.37, + "quote" : 9975.41, + "lacking" : 9971.46, + "nominally" : 9971.46, + "choked" : 9970.66, + "aristocracy" : 9969.87, + "granite" : 9969.08, + "gradual" : 9967.50, + "delights" : 9964.33, + "hurled" : 9964.33, + "joyful" : 9961.96, + "sack" : 9960.38, + "slumber" : 9958.01, + "detached" : 9956.42, + "snapped" : 9956.42, + "shadowy" : 9954.05, + "accompanying" : 9950.09, + "annoyance" : 9948.51, + "crush" : 9947.72, + "needle" : 9941.39, + "repent" : 9934.27, + "phenomenon" : 9927.94, + "execute" : 9926.36, + "canst" : 9920.82, + "smoked" : 9914.49, + "greet" : 9911.33, + "monarchy" : 9908.16, + "behave" : 9905.00, + "richly" : 9905.00, + "controlled" : 9904.21, + "strive" : 9902.63, + "endeavor" : 9901.84, + "barrier" : 9897.88, + "canadian" : 9897.88, + "curve" : 9890.76, + "politeness" : 9889.18, + "flora" : 9883.64, + "rely" : 9875.73, + "flank" : 9872.56, + "convenience" : 9870.98, + "courteous" : 9866.23, + "logs" : 9866.23, + "lamb" : 9863.86, + "effectually" : 9859.11, + "robinson" : 9856.74, + "logical" : 9855.16, + "shan't" : 9855.16, + "dimly" : 9853.58, + "withered" : 9851.99, + "diet" : 9851.20, + "praises" : 9851.20, + "fulfil" : 9849.62, + "mantle" : 9848.83, + "ne'er" : 9848.83, + "discussing" : 9843.29, + "chicken" : 9838.54, + "judicial" : 9838.54, + "consistent" : 9836.17, + "ridicule" : 9835.38, + "as." : 9834.59, + "reins" : 9834.59, + "barrel" : 9833.01, + "distrust" : 9832.22, + "trunks" : 9829.84, + "verily" : 9829.05, + "hunters" : 9827.47, + "feather" : 9825.10, + "desperately" : 9820.35, + "goodly" : 9817.18, + "habitual" : 9815.60, + "voluntary" : 9815.60, + "luncheon" : 9812.44, + "eighteenth" : 9808.48, + "exertions" : 9807.69, + "expert" : 9806.90, + "coolly" : 9806.11, + "mistakes" : 9804.53, + "tedious" : 9802.94, + "contemplated" : 9796.61, + "clark" : 9795.82, + "jacket" : 9795.82, + "gleaming" : 9792.66, + "shrank" : 9787.91, + "swimming" : 9787.12, + "kent" : 9785.54, + "perplexed" : 9782.37, + "impressive" : 9780.79, + "universally" : 9780.00, + "displeasure" : 9776.84, + "maids" : 9772.09, + "rates" : 9772.09, + "underneath" : 9771.30, + "expedient" : 9767.34, + "emma" : 9758.64, + "impress" : 9755.48, + "bees" : 9751.52, + "bounded" : 9751.52, + "worshipped" : 9750.73, + "resisted" : 9749.94, + "provincial" : 9749.15, + "popularity" : 9748.36, + "baker" : 9747.56, + "shattered" : 9747.56, + "merciful" : 9745.98, + "olive" : 9745.19, + "tramp" : 9742.82, + "compensation" : 9740.44, + "ernest" : 9736.49, + "martial" : 9736.49, + "genial" : 9735.70, + "syria" : 9735.70, + "conjecture" : 9734.91, + "van" : 9734.91, + "waiter" : 9734.11, + "detained" : 9730.95, + "items" : 9728.58, + "promote" : 9727.79, + "delaware" : 9726.99, + "covenant" : 9725.41, + "nought" : 9722.25, + "interposed" : 9721.46, + "seizing" : 9721.46, + "sinner" : 9719.08, + "vigor" : 9715.92, + "devote" : 9715.13, + "decorated" : 9705.63, + "sentimental" : 9700.10, + "yoke" : 9700.10, + "properties" : 9698.51, + "warlike" : 9696.93, + "perilous" : 9694.56, + "threats" : 9687.44, + "kindled" : 9684.27, + "lays" : 9684.27, + "hostility" : 9682.69, + "dragging" : 9679.53, + "mare" : 9677.94, + "regulations" : 9676.36, + "obstacle" : 9674.78, + "sage" : 9673.20, + "destitute" : 9672.41, + "pays" : 9671.62, + "sleepy" : 9669.24, + "dublin" : 9662.91, + "jonathan" : 9661.33, + "posterity" : 9661.33, + "they'd" : 9661.33, + "nod" : 9658.96, + "mason" : 9655.00, + "patriotic" : 9653.42, + "plantation" : 9650.25, + "pitiful" : 9649.46, + "foster" : 9648.67, + "requisite" : 9647.88, + "expose" : 9647.09, + "oxen" : 9647.09, + "patch" : 9647.09, + "anderson" : 9644.72, + "stuart" : 9643.13, + "interruption" : 9641.55, + "lance" : 9641.55, + "payable" : 9639.18, + "definition" : 9637.60, + "birthday" : 9636.81, + "thumb" : 9636.81, + "wolves" : 9635.22, + "hammer" : 9632.06, + "overwhelming" : 9631.27, + "intensely" : 9628.10, + "revolutionary" : 9627.31, + "fragrant" : 9626.52, + "bleeding" : 9625.73, + "sheltered" : 9625.73, + "circuit" : 9624.15, + "dominions" : 9623.36, + "sales" : 9616.24, + "energetic" : 9615.44, + "insignificant" : 9612.28, + "repetition" : 9610.70, + "we'd" : 9602.00, + "amazing" : 9595.67, + "trains" : 9591.71, + "skirts" : 9590.13, + "tip" : 9589.34, + "trivial" : 9589.34, + "kick" : 9588.55, + "tended" : 9586.17, + "rejoicing" : 9581.43, + "dig" : 9579.05, + "pet" : 9575.89, + "skull" : 9575.89, + "lectures" : 9574.31, + "ness" : 9573.51, + "threat" : 9571.93, + "legislature" : 9570.35, + "plunder" : 9567.98, + "removing" : 9567.98, + "jungle" : 9567.19, + "ghosts" : 9566.39, + "numbered" : 9562.44, + "famine" : 9559.27, + "palaces" : 9552.94, + "sorrowful" : 9547.41, + "improvements" : 9543.45, + "coleridge" : 9542.66, + "fuller" : 9540.29, + "asp" : 9533.96, + "blocks" : 9531.58, + "darted" : 9526.05, + "shrine" : 9524.46, + "heel" : 9522.88, + "typical" : 9518.93, + "throws" : 9516.55, + "fortunately" : 9514.97, + "recognise" : 9512.60, + "fuel" : 9511.01, + "6th" : 9507.85, + "tranquil" : 9507.06, + "frown" : 9501.52, + "destination" : 9498.36, + "plunge" : 9494.40, + "moor" : 9488.86, + "pin" : 9485.70, + "mars" : 9484.91, + "associate" : 9484.12, + "here's" : 9480.95, + "owen" : 9480.95, + "10th" : 9480.16, + "arabic" : 9478.58, + "vicious" : 9478.58, + "framed" : 9477.79, + "banquet" : 9477.00, + "expressive" : 9474.62, + "instinctively" : 9461.96, + "lighting" : 9461.96, + "scanning" : 9461.96, + "subordinate" : 9461.17, + "jaws" : 9458.80, + "patent" : 9458.80, + "courtyard" : 9452.47, + "gulf" : 9449.31, + "destroying" : 9446.93, + "detailed" : 9439.81, + "regulating" : 9430.32, + "closet" : 9429.53, + "compel" : 9427.15, + "inland" : 9426.36, + "excepting" : 9423.20, + "pretext" : 9417.66, + "legislative" : 9414.50, + "stationed" : 9413.71, + "rash" : 9408.17, + "margin" : 9401.05, + "champion" : 9400.26, + "settling" : 9400.26, + "billion" : 9396.30, + "shorter" : 9393.93, + "betwixt" : 9393.14, + "admiring" : 9392.34, + "morgan" : 9390.76, + "nick" : 9390.76, + "chemical" : 9389.97, + "chapters" : 9389.18, + "worthless" : 9386.02, + "aristocratic" : 9382.85, + "nan" : 9382.06, + "especial" : 9378.10, + "hon" : 9378.10, + "attentive" : 9376.52, + "maintenance" : 9374.15, + "charlie" : 9372.57, + "explanatory" : 9371.78, + "differently" : 9367.82, + "furiously" : 9367.82, + "pulse" : 9367.03, + "scanty" : 9367.03, + "flee" : 9364.65, + "admiral" : 9363.86, + "clause" : 9360.70, + "resume" : 9359.12, + "compound" : 9358.33, + "pilot" : 9353.58, + "growled" : 9351.21, + "charmed" : 9344.09, + "imitate" : 9341.71, + "happening" : 9339.34, + "knot" : 9335.38, + "rags" : 9329.85, + "mock" : 9320.35, + "majestic" : 9316.40, + "messages" : 9314.02, + "prussian" : 9312.44, + "suspense" : 9312.44, + "clare" : 9310.07, + "relationship" : 9309.28, + "skirt" : 9308.48, + "agency" : 9303.74, + "arisen" : 9302.95, + "grin" : 9301.36, + "unusually" : 9300.57, + "michigan" : 9298.99, + "hoarse" : 9296.62, + "mills" : 9286.33, + "intently" : 9283.17, + "dining" : 9281.59, + "demonstration" : 9280.79, + "depression" : 9277.63, + "lain" : 9276.84, + "expectations" : 9272.88, + "joining" : 9272.09, + "weekly" : 9268.14, + "trenches" : 9267.35, + "technical" : 9262.60, + "vehicle" : 9262.60, + "aimed" : 9253.10, + "borrow" : 9253.10, + "flattering" : 9249.15, + "portugal" : 9248.36, + "prodigious" : 9246.78, + "scope" : 9245.98, + "vegetation" : 9245.98, + "switzerland" : 9243.61, + "arkansas" : 9242.82, + "swelling" : 9242.82, + "fortified" : 9241.24, + "favoured" : 9238.07, + "salute" : 9238.07, + "topic" : 9237.28, + "blushed" : 9233.33, + "superb" : 9231.74, + "strengthen" : 9230.16, + "confidential" : 9228.58, + "crow" : 9227.79, + "shawl" : 9226.21, + "sunrise" : 9226.21, + "sings" : 9224.62, + "coats" : 9220.67, + "sturdy" : 9219.88, + "dissolved" : 9218.30, + "lifetime" : 9218.30, + "dispersed" : 9217.50, + "sergeant" : 9216.71, + "contribute" : 9215.92, + "strode" : 9215.13, + "brigade" : 9214.34, + "verdict" : 9211.97, + "they've" : 9203.26, + "honors" : 9198.52, + "panting" : 9188.23, + "females" : 9187.44, + "richest" : 9187.44, + "attribute" : 9186.65, + "brighter" : 9184.28, + "hook" : 9183.49, + "discontent" : 9173.20, + "orderly" : 9172.41, + "airs" : 9165.29, + "tiger" : 9165.29, + "messengers" : 9163.71, + "penetrate" : 9157.38, + "sabbath" : 9157.38, + "identification" : 9156.59, + "holiness" : 9155.80, + "crooked" : 9154.21, + "housekeeper" : 9144.72, + "productions" : 9142.35, + "prescribed" : 9139.18, + "rector" : 9139.18, + "spark" : 9135.23, + "sleeve" : 9132.06, + "honored" : 9127.31, + "tame" : 9124.94, + "highway" : 9124.15, + "alabama" : 9123.36, + "edmund" : 9118.61, + "militia" : 9113.87, + "nobleman" : 9113.87, + "energies" : 9112.28, + "spacious" : 9109.12, + "tearing" : 9102.00, + "affliction" : 9099.62, + "photograph" : 9094.88, + "ally" : 9090.92, + "hampshire" : 9088.55, + "ascent" : 9086.18, + "ditch" : 9084.59, + "fishes" : 9083.80, + "jupiter" : 9080.64, + "rubbing" : 9071.94, + "tract" : 9069.56, + "standards" : 9064.81, + "afore" : 9064.02, + "ribbon" : 9063.23, + "cecilia" : 9058.49, + "oregon" : 9057.69, + "integrity" : 9054.53, + "plus" : 9051.37, + "transparent" : 9048.20, + "farms" : 9043.45, + "pulpit" : 9036.33, + "ropes" : 9034.75, + "nineteen" : 9033.96, + "rescued" : 9032.38, + "counting" : 9030.80, + "perfume" : 9030.80, + "socrates" : 9030.80, + "hounds" : 9028.42, + "solicited" : 9028.42, + "bother" : 9022.88, + "fascinating" : 9016.56, + "qualified" : 9016.56, + "desolation" : 9015.76, + "essay" : 9014.97, + "rains" : 9014.97, + "renew" : 9014.18, + "odious" : 9011.81, + "assuredly" : 9011.02, + "suggests" : 9005.48, + "rider" : 8996.78, + "loneliness" : 8992.82, + "pond" : 8992.03, + "activities" : 8982.54, + "dazzling" : 8981.75, + "leaping" : 8981.75, + "squadron" : 8980.16, + "bowing" : 8977.79, + "novelty" : 8977.79, + "wrist" : 8971.46, + "keeper" : 8968.30, + "homeward" : 8966.71, + "alexandria" : 8965.92, + "finely" : 8962.76, + "li" : 8960.39, + "efficiency" : 8958.80, + "marvel" : 8956.43, + "tranquillity" : 8954.85, + "agnes" : 8951.68, + "charities" : 8951.68, + "spenser" : 8950.10, + "condemn" : 8946.14, + "elephants" : 8945.35, + "elders" : 8942.98, + "julian" : 8942.98, + "tries" : 8942.98, + "2nd" : 8939.82, + "sweetly" : 8939.02, + "endurance" : 8937.44, + "bags" : 8936.65, + "reared" : 8932.70, + "jaw" : 8931.90, + "unique" : 8931.90, + "navigation" : 8931.11, + "inevitably" : 8928.74, + "admirably" : 8927.16, + "sect" : 8927.16, + "drum" : 8923.20, + "poles" : 8921.62, + "verge" : 8918.46, + "piercing" : 8912.13, + "sanction" : 8911.33, + "russians" : 8904.21, + "forlorn" : 8901.84, + "approbation" : 8899.47, + "organic" : 8895.51, + "stanley" : 8895.51, + "allegiance" : 8891.56, + "bin" : 8891.56, + "expressly" : 8879.69, + "ingenuity" : 8877.32, + "dispose" : 8873.36, + "stained" : 8873.36, + "theology" : 8870.20, + "withal" : 8870.20, + "duration" : 8868.61, + "fundraising" : 8851.21, + "adj." : 8846.46, + "collecting" : 8846.46, + "weigh" : 8841.71, + "sweetest" : 8840.13, + "float" : 8839.34, + "consul" : 8837.76, + "monastery" : 8837.76, + "raging" : 8836.18, + "publish" : 8833.80, + "knocking" : 8832.22, + "precaution" : 8832.22, + "privately" : 8832.22, + "aaron" : 8828.27, + "endeavored" : 8827.47, + "insight" : 8827.47, + "definitely" : 8825.89, + "stature" : 8825.10, + "troy" : 8825.10, + "miriam" : 8824.31, + "judah" : 8823.52, + "oblige" : 8822.73, + "urging" : 8816.40, + "shift" : 8810.86, + "mould" : 8808.49, + "courses" : 8807.70, + "countless" : 8806.11, + "associates" : 8798.20, + "hymn" : 8797.41, + "rapture" : 8797.41, + "tonight" : 8797.41, + "trumpet" : 8795.83, + "parker" : 8791.87, + "entrusted" : 8787.92, + "firmness" : 8787.92, + "comic" : 8780.80, + "breeding" : 8780.01, + "ken" : 8775.26, + "questioning" : 8772.89, + "factor" : 8772.10, + "monuments" : 8767.35, + "loveliness" : 8766.56, + "handled" : 8761.02, + "communities" : 8754.69, + "saloon" : 8754.69, + "stumbled" : 8749.15, + "witch" : 8748.36, + "confronted" : 8747.57, + "traveling" : 8747.57, + "seamen" : 8745.99, + "backed" : 8744.41, + "profoundly" : 8742.03, + "gladness" : 8738.87, + "pomp" : 8737.29, + "mess" : 8735.70, + "practise" : 8734.12, + "sanctuary" : 8734.12, + "superstitious" : 8734.12, + "casual" : 8732.54, + "iowa" : 8732.54, + "analyzed" : 8725.42, + "historic" : 8724.63, + "bored" : 8723.84, + "shrink" : 8723.84, + "judging" : 8723.04, + "treating" : 8717.51, + "expenditure" : 8716.72, + "encouraging" : 8715.13, + "diplomatic" : 8714.34, + "forcing" : 8713.55, + "studio" : 8712.76, + "exposure" : 8710.39, + "crude" : 8705.64, + "compilation" : 8704.85, + "vermont" : 8692.98, + "eve" : 8689.82, + "ascend" : 8689.03, + "unbroken" : 8689.03, + "apollo" : 8688.23, + "countess" : 8682.70, + "binding" : 8680.32, + "exceed" : 8677.95, + "frail" : 8677.16, + "hans" : 8676.37, + "champagne" : 8671.62, + "shuddered" : 8671.62, + "carter" : 8670.83, + "mule" : 8667.67, + "inserted" : 8666.87, + "parson" : 8666.08, + "rascal" : 8664.50, + "inspire" : 8660.55, + "banner" : 8657.38, + "divorce" : 8655.01, + "treacherous" : 8655.01, + "nineteenth" : 8651.84, + "invalid" : 8650.26, + "weaker" : 8650.26, + "organizations" : 8648.68, + "bolt" : 8646.30, + "ticket" : 8643.14, + "backwards" : 8642.35, + "captivity" : 8642.35, + "lame" : 8640.77, + "provoked" : 8639.18, + "vein" : 8636.02, + "lists" : 8625.74, + "gallop" : 8624.94, + "communications" : 8622.57, + "dagger" : 8619.41, + "passive" : 8618.62, + "shoe" : 8618.62, + "thrice" : 8613.08, + "corrected" : 8611.49, + "mystic" : 8605.17, + "infancy" : 8602.00, + "foam" : 8600.42, + "keith" : 8600.42, + "tavern" : 8599.63, + "fraud" : 8597.25, + "7th" : 8596.46, + "cradle" : 8594.09, + "rifles" : 8589.34, + "vigorously" : 8589.34, + "censure" : 8587.76, + "gentleness" : 8587.76, + "jr" : 8587.76, + "sobbing" : 8586.18, + "monotonous" : 8579.85, + "explosion" : 8578.27, + "catastrophe" : 8570.36, + "respectfully" : 8567.98, + "wearied" : 8565.61, + "cats" : 8564.82, + "blamed" : 8563.24, + "needful" : 8562.44, + "fireplace" : 8561.65, + "gravel" : 8560.86, + "affords" : 8560.07, + "discovering" : 8560.07, + "jar" : 8560.07, + "selfishness" : 8557.70, + "tolerably" : 8553.74, + "clerks" : 8551.37, + "ark" : 8549.00, + "moist" : 8549.00, + "wid" : 8544.25, + "sauce" : 8543.46, + "prompted" : 8534.75, + "exceptions" : 8532.38, + "bullets" : 8527.63, + "writ" : 8527.63, + "bruce" : 8526.84, + "insolent" : 8523.68, + "moisture" : 8523.68, + "thompson" : 8522.89, + "furnace" : 8519.72, + "healing" : 8519.72, + "fewer" : 8517.35, + "deem" : 8515.77, + "apron" : 8513.39, + "humiliation" : 8513.39, + "punctuation" : 8512.60, + "rolls" : 8511.81, + "doe" : 8509.44, + "rotten" : 8507.86, + "richer" : 8505.48, + "swiss" : 8505.48, + "behavior" : 8503.90, + "nowadays" : 8501.53, + "pamphlet" : 8499.15, + "loan" : 8497.57, + "beads" : 8494.41, + "divers" : 8493.62, + "unreasonable" : 8492.03, + "realise" : 8490.45, + "lust" : 8484.12, + "ah" : 8480.17, + "annually" : 8479.38, + "detach" : 8478.58, + "gaily" : 8477.00, + "shares" : 8477.00, + "gifted" : 8473.05, + "planet" : 8473.05, + "feverish" : 8466.72, + "resurrection" : 8466.72, + "saul" : 8464.34, + "consecrated" : 8461.97, + "enforced" : 8460.39, + "vincent" : 8453.27, + "shelf" : 8451.69, + "fan" : 8450.89, + "fluid" : 8449.31, + "brightly" : 8448.52, + "damsel" : 8448.52, + "gabriel" : 8447.73, + "kid" : 8446.94, + "frantic" : 8441.40, + "neatly" : 8441.40, + "anon" : 8435.86, + "ascribed" : 8435.07, + "insane" : 8435.07, + "tropical" : 8434.28, + "8th" : 8431.12, + "milan" : 8429.53, + "hardened" : 8427.95, + "overthrow" : 8427.16, + "phase" : 8427.16, + "achievement" : 8424.79, + "immortality" : 8424.79, + "obscurity" : 8421.62, + "assumption" : 8420.04, + "discern" : 8412.92, + "hopeful" : 8412.13, + "humorous" : 8410.55, + "composure" : 8408.17, + "turf" : 8408.17, + "poland" : 8407.38, + "dame" : 8406.59, + "missionaries" : 8406.59, + "orator" : 8405.01, + "perpetually" : 8405.01, + "arbitrary" : 8403.43, + "ecstasy" : 8397.89, + "retirement" : 8397.10, + "pronounce" : 8393.14, + "authorized" : 8387.60, + "familiarity" : 8387.60, + "nl" : 8386.02, + "hastings" : 8384.44, + "clubs" : 8383.65, + "reconciled" : 8383.65, + "grievous" : 8382.86, + "mercury" : 8381.27, + "elegance" : 8379.69, + "chivalry" : 8378.90, + "luminous" : 8377.32, + "beseech" : 8375.74, + "benevolent" : 8374.95, + "confided" : 8374.95, + "dances" : 8374.15, + "perplexity" : 8370.20, + "escaping" : 8369.41, + "terrific" : 8369.41, + "companionship" : 8365.45, + "commence" : 8364.66, + "daisy" : 8364.66, + "parliament" : 8361.50, + "9th" : 8353.58, + "creep" : 8352.79, + "pleading" : 8347.26, + "disdain" : 8345.67, + "pm" : 8345.67, + "sympathies" : 8341.72, + "guides" : 8340.93, + "emergency" : 8338.55, + "parcel" : 8337.76, + "suicide" : 8337.76, + "replies" : 8336.18, + "drawer" : 8335.39, + "contribution" : 8334.60, + "supposition" : 8331.43, + "vii" : 8329.85, + "weren't" : 8325.90, + "link" : 8325.10, + "homely" : 8321.94, + "pluck" : 8321.94, + "ruling" : 8317.19, + "patrick" : 8316.40, + "statesmen" : 8311.65, + "hannah" : 8310.86, + "printing" : 8310.86, + "joshua" : 8309.28, + "synonymous" : 8307.70, + "sinister" : 8306.91, + "advocate" : 8306.12, + "destructive" : 8304.53, + "environment" : 8304.53, + "blossom" : 8302.16, + "bridle" : 8296.62, + "yon" : 8295.83, + "waistcoat" : 8291.88, + "extends" : 8291.09, + "confirm" : 8289.50, + "listing" : 8287.13, + "solemnity" : 8287.13, + "projects" : 8284.76, + "reporter" : 8284.76, + "deprive" : 8283.17, + "detachment" : 8280.80, + "infernal" : 8270.52, + "traversed" : 8269.72, + "moss" : 8266.56, + "skilled" : 8264.98, + "announce" : 8263.40, + "hateful" : 8260.23, + "fugitive" : 8257.07, + "gothic" : 8257.07, + "coolness" : 8256.28, + "insurrection" : 8254.69, + "cum" : 8252.32, + "med" : 8251.53, + "coachman" : 8249.16, + "expend" : 8249.16, + "stepping" : 8248.36, + "julius" : 8242.83, + "resign" : 8237.29, + "despatch" : 8233.33, + "excluded" : 8233.33, + "reject" : 8233.33, + "tough" : 8230.17, + "plea" : 8228.59, + "roy" : 8227.79, + "fragment" : 8227.00, + "lacked" : 8227.00, + "wordsworth" : 8224.63, + "balcony" : 8223.84, + "darker" : 8222.26, + "mac" : 8222.26, + "nevada" : 8222.26, + "christopher" : 8219.88, + "fork" : 8219.88, + "flatter" : 8219.09, + "iniquity" : 8212.76, + "meditation" : 8212.76, + "disastrous" : 8211.18, + "stain" : 8209.60, + "patches" : 8208.02, + "hints" : 8203.27, + "ordained" : 8198.52, + "drinks" : 8197.73, + "whipped" : 8197.73, + "burial" : 8196.15, + "matt" : 8196.15, + "employee" : 8193.78, + "employer" : 8192.19, + "hypothesis" : 8192.19, + "steed" : 8191.40, + "width" : 8189.82, + "sweden" : 8187.45, + "transaction" : 8184.28, + "victories" : 8182.70, + "devout" : 8181.91, + "outrage" : 8181.91, + "vary" : 8179.54, + "attorney" : 8176.37, + "rouse" : 8175.58, + "doubled" : 8170.04, + "sidney" : 8168.46, + "schooner" : 8166.88, + "flaming" : 8165.29, + "offend" : 8161.34, + "sheriff" : 8161.34, + "encamped" : 8160.55, + "magnificence" : 8158.17, + "vent" : 8145.52, + "politely" : 8144.73, + "vines" : 8144.73, + "flags" : 8142.35, + "italians" : 8138.40, + "necessities" : 8136.81, + "austin" : 8135.23, + "nobler" : 8132.07, + "accusation" : 8117.04, + "impulses" : 8113.08, + "packet" : 8112.29, + "shabby" : 8111.50, + "irritated" : 8108.33, + "dakota" : 8107.54, + "industrious" : 8105.17, + "classic" : 8103.59, + "ranch" : 8102.80, + "ascending" : 8097.26, + "cruelly" : 8096.47, + "happiest" : 8095.68, + "antonio" : 8094.88, + "accuse" : 8092.51, + "insulted" : 8089.35, + "bridges" : 8086.97, + "players" : 8086.97, + "sixteenth" : 8084.60, + "solicitation" : 8083.81, + "embarked" : 8075.11, + "idol" : 8071.94, + "odds" : 8071.94, + "aims" : 8067.99, + "illuminated" : 8067.99, + "enchanted" : 8064.82, + "adversary" : 8060.87, + "pie" : 8060.87, + "reflecting" : 8059.28, + "pension" : 8057.70, + "luxurious" : 8056.12, + "pigs" : 8055.33, + "choir" : 8053.74, + "tumbled" : 8052.16, + "conqueror" : 8051.37, + "irritation" : 8049.00, + "verb" : 8049.00, + "monkey" : 8046.62, + "acceptable" : 8045.04, + "dynasty" : 8045.04, + "accurately" : 8043.46, + "divinity" : 8042.67, + "signature" : 8042.67, + "heretofore" : 8041.88, + "hazard" : 8041.09, + "dora" : 8040.30, + "sq." : 8039.50, + "stead" : 8037.92, + "attire" : 8037.13, + "fling" : 8036.34, + "marine" : 8034.76, + "occupations" : 8031.59, + "soothing" : 8031.59, + "devised" : 8030.80, + "singer" : 8028.43, + "spaces" : 8027.64, + "emerson" : 8026.06, + "disguised" : 8023.68, + "antique" : 8022.10, + "orthodox" : 8019.73, + "poisoned" : 8016.56, + "dove" : 8015.77, + "gratification" : 8014.98, + "sydney" : 8011.81, + "electricity" : 8008.65, + "alien" : 8002.32, + "sorely" : 8002.32, + "cracked" : 7994.41, + "supremacy" : 7994.41, + "summon" : 7991.25, + "depressed" : 7989.66, + "sexes" : 7988.87, + "offerings" : 7988.08, + "pledged" : 7988.08, + "irony" : 7987.29, + "recourse" : 7982.54, + "tortured" : 7982.54, + "thickly" : 7978.59, + "correspondent" : 7976.21, + "sounding" : 7975.42, + "64" : 7973.84, + "sombre" : 7969.88, + "brushed" : 7968.30, + "reasonably" : 7957.23, + "12th" : 7956.44, + "duel" : 7956.44, + "reluctantly" : 7956.44, + "implies" : 7955.64, + "cable" : 7954.85, + "ridden" : 7949.32, + "acre" : 7948.52, + "grieve" : 7945.36, + "inquiring" : 7944.57, + "colonists" : 7942.19, + "addison" : 7938.24, + "republican" : 7938.24, + "illustrate" : 7937.45, + "tim" : 7937.45, + "liverpool" : 7936.66, + "gilded" : 7935.87, + "clumsy" : 7935.07, + "satin" : 7931.12, + "displeased" : 7927.95, + "odor" : 7927.16, + "clearer" : 7926.37, + "prairie" : 7921.63, + "hudson" : 7919.25, + "feudal" : 7916.09, + "flint" : 7908.97, + "easter" : 7908.18, + "freshness" : 7908.18, + "nursery" : 7906.59, + "explanations" : 7905.01, + "adoption" : 7902.64, + "reluctance" : 7902.64, + "crosses" : 7898.68, + "blushing" : 7897.89, + "imported" : 7897.89, + "notorious" : 7895.52, + "equipped" : 7893.94, + "sinful" : 7890.77, + "starving" : 7890.77, + "eugene" : 7886.02, + "bedside" : 7884.44, + "sovereigns" : 7883.65, + "abrupt" : 7882.86, + "excused" : 7879.70, + "injure" : 7877.32, + "incessant" : 7876.53, + "correctly" : 7874.95, + "drooping" : 7872.58, + "adored" : 7871.78, + "embroidered" : 7871.78, + "pasture" : 7871.78, + "pillar" : 7870.20, + "import" : 7867.83, + "founder" : 7862.29, + "torch" : 7862.29, + "vault" : 7862.29, + "worm" : 7862.29, + "ay" : 7859.92, + "bravery" : 7859.13, + "confinement" : 7853.59, + "trusting" : 7846.47, + "butler" : 7844.89, + "rattle" : 7844.89, + "transported" : 7844.89, + "estimation" : 7844.09, + "edit" : 7840.93, + "gotten" : 7839.35, + "cuts" : 7838.56, + "headlong" : 7836.97, + "outfit" : 7836.18, + "insolence" : 7829.85, + "secrecy" : 7829.85, + "thereupon" : 7820.36, + "unlucky" : 7817.20, + "eighth" : 7816.40, + "valour" : 7815.61, + "grammar" : 7814.03, + "relaxed" : 7812.45, + "mentions" : 7804.54, + "adjacent" : 7802.96, + "knives" : 7802.16, + "attacking" : 7801.37, + "exceptional" : 7801.37, + "recollections" : 7800.58, + "deposit" : 7794.25, + "establishing" : 7794.25, + "muddy" : 7794.25, + "arches" : 7793.46, + "aspects" : 7790.30, + "senior" : 7788.71, + "fragrance" : 7785.55, + "colonial" : 7784.76, + "penetrating" : 7783.18, + "refinement" : 7779.22, + "te" : 7776.85, + "yacht" : 7776.85, + "intelligible" : 7776.06, + "stray" : 7772.89, + "forcibly" : 7771.31, + "jenny" : 7771.31, + "superficial" : 7771.31, + "tends" : 7767.35, + "identified" : 7766.56, + "wan" : 7766.56, + "choosing" : 7764.19, + "frighten" : 7762.61, + "grotesque" : 7762.61, + "reprinted" : 7761.82, + "tutor" : 7761.82, + "contributing" : 7761.03, + "welsh" : 7757.07, + "gaiety" : 7756.28, + "besieged" : 7753.90, + "robbery" : 7753.11, + "transmitted" : 7753.11, + "swam" : 7749.95, + "consequential" : 7746.78, + "slid" : 7743.62, + "stony" : 7742.83, + "donald" : 7741.25, + "gratify" : 7741.25, + "heavier" : 7741.25, + "confidently" : 7740.46, + "mabel" : 7739.66, + "demon" : 7734.92, + "treatise" : 7734.92, + "mechanically" : 7732.54, + "batteries" : 7728.59, + "trading" : 7728.59, + "cock" : 7727.80, + "pilgrimage" : 7727.80, + "extinct" : 7726.22, + "idleness" : 7725.42, + "sicily" : 7724.63, + "merrily" : 7723.84, + "excursion" : 7721.47, + "handling" : 7719.89, + "utah" : 7719.89, + "eminence" : 7718.30, + "lump" : 7714.35, + "boyhood" : 7713.56, + "montana" : 7713.56, + "superfluous" : 7713.56, + "wee" : 7711.97, + "dome" : 7709.60, + "shivering" : 7708.81, + "accidental" : 7708.02, + "thickness" : 7708.02, + "darwin" : 7706.44, + "continuance" : 7704.06, + "fixing" : 7703.27, + "harris" : 7703.27, + "rustic" : 7703.27, + "cheered" : 7697.73, + "vernon" : 7696.94, + "premises" : 7694.57, + "delivery" : 7687.45, + "nodding" : 7687.45, + "snowy" : 7681.91, + "curved" : 7680.33, + "productive" : 7679.54, + "discouraged" : 7677.96, + "variations" : 7677.16, + "shilling" : 7674.79, + "swollen" : 7674.79, + "miraculous" : 7673.21, + "stubborn" : 7673.21, + "belgium" : 7669.25, + "drives" : 7668.46, + "jerome" : 7667.67, + "orchard" : 7666.88, + "persuasion" : 7666.88, + "invaded" : 7666.09, + "alps" : 7661.34, + "ungrateful" : 7658.97, + "insensible" : 7658.18, + "muscle" : 7655.80, + "madrid" : 7655.01, + "flanders" : 7654.22, + "cultivate" : 7652.64, + "involuntarily" : 7652.64, + "speedy" : 7651.06, + "variation" : 7649.48, + "marian" : 7648.68, + "harp" : 7647.89, + "peaks" : 7643.94, + "daybreak" : 7642.35, + "magnitude" : 7642.35, + "precautions" : 7640.77, + "rub" : 7640.77, + "requiring" : 7638.40, + "coral" : 7636.03, + "grapes" : 7634.44, + "fairest" : 7628.91, + "locality" : 7628.91, + "opponent" : 7622.58, + "bondage" : 7621.79, + "beans" : 7620.99, + "cowardly" : 7619.41, + "grandson" : 7614.67, + "leo" : 7612.29, + "gertrude" : 7605.17, + "nail" : 7605.17, + "protecting" : 7604.38, + "hospitable" : 7603.59, + "proving" : 7603.59, + "benevolence" : 7594.89, + "brussels" : 7594.89, + "civilisation" : 7594.89, + "mounting" : 7591.72, + "desiring" : 7590.93, + "rushes" : 7588.56, + "precision" : 7587.77, + "watchful" : 7586.18, + "harness" : 7584.60, + "perchance" : 7584.60, + "forbade" : 7579.06, + "channels" : 7577.48, + "indication" : 7576.69, + "zealous" : 7576.69, + "tact" : 7574.32, + "seventeenth" : 7567.99, + "theodore" : 7565.61, + "stating" : 7564.82, + "toast" : 7564.03, + "dreadfully" : 7562.45, + "judith" : 7561.66, + "asterisk" : 7560.08, + "virgil" : 7559.29, + "edifice" : 7556.12, + "swelled" : 7556.12, + "accomplishment" : 7555.33, + "sundry" : 7550.58, + "reckoning" : 7548.21, + "mouse" : 7544.25, + "prostrate" : 7544.25, + "helm" : 7541.09, + "slim" : 7541.09, + "whistling" : 7537.93, + "syllable" : 7537.13, + "handwriting" : 7536.34, + "commissioners" : 7535.55, + "lime" : 7535.55, + "spur" : 7534.76, + "unfit" : 7532.39, + "gen." : 7531.60, + "relish" : 7529.22, + "reduction" : 7526.06, + "sown" : 7526.06, + "venetian" : 7525.27, + "cordially" : 7521.31, + "hush" : 7520.52, + "breasts" : 7515.77, + "slipping" : 7514.98, + "pat" : 7513.40, + "arabian" : 7512.61, + "dialogue" : 7511.82, + "forwards" : 7511.82, + "entreat" : 7511.03, + "fascination" : 7510.24, + "belly" : 7509.44, + "neutral" : 7509.44, + "grasping" : 7507.86, + "diligence" : 7505.49, + "disgusted" : 7504.70, + "retiring" : 7503.12, + "strokes" : 7500.74, + "sob" : 7497.58, + "vine" : 7496.00, + "compose" : 7495.20, + "valentine" : 7492.04, + "harvey" : 7489.67, + "icy" : 7488.08, + "inconvenience" : 7488.08, + "v" : 7483.34, + "pots" : 7482.55, + "dimensions" : 7480.96, + "abused" : 7479.38, + "armor" : 7478.59, + "detect" : 7478.59, + "contradiction" : 7473.84, + "banker" : 7468.31, + "infamous" : 7463.56, + "powerless" : 7461.19, + "passenger" : 7458.81, + "crust" : 7456.44, + "historians" : 7455.65, + "disclaim" : 7453.27, + "norway" : 7451.69, + "peculiarities" : 7450.90, + "sting" : 7450.90, + "simultaneously" : 7445.36, + "watches" : 7445.36, + "cong." : 7444.57, + "episode" : 7443.78, + "achieve" : 7439.82, + "populace" : 7439.03, + "sherman" : 7439.03, + "incense" : 7438.24, + "rebecca" : 7436.66, + "jordan" : 7435.08, + "persistent" : 7435.08, + "wisconsin" : 7435.08, + "ho" : 7428.75, + "ta" : 7428.75, + "fruitful" : 7427.17, + "scoundrel" : 7427.17, + "coasts" : 7424.00, + "starve" : 7419.26, + "denmark" : 7415.30, + "scots" : 7415.30, + "consultation" : 7414.51, + "habitation" : 7410.55, + "goat" : 7406.60, + "howling" : 7406.60, + "tailor" : 7406.60, + "flourish" : 7401.85, + "trifles" : 7394.73, + "dashing" : 7393.94, + "disappearance" : 7393.15, + "sour" : 7393.15, + "practicable" : 7390.77, + "shameful" : 7389.19, + "inviting" : 7386.03, + "criminals" : 7383.65, + "leisurely" : 7383.65, + "accumulated" : 7382.07, + "audible" : 7380.49, + "topics" : 7380.49, + "expends" : 7378.91, + "radiance" : 7377.32, + "underline" : 7375.74, + "parade" : 7374.95, + "spoils" : 7374.95, + "helmet" : 7365.46, + "consternation" : 7364.67, + "expenditures" : 7364.67, + "impose" : 7363.88, + "originator" : 7363.08, + "pa" : 7362.29, + "unequal" : 7362.29, + "wooded" : 7356.76, + "enduring" : 7352.01, + "ox" : 7349.64, + "valet" : 7349.64, + "proclaim" : 7348.05, + "carl" : 7346.47, + "impossibility" : 7346.47, + "lydia" : 7344.10, + "territories" : 7342.51, + "deference" : 7340.93, + "ravine" : 7340.93, + "geoffrey" : 7339.35, + "blanche" : 7336.98, + "accommodation" : 7333.02, + "boyish" : 7331.44, + "spray" : 7329.07, + "theological" : 7328.27, + "anonymous" : 7327.48, + "injurious" : 7326.69, + "formally" : 7324.32, + "sports" : 7324.32, + "ab" : 7322.74, + "scales" : 7322.74, + "wyoming" : 7321.95, + "discontinue" : 7321.15, + "calf" : 7319.57, + "manual" : 7318.78, + "disturbing" : 7317.99, + "potent" : 7317.20, + "anticipation" : 7316.41, + "melt" : 7314.83, + "tilde" : 7314.83, + "thames" : 7314.03, + "grade" : 7312.45, + "mischievous" : 7310.87, + "pang" : 7310.87, + "pathos" : 7308.50, + "alternately" : 7306.12, + "brisk" : 7305.33, + "stool" : 7304.54, + "justification" : 7299.79, + "foreigner" : 7298.21, + "endeavouring" : 7297.42, + "satire" : 7297.42, + "al" : 7295.84, + "delete" : 7294.26, + "masculine" : 7293.46, + "spies" : 7291.88, + "umbrella" : 7284.76, + "transportation" : 7283.18, + "yell" : 7281.60, + "remnant" : 7280.81, + "boot" : 7279.22, + "ignored" : 7276.06, + "thrilling" : 7276.06, + "ale" : 7270.52, + "mineral" : 7265.77, + "goose" : 7263.40, + "nebraska" : 7261.82, + "truce" : 7261.82, + "lastly" : 7260.24, + "airy" : 7254.70, + "sketches" : 7254.70, + "groves" : 7253.91, + "col." : 7253.12, + "11th" : 7250.74, + "comprehension" : 7250.74, + "cling" : 7247.58, + "duck" : 7247.58, + "abyss" : 7246.79, + "alaska" : 7246.79, + "baffled" : 7246.79, + "planning" : 7246.00, + "abominable" : 7235.71, + "aversion" : 7235.71, + "drawings" : 7234.13, + "customers" : 7233.34, + "weird" : 7230.96, + "stewart" : 7230.17, + "traveled" : 7230.17, + "alan" : 7228.59, + "incessantly" : 7226.22, + "flattery" : 7223.84, + "director" : 7221.47, + "improbable" : 7221.47, + "moderation" : 7219.89, + "awakening" : 7219.10, + "males" : 7219.10, + "pairs" : 7218.31, + "temporal" : 7217.52, + "con" : 7215.93, + "nicely" : 7215.93, + "lapse" : 7212.77, + "vitality" : 7211.98, + "soap" : 7208.02, + "patriot" : 7207.23, + "malicious" : 7206.44, + "eyed" : 7205.65, + "pirates" : 7205.65, + "enforce" : 7203.28, + "doll" : 7199.32, + "briskly" : 7195.36, + "sez" : 7191.41, + "skeleton" : 7189.83, + "comprehensive" : 7188.24, + "buttons" : 7187.45, + "crushing" : 7186.66, + "personages" : 7185.08, + "threaten" : 7184.29, + "nuts" : 7182.71, + "undone" : 7181.12, + "wright" : 7181.12, + "frankness" : 7179.54, + "hides" : 7177.96, + "progressive" : 7170.05, + "rogers" : 7170.05, + "villa" : 7163.72, + "aristotle" : 7160.55, + "resource" : 7160.55, + "irs" : 7155.81, + "confine" : 7154.22, + "sewing" : 7154.22, + "co" : 7148.69, + "congratulate" : 7144.73, + "walt" : 7141.57, + "reconcile" : 7139.19, + "insurance" : 7138.40, + "terminated" : 7137.61, + "dusky" : 7134.45, + "appoint" : 7133.66, + "pearl" : 7132.86, + "thrilled" : 7131.28, + "gains" : 7127.33, + "interrupt" : 7122.58, + "extravagance" : 7121.79, + "jokes" : 7121.79, + "suppress" : 7121.79, + "quod" : 7121.00, + "signify" : 7120.21, + "layer" : 7117.04, + "clue" : 7116.25, + "kettle" : 7115.46, + "contemplate" : 7113.09, + "aforesaid" : 7111.50, + "tooth" : 7109.13, + "sensibility" : 7106.76, + "boldness" : 7105.97, + "mature" : 7105.17, + "cuba" : 7098.05, + "tolerable" : 7096.47, + "rabbit" : 7095.68, + "befallen" : 7092.52, + "needless" : 7092.52, + "yankee" : 7091.73, + "awaken" : 7083.02, + "clasp" : 7083.02, + "lets" : 7080.65, + "blinded" : 7079.07, + "conductor" : 7078.28, + "dependence" : 7077.48, + "guarantee" : 7076.69, + "affectionately" : 7073.53, + "player" : 7072.74, + "wires" : 7072.74, + "thicket" : 7066.41, + "walker" : 7062.45, + "outstretched" : 7061.66, + "procedure" : 7061.66, + "wheeled" : 7060.87, + "aye" : 7059.29, + "oneself" : 7056.12, + "recommendation" : 7055.33, + "projecting" : 7054.54, + "shriek" : 7052.96, + "futile" : 7052.17, + "cheerfulness" : 7051.38, + "deity" : 7051.38, + "fifteenth" : 7045.84, + "gap" : 7045.05, + "muscular" : 7045.05, + "dripping" : 7044.26, + "insect" : 7041.88, + "values" : 7039.51, + "brooding" : 7038.72, + "restaurant" : 7037.14, + "baptism" : 7036.35, + "imaginative" : 7036.35, + "rhyme" : 7033.18, + "exhaustion" : 7031.60, + "intrigue" : 7031.60, + "senseless" : 7031.60, + "hercules" : 7030.81, + "yearly" : 7030.81, + "baron" : 7028.43, + "occupying" : 7026.85, + "imply" : 7022.90, + "absurdity" : 7020.52, + "launched" : 7020.52, + "resolutely" : 7015.78, + "vowed" : 7014.99, + "attach" : 7011.82, + "characterized" : 7010.24, + "fellowship" : 7010.24, + "posture" : 7006.28, + "caps" : 7005.49, + "leon" : 7004.70, + "demanding" : 7003.12, + "owl" : 7002.33, + "beset" : 7001.54, + "ensuring" : 7001.54, + "suite" : 6997.58, + "tennyson" : 6996.79, + "thereto" : 6996.00, + "heaped" : 6992.04, + "jewel" : 6992.04, + "regained" : 6991.25, + "voluntarily" : 6984.92, + "longitude" : 6977.01, + "permanently" : 6976.22, + "jumping" : 6974.64, + "babe" : 6973.85, + "secondly" : 6973.06, + "violin" : 6971.47, + "rogue" : 6969.10, + "rainy" : 6968.31, + "reconciliation" : 6968.31, + "emotional" : 6967.52, + "radical" : 6962.77, + "accursed" : 6958.81, + "tendencies" : 6958.02, + "concrete" : 6957.23, + "resident" : 6956.44, + "lustre" : 6954.86, + "hull" : 6954.07, + "ominous" : 6953.28, + "overboard" : 6952.49, + "uproar" : 6951.69, + "cavern" : 6950.90, + "combine" : 6950.11, + "respectively" : 6950.11, + "menace" : 6946.95, + "pilgrims" : 6945.37, + "jeff" : 6942.99, + "peak" : 6942.20, + "currency" : 6941.41, + "silken" : 6941.41, + "violet" : 6939.83, + "khan" : 6937.45, + "mastery" : 6937.45, + "objective" : 6929.54, + "plucked" : 6927.17, + "litter" : 6926.38, + "memorial" : 6925.59, + "bids" : 6923.21, + "fondly" : 6923.21, + "clapped" : 6920.84, + "tariff" : 6917.68, + "beneficial" : 6916.88, + "unsolicited" : 6916.88, + "reluctant" : 6914.51, + "separately" : 6906.60, + "patronage" : 6905.81, + "revenues" : 6904.23, + "dragon" : 6903.44, + "zeus" : 6901.85, + "mike" : 6899.48, + "ranges" : 6897.90, + "vexation" : 6897.11, + "indicates" : 6896.32, + "overheard" : 6895.52, + "tray" : 6894.73, + "raymond" : 6891.57, + "thereafter" : 6890.78, + "exporting" : 6889.99, + "mound" : 6889.99, + "taxation" : 6886.82, + "frenzy" : 6884.45, + "horizontal" : 6881.28, + "thirsty" : 6880.49, + "disputed" : 6879.70, + "charter" : 6876.54, + "redistribution" : 6876.54, + "boasted" : 6875.75, + "item" : 6875.75, + "moscow" : 6873.37, + "termination" : 6872.58, + "eminently" : 6871.79, + "suggestive" : 6871.00, + "linger" : 6869.42, + "shady" : 6868.63, + "calculation" : 6867.04, + "expansion" : 6864.67, + "mast" : 6859.92, + "confer" : 6859.13, + "sophia" : 6859.13, + "commanders" : 6853.59, + "pitied" : 6852.01, + "twist" : 6852.01, + "traditional" : 6851.22, + "involve" : 6850.43, + "interfered" : 6848.06, + "achilles" : 6846.47, + "wanton" : 6846.47, + "repay" : 6845.68, + "brother-in-law" : 6844.89, + "routine" : 6844.89, + "son-in-law" : 6842.52, + "gaul" : 6841.73, + "groom" : 6840.14, + "solve" : 6840.14, + "grassy" : 6836.98, + "tempt" : 6836.19, + "unsuccessful" : 6836.19, + "witty" : 6836.19, + "politician" : 6834.61, + "yearning" : 6834.61, + "lid" : 6833.02, + "noticing" : 6833.02, + "courtiers" : 6831.44, + "cheering" : 6829.86, + "bounty" : 6828.28, + "consequent" : 6826.70, + "renown" : 6824.32, + "regulation" : 6823.53, + "fowl" : 6820.37, + "mayor" : 6818.78, + "wrinkled" : 6817.99, + "defy" : 6817.20, + "threads" : 6817.20, + "violation" : 6817.20, + "junction" : 6816.41, + "boss" : 6814.83, + "particles" : 6814.04, + "glories" : 6810.87, + "signifies" : 6810.08, + "constrained" : 6806.92, + "paternal" : 6806.92, + "piles" : 6805.33, + "hardware" : 6804.54, + "engaging" : 6803.75, + "e.g." : 6802.17, + "peer" : 6802.17, + "counties" : 6801.38, + "mocking" : 6801.38, + "ch." : 6799.01, + "avoiding" : 6798.21, + "rebuke" : 6796.63, + "abolished" : 6793.47, + "cheers" : 6792.68, + "idiot" : 6791.09, + "3rd" : 6790.30, + "morbid" : 6790.30, + "wrung" : 6787.93, + "e-mail" : 6787.14, + "outcome" : 6782.39, + "gilt" : 6774.48, + "coldness" : 6768.94, + "applying" : 6768.15, + "strand" : 6761.82, + "renowned" : 6760.24, + "fishermen" : 6757.08, + "creative" : 6755.49, + "circus" : 6753.12, + "moustache" : 6753.12, + "proverb" : 6750.75, + "lowering" : 6746.79, + "biggest" : 6746.00, + "sly" : 6742.83, + "nursing" : 6741.25, + "boon" : 6739.67, + "weighing" : 6738.09, + "oklahoma" : 6735.71, + "brink" : 6734.13, + "degraded" : 6734.13, + "avenge" : 6731.76, + "hum" : 6730.97, + "minority" : 6730.97, + "spaniard" : 6730.97, + "ridges" : 6729.39, + "perils" : 6727.80, + "larry" : 6725.43, + "merchandise" : 6723.06, + "aloof" : 6721.47, + "despairing" : 6720.68, + "acquisition" : 6719.10, + "asylum" : 6718.31, + "chickens" : 6718.31, + "placid" : 6718.31, + "affirm" : 6715.94, + "trod" : 6715.94, + "gardener" : 6711.98, + "schedule" : 6711.19, + "calmness" : 6710.40, + "protector" : 6710.40, + "concealment" : 6707.23, + "trench" : 6704.86, + "fore" : 6699.32, + "accession" : 6689.83, + "h" : 6688.25, + "dey" : 6685.87, + "connexion" : 6685.08, + "cairo" : 6684.29, + "mend" : 6681.92, + "considers" : 6677.17, + "twenty-one" : 6677.17, + "municipal" : 6675.59, + "achievements" : 6674.80, + "cherish" : 6674.80, + "deserving" : 6674.80, + "exert" : 6672.42, + "riot" : 6672.42, + "veteran" : 6672.42, + "advancement" : 6670.05, + "inventor" : 6666.89, + "meek" : 6666.09, + "cameron" : 6662.93, + "hopelessly" : 6661.35, + "judicious" : 6661.35, + "tending" : 6658.18, + "testify" : 6657.39, + "governess" : 6656.60, + "orchestra" : 6655.81, + "garb" : 6655.02, + "condemnation" : 6653.44, + "foregoing" : 6652.65, + "bacon" : 6649.48, + "maternal" : 6648.69, + "wasting" : 6648.69, + "australian" : 6645.53, + "strata" : 6645.53, + "hushed" : 6644.73, + "maryland" : 6644.73, + "sculpture" : 6644.73, + "miniature" : 6640.78, + "corrections" : 6639.99, + "tangled" : 6638.41, + "completion" : 6631.28, + "regulated" : 6631.28, + "athenian" : 6629.70, + "flavor" : 6628.12, + "brand" : 6627.33, + "intimately" : 6625.75, + "unlimited" : 6625.75, + "dipped" : 6622.58, + "luggage" : 6621.79, + "inconsistent" : 6621.00, + "forsaken" : 6619.42, + "feebly" : 6618.63, + "woven" : 6617.84, + "lloyd" : 6617.04, + "rubbish" : 6617.04, + "tool" : 6617.04, + "spirited" : 6615.46, + "christendom" : 6614.67, + "chaos" : 6610.72, + "twinkling" : 6610.72, + "muffled" : 6609.13, + "accents" : 6607.55, + "accidentally" : 6603.60, + "degradation" : 6599.64, + "emancipation" : 6598.06, + "prosecution" : 6596.48, + "cleveland" : 6595.68, + "outbreak" : 6594.89, + "defending" : 6593.31, + "dwarf" : 6592.52, + "abundantly" : 6590.15, + "turner" : 6590.15, + "disadvantage" : 6586.19, + "abolition" : 6585.40, + "disregard" : 6585.40, + "deliberation" : 6584.61, + "filthy" : 6583.82, + "ak" : 6579.07, + "notifies" : 6577.49, + "dealings" : 6576.70, + "demonstrated" : 6576.70, + "paced" : 6575.91, + "tense" : 6575.91, + "drums" : 6573.53, + "interpreter" : 6573.53, + "vanish" : 6572.74, + "astray" : 6571.16, + "hen" : 6569.58, + "workman" : 6569.58, + "asunder" : 6566.41, + "baked" : 6566.41, + "baltimore" : 6566.41, + "bustle" : 6565.62, + "winged" : 6565.62, + "mentioning" : 6564.04, + "pastoral" : 6564.04, + "fabric" : 6563.25, + "trim" : 6563.25, + "musician" : 6558.50, + "twenty-two" : 6558.50, + "patty" : 6556.92, + "mentally" : 6553.75, + "wrecked" : 6553.75, + "discreet" : 6552.96, + "godfrey" : 6552.96, + "apostle" : 6552.17, + "ledge" : 6549.80, + "roast" : 6549.80, + "accessed" : 6547.42, + "preface" : 6546.63, + "convincing" : 6542.68, + "quiver" : 6537.93, + "stocks" : 6537.93, + "mourn" : 6534.77, + "commented" : 6533.98, + "redistribute" : 6532.39, + "precipice" : 6528.44, + "outdated" : 6527.65, + "juliet" : 6526.86, + "dialect" : 6526.06, + "elementary" : 6525.27, + "freight" : 6525.27, + "cowardice" : 6522.90, + "wipe" : 6522.90, + "deserts" : 6519.74, + "shelves" : 6517.36, + "denial" : 6514.20, + "1b" : 6504.70, + "traits" : 6503.91, + "denounced" : 6503.12, + "eric" : 6503.12, + "underground" : 6499.17, + "phantom" : 6498.37, + "whirling" : 6498.37, + "pecuniary" : 6494.42, + "dire" : 6493.63, + "hostilities" : 6493.63, + "gait" : 6492.84, + "it'll" : 6492.05, + "vividly" : 6490.46, + "instruct" : 6488.88, + "dickens" : 6486.51, + "puritan" : 6486.51, + "clutched" : 6484.93, + "acknowledgment" : 6484.13, + "conjunction" : 6481.76, + "oppressive" : 6480.97, + "intermediate" : 6480.18, + "formula" : 6478.60, + "hungary" : 6477.01, + "sneer" : 6469.10, + "ore" : 6468.31, + "plentiful" : 6468.31, + "plump" : 6467.52, + "combinations" : 6464.36, + "purest" : 6463.56, + "cheat" : 6462.77, + "doubly" : 6462.77, + "inadequate" : 6461.19, + "leslie" : 6459.61, + "blest" : 6458.82, + "forbear" : 6457.24, + "haunt" : 6454.07, + "treaties" : 6454.07, + "fearless" : 6453.28, + "constable" : 6452.49, + "enveloped" : 6450.91, + "enmity" : 6449.32, + "watson" : 6447.74, + "bridegroom" : 6446.16, + "curate" : 6445.37, + "developing" : 6445.37, + "frock" : 6442.99, + "mining" : 6439.83, + "audacity" : 6436.67, + "improper" : 6434.29, + "motto" : 6432.71, + "parisian" : 6431.92, + "faction" : 6424.80, + "architect" : 6422.43, + "melting" : 6421.63, + "delicately" : 6420.05, + "register" : 6419.26, + "heroine" : 6416.89, + "indefinite" : 6412.14, + "console" : 6408.19, + "defensive" : 6408.19, + "perceptible" : 6406.60, + "fruitless" : 6405.81, + "ransom" : 6401.06, + "surplus" : 6398.69, + "solicitude" : 6396.32, + "effectual" : 6393.15, + "shiver" : 6387.62, + "gal" : 6386.82, + "wed" : 6386.03, + "contemptuous" : 6385.24, + "plough" : 6382.87, + "snakes" : 6381.29, + "felicity" : 6380.50, + "reef" : 6380.50, + "outset" : 6379.70, + "constitutes" : 6378.91, + "lament" : 6378.91, + "tissue" : 6378.12, + "draft" : 6377.33, + "impelled" : 6376.54, + "epic" : 6374.96, + "fisherman" : 6369.42, + "hawaii" : 6368.63, + "obstinacy" : 6367.84, + "ulysses" : 6367.84, + "lemon" : 6367.05, + "voltaire" : 6365.46, + "hound" : 6364.67, + "measuring" : 6361.51, + "conscientious" : 6358.34, + "robber" : 6355.97, + "toy" : 6355.97, + "impart" : 6355.18, + "statute" : 6353.60, + "barry" : 6352.81, + "girdle" : 6352.01, + "basil" : 6348.06, + "rebellious" : 6348.06, + "stair" : 6346.48, + "biting" : 6344.89, + "consulting" : 6344.89, + "perseverance" : 6344.89, + "manila" : 6340.94, + "massacre" : 6339.36, + "cough" : 6338.57, + "blazed" : 6337.77, + "claude" : 6337.77, + "transition" : 6337.77, + "button" : 6334.61, + "headache" : 6332.24, + "tenant" : 6331.44, + "burns" : 6330.65, + "harmonious" : 6329.86, + "dreamy" : 6325.91, + "burgundy" : 6324.32, + "collections" : 6321.95, + "unkind" : 6321.16, + "inscribed" : 6319.58, + "cushions" : 6318.79, + "programme" : 6317.20, + "din" : 6316.41, + "laborious" : 6316.41, + "manufacturing" : 6315.62, + "markets" : 6312.46, + "zone" : 6308.50, + "humane" : 6306.92, + "ac" : 6306.13, + "fertility" : 6305.34, + "languid" : 6305.34, + "ninth" : 6304.55, + "curses" : 6303.76, + "introducing" : 6302.96, + "alcohol" : 6300.59, + "impending" : 6299.01, + "declining" : 6297.43, + "advantageous" : 6295.05, + "heal" : 6294.26, + "millennium" : 6294.26, + "karl" : 6293.47, + "ft." : 6291.10, + "staid" : 6289.51, + "planting" : 6287.93, + "theatrical" : 6287.93, + "spectator" : 6286.35, + "winchester" : 6283.19, + "greedy" : 6281.60, + "commonwealth" : 6280.81, + "suffrage" : 6280.81, + "tremulous" : 6280.81, + "commodities" : 6280.02, + "stuffed" : 6280.02, + "admitting" : 6275.27, + "aching" : 6273.69, + "ninety" : 6273.69, + "discomfort" : 6272.90, + "imperative" : 6272.90, + "montreal" : 6272.11, + "bobby" : 6271.32, + "bachelor" : 6269.74, + "geographical" : 6268.95, + "longest" : 6268.95, + "courageous" : 6266.57, + "carpenter" : 6259.45, + "sundays" : 6254.70, + "concluding" : 6253.12, + "danish" : 6252.33, + "steer" : 6251.54, + "influential" : 6249.96, + "surround" : 6249.96, + "random" : 6249.17, + "ounce" : 6248.38, + "afresh" : 6246.79, + "dictated" : 6239.67, + "ruddy" : 6239.67, + "rusty" : 6239.67, + "drown" : 6238.88, + "irving" : 6238.09, + "slide" : 6238.09, + "sow" : 6237.30, + "appalling" : 6236.51, + "profess" : 6234.93, + "sickly" : 6234.14, + "rides" : 6233.34, + "spoon" : 6233.34, + "imminent" : 6232.55, + "dominant" : 6230.97, + "leadership" : 6224.64, + "pinch" : 6223.06, + "wearily" : 6223.06, + "ducks" : 6222.27, + "diary" : 6219.10, + "duchess" : 6218.31, + "regain" : 6218.31, + "rum" : 6217.52, + "churchyard" : 6214.36, + "fondness" : 6214.36, + "apprehend" : 6212.77, + "ordinarily" : 6211.19, + "quicker" : 6211.19, + "thereon" : 6211.19, + "ni" : 6209.61, + "balloon" : 6208.03, + "individuality" : 6208.03, + "securely" : 6208.03, + "connecting" : 6207.24, + "celebrate" : 6206.45, + "bluff" : 6205.65, + "dawned" : 6205.65, + "amiss" : 6204.86, + "chalk" : 6203.28, + "sticking" : 6201.70, + "fuss" : 6200.91, + "dazed" : 6199.33, + "deputy" : 6199.33, + "forsake" : 6197.74, + "automobile" : 6196.95, + "discussions" : 6195.37, + "harrison" : 6195.37, + "refreshment" : 6195.37, + "amendment" : 6194.58, + "appealing" : 6189.04, + "eden" : 6189.04, + "vertical" : 6188.25, + "insufficient" : 6184.29, + "manchester" : 6182.71, + "hem" : 6179.55, + "gorge" : 6177.96, + "baptized" : 6175.59, + "damn" : 6174.01, + "silvery" : 6173.22, + "pastor" : 6171.64, + "inherent" : 6170.05, + "preventing" : 6169.26, + "inference" : 6168.47, + "advertisement" : 6167.68, + "mutton" : 6167.68, + "packing" : 6167.68, + "enclosure" : 6165.31, + "theft" : 6164.52, + "publisher" : 6162.93, + "spontaneous" : 6161.35, + "otto" : 6158.98, + "rats" : 6158.98, + "apparition" : 6158.19, + "refreshing" : 6158.19, + "irene" : 6156.60, + "sweetheart" : 6156.60, + "renounce" : 6155.02, + "lifeless" : 6154.23, + "adore" : 6153.44, + "vinegar" : 6149.48, + "normandy" : 6147.11, + "uncovered" : 6147.11, + "utility" : 6146.32, + "orphan" : 6144.74, + "symbols" : 6143.15, + "gracefully" : 6142.36, + "mightily" : 6142.36, + "peculiarity" : 6142.36, + "ash" : 6141.57, + "floods" : 6139.20, + "partake" : 6138.41, + "contemptible" : 6137.62, + "deities" : 6135.24, + "profane" : 6134.45, + "foreseen" : 6133.66, + "ti" : 6132.87, + "conceit" : 6132.08, + "commend" : 6129.71, + "twelfth" : 6129.71, + "bristol" : 6127.33, + "manifestation" : 6126.54, + "revive" : 6126.54, + "prone" : 6123.38, + "connect" : 6121.79, + "princely" : 6117.84, + "overtake" : 6117.05, + "improving" : 6115.47, + "downwards" : 6112.30, + "ferocious" : 6111.51, + "intervention" : 6110.72, + "subsistence" : 6109.14, + "susceptible" : 6109.14, + "tunnel" : 6109.14, + "disciple" : 6108.35, + "revival" : 6107.55, + "twins" : 6106.76, + "ivy" : 6105.97, + "puzzle" : 6103.60, + "citadel" : 6100.43, + "temporarily" : 6100.43, + "despotism" : 6099.64, + "internet" : 6099.64, + "mechanism" : 6098.85, + "stoop" : 6098.85, + "directors" : 6097.27, + "mathematics" : 6095.69, + "raft" : 6095.69, + "fade" : 6094.90, + "soothe" : 6093.31, + "pork" : 6092.52, + "substituted" : 6092.52, + "physically" : 6091.73, + "brilliancy" : 6086.98, + "dot" : 6086.98, + "loaf" : 6086.19, + "expanse" : 6079.86, + "shocking" : 6079.07, + "rudely" : 6075.12, + "isle" : 6074.33, + "balanced" : 6072.74, + "extracted" : 6071.95, + "fable" : 6071.95, + "matches" : 6071.95, + "index" : 6068.00, + "gerard" : 6066.41, + "cigars" : 6065.62, + "liver" : 6063.25, + "transmit" : 6063.25, + "dispatch" : 6061.67, + "onto" : 6056.13, + "veranda" : 6056.13, + "dip" : 6054.55, + "inexplicable" : 6052.97, + "liar" : 6052.17, + "diminish" : 6049.80, + "dungeon" : 6045.85, + "unit" : 6043.47, + "pagan" : 6042.68, + "phillips" : 6040.31, + "brig" : 6039.52, + "monopoly" : 6039.52, + "rim" : 6039.52, + "sordid" : 6031.60, + "complaining" : 6030.81, + "temperate" : 6030.81, + "chat" : 6030.02, + "gambling" : 6030.02, + "maps" : 6028.44, + "amber" : 6025.28, + "trot" : 6025.28, + "howl" : 6021.32, + "shipping" : 6021.32, + "ton" : 6021.32, + "magazines" : 6020.53, + "bricks" : 6017.36, + "submarine" : 6016.57, + "roberts" : 6015.78, + "cumberland" : 6012.62, + "cecil" : 6007.87, + "semblance" : 6007.08, + "palestine" : 6006.29, + "perpendicular" : 6005.50, + "regardless" : 6005.50, + "fervent" : 6004.71, + "sane" : 6004.71, + "wreath" : 6003.92, + "animation" : 6001.54, + "earthquake" : 5999.96, + "sloping" : 5998.38, + "smoothly" : 5998.38, + "tension" : 5998.38, + "intrigues" : 5996.00, + "fearfully" : 5995.21, + "macaulay" : 5994.42, + "laboratory" : 5992.05, + "cork" : 5991.26, + "comments" : 5986.51, + "whale" : 5986.51, + "wedded" : 5985.72, + "whiteness" : 5984.93, + "convicted" : 5984.14, + "deception" : 5982.55, + "paved" : 5982.55, + "scruple" : 5982.55, + "paintings" : 5981.76, + "therewith" : 5981.76, + "religions" : 5980.97, + "governing" : 5978.60, + "colleagues" : 5977.81, + "shrinking" : 5977.02, + "tickets" : 5975.43, + "prophetic" : 5974.64, + "undergo" : 5974.64, + "hare" : 5973.06, + "haze" : 5972.27, + "poisonous" : 5971.48, + "omit" : 5969.90, + "beware" : 5969.11, + "sagacity" : 5965.94, + "concession" : 5965.15, + "worker" : 5965.15, + "ted" : 5962.78, + "incline" : 5961.99, + "caste" : 5960.40, + "leapt" : 5960.40, + "dissatisfied" : 5955.66, + "hardest" : 5954.07, + "self-control" : 5954.07, + "toilet" : 5953.28, + "buddha" : 5951.70, + "offense" : 5951.70, + "woodland" : 5951.70, + "gentry" : 5950.91, + "starvation" : 5947.74, + "grudge" : 5946.95, + "penance" : 5946.16, + "tips" : 5946.16, + "rooted" : 5944.58, + "outburst" : 5943.00, + "fortitude" : 5939.83, + "turk" : 5939.04, + "devour" : 5937.46, + "malignant" : 5935.88, + "accorded" : 5932.71, + "brandon" : 5931.92, + "anticipate" : 5931.13, + "speechless" : 5931.13, + "inquisition" : 5929.55, + "eccentric" : 5927.97, + "anecdote" : 5927.18, + "annals" : 5927.18, + "scrutiny" : 5924.01, + "burroughs" : 5920.85, + "rhythm" : 5918.47, + "discord" : 5917.68, + "marius" : 5912.93, + "diversion" : 5908.98, + "archie" : 5905.02, + "rat" : 5905.02, + "knit" : 5902.65, + "correspond" : 5901.07, + "detain" : 5901.07, + "dis" : 5901.07, + "esp" : 5901.07, + "interpret" : 5900.28, + "vehement" : 5898.69, + "soda" : 5897.90, + "naughty" : 5894.74, + "salon" : 5893.16, + "operate" : 5890.78, + "idly" : 5889.99, + "imperious" : 5889.20, + "peru" : 5889.20, + "candid" : 5888.41, + "whig" : 5888.41, + "blooming" : 5886.83, + "wharf" : 5886.04, + "disgraceful" : 5883.66, + "stunned" : 5883.66, + "redemption" : 5881.29, + "drain" : 5878.12, + "wage" : 5878.12, + "cooper" : 5874.96, + "embassy" : 5874.96, + "unfinished" : 5874.17, + "nasty" : 5872.59, + "impetuous" : 5871.00, + "cemetery" : 5868.63, + "oblivion" : 5868.63, + "prohibited" : 5867.05, + "breeches" : 5866.26, + "abound" : 5864.68, + "christine" : 5860.72, + "frivolous" : 5855.97, + "hugo" : 5855.18, + "essays" : 5854.39, + "plaster" : 5852.81, + "tap" : 5850.44, + "chairman" : 5848.06, + "dismiss" : 5848.06, + "katherine" : 5848.06, + "provoke" : 5848.06, + "reside" : 5844.11, + "deficient" : 5842.52, + "decoration" : 5840.94, + "heroism" : 5840.15, + "toe" : 5840.15, + "wade" : 5839.36, + "apparel" : 5836.19, + "hazel" : 5836.19, + "inability" : 5836.19, + "farthest" : 5833.82, + "invent" : 5831.45, + "knave" : 5831.45, + "twain" : 5829.07, + "carelessness" : 5826.70, + "affectation" : 5822.75, + "connections" : 5821.16, + "climax" : 5820.37, + "avowed" : 5816.42, + "industries" : 5816.42, + "brood" : 5813.25, + "tempting" : 5812.46, + "define" : 5804.55, + "antwerp" : 5803.76, + "forefathers" : 5803.76, + "stretches" : 5802.18, + "gratifying" : 5801.38, + "plight" : 5800.59, + "restricted" : 5800.59, + "cupboard" : 5799.01, + "ludicrous" : 5798.22, + "alms" : 5797.43, + "colossal" : 5795.06, + "stupidity" : 5791.10, + "monotony" : 5790.31, + "stimulus" : 5790.31, + "vigilance" : 5788.73, + "digest" : 5784.77, + "vale" : 5784.77, + "overcoat" : 5783.19, + "colorado" : 5782.40, + "wink" : 5780.82, + "nous" : 5775.28, + "rack" : 5775.28, + "incomprehensible" : 5773.70, + "antagonist" : 5772.90, + "methinks" : 5767.37, + "barley" : 5764.20, + "plateau" : 5758.66, + "superintendent" : 5754.71, + "indescribable" : 5744.42, + "expanded" : 5743.63, + "presentation" : 5742.84, + "archbishop" : 5742.05, + "devise" : 5740.47, + "rubber" : 5738.89, + "adieu" : 5738.09, + "exclude" : 5737.30, + "carts" : 5736.51, + "lone" : 5734.93, + "whisky" : 5734.14, + "abuses" : 5732.56, + "inflict" : 5730.97, + "nightfall" : 5730.97, + "counts" : 5730.18, + "chocolate" : 5728.60, + "privileged" : 5728.60, + "hermit" : 5727.81, + "exultation" : 5727.02, + "overtook" : 5727.02, + "coincidence" : 5726.23, + "scratch" : 5726.23, + "screw" : 5723.85, + "caravan" : 5723.06, + "divert" : 5719.90, + "eliza" : 5719.90, + "comparing" : 5717.52, + "hood" : 5716.73, + "explore" : 5715.15, + "glove" : 5715.15, + "chaste" : 5713.57, + "whirl" : 5713.57, + "adventurous" : 5707.24, + "skipper" : 5703.28, + "tiresome" : 5702.49, + "implements" : 5701.70, + "recompense" : 5701.70, + "plank" : 5700.91, + "insure" : 5696.96, + "laboured" : 5696.16, + "exaggeration" : 5691.42, + "mi" : 5689.83, + "shepherds" : 5689.04, + "lilies" : 5688.25, + "ballad" : 5685.88, + "befall" : 5683.51, + "cylinder" : 5682.71, + "teddy" : 5676.39, + "summary" : 5671.64, + "daresay" : 5669.27, + "photographs" : 5669.27, + "colleges" : 5664.52, + "dissolution" : 5664.52, + "geneva" : 5662.94, + "marches" : 5662.15, + "instituted" : 5655.02, + "seals" : 5655.02, + "vehemence" : 5654.23, + "chaplain" : 5653.44, + "knots" : 5653.44, + "wail" : 5650.28, + "kneel" : 5647.11, + "unlikely" : 5644.74, + "deceit" : 5643.95, + "challenged" : 5640.78, + "geography" : 5639.20, + "herald" : 5637.62, + "lowly" : 5636.83, + "peep" : 5636.83, + "swarm" : 5636.04, + "clarke" : 5633.66, + "joyfully" : 5633.66, + "engraved" : 5632.08, + "ll" : 5632.08, + "bowels" : 5631.29, + "purposely" : 5629.71, + "blindness" : 5628.92, + "systematic" : 5626.54, + "virtually" : 5624.96, + "conformity" : 5621.80, + "remedies" : 5617.84, + "maxim" : 5617.05, + "indexes" : 5613.89, + "marshall" : 5613.89, + "baking" : 5613.09, + "invincible" : 5612.30, + "impertinent" : 5611.51, + "bust" : 5609.93, + "visage" : 5609.93, + "intuition" : 5609.14, + "mingle" : 5609.14, + "bathing" : 5607.56, + "arched" : 5606.77, + "investment" : 5605.97, + "tabernacle" : 5604.39, + "86" : 5601.23, + "client" : 5601.23, + "ghostly" : 5601.23, + "furs" : 5600.44, + "catalogue" : 5598.85, + "dock" : 5598.06, + "tenor" : 5598.06, + "arouse" : 5597.27, + "verbal" : 5592.53, + "excessively" : 5590.94, + "brazil" : 5588.57, + "strenuous" : 5587.78, + "irishman" : 5585.41, + "recess" : 5582.24, + "unclean" : 5581.45, + "psalms" : 5580.66, + "analogy" : 5579.08, + "chemistry" : 5579.08, + "peninsula" : 5579.08, + "infer" : 5578.28, + "maritime" : 5577.49, + "secular" : 5576.70, + "hawk" : 5574.33, + "rein" : 5573.54, + "averted" : 5572.75, + "bake" : 5572.75, + "constantine" : 5571.96, + "oracle" : 5571.96, + "alley" : 5568.00, + "softness" : 5568.00, + "pierce" : 5565.63, + "spinning" : 5564.84, + "snatch" : 5563.25, + "manufactured" : 5561.67, + "launch" : 5560.88, + "psychology" : 5560.88, + "worms" : 5560.88, + "regulate" : 5560.09, + "farming" : 5557.72, + "fasten" : 5556.92, + "actress" : 5553.76, + "etiquette" : 5551.39, + "theater" : 5551.39, + "thanksgiving" : 5550.60, + "valor" : 5549.01, + "untouched" : 5548.22, + "tactics" : 5547.43, + "drug" : 5546.64, + "adverse" : 5545.06, + "gaunt" : 5544.27, + "conducting" : 5542.68, + "veritable" : 5541.10, + "overtaken" : 5539.52, + "distorted" : 5538.73, + "rosa" : 5538.73, + "nina" : 5537.94, + "quart" : 5537.94, + "caprice" : 5536.35, + "candy" : 5531.61, + "obliging" : 5525.28, + "planets" : 5525.28, + "soothed" : 5524.49, + "sic" : 5523.70, + "opium" : 5520.53, + "pavilion" : 5520.53, + "strait" : 5518.16, + "sanguine" : 5516.58, + "cords" : 5512.62, + "odour" : 5512.62, + "trout" : 5510.25, + "paste" : 5509.46, + "regularity" : 5504.71, + "metallic" : 5497.59, + "scrap" : 5496.80, + "convict" : 5495.22, + "instructive" : 5494.42, + "investigate" : 5492.05, + "celtic" : 5490.47, + "package" : 5488.10, + "pirate" : 5486.51, + "fiend" : 5484.93, + "moan" : 5484.93, + "revealing" : 5484.93, + "trades" : 5483.35, + "rounds" : 5481.77, + "accomplishments" : 5479.39, + "crawl" : 5477.81, + "aft" : 5476.23, + "prevalent" : 5473.86, + "role" : 5473.86, + "dose" : 5471.48, + "evans" : 5471.48, + "hypocrisy" : 5470.69, + "l" : 5469.90, + "salmon" : 5468.32, + "snap" : 5468.32, + "alma" : 5465.94, + "magical" : 5464.36, + "tire" : 5463.57, + "hetty" : 5462.78, + "impenetrable" : 5462.78, + "geese" : 5461.99, + "madly" : 5460.41, + "manifold" : 5460.41, + "noticeable" : 5460.41, + "pudding" : 5460.41, + "volcanic" : 5459.61, + "locke" : 5458.82, + "magnetic" : 5458.82, + "deals" : 5458.03, + "core" : 5456.45, + "decency" : 5455.66, + "observance" : 5455.66, + "durst" : 5448.54, + "scratched" : 5448.54, + "predecessor" : 5446.96, + "diplomacy" : 5446.17, + "wert" : 5446.17, + "impartial" : 5444.58, + "disinterested" : 5440.63, + "wig" : 5440.63, + "pump" : 5439.05, + "swedish" : 5437.46, + "norfolk" : 5436.67, + "reigns" : 5433.51, + "similarly" : 5432.72, + "reap" : 5431.13, + "dam" : 5430.34, + "facilities" : 5430.34, + "slippery" : 5430.34, + "transformation" : 5427.97, + "oxygen" : 5427.18, + "suburbs" : 5427.18, + "dares" : 5426.39, + "ornamental" : 5425.60, + "pondered" : 5424.80, + "fringe" : 5423.22, + "raiment" : 5421.64, + "henrietta" : 5420.85, + "wellington" : 5420.85, + "foreman" : 5419.27, + "feat" : 5418.48, + "thirteenth" : 5418.48, + "sultan" : 5416.89, + "certificate" : 5416.10, + "rue" : 5415.31, + "heresy" : 5413.73, + "arabia" : 5410.56, + "medal" : 5409.77, + "location" : 5405.03, + "ether" : 5404.24, + "ruby" : 5401.86, + "heading" : 5396.32, + "subdue" : 5394.74, + "adorn" : 5391.58, + "ancestor" : 5391.58, + "warmer" : 5391.58, + "cluster" : 5389.99, + "quotation" : 5389.99, + "fullest" : 5389.20, + "exposition" : 5388.41, + "custody" : 5386.04, + "thermometer" : 5386.04, + "plausible" : 5383.67, + "toss" : 5381.29, + "desperation" : 5378.92, + "rhetoric" : 5378.92, + "scornful" : 5378.13, + "bailey" : 5376.55, + "rung" : 5376.55, + "civility" : 5375.75, + "dingy" : 5375.75, + "scaffold" : 5374.96, + "concentration" : 5374.17, + "avarice" : 5373.38, + "scrape" : 5373.38, + "pools" : 5371.80, + "oar" : 5370.22, + "flutter" : 5369.43, + "martyr" : 5369.43, + "handy" : 5368.63, + "montague" : 5368.63, + "bait" : 5367.84, + "login" : 5367.84, + "commotion" : 5367.05, + "congenial" : 5367.05, + "drawers" : 5365.47, + "telescope" : 5365.47, + "deposits" : 5363.10, + "edwards" : 5361.51, + "craving" : 5360.72, + "bureau" : 5359.14, + "oscar" : 5358.35, + "speculative" : 5358.35, + "huddled" : 5356.77, + "diverse" : 5355.18, + "slice" : 5354.39, + "renaissance" : 5352.81, + "angelo" : 5348.86, + "meg" : 5347.27, + "murderous" : 5347.27, + "serenity" : 5347.27, + "perspiration" : 5346.48, + "coventry" : 5344.90, + "impudent" : 5344.11, + "ardor" : 5343.32, + "necklace" : 5342.53, + "alight" : 5341.74, + "stimulated" : 5339.36, + "clifford" : 5337.78, + "steadfast" : 5333.82, + "genoa" : 5332.24, + "anglo-saxon" : 5330.66, + "courier" : 5328.29, + "inflamed" : 5328.29, + "xi" : 5328.29, + "drill" : 5325.91, + "spelling" : 5323.54, + "respond" : 5322.75, + "seriousness" : 5321.17, + "fourteenth" : 5319.58, + "womb" : 5319.58, + "literal" : 5317.21, + "singers" : 5317.21, + "usefulness" : 5315.63, + "cloudy" : 5314.84, + "mortality" : 5314.84, + "profusion" : 5314.84, + "fleeting" : 5314.05, + "twentieth" : 5314.05, + "maturity" : 5313.25, + "surf" : 5310.88, + "weed" : 5307.72, + "phases" : 5306.13, + "overcame" : 5304.55, + "womanhood" : 5304.55, + "envious" : 5302.97, + "tapped" : 5302.18, + "latent" : 5300.60, + "whiskey" : 5298.22, + "relatively" : 5292.69, + "forbidding" : 5290.31, + "cleopatra" : 5288.73, + "willow" : 5288.73, + "mathematical" : 5286.36, + "sojourn" : 5283.19, + "booty" : 5282.40, + "camel" : 5280.03, + "implore" : 5280.03, + "amateur" : 5279.24, + "morally" : 5276.07, + "qualifications" : 5273.70, + "gasp" : 5271.32, + "101" : 5270.53, + "gliding" : 5268.95, + "tested" : 5263.41, + "racing" : 5261.83, + "brightest" : 5261.04, + "joel" : 5260.25, + "extremes" : 5257.88, + "damascus" : 5257.08, + "labored" : 5256.29, + "peggy" : 5255.50, + "exit" : 5252.34, + "originality" : 5251.55, + "humming" : 5248.38, + "isolation" : 5247.59, + "sometime" : 5246.80, + "glee" : 5246.01, + "adult" : 5245.22, + "solace" : 5244.43, + "biography" : 5242.84, + "ff." : 5241.26, + "hardship" : 5241.26, + "lied" : 5241.26, + "donkey" : 5239.68, + "trader" : 5238.89, + "rumour" : 5234.93, + "amply" : 5231.77, + "confide" : 5231.77, + "favors" : 5231.77, + "perspective" : 5227.81, + "belgian" : 5226.23, + "withstand" : 5225.44, + "robust" : 5224.65, + "pro" : 5223.07, + "val" : 5222.27, + "eats" : 5221.48, + "snare" : 5220.69, + "monthly" : 5219.90, + "wines" : 5215.95, + "ignore" : 5215.15, + "envoy" : 5214.36, + "flown" : 5214.36, + "reverie" : 5213.57, + "jehovah" : 5207.24, + "contrive" : 5206.45, + "chatter" : 5205.66, + "judas" : 5205.66, + "nourishment" : 5204.87, + "reforms" : 5203.29, + "clatter" : 5201.70, + "adrian" : 5198.54, + "allude" : 5197.75, + "corrupted" : 5197.75, + "thorn" : 5196.17, + "junior" : 5193.79, + "tony" : 5187.46, + "calcutta" : 5185.88, + "re" : 5185.88, + "holt" : 5185.09, + "psychological" : 5182.72, + "constancy" : 5181.14, + "misunderstood" : 5180.34, + "signals" : 5177.97, + "drying" : 5175.60, + "harshly" : 5174.81, + "distressing" : 5170.85, + "novelist" : 5170.85, + "cyril" : 5169.27, + "editors" : 5168.48, + "intricate" : 5167.69, + "limestone" : 5166.10, + "forty-five" : 5165.31, + "collision" : 5164.52, + "pebbles" : 5163.73, + "willie" : 5163.73, + "knitting" : 5162.94, + "ordeal" : 5160.57, + "foresee" : 5158.98, + "peas" : 5157.40, + "repast" : 5156.61, + "supplying" : 5152.65, + "clan" : 5151.86, + "abject" : 5150.28, + "dart" : 5149.49, + "berth" : 5148.70, + "bridal" : 5148.70, + "indirect" : 5148.70, + "unnoticed" : 5148.70, + "tint" : 5147.91, + "insults" : 5145.53, + "precedent" : 5143.95, + "twisting" : 5142.37, + "bully" : 5139.21, + "vacation" : 5138.41, + "'ll" : 5133.67, + "canon" : 5132.88, + "aisle" : 5131.29, + "click" : 5131.29, + "inspiring" : 5131.29, + "oval" : 5130.50, + "impracticable" : 5128.92, + "delirium" : 5127.34, + "cedar" : 5126.55, + "contradict" : 5125.76, + "ingratitude" : 5125.76, + "soften" : 5125.76, + "bewilderment" : 5124.96, + "servitude" : 5123.38, + "comely" : 5122.59, + "stump" : 5121.80, + "redeem" : 5121.01, + "spun" : 5118.64, + "elastic" : 5117.84, + "poultry" : 5115.47, + "horseman" : 5114.68, + "dictionary" : 5112.31, + "prettiest" : 5112.31, + "adoration" : 5109.93, + "icel." : 5109.14, + "wager" : 5109.14, + "involving" : 5107.56, + "pathway" : 5104.40, + "essex" : 5102.81, + "wistful" : 5102.81, + "advent" : 5102.02, + "gear" : 5102.02, + "celebration" : 5100.44, + "conceivable" : 5100.44, + "drowning" : 5100.44, + "faintest" : 5097.28, + "acquiring" : 5094.90, + "befell" : 5092.53, + "good-looking" : 5092.53, + "wares" : 5092.53, + "rendezvous" : 5091.74, + "snug" : 5091.74, + "watery" : 5091.74, + "accompaniment" : 5090.95, + "chaps" : 5090.95, + "crawling" : 5088.57, + "lumber" : 5087.78, + "publishing" : 5087.78, + "customer" : 5086.99, + "mediaeval" : 5084.62, + "prints" : 5079.87, + "lavish" : 5078.29, + "md" : 5074.33, + "genesis" : 5069.59, + "rug" : 5068.79, + "analogous" : 5066.42, + "eleventh" : 5066.42, + "noah" : 5066.42, + "galley" : 5062.47, + "partition" : 5062.47, + "blunder" : 5061.67, + "glasgow" : 5061.67, + "fanciful" : 5060.09, + "ham" : 5057.72, + "rainbow" : 5056.14, + "sentinel" : 5055.34, + "hereby" : 5053.76, + "outlook" : 5053.76, + "smitten" : 5051.39, + "unmarried" : 5050.60, + "mice" : 5049.81, + "installed" : 5049.02, + "vivacity" : 5049.02, + "marking" : 5048.22, + "aesthetic" : 5045.85, + "consume" : 5045.85, + "resent" : 5044.27, + "pose" : 5041.90, + "contentment" : 5040.31, + "sterling" : 5039.52, + "veneration" : 5038.73, + "p.m." : 5037.15, + "barking" : 5034.78, + "bower" : 5034.78, + "organism" : 5034.78, + "unintelligible" : 5032.40, + "emphatic" : 5031.61, + "occurring" : 5030.03, + "factors" : 5029.24, + "guise" : 5027.66, + "editorial" : 5026.07, + "impudence" : 5025.28, + "midday" : 5022.91, + "corporal" : 5022.12, + "sg" : 5022.12, + "aright" : 5018.95, + "nigger" : 5015.79, + "lily" : 5012.62, + "noun" : 5007.09, + "scout" : 5007.09, + "spit" : 5007.09, + "cursing" : 5006.29, + "friedrich" : 5005.50, + "manifestly" : 5004.71, + "marco" : 5004.71, + "battalion" : 5000.76, + "heritage" : 5000.76, + "brotherhood" : 4999.17, + "nun" : 4999.17, + "wad" : 4997.59, + "folding" : 4995.22, + "discerned" : 4994.43, + "powerfully" : 4994.43, + "mitchell" : 4990.47, + "helpful" : 4989.68, + "persist" : 4989.68, + "ellis" : 4985.73, + "frigate" : 4984.93, + "spotted" : 4984.93, + "atoms" : 4983.35, + "curves" : 4983.35, + "outlet" : 4981.77, + "erroneous" : 4979.40, + "violated" : 4979.40, + "withheld" : 4978.60, + "fairies" : 4975.44, + "inherit" : 4975.44, + "sledge" : 4975.44, + "taller" : 4973.07, + "supervision" : 4972.28, + "butt" : 4971.48, + "handsomely" : 4971.48, + "tank" : 4965.16, + "velocity" : 4965.16, + "arctic" : 4963.57, + "colleague" : 4963.57, + "pins" : 4962.78, + "butcher" : 4961.99, + "drowsy" : 4961.99, + "butterfly" : 4960.41, + "chart" : 4957.24, + "twin" : 4957.24, + "sunken" : 4954.08, + "exasperated" : 4950.12, + "narrowly" : 4950.12, + "collins" : 4948.54, + "insulting" : 4946.96, + "deficiency" : 4945.38, + "operating" : 4943.79, + "overthrown" : 4942.21, + "gallows" : 4941.42, + "diligent" : 4940.63, + "hindu" : 4940.63, + "blunt" : 4939.84, + "omen" : 4939.05, + "bleak" : 4938.26, + "vehemently" : 4938.26, + "wretchedness" : 4935.88, + "e'er" : 4935.09, + "ensure" : 4931.93, + "denotes" : 4931.14, + "sentenced" : 4927.97, + "unfair" : 4927.18, + "encampment" : 4923.23, + "possessor" : 4923.23, + "absorbing" : 4921.64, + "descendant" : 4920.85, + "sub" : 4918.48, + "drugs" : 4917.69, + "engineers" : 4917.69, + "independently" : 4915.31, + "bucket" : 4914.52, + "clerical" : 4914.52, + "ache" : 4911.36, + "glitter" : 4911.36, + "ordinance" : 4906.61, + "bamboo" : 4905.82, + "amsterdam" : 4905.03, + "vocation" : 4899.49, + "admirer" : 4898.70, + "limp" : 4897.91, + "pallid" : 4897.91, + "mildly" : 4893.16, + "organisation" : 4891.58, + "timothy" : 4891.58, + "dealer" : 4890.79, + "yorkshire" : 4890.79, + "auspicious" : 4886.83, + "deuce" : 4882.88, + "emblem" : 4882.88, + "gibson" : 4882.88, + "primarily" : 4882.88, + "reducing" : 4881.30, + "ritual" : 4877.34, + "decorations" : 4876.55, + "thigh" : 4875.76, + "groaning" : 4874.18, + "scant" : 4871.80, + "fiscal" : 4871.01, + "mien" : 4871.01, + "charging" : 4867.85, + "cor" : 4867.85, + "railing" : 4867.85, + "peers" : 4866.26, + "inferred" : 4865.47, + "sanctity" : 4865.47, + "accumulation" : 4863.89, + "cynical" : 4861.52, + "inspector" : 4861.52, + "wardrobe" : 4859.14, + "jesuit" : 4854.40, + "texture" : 4853.61, + "adjustment" : 4852.02, + "epistle" : 4851.23, + "adventurer" : 4850.44, + "priesthood" : 4850.44, + "seaman" : 4849.65, + "turbulent" : 4849.65, + "chant" : 4844.90, + "marsh" : 4844.90, + "palmer" : 4844.90, + "unaware" : 4844.11, + "vase" : 4843.32, + "ty" : 4839.37, + "initial" : 4837.78, + "baths" : 4836.20, + "weighty" : 4836.20, + "minimum" : 4835.41, + "correction" : 4829.87, + "morsel" : 4829.08, + "overlook" : 4828.29, + "meagre" : 4827.50, + "unanimous" : 4826.71, + "magician" : 4824.33, + "mystical" : 4824.33, + "twenty-three" : 4823.54, + "inhabit" : 4822.75, + "shaggy" : 4822.75, + "unaccountable" : 4822.75, + "nightmare" : 4818.80, + "carbon" : 4818.00, + "coil" : 4818.00, + "lawless" : 4818.00, + "stairway" : 4818.00, + "willingness" : 4818.00, + "sarcasm" : 4815.63, + "crisp" : 4810.88, + "jerk" : 4810.09, + "tout" : 4808.51, + "vocabulary" : 4808.51, + "stroll" : 4806.14, + "poorly" : 4805.35, + "composing" : 4804.56, + "parliamentary" : 4804.56, + "controlling" : 4803.76, + "fitness" : 4803.76, + "thoughtless" : 4802.97, + "soames" : 4802.18, + "temperance" : 4802.18, + "illumination" : 4801.39, + "translations" : 4800.60, + "martyrdom" : 4799.02, + "mellow" : 4798.23, + "nationality" : 4795.06, + "jam" : 4794.27, + "austere" : 4792.69, + "shoots" : 4791.11, + "casually" : 4789.52, + "pensive" : 4788.73, + "flavour" : 4787.15, + "nets" : 4786.36, + "dice" : 4784.78, + "satisfactorily" : 4783.99, + "shrunk" : 4783.19, + "administer" : 4781.61, + "ante" : 4781.61, + "swine" : 4781.61, + "baptist" : 4780.03, + "listener" : 4778.45, + "unimportant" : 4778.45, + "genera" : 4776.87, + "contrivance" : 4776.07, + "deplorable" : 4776.07, + "museum" : 4776.07, + "benefactor" : 4773.70, + "tints" : 4772.12, + "alphabet" : 4770.54, + "rout" : 4768.16, + "scatter" : 4767.37, + "boer" : 4766.58, + "ftp" : 4766.58, + "steve" : 4766.58, + "extant" : 4765.79, + "bohemia" : 4765.00, + "misunderstanding" : 4765.00, + "universities" : 4765.00, + "dexterity" : 4762.63, + "rag" : 4759.46, + "inseparable" : 4758.67, + "punch" : 4757.09, + "brazen" : 4756.30, + "economical" : 4756.30, + "pernicious" : 4756.30, + "craig" : 4755.50, + "mythology" : 4755.50, + "drained" : 4754.71, + "bolted" : 4753.92, + "abel" : 4753.13, + "stride" : 4751.55, + "circumference" : 4749.18, + "meddle" : 4749.18, + "axis" : 4747.59, + "gum" : 4746.80, + "las" : 4746.01, + "kinder" : 4744.43, + "closes" : 4742.06, + "ferocity" : 4742.06, + "giddy" : 4740.47, + "secluded" : 4740.47, + "resisting" : 4737.31, + "satisfying" : 4735.73, + "reliable" : 4734.94, + "disgusting" : 4733.35, + "thirty-six" : 4733.35, + "ethical" : 4730.98, + "raleigh" : 4729.40, + "crouching" : 4728.61, + "lash" : 4728.61, + "recital" : 4727.02, + "buddhist" : 4726.23, + "collapse" : 4723.86, + "unsatisfactory" : 4721.49, + "lore" : 4718.32, + "varies" : 4718.32, + "mainland" : 4715.95, + "scot" : 4715.95, + "repute" : 4715.16, + "cushion" : 4714.37, + "confound" : 4712.78, + "scrub" : 4712.78, + "myth" : 4710.41, + "flights" : 4709.62, + "oats" : 4708.04, + "layers" : 4707.25, + "ownership" : 4707.25, + "cape" : 4706.45, + "glimmer" : 4704.87, + "scare" : 4704.87, + "waked" : 4704.87, + "bengal" : 4703.29, + "scrupulous" : 4703.29, + "equals" : 4700.92, + "redress" : 4700.13, + "brake" : 4698.54, + "nut" : 4698.54, + "stability" : 4698.54, + "crafty" : 4697.75, + "kirk" : 4697.75, + "bough" : 4696.17, + "momentous" : 4696.17, + "albeit" : 4695.38, + "enlarge" : 4694.59, + "hardness" : 4694.59, + "civilised" : 4693.80, + "dotted" : 4692.21, + "defiant" : 4691.42, + "timidity" : 4691.42, + "solar" : 4687.47, + "heartless" : 4683.51, + "thomson" : 4681.93, + "mat" : 4681.14, + "shun" : 4681.14, + "raid" : 4679.56, + "disclose" : 4678.76, + "suppression" : 4674.02, + "puff" : 4673.23, + "juncture" : 4670.85, + "beak" : 4670.06, + "unjustly" : 4668.48, + "foresaw" : 4664.52, + "rot" : 4662.15, + "aggressive" : 4661.36, + "predicted" : 4661.36, + "quaker" : 4661.36, + "grate" : 4659.78, + "lease" : 4657.40, + "ponderous" : 4656.61, + "maketh" : 4655.82, + "repaid" : 4655.82, + "charcoal" : 4652.66, + "chilly" : 4652.66, + "arrogance" : 4651.87, + "friction" : 4651.87, + "participation" : 4651.87, + "pier" : 4649.49, + "stale" : 4648.70, + "intoxicated" : 4644.75, + "commissioned" : 4643.16, + "ratio" : 4643.16, + "121" : 4640.79, + "comb" : 4640.00, + "masterpiece" : 4640.00, + "wholesale" : 4640.00, + "embraces" : 4639.21, + "trodden" : 4639.21, + "ephraim" : 4638.42, + "shaw" : 4634.46, + "translate" : 4631.30, + "mortar" : 4630.51, + "recreation" : 4629.71, + "rite" : 4628.13, + "truthful" : 4628.13, + "cavalier" : 4627.34, + "caress" : 4626.55, + "si" : 4624.97, + "curling" : 4624.18, + "rivalry" : 4623.39, + "whim" : 4623.39, + "abreast" : 4621.01, + "thebes" : 4620.22, + "faust" : 4619.43, + "peg" : 4619.43, + "wilhelm" : 4619.43, + "pestilence" : 4618.64, + "ceremonial" : 4617.85, + "receiver" : 4617.06, + "sample" : 4617.06, + "distinctive" : 4615.47, + "consummate" : 4614.68, + "matron" : 4610.73, + "claiming" : 4609.94, + "plural" : 4608.35, + "initiative" : 4607.56, + "inexhaustible" : 4606.77, + "a.m." : 4605.98, + "spider" : 4603.61, + "reed" : 4602.82, + "streak" : 4602.82, + "blocked" : 4601.23, + "titus" : 4601.23, + "smashed" : 4598.07, + "populous" : 4597.28, + "baronet" : 4596.49, + "commodore" : 4596.49, + "jelly" : 4596.49, + "advocates" : 4594.11, + "dinah" : 4592.53, + "salutation" : 4589.37, + "mutiny" : 4586.99, + "chronicles" : 4586.20, + "comforting" : 4585.41, + "serviceable" : 4584.62, + "parchment" : 4583.04, + "playful" : 4583.04, + "potato" : 4583.04, + "transient" : 4579.87, + "administrative" : 4579.08, + "anarchy" : 4579.08, + "barber" : 4579.08, + "revision" : 4579.08, + "operated" : 4578.29, + "farce" : 4577.50, + "germ" : 4576.71, + "profile" : 4576.71, + "provides" : 4576.71, + "noting" : 4575.13, + "disordered" : 4573.54, + "menacing" : 4573.54, + "heightened" : 4571.17, + "finance" : 4570.38, + "averse" : 4569.59, + "azure" : 4568.80, + "bathe" : 4568.80, + "campaigns" : 4564.84, + "lessen" : 4562.47, + "slate" : 4562.47, + "acquaint" : 4561.68, + "gin" : 4559.30, + "humiliating" : 4559.30, + "cleft" : 4556.93, + "conveyance" : 4556.93, + "chivalrous" : 4554.56, + "capricious" : 4553.77, + "tribune" : 4553.77, + "pilgrim" : 4552.97, + "entreaty" : 4551.39, + "womanly" : 4550.60, + "paltry" : 4549.81, + "sporting" : 4549.81, + "maker" : 4549.02, + "digestion" : 4545.85, + "bart" : 4544.27, + "infamy" : 4541.90, + "lambs" : 4541.90, + "gaping" : 4540.32, + "periodical" : 4540.32, + "standpoint" : 4540.32, + "amorous" : 4539.53, + "tub" : 4539.53, + "luxuriant" : 4538.73, + "basic" : 4536.36, + "mutually" : 4535.57, + "chris" : 4533.99, + "greed" : 4532.40, + "premature" : 4532.40, + "extinction" : 4531.61, + "boiler" : 4530.03, + "intimation" : 4529.24, + "scandalous" : 4527.66, + "separating" : 4526.87, + "oratory" : 4525.28, + "banish" : 4524.49, + "electrical" : 4524.49, + "herb" : 4523.70, + "multiply" : 4523.70, + "prosper" : 4522.91, + "friar" : 4522.12, + "nightly" : 4520.54, + "ole" : 4519.75, + "monkeys" : 4518.16, + "interminable" : 4516.58, + "enjoys" : 4515.79, + "similarity" : 4515.00, + "riddle" : 4514.21, + "cleaning" : 4512.63, + "subscription" : 4511.84, + "copious" : 4510.25, + "exclaim" : 4509.46, + "forged" : 4509.46, + "voting" : 4509.46, + "scourge" : 4508.67, + "darkly" : 4507.09, + "privacy" : 4506.30, + "arena" : 4503.92, + "bearded" : 4502.34, + "vera" : 4499.97, + "alacrity" : 4494.43, + "sensual" : 4493.64, + "spin" : 4493.64, + "neutrality" : 4492.85, + "flannel" : 4492.06, + "fasting" : 4491.27, + "trailer" : 4491.27, + "avert" : 4489.68, + "trustworthy" : 4489.68, + "jamaica" : 4488.10, + "unchanged" : 4485.73, + "traveler" : 4484.15, + "unfamiliar" : 4483.35, + "puffed" : 4482.56, + "mirrors" : 4480.98, + "phoebe" : 4480.19, + "father-in-law" : 4478.61, + "conform" : 4477.03, + "particle" : 4476.23, + "railways" : 4476.23, + "stupendous" : 4476.23, + "paddle" : 4474.65, + "innate" : 4473.86, + "reformation" : 4473.07, + "volley" : 4471.49, + "statistics" : 4470.70, + "agrees" : 4469.11, + "simpler" : 4469.11, + "padre" : 4468.32, + "congratulations" : 4467.53, + "lids" : 4466.74, + "muse" : 4466.74, + "inhabitant" : 4465.95, + "ishmael" : 4465.16, + "rustle" : 4465.16, + "clump" : 4464.37, + "calendar" : 4463.58, + "flute" : 4463.58, + "inaccessible" : 4461.99, + "yore" : 4461.20, + "jay" : 4459.62, + "repulsive" : 4459.62, + "fray" : 4458.04, + "po" : 4456.46, + "nomination" : 4454.08, + "conclusive" : 4453.29, + "peaceable" : 4453.29, + "beth" : 4452.50, + "inconceivable" : 4452.50, + "e'en" : 4450.92, + "emerald" : 4450.13, + "lava" : 4450.13, + "trillion" : 4448.54, + "uppermost" : 4448.54, + "arduous" : 4447.75, + "lyric" : 4446.96, + "downright" : 4446.17, + "reproduction" : 4444.59, + "foresight" : 4443.01, + "consistency" : 4442.22, + "ape" : 4441.42, + "senators" : 4439.05, + "pallor" : 4437.47, + "span" : 4436.68, + "salad" : 4431.93, + "snuff" : 4431.93, + "drooped" : 4431.14, + "greetings" : 4431.14, + "chestnut" : 4427.98, + "inquisitive" : 4427.98, + "vicar" : 4427.98, + "noel" : 4426.39, + "attic" : 4425.60, + "savings" : 4425.60, + "affirmative" : 4424.02, + "ills" : 4422.44, + "applications" : 4421.65, + "t" : 4421.65, + "dye" : 4420.06, + "gloucester" : 4420.06, + "nominal" : 4417.69, + "demonstrate" : 4414.53, + "dispense" : 4414.53, + "dissatisfaction" : 4414.53, + "merciless" : 4414.53, + "trusty" : 4414.53, + "coloring" : 4412.15, + "perusal" : 4412.15, + "plaintive" : 4412.15, + "discarded" : 4410.57, + "precarious" : 4408.20, + "infection" : 4406.61, + "ruinous" : 4405.03, + "bolts" : 4404.24, + "arithmetic" : 4402.66, + "considerate" : 4402.66, + "lark" : 4401.87, + "ethics" : 4401.08, + "conventions" : 4400.29, + "stumbling" : 4400.29, + "pitcher" : 4399.49, + "slips" : 4399.49, + "seine" : 4398.70, + "officially" : 4396.33, + "danube" : 4395.54, + "annoy" : 4393.96, + "glide" : 4392.37, + "impunity" : 4390.79, + "amends" : 4390.00, + "sol" : 4389.21, + "conveying" : 4386.05, + "abandonment" : 4385.25, + "mane" : 4384.46, + "tinge" : 4384.46, + "brim" : 4382.09, + "forenoon" : 4380.51, + "seventy-five" : 4380.51, + "sparkle" : 4380.51, + "syllables" : 4380.51, + "shrug" : 4377.34, + "enchantment" : 4375.76, + "franz" : 4375.76, + "trait" : 4375.76, + "bribe" : 4374.97, + "composer" : 4373.39, + "preparatory" : 4373.39, + "audacious" : 4372.60, + "outskirts" : 4372.60, + "soiled" : 4372.60, + "fiddle" : 4371.01, + "football" : 4370.22, + "isaiah" : 4370.22, + "partnership" : 4370.22, + "continuation" : 4368.64, + "pioneer" : 4368.64, + "vest" : 4367.85, + "bass" : 4367.06, + "derby" : 4367.06, + "quarry" : 4367.06, + "rigging" : 4367.06, + "dizzy" : 4366.27, + "abnormal" : 4365.48, + "omission" : 4364.68, + "idolatry" : 4363.89, + "sequence" : 4363.89, + "squeeze" : 4362.31, + "cabbage" : 4360.73, + "canopy" : 4360.73, + "athletic" : 4359.94, + "shirley" : 4359.94, + "drunkenness" : 4359.15, + "intrusion" : 4358.36, + "'cause" : 4355.98, + "assign" : 4355.19, + "tackle" : 4354.40, + "dreamt" : 4353.61, + "sceptre" : 4352.82, + "exacting" : 4352.03, + "parched" : 4349.65, + "eddy" : 4347.28, + "percentage" : 4346.49, + "twinkle" : 4342.53, + "curb" : 4340.95, + "sandstone" : 4340.16, + "invaluable" : 4337.79, + "fathom" : 4336.20, + "preferable" : 4336.20, + "adelaide" : 4334.62, + "advertising" : 4332.25, + "scraps" : 4330.67, + "lever" : 4329.08, + "muster" : 4328.29, + "cavity" : 4324.34, + "barbarian" : 4322.75, + "sleepless" : 4322.75, + "fried" : 4320.38, + "abstraction" : 4319.59, + "forefinger" : 4319.59, + "spade" : 4319.59, + "erection" : 4318.80, + "scorned" : 4318.80, + "pail" : 4317.22, + "withdrawal" : 4317.22, + "senator" : 4315.63, + "mortgage" : 4314.84, + "ancestral" : 4311.68, + "succour" : 4310.89, + "ma" : 4309.31, + "forbearance" : 4308.51, + "repress" : 4308.51, + "spouse" : 4305.35, + "valid" : 4304.56, + "witchcraft" : 4303.77, + "workmanship" : 4302.98, + "legacy" : 4300.60, + "proximity" : 4300.60, + "bombay" : 4299.81, + "paula" : 4299.81, + "incorporated" : 4298.23, + "muzzle" : 4297.44, + "reuben" : 4296.65, + "clusters" : 4293.48, + "valve" : 4291.11, + "compelling" : 4290.32, + "dissipated" : 4289.53, + "flickering" : 4287.15, + "guinea" : 4286.36, + "sup" : 4286.36, + "tarry" : 4286.36, + "derision" : 4285.57, + "vehicles" : 4283.20, + "accommodate" : 4282.41, + "glossy" : 4282.41, + "iris" : 4278.45, + "relic" : 4277.66, + "ant" : 4276.08, + "heath" : 4269.75, + "bug" : 4266.58, + "vocal" : 4265.00, + "downfall" : 4262.63, + "construct" : 4261.05, + "undue" : 4261.05, + "vapor" : 4261.05, + "bat" : 4259.46, + "whimsical" : 4259.46, + "contradictory" : 4255.51, + "unlocked" : 4255.51, + "foretold" : 4250.76, + "automatic" : 4249.97, + "explicit" : 4249.18, + "indolent" : 4248.39, + "mates" : 4247.60, + "artful" : 4243.64, + "downcast" : 4242.85, + "well-being" : 4241.27, + "winston" : 4241.27, + "ordinances" : 4240.48, + "catharine" : 4239.69, + "effectively" : 4239.69, + "missions" : 4239.69, + "stalk" : 4239.69, + "indistinct" : 4238.89, + "pregnant" : 4236.52, + "reddish" : 4236.52, + "coveted" : 4235.73, + "fret" : 4234.94, + "peeping" : 4234.15, + "buck" : 4233.36, + "sumptuous" : 4232.56, + "indefinitely" : 4231.77, + "reliance" : 4230.98, + "panama" : 4230.19, + "cocked" : 4229.40, + "dad" : 4226.24, + "everyday" : 4224.65, + "intoxication" : 4221.49, + "aghast" : 4219.12, + "subterranean" : 4218.32, + "turmoil" : 4218.32, + "forfeit" : 4215.16, + "chasm" : 4214.37, + "inspect" : 4212.79, + "perverse" : 4212.79, + "precipitate" : 4212.79, + "dover" : 4212.00, + "ambush" : 4210.41, + "evermore" : 4210.41, + "mass." : 4210.41, + "blot" : 4209.62, + "nook" : 4209.62, + "verdure" : 4209.62, + "parapet" : 4208.83, + "jake" : 4208.04, + "cessation" : 4207.25, + "ankle" : 4206.46, + "classification" : 4206.46, + "fervently" : 4206.46, + "oddly" : 4205.67, + "haul" : 4204.08, + "saxony" : 4203.29, + "embarrassing" : 4202.50, + "hairy" : 4200.92, + "northwest" : 4200.92, + "disabled" : 4199.34, + "laurel" : 4199.34, + "preston" : 4198.55, + "arrogant" : 4196.96, + "hurts" : 4196.96, + "demonstrations" : 4195.38, + "splash" : 4195.38, + "curl" : 4194.59, + "livelihood" : 4193.80, + "wary" : 4193.80, + "scattering" : 4193.01, + "brace" : 4192.22, + "converts" : 4190.63, + "detestable" : 4190.63, + "143" : 4189.05, + "abandoning" : 4189.05, + "somerset" : 4189.05, + "weakly" : 4189.05, + "clothe" : 4188.26, + "gem" : 4187.47, + "tremor" : 4185.89, + "surveying" : 4184.31, + "variable" : 4183.51, + "anniversary" : 4175.60, + "thirty-two" : 4174.81, + "wrap" : 4174.02, + "curly" : 4171.65, + "diversity" : 4170.86, + "prestige" : 4170.86, + "desertion" : 4170.07, + "freezing" : 4170.07, + "heedless" : 4170.07, + "sentry" : 4170.07, + "believer" : 4169.27, + "ram" : 4169.27, + "rowing" : 4169.27, + "negligence" : 4168.48, + "self-" : 4168.48, + "sulphur" : 4167.69, + "discrimination" : 4166.90, + "cooling" : 4162.95, + "millionaire" : 4162.95, + "flowering" : 4161.36, + "meridian" : 4161.36, + "wins" : 4161.36, + "awed" : 4159.78, + "beastly" : 4159.78, + "nuisance" : 4158.99, + "abstain" : 4158.20, + "continental" : 4158.20, + "stanza" : 4157.41, + "target" : 4156.62, + "unwonted" : 4156.62, + "whit" : 4155.82, + "jason" : 4153.45, + "stall" : 4152.66, + "sham" : 4151.87, + "dictate" : 4151.08, + "empress" : 4151.08, + "gout" : 4151.08, + "jobs" : 4151.08, + "manure" : 4151.08, + "nigel" : 4151.08, + "sidewalk" : 4150.29, + "sate" : 4148.70, + "grievance" : 4147.91, + "axes" : 4147.12, + "bony" : 4146.33, + "invest" : 4146.33, + "birmingham" : 4143.96, + "ebb" : 4143.96, + "rabble" : 4140.79, + "restlessness" : 4140.00, + "cruise" : 4137.63, + "rally" : 4136.84, + "rumor" : 4135.26, + "hysterical" : 4132.88, + "girlish" : 4130.51, + "actively" : 4129.72, + "shortest" : 4129.72, + "marseilles" : 4128.93, + "cheque" : 4128.14, + "disregarded" : 4127.34, + "retort" : 4127.34, + "rocking" : 4127.34, + "emerge" : 4125.76, + "perch" : 4124.18, + "flask" : 4123.39, + "ka" : 4123.39, + "countryman" : 4121.81, + "lonesome" : 4121.81, + "manned" : 4121.01, + "unarmed" : 4121.01, + "wast" : 4121.01, + "frog" : 4119.43, + "twenty-eight" : 4119.43, + "unscrupulous" : 4119.43, + "yarn" : 4119.43, + "victuals" : 4118.64, + "outrageous" : 4117.85, + "appropriation" : 4114.69, + "foolishness" : 4114.69, + "quickness" : 4114.69, + "adversity" : 4113.89, + "parma" : 4112.31, + "diseased" : 4111.52, + "iliad" : 4109.94, + "salutary" : 4109.94, + "smelt" : 4108.36, + "territorial" : 4108.36, + "hurricane" : 4107.57, + "irons" : 4106.77, + "canyon" : 4105.98, + "jeremiah" : 4105.98, + "brooklyn" : 4105.19, + "indulging" : 4105.19, + "vapour" : 4104.40, + "disobedience" : 4103.61, + "atrocious" : 4102.82, + "leaps" : 4102.03, + "tapestry" : 4099.65, + "provocation" : 4098.86, + "twenty-six" : 4098.86, + "impotent" : 4098.07, + "smite" : 4093.33, + "acquitted" : 4090.95, + "os" : 4090.16, + "tumultuous" : 4090.16, + "barge" : 4089.37, + "palpable" : 4087.79, + "apprentice" : 4087.00, + "lances" : 4086.21, + "compartment" : 4085.41, + "godly" : 4085.41, + "sarcastic" : 4085.41, + "therefrom" : 4085.41, + "specifically" : 4084.62, + "uniformity" : 4083.83, + "emerging" : 4083.04, + "atonement" : 4082.25, + "whereabouts" : 4082.25, + "davy" : 4081.46, + "framework" : 4081.46, + "sponge" : 4081.46, + "mountainous" : 4080.67, + "annoying" : 4079.08, + "cot" : 4079.08, + "squirrel" : 4079.08, + "wand" : 4076.71, + "grind" : 4075.92, + "bang" : 4075.13, + "unreal" : 4075.13, + "blacksmith" : 4074.34, + "injunction" : 4072.76, + "scarcity" : 4071.96, + "withhold" : 4071.96, + "outright" : 4070.38, + "bavaria" : 4069.59, + "cement" : 4068.80, + "growl" : 4067.22, + "aggregate" : 4066.43, + "fraction" : 4066.43, + "exaltation" : 4064.05, + "inexorable" : 4063.26, + "jug" : 4063.26, + "purer" : 4063.26, + "sap" : 4063.26, + "illegal" : 4062.47, + "sister-in-law" : 4061.68, + "presses" : 4060.89, + "stealthily" : 4060.89, + "dissolve" : 4060.10, + "volcano" : 4059.31, + "hungarian" : 4057.72, + "equilibrium" : 4056.93, + "obstinately" : 4056.14, + "sullenly" : 4056.14, + "assassination" : 4055.35, + "commissions" : 4054.56, + "respectability" : 4052.98, + "bases" : 4051.40, + "maxwell" : 4050.60, + "resounded" : 4050.60, + "closest" : 4049.81, + "embroidery" : 4049.02, + "gunpowder" : 4049.02, + "reproof" : 4049.02, + "yale" : 4045.07, + "combining" : 4043.48, + "weaving" : 4041.90, + "earnings" : 4041.11, + "hamburg" : 4039.53, + "indoors" : 4039.53, + "manufacturers" : 4039.53, + "pitiless" : 4039.53, + "scarf" : 4039.53, + "picnic" : 4037.95, + "misled" : 4035.57, + "pompous" : 4035.57, + "brian" : 4034.78, + "respite" : 4033.99, + "exploit" : 4033.20, + "tracing" : 4033.20, + "geological" : 4031.62, + "passport" : 4031.62, + "confines" : 4030.83, + "dishonour" : 4029.24, + "executioner" : 4029.24, + "township" : 4029.24, + "vacancy" : 4029.24, + "acquiescence" : 4026.87, + "cornwall" : 4026.87, + "crumbling" : 4026.08, + "three-quarters" : 4025.29, + "exploration" : 4022.91, + "needy" : 4021.33, + "stationary" : 4021.33, + "disconcerted" : 4020.54, + "wanderer" : 4019.75, + "beaver" : 4018.17, + "lookout" : 4015.79, + "onion" : 4015.79, + "depicted" : 4015.00, + "boisterous" : 4014.21, + "couples" : 4013.42, + "speakers" : 4013.42, + "woollen" : 4012.63, + "lightness" : 4011.05, + "bitten" : 4007.88, + "aux" : 4007.09, + "toleration" : 4005.51, + "lucia" : 4004.72, + "scar" : 4004.72, + "bohemian" : 4002.34, + "vested" : 4002.34, + "affinity" : 4001.55, + "carlo" : 4001.55, + "sous" : 4001.55, + "penitent" : 4000.76, + "simpson" : 4000.76, + "abiding" : 3997.60, + "ca" : 3996.02, + "immoral" : 3996.02, + "dishonest" : 3995.22, + "yawning" : 3994.43, + "mustache" : 3992.85, + "supplement" : 3992.85, + "whirlwind" : 3992.85, + "clash" : 3991.27, + "terence" : 3990.48, + "lamentable" : 3989.69, + "bennett" : 3988.90, + "farthing" : 3987.31, + "speck" : 3987.31, + "biscuit" : 3986.52, + "appellation" : 3985.73, + "gdp" : 3984.94, + "reserves" : 3983.36, + "uncouth" : 3982.57, + "birch" : 3980.98, + "armchair" : 3980.19, + "judy" : 3980.19, + "greasy" : 3978.61, + "leaden" : 3978.61, + "dough" : 3977.03, + "lining" : 3976.24, + "cleverness" : 3971.49, + "ascetic" : 3969.91, + "clutch" : 3969.12, + "krishna" : 3969.12, + "embark" : 3968.33, + "quotations" : 3968.33, + "friendliness" : 3967.53, + "liberally" : 3967.53, + "trance" : 3965.16, + "untrue" : 3965.16, + "rejection" : 3964.37, + "grating" : 3962.79, + "hanover" : 3961.21, + "inexperienced" : 3961.21, + "mon" : 3960.41, + "wintry" : 3960.41, + "stalwart" : 3958.83, + "meats" : 3958.04, + "stamping" : 3956.46, + "variance" : 3956.46, + "apiece" : 3954.88, + "firmament" : 3954.88, + "absorption" : 3953.29, + "apprehensive" : 3953.29, + "terminate" : 3953.29, + "wilful" : 3952.50, + "conveniently" : 3951.71, + "cleanliness" : 3950.92, + "collective" : 3950.92, + "angela" : 3950.13, + "filth" : 3950.13, + "philippines" : 3950.13, + "timely" : 3950.13, + "herein" : 3948.55, + "ignoble" : 3948.55, + "canton" : 3946.17, + "lamentations" : 3944.59, + "moslem" : 3944.59, + "ware" : 3943.80, + "adjective" : 3943.01, + "glen" : 3943.01, + "invade" : 3943.01, + "livid" : 3943.01, + "buggy" : 3941.43, + "prolong" : 3940.64, + "weaken" : 3937.47, + "folio" : 3935.10, + "dismissal" : 3934.31, + "quay" : 3934.31, + "enchanting" : 3933.52, + "heave" : 3931.93, + "purified" : 3931.14, + "syrian" : 3931.14, + "significantly" : 3929.56, + "experimental" : 3927.98, + "film" : 3926.40, + "repressed" : 3926.40, + "cooperation" : 3924.81, + "sequel" : 3924.02, + "wench" : 3924.02, + "calves" : 3923.23 + } + +def get_frequency(word): + "Return the word frequency, or 0 if not found" + return frequencies.get(word, 0.0) diff --git a/other/index-helper.py b/other/index-helper.py new file mode 100644 index 0000000000000000000000000000000000000000..54abcb6231cd23e14949517afcd258881e1bf1c8 --- /dev/null +++ b/other/index-helper.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python + +import sys +import re +import frequency + +max_occurrences = 1000 + +filter_re = sys.argv[1:] if len(sys.argv) > 1 else ['.*'] + +files = [ + # "macros.tex", + "front.tex", + "preface.tex", + "introduction.tex", + "preliminaries.tex", + "basics.tex", + "logic.tex", + "equivalences.tex", + "induction.tex", + "hits.tex", + "hlevels.tex", + "homotopy.tex", + "categories.tex", + "setmath.tex", + "reals.tex", + "formal.tex" + ] + + +words = {} +macros = set({}) +antimacros = set({}) +antifiles = ['symbols.tex', + 'macros.tex', + 'opt-letter.tex', + 'opt-ustrade.tex', + 'opt-color.tex', + 'hott-ustrade.tex', + 'hott-letter.tex', + 'hott-online.tex'] + +def matchtospaces(m): + return ' ' * len(m.group(0)) + +for fn in files: + with open(fn, "r") as f: + text = f.read() + # Remove environment names + #text = re.sub(r'\\(begin|end){[^}]+}', ' ', text) + # Remove all labels and refs + #text = re.sub(r'(\\(label|cref|autoref|eqref|ref){[^}]+})', ' ', text) + # Remove hyphenation hints + #text = re.sub(r'\\-', '', text) + # Remove quotes + #text = re.sub(r"['`]", ' ', text) + # Replace --- with space + text = re.sub(r'---', ' ', text) + # Replace punctuation with space + #text = re.sub(r'[,.;:?!]', ' ', text) + # Replace newlines with spaces + #text = re.sub(r'\n', ' ', text) + # Find macros + for m in re.findall(r"\\[a-zA-Z]+\b", text): + if fn in antifiles: + antimacros.add(m) + else: + macros.add(m) + # Delete macros + #text = re.sub(r'\\[a-zA-Z]+\b', ' ', text) + # Delete cross-references, labels, citations, urls, math terms, urls, environments, index entries + text = re.sub(r'\\(autoref|cref|cite|label|ref|eqref|mathsf|href|url|begin|end|index|indexdef|indexfoot|indexsee){[0-9a-zA-Z-_:,!@$* \\]*}', matchtospaces, text) + # Find words, try to include things like "$(n-2)$-connected" + for m in re.finditer(r"(?<=(.{20}))[^\\]\b(\$[^$]*\$-)?([a-zA-Z]([a-zA-Z-']|\\-)*[a-zA-Z-])\b(?=(.{20}))", text, re.DOTALL): + key = str(m.group(3)).lower() + key = re.sub(r'\\-', '', key) # remove hyphenation hints + pos = m.start(3) + excerpt = str(m.group(1) + m.group(0) + m.group(5)) + excerpt = re.sub(r'\n', ' ', excerpt) # replace newlines with spaces + if key in words: + words[key].append((excerpt, fn, pos)) + else: + words[key] = [(excerpt, fn, pos)] + +# Macros which appear somewhere but are not in the symbols index, macros.tex, +# or configuration files. +macros -= antimacros + +# Uncomment to see the macros. +#for macro in sorted(macros - antimacros): +# print (macro) + +def sortkey(word): + return (frequency.get_frequency(word), word) + +def filter_word(w, fs): + for r in fs: + if re.search(r, w, flags = re.IGNORECASE): return True + return False + +for key in sorted(words.keys(), key = sortkey): + if filter_word(key, filter_re): + freq = frequency.get_frequency(key) + if freq > 1100000: + continue + print("\n\n======== %s [%d]\n\n" % (key, freq)) + for (excerpt, fn, pos) in words[key][:max_occurrences]: + print (" ...%s... [%s @ %d]" % (excerpt, fn, pos)) + if len(words[key]) > max_occurrences: + print ("\n [[%d omitted occurrences]]" % (len(words[key]) - max_occurrences)) + diff --git a/other/index.el b/other/index.el new file mode 100644 index 0000000000000000000000000000000000000000..5a41e954f0be1074df641bf06014f375b8533c75 --- /dev/null +++ b/other/index.el @@ -0,0 +1,127 @@ +;; HOW TO USE THIS FILE + +;; 1. Open this file in Emacs and type `M-x eval-buffer' to evaluate +;; all the Emacs Lisp function definitions and key bindings in it. + +;; 2. Run the script index-helper.pl from the shell and save its +;; output to a file, e.g. +;; hottbook$ other/index-helper.pl >indexterms.txt + +;; 3. Open the `indexterms.txt` file in Emacs, position point at the +;; beginning of the words you want to index (e.g. the beginning of a +;; letter), and type `C-c i`. You will be prompted one by one whether +;; you want to index the words appearing after that point. As soon as +;; you say "yes" to one of them, you will be prompted for the term +;; under which you want to index it. You can break out of this +;; without selecting a word to index by typing `C-g` (the standard +;; Emacs quit command). + +;; 4. After choosing a word to index as above, type `C-c n` to jump to +;; and highlight the next occurrence of that word; you will then be +;; prompted whether or not to add an index entry for it. If you've +;; been editing files since creating the `indexterms.txt` file, then +;; the positions stored therein may not match reality and the script +;; may not be able to find the actual occurrence, but it should +;; hopefully be close by and you can find it yourself. FEEL FREE to +;; say "no" to the script and then add your own index entry or +;; entries, if you think the default `\index{term}` is not right for +;; this occurrence. + +;; 5. Repeat step 4 until the script tells you "No more occurrences of +;; current word". If you type `C-u C-c n`, then the command `C-c n` +;; will repeat itself automatically until you quit (with `C-g`) or run +;; out of occurrences. In either case, you should be left back at the +;; `indexterms.txt` file, ready to type `C-c i` again and choose your +;; next word to index. + +;; 6. After doing this for a while, especially if you've been making +;; other edits at the same time (as tends to happen), the positions in +;; the `indexterms.txt` file may become very far off. When this +;; happens you can do the following. +;; a) Repeat step 2 to recreate the file. +;; b) Switch to that file in Emacs and type `M-x revert-buffer` to +;; reload the new version. Make sure you reposition the cursor +;; where it was before. +;; c) Type `M-x index-clear-offsets` to inform the indexing scripts. +;; In place of steps b and c, you can also just quit and restart Emacs. + +(defvar index-buffer nil) +(defvar index-word nil) +(defvar index-term nil) +(defvar index-bound nil) + +(defvar index-overlay nil) +(setq index-overlay (make-overlay (point-min) (point-max))) +(delete-overlay index-overlay) +(overlay-put index-overlay 'face '((:background "purple"))) + +(defvar index-offsets nil) + +(defun index-term () (interactive) + (if (and (re-search-forward "^=+ " nil t) + (progn (recenter) t) + (looking-at "\\([A-Za-z-']+\\) ")) + (let ((word (match-string 1))) + (move-overlay index-overlay (match-beginning 1) (match-end 1)) + (unwind-protect + (if (y-or-n-p (concat "Index '" word "'? ")) + (progn + (setq index-buffer (current-buffer) + index-word word + index-term (read-string (concat "Index entry for '" index-word "' (default=" index-word ") : ") nil nil index-word) + index-bound (save-excursion (re-search-forward "^=+ " nil t))) + (forward-line 1)) + (index-term)) + (beginning-of-line) + (delete-overlay index-overlay))) + (message "No words found"))) + +(global-set-key '[(control ?c) ?i] 'index-term) + +(defun index-next (repeat) (interactive "P") + (let (file loc) + (if (progn + (set-buffer index-buffer) + (re-search-forward "\\[\\([A-Za-z]+\\.tex\\) @ \\([0-9]+\\)\\]" index-bound t)) + (let ((file (match-string 1)) + (loc (string-to-number (match-string 2))) + offset) + (find-file file) + (goto-char loc) + (backward-char 20) ; Correct for strange misalignments + (setq offset (or (cdr (assoc (current-buffer) index-offsets)) 0)) + (forward-char offset) + (if (search-forward index-word (+ (point) 400) t) + (progn + (move-overlay index-overlay (match-beginning 0) (match-end 0)) + (unwind-protect + (progn + (when (y-or-n-p (concat "Index this occurrence as '" index-term "'? ")) + (when (or (looking-at "}") + (save-excursion + (goto-char (match-beginning 0)) + (backward-char 1) + (looking-at "{"))) + (backward-up-list -1)) + (insert "\\index{" index-term "}") + (setq offset (+ offset 8 (length index-term))) + (if (assoc (current-buffer) index-offsets) + (setcdr (assoc (current-buffer) index-offsets) offset) + (setq index-offsets (cons (cons (current-buffer) offset) index-offsets)))) + (with-current-buffer index-buffer + (forward-line 1))) + (delete-overlay index-overlay) + (with-current-buffer index-buffer + (beginning-of-line))) + (if repeat + (index-next repeat))) + (if (and repeat (y-or-n-p "This occurrence not found; continue? ")) + (index-next repeat) + (message "Occurrence not found")))) + (switch-to-buffer index-buffer) + (message "No more occurrences of current word")))) + +(global-set-key `[(control ?c) ?n] 'index-next) + +(defun index-clear-offsets () (interactive) + (setq index-offsets nil)) diff --git a/other/prelim.agda b/other/prelim.agda new file mode 100644 index 0000000000000000000000000000000000000000..71692c802a56a3d7be499f409d6158462e8ec4f6 --- /dev/null +++ b/other/prelim.agda @@ -0,0 +1,73 @@ +{-# OPTIONS --type-in-type #-} +module prelim where + +open import Relation.Binary.PropositionalEquality + +data Bool : Set where + true : Bool + false : Bool + +RecBool : (C : Set) → C → C → Bool → C +RecBool C b0 b1 false = b0 +RecBool C b0 b1 true = b1 + + +IndBool : (C : Bool → Set) → C false → C true → (x : Bool) → C x +IndBool C b0 b1 false = b0 +IndBool C b0 b1 true = b1 + + +data Σ (A : Set)(B : A → Set) : Set where + _,_ : (a : A)(b : B a) → Σ A B + +RecΣ[_,_] : (A : Set)(B : A → Set)(C : Set) → ((a : A) → B a → C) → Σ A B → C +RecΣ[ A , B ] C g ( a , b) = g a b + +IndΣ[_,_] : (A : Set)(B : A → Set)(C : (Σ A B) → Set) + → ((a : A)(b : B a) → C (a , b)) + → (x : Σ A B) → C x +IndΣ[ A , B ] C g ( a , b) = g a b + +{- definition of A + B -} + +_+_ : Set → Set → Set +A + B = Σ Bool (RecBool Set A B) + +inl : ∀ {A B} → A → A + B +inl a = false , a + +inr : ∀ {A B} → B → A + B +inr b = true , b + +Rec+[_,_] : (A B C : Set) → (A → C) → (B → C) → (A + B) → C +Rec+[ A , B ] C g0 g1 = RecΣ[ Bool , RecBool Set A B ] C (IndBool (λ x → RecBool Set A B x → C) g0 g1) + +Ind+[_,_] : (A B : Set)(C : A + B → Set) + → ((a : A) → C (inl a)) → ((b : B) → C (inr b)) + → (x : A + B) → C x +Ind+[ A , B ] C g0 g1 = + IndΣ[ Bool , RecBool Set A B ] C + (IndBool (λ x → (y : RecBool Set A B x) → C (x , y)) g0 g1) + +β-Indβ : (A B : Set)(C : A + B → Set) + → (g0 : (a : A) → C (inl a)) → (g1 : (b : B) → C (inr b)) + → (a : A) → Ind+[ A , B ] C g0 g1 (inl a) ≡ g0 a +β-Indβ A B C g0 g1 a = refl + +_×_ : Set → Set → Set +A × B = (x : Bool) → RecBool Set A B x + +pair : ∀ {A B} → A → B → A × B +pair {A} {B} a b = IndBool (RecBool Set A B) a b + +Rec× : {A B C : Set} → (A → B → C) → A × B → C +Rec× g x = g (x false) (x true) + +postulate ext : {A : Set}{B : A → Set}{f g : (a : A) → B a} → ((x : A) → f x ≡ g x) → f ≡ g + +Ind× : {A B : Set}(C : A × B → Set)(g : (a : A)(b : B) → C (pair a b))(x : A × B) → C x +Ind× {A} {B} C g x = subst C aux (g (x false) (x true)) + where Ind×aux : (b : Bool) → IndBool (RecBool Set A B) (x false) (x true) b ≡ x b + Ind×aux = IndBool (λ b → IndBool (RecBool Set A B) (x false) (x true) b ≡ x b) refl refl + aux : IndBool (RecBool Set A B) (x false) (x true) ≡ x + aux = ext Ind×aux diff --git a/preface.tex b/preface.tex new file mode 100644 index 0000000000000000000000000000000000000000..265876a8264783593ea4bac51b156e62fc980818 --- /dev/null +++ b/preface.tex @@ -0,0 +1,111 @@ +\chapter*{Preface} +\label{cha:preface} + +% Uncomment this if you think Preface should appear in TOC +%\addcontentsline{toc}{chapter}{Preface} +\subsection*{IAS Special Year on Univalent Foundations} + +A Special Year on Univalent Foundations of Mathematics was held in 2012-13 at the Institute for Advanced Study, School of Mathematics, organized by Steve Awodey, Thierry Coquand, and Vladimir Voevodsky. The following people were the official participants. + +\begin{multicols}{\OPTprefacecols}{ +\begin{itemize} +\item[] Peter Aczel +\item[] Benedikt Ahrens +\item[] Thorsten Altenkirch +\item[] Steve Awodey +\item[] Bruno Barras +\item[] Andrej Bauer +\item[] Yves Bertot +\item[] Marc Bezem +\item[] Thierry Coquand +\item[] Eric Finster +\item[] Daniel Grayson +\item[] Hugo Herbelin +\item[] Andr\'e Joyal +\item[] Dan Licata +\item[] Peter Lumsdaine +\item[] Assia Mahboubi +\item[] Per Martin-L\"of +\item[] Sergey Melikhov +\item[] Alvaro Pelayo +\item[] Andrew Polonsky +\item[] Michael Shulman +\item[] Matthieu Sozeau +\item[] Bas Spitters +\item[] Benno van den Berg +\item[] Vladimir Voevodsky +\item[] Michael Warren +\item[] Noam Zeilberger +\end{itemize} +} +\end{multicols} + +\noindent There were also the following students, whose participation was no less valuable. + +\begin{multicols}{\OPTprefacecols}{ +\begin{itemize} +\item[] Carlo Angiuli +\item[] Anthony Bordg +\item[] Guillaume Brunerie +\item[] Chris Kapulkin +\item[] Egbert Rijke +\item[] Kristina Sojakova +\end{itemize} +} +\end{multicols} + +\noindent In addition, there were the following short- and long-term visitors, including student visitors, whose contributions to the Special Year were also essential. + +\begin{multicols}{\OPTprefacecols}{ +\begin{itemize} +\item[] Jeremy Avigad +\item[] Cyril Cohen +\item[] Robert Constable +\item[] Pierre-Louis Curien +\item[] Peter Dybjer +\item[] Mart{\'\i}n Escard{\'o} +\item[] Kuen-Bang Hou +\item[] Nicola Gambino +\item[] Richard Garner +\item[] Georges Gonthier +\item[] Thomas Hales +\item[] Robert Harper +\item[] Martin Hofmann +\item[] Pieter Hofstra +\item[] Joachim Kock +\item[] Nicolai Kraus +\item[] Nuo Li +\item[] Zhaohui Luo +\item[] Michael Nahas +\item[] Erik Palmgren +\item[] Emily Riehl +\item[] Dana Scott +\item[] Philip Scott +\item[] Sergei Soloviev +\end{itemize} +} +\end{multicols} + +\subsection*{About this book} + +We did not set out to write a book. The present work has its origins in our collective attempts to develop a new style of ``informal type theory'' that can be read and understood by a human being, as a complement to a formal proof that can be checked by a machine. +Univalent foundations is closely tied to the idea of a foundation of mathematics that can be implemented in a computer proof assistant. Although such a formalization is not part of this book, much of the material presented here was actually done first in the fully formalized setting inside a proof assistant, and only later ``unformalized'' to arrive at the presentation you find before you --- a remarkable inversion of the usual state of affairs in formalized mathematics. + +Each of the above-named individuals contributed something to the Special Year --- and so to this book --- in the form of ideas, words, or deeds. The spirit of collaboration that prevailed throughout the year was truly extraordinary. + +\mentalpause + +Special thanks are due to the Institute for Advanced Study, without which this book would obviously never have come to be. It proved to be an ideal setting for the creation of this new branch of mathematics: stimulating, congenial, and supportive. May some trace of this unique atmosphere linger in the pages of this book, and in the future development of this new field of study. + +\bigskip + +\begin{flushright} +The Univalent Foundations Program\\ +Institute for Advanced Study\\ +Princeton, April 2013 +\end{flushright} + +%%%%%%%%%%%%% end of scope of local macros +% Local Variables: +% TeX-master: "hott-online" +% End: diff --git a/preliminaries.tex b/preliminaries.tex new file mode 100644 index 0000000000000000000000000000000000000000..0f745b84adea1f8bfca2b15b56c482e25be1fd2f --- /dev/null +++ b/preliminaries.tex @@ -0,0 +1,2044 @@ +\chapter{Type theory} +\label{cha:typetheory} + +\section{Type theory versus set theory} +\label{sec:types-vs-sets} +\label{sec:axioms} + +\index{type theory} +Homotopy type theory is (among other things) a foundational language for mathematics, i.e., an alternative to Zermelo--Fraenkel\index{set theory!Zermelo--Fraenkel} set theory. +However, it behaves differently from set theory in several important ways, and that can take some getting used to. +Explaining these differences carefully requires us to be more formal here than we will be in the rest of the book. +As stated in the introduction, our goal is to write type theory \emph{informally}; but for a mathematician accustomed to set theory, more precision at the beginning can help avoid some common misconceptions and mistakes. + +We note that a set-theoretic foundation has two ``layers'': the deductive system of first-order logic,\index{first-order!logic} and, formulated inside this system, the axioms of a particular theory, such as ZFC. +Thus, set theory is not only about sets, but rather about the interplay between sets (the objects of the second layer) and propositions (the objects of the first layer). + +By contrast, type theory is its own deductive system: it need not be formulated inside any superstructure, such as first-order logic. +Instead of the two basic notions of set theory, sets and propositions, type theory has one basic notion: \emph{types}. +Propositions (statements which we can prove, disprove, assume, negate, and so on\footnote{Confusingly, it is also a common practice (dating +back to Euclid) to use the word ``proposition'' synonymously with ``theorem''. + We will confine ourselves to the logician's usage, according to which a \emph{proposition} is a statement \emph{susceptible to} proof, whereas a \emph{theorem}\indexfoot{theorem} (or ``lemma''\indexfoot{lemma} or ``corollary''\indexfoot{corollary}) is such a statement that \emph{has been} proven. +Thus ``$0=1$'' and its negation ``$\neg(0=1)$'' are both propositions, but only the latter is a theorem.}) are identified with particular types, via the correspondence shown in \cref{tab:pov} on page~\pageref{tab:pov}. +Thus, the mathematical activity of \emph{proving a theorem} is identified with a special case of the mathematical activity of \emph{constructing an object} --- in this case, an inhabitant of a type that represents a proposition. + +\index{deductive system}% +This leads us to another difference between type theory and set theory, but to explain it we must say a little about deductive systems in general. +Informally, a deductive system is a collection of \define{rules} +\indexdef{rule}% +for deriving things called \define{judgments}. +\indexdef{judgment}% +If we think of a deductive system as a formal game, +\index{game!deductive system as}% +then the judgments are the ``positions'' in the game which we reach by following the game rules. +We can also think of a deductive system as a sort of algebraic theory, in which case the judgments are the elements (like the elements of a group) and the deductive rules are the operations (like the group multiplication). +From a logical point of view, the judgments can be considered to be the ``external'' statements, living in the metatheory, as opposed to the ``internal'' statements of the theory itself. + +In the deductive system of first-order logic (on which set theory is based), there is only one kind of judgment: that a given proposition has a proof. +That is, each proposition $A$ gives rise to a judgment ``$A$ has a proof'', and all judgments are of this form. +A rule of first-order logic such as ``from $A$ and $B$ infer $A\wedge B$'' is actually a rule of ``proof construction'' which says that given the judgments ``$A$ has a proof'' and ``$B$ has a proof'', we may deduce that ``$A\wedge B$ has a proof''. +Note that the judgment ``$A$ has a proof'' exists at a different level from the \emph{proposition} $A$ itself, which is an internal statement of the theory. +% In particular, we cannot manipulate it to construct propositions such as ``if $A$ has a proof, then $B$ does not have a proof'' --- unless we are using our set-theoretic foundation as a meta-theory with which to talk about some other axiomatic system. + +The basic judgment of type theory, analogous to ``$A$ has a proof'', is written ``$a:A$'' and pronounced as ``the term $a$ has type $A$'', or more loosely ``$a$ is an element of $A$'' (or, in homotopy type theory, ``$a$ is a point of $A$''). +\indexdef{term}% +\indexdef{element}% +\indexdef{point!of a type}% +When $A$ is a type representing a proposition, then $a$ may be called a \emph{witness}\index{witness!to the truth of a proposition} to the provability of $A$, or \emph{evidence}\index{evidence, of the truth of a proposition} of the truth of $A$ (or even a \emph{proof}\index{proof} of $A$, but we will try to avoid this confusing terminology). +In this case, the judgment $a:A$ is derivable in type theory (for some $a$) precisely when the analogous judgment ``$A$ has a proof'' is derivable in first-order logic (modulo differences in the axioms assumed and in the encoding of mathematics, as we will discuss throughout the book). + +On the other hand, if the type $A$ is being treated more like a set than like a proposition (although as we will see, the distinction can become blurry), then ``$a:A$'' may be regarded as analogous to the set-theoretic statement ``$a\in A$''. +However, there is an essential difference in that ``$a:A$'' is a \emph{judgment} whereas ``$a\in A$'' is a \emph{proposition}. +In particular, when working internally in type theory, we cannot make statements such as ``if $a:A$ then it is not the case that $b:B$'', nor can we ``disprove'' the judgment ``$a:A$''. + +A good way to think about this is that in set theory, ``membership'' is a relation which may or may not hold between two pre-existing objects ``$a$'' and ``$A$'', while in type theory we cannot talk about an element ``$a$'' in isolation: every element \emph{by its very nature} is an element of some type, and that type is (generally speaking) uniquely determined. +Thus, when we say informally ``let $x$ be a natural number'', in set theory this is shorthand for ``let $x$ be a thing and assume that $x\in\nat$'', whereas in type theory ``let $x:\nat$'' is an atomic statement: we cannot introduce a variable without specifying its type.\index{membership} + + +At first glance, this may seem an uncomfortable restriction, but it is arguably closer to the intuitive mathematical meaning of ``let $x$ be a natural number''. +In practice, it seems that whenever we actually \emph{need} ``$a\in A$'' to be a proposition rather than a judgment, there is always an ambient set $B$ of which $a$ is known to be an element and $A$ is known to be a subset. +This situation is also easy to represent in type theory, by taking $a$ to be an element of the type $B$, and $A$ to be a predicate on $B$; see \cref{subsec:prop-subsets}. + +A last difference between type theory and set theory is the treatment of equality. +The familiar notion of equality in mathematics is a proposition: e.g.\ we can disprove an equality or assume an equality as a hypothesis. +Since in type theory, propositions are types, this means that equality is a type: for elements $a,b:A$ (that is, both $a:A$ and $b:A$) we have a type ``$\id[A]ab$''. +(In \emph{homotopy} type theory, of course, this equality proposition can behave in unfamiliar ways: see \cref{sec:identity-types,cha:basics}, and the rest of the book). +When $\id[A]ab$ is inhabited, we say that $a$ and $b$ are \define{(propositionally) equal}. +\index{propositional!equality}% +\index{equality!propositional}% + +However, in type theory there is also a need for an equality \emph{judgment}, existing at the same level as the judgment ``$x:A$''.\index{judgment} +\symlabel{defn:judgmental-equality}% +This is called \define{judgmental equality} +\indexdef{equality!judgmental}% +\indexdef{judgmental equality}% +or \define{definitional equality}, +\indexdef{equality!definitional}% +\indexsee{definitional equality}{equality, definitional}% +and we write it as $a\jdeq b : A$ or simply $a \jdeq b$. +It is helpful to think of this as meaning ``equal by definition''. +For instance, if we define a function $f:\nat\to\nat$ by the equation $f(x)=x^2$, then the expression $f(3)$ is equal to $3^2$ \emph{by definition}. +Inside the theory, it does not make sense to negate or assume an equality-by-definition; we cannot say ``if $x$ is equal to $y$ by definition, then $z$ is not equal to $w$ by definition''. +Whether or not two expressions are equal by definition is just a matter of expanding out the definitions; in particular, it is algorithmically\index{algorithm} decidable (though the algorithm is necessarily meta-theoretic, not internal to the theory).\index{decidable!definitional equality} + +As type theory becomes more complicated, judgmental equality can get more subtle than this, but it is a good intuition to start from. +Alternatively, if we regard a deductive system as an algebraic theory, then judgmental equality is simply the equality in that theory, analogous to the equality between elements of a group --- the only potential for confusion is that there is \emph{also} an object \emph{inside} the deductive system of type theory (namely the type ``$a=b$'') which behaves internally as a notion of ``equality''. + +The reason we \emph{want} a judgmental notion of equality is so that it can control the other form of judgment, ``$a:A$''. +For instance, suppose we have given a proof that $3^2=9$, i.e.\ we have derived the judgment $p:(3^2=9)$ for some $p$. +Then the same witness $p$ ought to count as a proof that $f(3)=9$, since $f(3)$ is $3^2$ \emph{by definition}. +The best way to represent this is with a rule saying that given the judgments $a:A$ and $A\jdeq B$, we may derive the judgment $a:B$. + +Thus, for us, type theory will be a deductive system based on two forms of judgment: +\begin{center} +\medskip +\begin{tabular}{cl} + \toprule + Judgment & Meaning\\ + \midrule + $a : A$ & ``$a$ is an object of type $A$''\\ + $a \jdeq b : A$ & ``$a$ and $b$ are definitionally equal objects of type $A$''\\ + \bottomrule +\end{tabular} +\medskip +\end{center} +% +\symlabel{defn:defeq}% +When introducing a definitional equality, i.e., defining one thing to be equal to another, we will use the symbol ``$\defeq$''. +Thus, the above definition of the function $f$ would be written as $f(x)\defeq x^2$. + +Because judgments cannot be put together into more complicated statements, the symbols ``$:$'' and ``$\jdeq$'' bind more loosely than anything else.% +\footnote{In formalized\indexfoot{mathematics!formalized} type theory, commas and turnstiles can bind even more loosely. + For instance, $x:A,y:B\vdash c:C$ is parsed as $((x:A),(y:B))\vdash (c:C)$. + However, in this book we refrain from such notation until \cref{cha:rules}.} +Thus, for instance, ``$p:\id{x}{y}$'' should be parsed as ``$p:(\id{x}{y})$'', which makes sense since ``$\id{x}{y}$'' is a type, and not as ``$\id{(p:x)}{y}$'', which is senseless since ``$p:x$'' is a judgment and cannot be equal to anything. +Similarly, ``$A\jdeq \id{x}{y}$'' can only be parsed as ``$A\jdeq(\id{x}{y})$'', although in extreme cases such as this, one ought to add parentheses anyway to aid reading comprehension. +Moreover, later on we will fall into the common notation of chaining together equalities --- e.g.\ writing $a=b=c=d$ to mean ``$a=b$ and $b=c$ and $c=d$, hence $a=d$'' --- and we will also include judgmental equalities in such chains. +Context usually suffices to make the intent clear. + +This is perhaps also an appropriate place to mention that the common mathematical notation ``$f:A\to B$'', expressing the fact that $f$ is a function from $A$ to $B$, can be regarded as a typing judgment, since we use ``$A\to B$'' as notation for the type of functions from $A$ to $B$ (as is standard practice in type theory; see \cref{sec:pi-types}). + +\index{assumption|(defstyle}% +Judgments may depend on \emph{assumptions} of the form $x:A$, where $x$ is a variable +\indexdef{variable}% +and $A$ is a type. +For example, we may construct an object $m + n : \nat$ under the assumptions that $m,n : \nat$. +Another example is that assuming $A$ is a type, $x,y : A$, and $p : \id[A]{x}{y}$, we may construct an element $p^{-1} : \id[A]{y}{x}$. +The collection of all such assumptions is called the \define{context};% +\index{context} +from a topological point of view it may be thought of as a ``parameter\index{parameter!space} space''. +In fact, technically the context must be an ordered list of assumptions, since later assumptions may depend on previous ones: the assumption $x:A$ can only be made \emph{after} the assumptions of any variables appearing in the type $A$. + +If the type $A$ in an assumption $x:A$ represents a proposition, then the assumption is a type-theoretic version of a \emph{hypothesis}: +\indexdef{hypothesis}% +we assume that the proposition $A$ holds. +When types are regarded as propositions, we may omit the names of their proofs. +Thus, in the second example above we may instead say that assuming $\id[A]{x}{y}$, we can prove $\id[A]{y}{x}$. +However, since we are doing ``proof-relevant'' mathematics, +\index{mathematics!proof-relevant}% +we will frequently refer back to proofs as objects. +In the example above, for instance, we may want to establish that $p^{-1}$ together with the proofs of transitivity and reflexivity behave like a groupoid; see \cref{cha:basics}. + +Note that under this meaning of the word \emph{assumption}, we can assume a propositional equality (by assuming a variable $p:x=y$), but we cannot assume a judgmental equality $x\jdeq y$, since it is not a type that can have an element. +However, we can do something else which looks kind of like assuming a judgmental equality: if we have a type or an element which involves a variable $x:A$, then we can \emph{substitute} any particular element $a:A$ for $x$ to obtain a more specific type or element. +We will sometimes use language like ``now assume $x\jdeq a$'' to refer to this process of substitution, even though it is not an \emph{assumption} in the technical sense introduced above. +\index{assumption|)}% + +By the same token, we cannot \emph{prove} a judgmental equality either, since it is not a type in which we can exhibit a witness. +Nevertheless, we will sometimes state judgmental equalities as part of a theorem, e.g.\ ``there exists $f:A\to B$ such that $f(x)\jdeq y$''. +This should be regarded as the making of two separate judgments: first we make the judgment $f:A\to B$ for some element $f$, then we make the additional judgment that $f(x)\jdeq y$. + +In the rest of this chapter, we attempt to give an informal presentation of type theory, sufficient for the purposes of this book; we give a more formal account in \cref{cha:rules}. +Aside from some fairly obvious rules (such as the fact that judgmentally equal things can always be substituted\index{substitution} for each other), the rules of type theory can be grouped into \emph{type formers}. +Each type former consists of a way to construct types (possibly making use of previously constructed types), together with rules for the construction and behavior of elements of that type. +In most cases, these rules follow a fairly predictable pattern, but we will not attempt to make this precise here; see however the beginning of \cref{sec:finite-product-types} and also \cref{cha:induction}.\index{type theory!informal} + + +\index{axiom!versus rules}% +\index{rule!versus axioms}% +An important aspect of the type theory presented in this chapter is that it consists entirely of \emph{rules}, without any \emph{axioms}. +In the description of deductive systems in terms of judgments, the \emph{rules} are what allow us to conclude one judgment from a collection of others, while the \emph{axioms} are the judgments we are given at the outset. +If we think of a deductive system as a formal game, then the rules are the rules of the game, while the axioms are the starting position. +And if we think of a deductive system as an algebraic theory, then the rules are the operations of the theory, while the axioms are the \emph{generators} for some particular free model of that theory. + +In set theory, the only rules are the rules of first-order logic (such as the rule allowing us to deduce ``$A\wedge B$ has a proof'' from ``$A$ has a proof'' and ``$B$ has a proof''): all the information about the behavior of sets is contained in the axioms. +By contrast, in type theory, it is usually the \emph{rules} which contain all the information, with no axioms being necessary. +For instance, in \cref{sec:finite-product-types} we will see that there is a rule allowing us to deduce the judgment ``$(a,b):A\times B$'' from ``$a:A$'' and ``$b:B$'', whereas in set theory the analogous statement would be (a consequence of) the pairing axiom. + +The advantage of formulating type theory using only rules is that rules are ``procedural''. +In particular, this property is what makes possible (though it does not automatically ensure) the good computational properties of type theory, such as ``canonicity''.\index{canonicity} +However, while this style works for traditional type theories, we do not yet understand how to formulate everything we need for \emph{homotopy} type theory in this way. +In particular, in \cref{sec:compute-pi,sec:compute-universe,cha:hits} we will have to augment the rules of type theory presented in this chapter by introducing additional axioms, notably the \emph{univalence axiom}. +In this chapter, however, we confine ourselves to a traditional rule-based type theory. + + +\section{Function types} +\label{sec:function-types} + +\index{type!function|(defstyle}% +\indexsee{function type}{type, function}% +Given types $A$ and $B$, we can construct the type $A \to B$ of \define{functions} +\index{function|(defstyle}% +\indexsee{map}{function}% +\indexsee{mapping}{function}% +with domain $A$ and codomain $B$. +We also sometimes refer to functions as \define{maps}. +\index{domain!of a function}% +\index{codomain, of a function}% +\index{function!domain of}% +\index{function!codomain of}% +\index{functional relation}% +Unlike in set theory, functions are not defined as +functional relations; rather they are a primitive concept in type theory. +We explain the function type by prescribing what we can do with functions, +how to construct them and what equalities they induce. + +Given a function $f : A \to B$ and an element of the domain $a : A$, we +can \define{apply} +\indexdef{application!of function}% +\indexdef{function!application}% +\indexsee{evaluation}{application, of a function} +the function to obtain an element of the codomain $B$, +denoted $f(a)$ and called the \define{value} of $f$ at $a$. +\indexdef{value!of a function}% +It is common in type theory to omit the parentheses\index{parentheses} and denote $f(a)$ simply by $f\,a$, and we will sometimes do this as well. + +But how can we construct elements of $A \to B$? There are two equivalent ways: +either by direct definition or by using +$\lambda$-abstraction. Introducing a function by definition +\indexdef{definition!of function, direct}% +means that +we introduce a function by giving it a name --- let's say, $f$ --- and saying +we define $f : A \to B$ by giving an equation +\begin{equation} + \label{eq:expldef} + f(x) \defeq \Phi +\end{equation} +where $x$ is a variable +\index{variable}% +and $\Phi$ is an expression which may use $x$. +In order for this to be valid, we have to check that $\Phi : B$ assuming $x:A$. + +Now we can compute $f(a)$ by replacing the variable $x$ in $\Phi$ with +$a$. As an example, consider the function $f : \nat \to \nat$ which is +defined by $f(x) \defeq x+x$. (We will define $\nat$ and $+$ in \cref{sec:inductive-types}.) +Then $f(2)$ is judgmentally equal to $2+2$. + +If we don't want to introduce a name for the function, we can use +\define{$\lambda$-abstraction}. +\index{lambda abstraction@$\lambda$-abstraction|defstyle}% +\indexsee{function!lambda abstraction@$\lambda$-abstraction}{$\lambda$-abstraction}% +\indexsee{abstraction!lambda-@$\lambda$-}{$\lambda$-abstraction}% +Given an expression $\Phi$ of type $B$ which may use $x:A$, as above, we write $\lam{x:A} \Phi$ to indicate the same function defined by~\eqref{eq:expldef}. +Thus, we have +\[ (\lamt{x:A}\Phi) : A \to B. \] +For the example in the previous paragraph, we have the typing judgment +\[ (\lam{x:\nat}x+x) : \nat \to \nat. \] +As another example, for any types $A$ and $B$ and any element $y:B$, we have a \define{constant function} +\indexdef{constant!function}% +\indexdef{function!constant}% +$(\lam{x:A} y): A\to B$. + +We generally omit the type of the variable $x$ in a $\lambda$-abstraction and write $\lam{x}\Phi$, since the typing $x:A$ is inferable from the judgment that the function $\lam x \Phi$ has type $A\to B$. +By convention, the ``scope'' +\indexdef{variable!scope of}% +\indexdef{scope}% +of the variable binding ``$\lam{x}$'' is the entire rest of the expression, unless delimited with parentheses\index{parentheses}. +Thus, for instance, $\lam{x} x+x$ should be parsed as $\lam{x} (x+x)$, not as $(\lam{x}x)+x$ (which would, in this case, be ill-typed anyway). + +Another equivalent notation is +\symlabel{mapsto}% +\[ (x \mapsto \Phi) : A \to B. \] +\symlabel{blank}% +We may also sometimes use a blank ``$\blank$'' in the expression $\Phi$ in place of a variable, to denote an implicit $\lambda$-abstraction. +For instance, $g(x,\blank)$ is another way to write $\lam{y} g(x,y)$. + +Now a $\lambda$-abstraction is a function, so we can apply it to an argument $a:A$. +We then have the following \define{computation rule}\indexdef{computation rule!for function types}\footnote{Use of this equality is often referred to as \define{$\beta$-conversion} +\indexsee{beta-conversion@$\beta $-conversion}{$\beta$-reduction}% +\indexsee{conversion!beta@$\beta $-}{$\beta$-reduction}% +or \define{$\beta$-reduction}.% +\index{beta-reduction@$\beta $-reduction|footstyle}% +\indexsee{reduction!beta@$\beta $-}{$\beta$-reduction}% +}, which is a definitional equality: +\[(\lamu{x:A}\Phi)(a) \jdeq \Phi'\] +where $\Phi'$ is the +expression $\Phi$ in which all occurrences of $x$ have been replaced by $a$. +Continuing the above example, we have +% +\[ (\lamu{x:\nat}x+x)(2) \jdeq 2+2. \] +% +Note that from any function $f:A\to B$, we can construct a lambda abstraction function $\lam{x} f(x)$. +Since this is by definition ``the function that applies $f$ to its argument'' we consider it to be definitionally equal to $f$:\footnote{Use of this equality is often referred to as \define{$\eta$-conversion} +\indexsee{eta-conversion@$\eta $-conversion}{$\eta$-expansion}% +\indexsee{conversion!eta@$\eta $-}{$\eta$-expansion}% +or \define{$\eta$-expansion. +\index{eta-expansion@$\eta $-expansion|footstyle}% +\indexsee{expansion, eta-@expansion, $\eta $-}{$\eta$-expansion}% +}} +\[ f \jdeq (\lam{x} f(x)). \] +This equality is the \define{uniqueness principle for function types}\indexdef{uniqueness!principle!for function types}, because it shows that $f$ is uniquely determined by its values. + +The introduction of functions by definitions with explicit parameters can be reduced +to simple definitions by using $\lambda$-abstraction: i.e., we can read +a definition of $f: A\to B$ by +\[ f(x) \defeq \Phi \] +as +\[ f \defeq \lamu{x:A}\Phi.\] + +When doing calculations involving variables, we have to be +careful when replacing a variable with an expression that also involves +variables, because we want to preserve the binding structure of +expressions. By the \emph{binding structure}\indexdef{binding structure} we mean the +invisible link generated by binders such as $\lambda$, $\Pi$ and +$\Sigma$ (the latter we are going to meet soon) between the place where the variable is introduced and where it is used. As an example, consider $f : \nat \to (\nat \to \nat)$ +defined as +\[ f(x) \defeq \lamu{y:\nat} x + y. \] +Now if we have assumed somewhere that $y : \nat$, then what is $f(y)$? It would be wrong to just naively replace $x$ by $y$ everywhere in the expression ``$\lam{y}x+y$'' defining $f(x)$, obtaining $\lamu{y:\nat} y + y$, because this means that $y$ gets \define{captured}. +\indexdef{capture, of a variable}% +\indexdef{variable!captured}% +Previously, the substituted\index{substitution} $y$ was referring to our assumption, but now it is referring to the argument of the $\lambda$-abstraction. Hence, this naive substitution would destroy the binding structure, allowing us to perform calculations which are semantically unsound. + +But what \emph{is} $f(y)$ in this example? Note that bound (or ``dummy'') +variables +\indexdef{variable!bound}% +\indexdef{variable!dummy}% +\indexsee{bound variable}{variable, bound}% +\indexsee{dummy variable}{variable, bound}% +such as $y$ in the expression $\lamu{y:\nat} x + y$ +have only a local meaning, and can be consistently replaced by any +other variable, preserving the binding structure. Indeed, $\lamu{y:\nat} x + y$ is declared to be judgmentally equal\footnote{Use of this equality is often referred to as \define{$\alpha$-conversion. +\indexfoot{alpha-conversion@$\alpha $-conversion} +\indexsee{conversion!alpha@$\alpha$-}{$\alpha$-conversion} +}} to +$\lamu{z:\nat} x + z$. It follows that +$f(y)$ is judgmentally equal to $\lamu{z:\nat} y + z$, and that answers our question. (Instead of $z$, +any variable distinct from $y$ could have been used, yielding an equal result.) + +Of course, this should all be familiar to any mathematician: it is the same phenomenon as the fact that if $f(x) \defeq \int_1^2 \frac{dt}{x-t}$, then $f(t)$ is not $\int_1^2 \frac{dt}{t-t}$ but rather $\int_1^2 \frac{ds}{t-s}$. +A $\lambda$-abstraction binds a dummy variable in exactly the same way that an integral does. + +We have seen how to define functions in one variable. One +way to define functions in several variables would be to use the +cartesian product, which will be introduced later; a function with +parameters $A$ and $B$ and results in $C$ would be given the type +$f : A \times B \to C$. However, there is another choice that avoids +using product types, which is called \define{currying} +\indexdef{currying}% +\indexdef{function!currying of}% +(after the mathematician Haskell Curry). +\index{programming}% + +The idea of currying is to represent a function of two inputs $a:A$ and $b:B$ as a function which takes \emph{one} input $a:A$ and returns \emph{another function}, which then takes a second input $b:B$ and returns the result. +That is, we consider two-variable functions to belong to an iterated function type, $f : A \to (B \to C)$. +We may also write this without the parentheses\index{parentheses}, as $f : A \to B \to C$, with +associativity\index{associativity!of function types} to the right as the default convention. Then given $a : A$ and $b : B$, +we can apply $f$ to $a$ and then apply the result to $b$, obtaining +$f(a)(b) : C$. To avoid the proliferation of parentheses, we allow ourselves to +write $f(a)(b)$ as $f(a,b)$ even though there are no products +involved. +When omitting parentheses around function arguments entirely, we write $f\,a\,b$ for $(f\,a)\,b$, with the default associativity now being to the left so that $f$ is applied to its arguments in the correct order. + +Our notation for definitions with explicit parameters extends to +this situation: we can define a named function $f : A \to B \to C$ by +giving an equation +\[ f(x,y) \defeq \Phi\] +where $\Phi:C$ assuming $x:A$ and $y:B$. Using $\lambda$-abstraction\index{lambda abstraction@$\lambda$-abstraction} this +corresponds to +\[ f \defeq \lamu{x:A}{y:B} \Phi, \] +which may also be written as +\[ f \defeq x \mapsto y \mapsto \Phi. \] +We can also implicitly abstract over multiple variables by writing multiple blanks, e.g.\ $g(\blank,\blank)$ means $\lam{x}{y} g(x,y)$. +Currying a function of three or more arguments is a straightforward extension of what we have just described. + +\index{type!function|)}% +\index{function|)}% + + +\section{Universes and families} +\label{sec:universes} + +So far, we have been using the expression ``$A$ is a type'' informally. We +are going to make this more precise by introducing \define{universes}. +\index{type!universe|(defstyle}% +\indexsee{universe}{type, universe}% +A universe is a type whose elements are types. As in naive set theory, +we might wish for a universe of all types $\UU_\infty$ including itself +(that is, with $\UU_\infty : \UU_\infty$). +However, as in set +theory, this is unsound, i.e.\ we can deduce from it that every type, +including the empty type representing the proposition False (see \cref{sec:coproduct-types}), is inhabited. +For instance, using a +representation of sets as trees, we can directly encode Russell's +paradox\index{paradox} \cite{coquand:paradox}. +% or alternatively, in order to avoid the use of +% inductive types to define trees, we can follow Girard \cite{girard:paradox} and encode the Burali-Forti paradox, +% which shows that the collection of all ordinals cannot be an ordinal. + +To avoid the paradox we introduce a hierarchy of universes +\indexsee{hierarchy!of universes}{type, universe}% +\[ \UU_0 : \UU_1 : \UU_2 : \cdots \] +where every universe $\UU_i$ is an element of the next universe +$\UU_{i+1}$. Moreover, we assume that our universes are +\define{cumulative}, +\indexdef{type!universe!cumulative}% +\indexdef{cumulative!universes}% +that is that all the elements of the $i^{\mathrm{th}}$ +universe are also elements of the $(i+1)^{\mathrm{st}}$ universe, i.e.\ if +$A:\UU_i$ then also $A:\UU_{i+1}$. +This is convenient, but has the slightly unpleasant consequence that elements no longer have unique types, and is a bit tricky in other ways that need not concern us here; see the Notes. + +When we say that $A$ is a type, we mean that it inhabits some universe +$\UU_i$. We usually want to avoid mentioning the level +\indexdef{universe level}% +\indexsee{level}{universe level or $n$-type}% +\indexsee{type!universe!level}{universe level}% +$i$ explicitly, +and just assume that levels can be assigned in a consistent way; thus we +may write $A:\UU$ omitting the level. This way we can even write +$\UU:\UU$, which can be read as $\UU_i:\UU_{i+1}$, having left the +indices implicit. Writing universes in this style is referred to as +\define{typical ambiguity}. +\indexdef{typical ambiguity}% +It is convenient but a bit dangerous, since it allows us to write valid-looking proofs that reproduce the paradoxes of self-reference. +If there is any doubt about whether an argument is correct, the way to check it is to try to assign levels consistently to all universes appearing in it. +When some universe \UU is assumed, we may refer to types belonging to \UU as \define{small types}. +\indexdef{small!type}% +\indexdef{type!small}% + +To model a collection of types varying over a given type $A$, we use functions $B : A \to \UU$ whose +codomain is a universe. These functions are called +\define{families of types} (or sometimes \emph{dependent types}); +\indexsee{family!of types}{type, family of}% +\indexdef{type!family of}% +\indexsee{type!dependent}{type, family of}% +\indexsee{dependent!type}{type, family of}% +they correspond to families of sets as used in +set theory. + +\symlabel{fin}% +An example of a type family is the family of finite sets $\Fin +: \nat \to \UU$, where $\Fin(n)$ is a type with exactly $n$ elements. +(We cannot \emph{define} the family $\Fin$ yet --- indeed, we have not even introduced its domain $\nat$ yet --- but we will be able to soon; see \cref{ex:fin}.) +We may denote the elements of $\Fin(n)$ by $0_n,1_n,\dots,(n-1)_n$, with subscripts to emphasize that the elements of $\Fin(n)$ are different from those of $\Fin(m)$ if $n$ is different from $m$, and all are different from the ordinary natural numbers (which we will introduce in \cref{sec:inductive-types}). +\index{finite!sets, family of}% + +A more trivial (but very important) example of a type family is the \define{constant} type family +\indexdef{constant!type family}% +\indexdef{type!family of!constant}% +at a type $B:\UU$, which is of course the constant function $(\lam{x:A} B):A\to\UU$. + +As a \emph{non}-example, in our version of type theory there is no type family ``$\lam{i:\nat} \UU_i$''. +Indeed, there is no universe large enough to be its codomain. +Moreover, we do not even identify the indices $i$ of the universes $\UU_i$ with the natural numbers \nat of type theory (the latter to be introduced in \cref{sec:inductive-types}). + +\index{type!universe|)}% + +\section{Dependent function types (\texorpdfstring{$\Pi$}{Π}-types)} +\label{sec:pi-types} + +\index{type!dependent function|(defstyle}% +\index{function!dependent|(defstyle}% +\indexsee{dependent!function}{function, dependent}% +\indexsee{type!Pi-@$\Pi$-}{type, dependent function}% +\indexsee{Pi-type@$\Pi$-type}{type, dependent function}% +In type theory we often use a more general version of function +types, called a \define{$\Pi$-type} or \define{dependent function type}. The elements of +a $\Pi$-type are functions +whose codomain type can vary depending on the +element of the domain to which the function is applied, called \define{dependent functions}. The name ``$\Pi$-type'' +is used because this type can also be regarded as the cartesian +product over a given type. + +Given a type $A:\UU$ and a family $B:A \to \UU$, we may construct +the type of dependent functions $\prd{x:A}B(x) : \UU$. +There are many alternative notations for this type, such as +\[ \tprd{x:A} B(x) \qquad \dprd{x:A}B(x) \qquad \lprd{x:A} B(x). \] +If $B$ is a constant family, then the dependent product type is the ordinary function type: +\[\tprd{x:A} B \jdeq (A \to B).\] +Indeed, all the constructions of $\Pi$-types are generalizations of the corresponding constructions on ordinary function types. + +\indexdef{definition!of function, direct}% +We can introduce dependent functions by explicit definitions: to +define $f : \prd{x:A}B(x)$, where $f$ is the name of a dependent function to be +defined, we need an expression $\Phi : B(x)$ possibly involving the variable $x:A$, +\index{variable}% +and we write +\[ f(x) \defeq \Phi \qquad \mbox{for $x:A$}.\] +Alternatively, we can use \define{$\lambda$-abstraction}% +\index{lambda abstraction@$\lambda$-abstraction|defstyle}% +\begin{equation} + \label{eq:lambda-abstraction} + \lamu{x:A} \Phi \ :\ \prd{x:A} B(x). +\end{equation} +\indexdef{application!of dependent function}% +\indexdef{function!dependent!application}% +As with non-dependent functions, we can \define{apply} a dependent function $f : \prd{x:A}B(x)$ to an argument $a:A$ to obtain an element $f(a):B(a)$. +The equalities are the same as for the ordinary function type, i.e.\ we have the following computation rule: +\index{computation rule!for dependent function types}% +given $a:A$ we have $f(a) \jdeq \Phi'$ and +$(\lamu{x:A} \Phi)(a) \jdeq \Phi'$, where $\Phi' $ is obtained by replacing all +occurrences of $x$ in $\Phi$ by $a$ (avoiding variable capture, as always). +Similarly, we have the uniqueness principle $f\jdeq (\lam{x} f(x))$ for any $f:\prd{x:A} B(x)$. +\index{uniqueness!principle!for dependent function types}% + +As an example, recall from \cref{sec:universes} that there is a type family $\Fin:\nat\to\UU$ whose values are the standard finite sets, with elements $0_n,1_n,\dots,(n-1)_n : \Fin(n)$. +There is then a dependent function $\fmax : \prd{n:\nat} \Fin(n+1)$ +which returns the ``largest'' element of each nonempty finite type, $\fmax(n) \defeq n_{n+1}$. +\index{finite!sets, family of}% +As was the case for $\Fin$ itself, we cannot define $\fmax$ yet, but we will be able to soon; see \cref{ex:fin}. + +Another important class of dependent function types, which we can define now, are functions which are \define{polymorphic} +\indexdef{function!polymorphic}% +\indexdef{polymorphic function}% +over a given universe. +A polymorphic function is one which takes a type as one of its arguments, and then acts on elements of that type (or of other types constructed from it). +\symlabel{idfunc}% +\indexdef{function!identity}% +\indexdef{identity!function}% +An example is the polymorphic identity function $\idfunc : \prd{A:\UU} A \to A$, which we define by $\idfunc{} \defeq \lam{A:\type}{x:A} x$. +(Like $\lambda$-abstractions, $\Pi$s automatically scope\index{scope} over the rest of the expression unless delimited; thus $\idfunc : \prd{A:\UU} A \to A$ means $\idfunc : \prd{A:\UU} (A \to A)$. +This convention, though unusual in mathematics, is common in type theory.) + +We sometimes write some arguments of a dependent function as subscripts. +For instance, we might equivalently define the polymorphic identity function by $\idfunc[A](x) \defeq x$. +Moreover, if an argument can be inferred from context, we may omit it altogether. +For instance, if $a:A$, then writing $\idfunc(a)$ is unambiguous, since $\idfunc$ must mean $\idfunc[A]$ in order for it to be applicable to $a$. + +Another, less trivial, example of a polymorphic function is the ``swap'' operation that switches the order of the arguments of a (curried) two-argument function: +\[ \mathsf{swap} : \prd{A:\UU}{B:\UU}{C:\UU} (A\to B\to C) \to (B\to A \to C). \] +We can define this by +\[ \mathsf{swap}(A,B,C,g) \defeq \lam{b}{a} g(a)(b). \] +We might also equivalently write the type arguments as subscripts: +\[ \mathsf{swap}_{A,B,C}(g)(b,a) \defeq g(a,b). \] + +Note that as we did for ordinary functions, we use currying to define dependent functions with +several arguments (such as $\mathsf{swap}$). However, in the dependent case the second domain may +depend on the first one, and the codomain may depend on both. That is, +given $A:\UU$ and type families $B : A \to \UU$ and $C : \prd{x:A}B(x) \to \UU$, we may construct +the type $\prd{x:A}{y : B(x)} C(x,y)$ of functions with two +arguments. +In the case when $B$ is constant and equal to $A$, we may condense the notation and write $\prd{x,y:A}$; for instance, the type of $\mathsf{swap}$ could also be written as +\[ \mathsf{swap} : \prd{A,B,C:\UU} (A\to B\to C) \to (B\to A \to C). \] +Finally, given $f:\prd{x:A}{y : B(x)} C(x,y)$ and arguments $a:A$ and $b:B(a)$, we have $f(a)(b) : C(a,b)$, which, +as before, we write as $f(a,b) : C(a,b)$. + +\index{type!dependent function|)}% +\index{function!dependent|)}% + + +\section{Product types} +\label{sec:finite-product-types} + +Given types $A,B:\UU$ we introduce the type $A\times B:\UU$, which we call their \define{cartesian product}. +\indexsee{cartesian product}{type, product}% +\indexsee{type!cartesian product}{type, product}% +\index{type!product|(defstyle}% +\indexsee{product!of types}{type, product}% +We also introduce a nullary product type, called the \define{unit type} $\unit : \UU$. +\indexsee{nullary!product}{type, unit}% +\indexsee{unit!type}{type, unit}% +\index{type!unit|(defstyle}% +We intend the elements of $A\times B$ to be pairs $\tup{a}{b} : A \times B$, where $a:A$ and $b:B$, and the only element of $\unit$ to be some particular object $\ttt : \unit$. +\indexdef{pair!ordered}% +However, unlike in set theory, where we define ordered pairs to be particular sets and then collect them all together into the cartesian product, in type theory, ordered pairs are a primitive concept, as are functions. + +\begin{rmk}\label{rmk:introducing-new-concepts} + There is a general pattern for introduction of a new kind of type in type theory. + We have already seen this pattern in \cref{sec:function-types,sec:pi-types}\footnote{The description of universes above is an exception.}, so it is worth emphasizing the general form. + To specify a type, we specify: + \begin{enumerate} + \item how to form new types of this kind, via \define{formation rules}. + \indexdef{formation rule}% + \index{rule!formation}% +(For example, we can form the function type $A \to B$ when $A$ is a type and when $B$ is a type. We can form the dependent function type $\prd{x:A} B(x)$ when $A$ is a type and $B(x)$ is a type for $x:A$.) + + \item how to construct elements of that type. + These are called the type's \define{constructors} or \define{introduction rules}. + \indexdef{constructor}% + \indexdef{rule!introduction}% + \indexdef{introduction rule}% + (For example, a function type has one constructor, $\lambda$-abstraction. + Recall that a direct definition like $f(x)\defeq 2x$ can equivalently be phrased + as a $\lambda$-abstraction $f\defeq \lam{x} 2x$.) + + \item how to use elements of that type. + These are called the type's \define{eliminators} or \define{elimination rules}. + \indexsee{rule!elimination}{eliminator}% + \indexsee{elimination rule}{eliminator}% + \indexdef{eliminator}% + (For example, the function type has one eliminator, namely function application.) + + \item + a \define{computation rule}\indexdef{computation rule}\footnote{also referred to as \define{$\beta$-reduction}\index{beta-reduction@$\beta $-reduction|footstyle}}, which expresses how an eliminator acts on a constructor. +(For example, for functions, the computation rule states that $(\lamu{x:A}\Phi)(a)$ is judgmentally equal to the substitution of $a$ for $x$ in $\Phi$.) + + \item + an optional \define{uniqueness principle}\indexdef{uniqueness!principle}\footnote{also referred to as \define{$\eta$-expansion}\index{eta-expansion@$\eta $-expansion|footstyle}}, which expresses +uniqueness of maps into or out of that type. +For some types, the uniqueness principle characterizes maps into the type, by stating that +every element of the type is uniquely determined by the results of applying eliminators to it, and can be reconstructed from those results by applying a constructor --- thus expressing how constructors act on eliminators, dually to the computation rule. +(For example, for functions, the uniqueness principle says that any function $f$ is judgmentally equal to the ``expanded'' function $\lamu{x} f(x)$, and thus is uniquely determined by its values.) +For other types, the uniqueness principle says that every map (function) \emph{from} that type is uniquely determined by some data. (An example is the coproduct type introduced in \cref{sec:coproduct-types}, whose uniqueness principle is mentioned in \cref{sec:universal-properties}.) + + When the uniqueness principle is not taken as a rule of judgmental equality, it is often nevertheless provable as a \emph{propositional} equality from the other rules for the type. + In this case we call it a \define{propositional uniqueness principle}. + \indexdef{uniqueness!principle, propositional}% + \indexsee{propositional!uniqueness principle}{uniqueness principle, propositional}% + (In later chapters we will also occasionally encounter \emph{propositional computation rules}.) + \indexdef{computation rule!propositional}% + \end{enumerate} +The inference rules in \cref{sec:syntax-more-formally} are organized and named accordingly; see, for example, \cref{sec:more-formal-pi}, where each possibility is realized. +\end{rmk} + +The way to construct pairs is obvious: given $a:A$ and $b:B$, we may form $(a,b):A\times B$. +Similarly, there is a unique way to construct elements of $\unit$, namely we have $\ttt:\unit$. +We expect that ``every element of $A\times B$ is a pair'', which is the uniqueness principle for products; we do not assert this as a rule of type theory, but we will prove it later on as a propositional equality. + +Now, how can we \emph{use} pairs, i.e.\ how can we define functions out of a product type? +Let us first consider the definition of a non-dependent function $f : A\times B \to C$. +Since we intend the only elements of $A\times B$ to be pairs, we expect to be able to define such a function by prescribing the result +when $f$ is applied to a pair $\tup{a}{b}$. +We can prescribe these results by providing a function $g : A \to B \to C$. +Thus, we introduce a new rule (the elimination rule for products), which says that for any such $g$, we can define a function $f : A\times B \to C$ by +\[ f(\tup{a}{b}) \defeq g(a)(b). \] +We avoid writing $g(a,b)$ here, in order to emphasize that $g$ is not a function on a product. +(However, later on in the book we will often write $g(a,b)$ both for functions on a product and for curried functions of two variables.) +This defining equation is the computation rule for product types\index{computation rule!for product types}. + +Note that in set theory, we would justify the above definition of $f$ by the fact that every element of $A\times B$ is an ordered pair, so that it suffices to define $f$ on such pairs. +By contrast, type theory reverses the situation: we assume that a function on $A\times B$ is well-defined as soon as we specify its values on pairs, and from this (or more precisely, from its more general version for dependent functions, below) we will be able to \emph{prove} that every element of $A\times B$ is a pair. +From a category-theoretic perspective, we can say that we define the product $A\times B$ to be left adjoint to the ``exponential'' $B\to C$, which we have already introduced. + +As an example, we can derive the \define{projection} +\indexsee{function!projection}{projection}% +\indexsee{component, of a pair}{projection}% +\indexdef{projection!from cartesian product type}% +functions +\symlabel{defn:proj}% +\begin{align*} + \fst & : A \times B \to A \\ + \snd & : A \times B \to B +\end{align*} +with the defining equations +\begin{align*} + \fst(\tup{a}{b}) & \defeq a \\ + \snd(\tup{a}{b}) & \defeq b. +\end{align*} +% +\symlabel{defn:recursor-times}% +Rather than invoking this principle of function definition every time we want to define a function, an alternative approach is to invoke it once, in a universal case, and then simply apply the resulting function in all other cases. +That is, we may define a function of type +\begin{equation} + \rec{A\times B} : \prd{C:\UU}(A \to B \to C) \to A \times B \to C +\end{equation} +with the defining equation +\[\rec{A\times B}(C,g,\tup{a}{b}) \defeq g(a)(b). \] +Then instead of defining functions such as $\fst$ and $\snd$ directly by a defining equation, we could define +\begin{align*} + \fst &\defeq \rec{A\times B}(A, \lam{a}{b} a)\\ + \snd &\defeq \rec{A\times B}(B, \lam{a}{b} b). +\end{align*} +We refer to the function $\rec{A\times B}$ as the \define{recursor} +\indexsee{recursor}{recursion principle}% +for product types. The name ``recursor'' is a bit unfortunate here, since no recursion is taking place. It comes from the fact that product types are a degenerate example of a general framework for inductive types, and for types such as the natural numbers, the recursor will actually be recursive. We may also speak of the \define{recursion principle} for cartesian products, meaning the fact that we can define a function $f:A\times B\to C$ as above by giving its value on pairs. +\index{recursion principle!for cartesian product}% + +We leave it as a simple exercise to show that the recursor can be +derived from the projections and vice versa. +% Ex: Derive from projections + +\symlabel{defn:recursor-unit}% +We also have a recursor for the unit type: +\[\rec{\unit} : \prd{C:\UU}C \to \unit \to C\] +with the defining equation +\[ \rec{\unit}(C,c,\ttt) \defeq c. \] +Although we include it to maintain the pattern of type definitions, the recursor for $\unit$ is completely useless, +because we could have defined such a function directly +by simply ignoring the argument of type $\unit$. + +To be able to define \emph{dependent} functions over the product type, we have +to generalize the recursor. Given $C: A \times B \to \UU$, we may +define a function $f : \prd{x : A \times B} C(x)$ by providing a +function +\narrowequation{ + g : \prd{x:A}\prd{y:B} C(\tup{x}{y}) +} +with defining equation +\[ f(\tup x y) \defeq g(x)(y). \] +For example, in this way we can prove the propositional uniqueness principle, which says that every element of $A\times B$ is equal to a pair. +\index{uniqueness!principle, propositional!for product types}% +Specifically, we can construct a function +\[ \uniq{A\times B} : \prd{x:A \times B} (\id[A\times B]{\tup{\fst {(x)}}{\snd {(x)}}}{x}). \] +Here we are using the identity type, which we are going to introduce below in \cref{sec:identity-types}. +However, all we need to know now is that there is a reflexivity element $\refl{x} : \id[A]{x}{x}$ for any $x:A$. +Given this, we can define +\label{uniquenessproduct} +\[ \uniq{A\times B}(\tup{a}{b}) \defeq \refl{\tup{a}{b}}. \] +This construction works, because in the case that $x \defeq \tup{a}{b}$ we can +calculate +\[ \tup{\fst(\tup{a}{b})}{\snd{(\tup{a}{b})}} \jdeq \tup{a}{b} \] +using the defining equations for the projections. Therefore, +\[ \refl{\tup{a}{b}} : \id{\tup{\fst(\tup{a}{b})}{\snd{(\tup{a}{b})}}}{\tup{a}{b}} \] +is well-typed, since both sides of the equality are judgmentally equal. + +More generally, the ability to define dependent functions in this way means that to prove a property for all elements of a product, it is enough +to prove it for its canonical elements, the ordered pairs. +When we come to inductive types such as the natural numbers, the analogous property will be the ability to write proofs by induction. +Thus, if we do as we did above and apply this principle once in the universal case, we call the resulting function \define{induction} for product types: given $A,B : \UU$ we have +\symlabel{defn:induction-times}% +\[ \ind{A\times B} : \prd{C:A \times B \to \UU} +\Parens{\prd{x:A}{y:B} C(\tup{x}{y})} \to \prd{x:A \times B} C(x) \] +with the defining equation +\[ \ind{A\times B}(C,g,\tup{a}{b}) \defeq g(a)(b). \] +Similarly, we may speak of a dependent function defined on pairs being obtained from the \define{induction principle} +\index{induction principle}% +\index{induction principle!for product}% +of the cartesian product. +It is easy to see that the recursor is just the special case of induction +in the case that the family $C$ is constant. +Because induction describes how to use an element of the product type, induction is also called the \define{(dependent) eliminator}, +\indexsee{eliminator!of inductive type!dependent}{induction principle}% +and recursion the \define{non-dependent eliminator}. +\indexsee{eliminator!of inductive type!non-dependent}{recursion principle}% +\indexsee{non-dependent eliminator}{recursion principle}% +\indexsee{dependent eliminator}{induction principle}% + +% We can read induction propositionally as saying that a property which +% is true for all pairs holds for all elements of the product type. + +Induction for the unit type turns out to be more useful than the +recursor: +\symlabel{defn:induction-unit}% +\[ \ind{\unit} : \prd{C:\unit \to \UU} C(\ttt) \to \prd{x:\unit}C(x)\] +with the defining equation +\[ \ind{\unit}(C,c,\ttt) \defeq c. \] +Induction enables us to prove the propositional uniqueness principle for $\unit$, which asserts that its only inhabitant is $\ttt$. +That is, we can construct +\label{uniquenessunit} +\[\uniq{\unit} : \prd{x:\unit} \id{x}{\ttt} \] +by using the defining equations +\[\uniq{\unit}(\ttt) \defeq \refl{\ttt} \] +or equivalently by using induction: +\[\uniq{\unit} \defeq \ind{\unit}(\lamu{x:\unit} \id{x}{\ttt},\refl{\ttt}). \] + +\index{type!product|)}% +\index{type!unit|)}% + +\section{Dependent pair types (\texorpdfstring{$\Sigma$}{Σ}-types)} +\label{sec:sigma-types} + +\index{type!dependent pair|(defstyle}% +\indexsee{type!dependent sum}{type, dependent pair}% +\indexsee{type!Sigma-@$\Sigma$-}{type, dependent pair}% +\indexsee{Sigma-type@$\Sigma$-type}{type, dependent pair}% +\indexsee{sum!dependent}{type, dependent pair}% + +Just as we generalized function types (\cref{sec:function-types}) to dependent function types (\cref{sec:pi-types}), it is often useful to generalize the product types from \cref{sec:finite-product-types} to allow the type of +the second component of a pair to vary depending on the choice of the first +component. This is called a \define{dependent pair type}, or \define{$\Sigma$-type}, because in set theory it +corresponds to an indexed sum (in the sense of coproduct or +disjoint union) over a given type. + +Given a type $A:\UU$ and a family $B : A \to \UU$, the dependent +pair type is written as $\sm{x:A} B(x) : \UU$. +Alternative notations are +\[ \tsm{x:A} B(x) \hspace{2cm} \dsm{x:A}B(x) \hspace{2cm} \lsm{x:A} B(x). \] +Like other binding constructs such as $\lambda$-abstractions and $\Pi$s, $\Sigma$s automatically scope\index{scope} over the rest of the expression unless delimited, so e.g.\ $\sm{x:A} B(x) \to C$ means $\sm{x:A} (B(x) \to C)$. + +\symlabel{defn:dependent-pair}% +\indexdef{pair!dependent}% +The way to construct elements of a dependent pair type is by pairing: we have +$\tup{a}{b} : \sm{x:A} B(x)$ given $a:A$ and $b:B(a)$. +If $B$ is constant, then the dependent pair type is the +ordinary cartesian product type: +\[ \Parens{\sm{x:A} B} \jdeq (A \times B).\] +All the constructions on $\Sigma$-types arise as straightforward generalizations of the ones for product types, with dependent functions often replacing non-dependent ones. + +For instance, the recursion principle% +\index{recursion principle!for dependent pair type} +says that to define a non-dependent function out of a $\Sigma$-type +$f : (\sm{x:A} B(x)) \to C$, we provide a function +$g : \prd{x:A} B(x) \to C$, and then we can define $f$ via the defining +equation +\[ f(\tup{a}{b}) \defeq g(a)(b). \] +\indexdef{projection!from dependent pair type}% +For instance, we can derive the first projection from a $\Sigma$-type: +\symlabel{defn:dependent-proj1}% +\begin{equation*} + \fst : \Parens{\sm{x : A}B(x)} \to A +\end{equation*} +by the defining equation +\begin{equation*} + \fst(\tup{a}{b}) \defeq a. +\end{equation*} +However, since the type of the second component of a pair +\narrowequation{ + (a,b):\sm{x:A} B(x) +} +is $B(a)$, the second projection must be a \emph{dependent} function, whose type involves the first projection function: +\symlabel{defn:dependent-proj2}% +\[ \snd : \prd{p:\sm{x : A}B(x)}B(\fst(p)). \] +Thus we need the \emph{induction} principle% +\index{induction principle!for dependent pair type} +for $\Sigma$-types (the ``dependent eliminator''). +This says that to construct a dependent function out of a $\Sigma$-type into a family $C : (\sm{x:A} B(x)) \to \UU$, we need a function +\[ g : \prd{a:A}{b:B(a)} C(\tup{a}{b}). \] +We can then derive a function +\[ f : \prd{p : \sm{x:A}B(x)} C(p) \] +with defining equation\index{computation rule!for dependent pair type} +\[ f(\tup{a}{b}) \defeq g(a)(b).\] +Applying this with $C(p)\defeq B(\fst(p))$, we can define +\narrowequation{ +\snd : \prd{p:\sm{x : A}B(x)}B(\fst(p)) +} +with the obvious equation +\[ \snd(\tup{a}{b}) \defeq b. \] +To convince ourselves that this is correct, we note that $B (\fst(\tup{a}{b})) \jdeq B(a)$, using the defining equation for $\fst$, and +indeed $b : B(a)$. + +We can package the recursion and induction principles into the recursor for $\Sigma$: +\symlabel{defn:recursor-sm}% +\[ \rec{\sm{x:A}B(x)} : \dprd{C:\UU}\Parens{\tprd{x:A} B(x) \to C} \to +\Parens{\tsm{x:A}B(x)} \to C \] +with the defining equation +\[ \rec{\sm{x:A}B(x)}(C,g,\tup{a}{b}) \defeq g(a)(b) \] +and the corresponding induction operator: +\symlabel{defn:induction-sm}% +\begin{narrowmultline*} + \ind{\sm{x:A}B(x)} : \narrowbreak + \dprd{C:(\sm{x:A} B(x)) \to \UU} + \Parens{\tprd{a:A}{b:B(a)} C(\tup{a}{b})} + \to \dprd{p : \sm{x:A}B(x)} C(p) +\end{narrowmultline*} +with the defining equation +\[ \ind{\sm{x:A}B(x)}(C,g,\tup{a}{b}) \defeq g(a)(b). \] +As before, the recursor is the special case of induction +when the family $C$ is constant. + +As a further example, consider the following principle, where $A$ and $B$ are types and $R:A\to B\to \UU$: +\[ \ac : \Parens{\tprd{x:A} \tsm{y :B} R(x,y)} \to +\Parens{\tsm{f:A\to B} \tprd{x:A} R(x,f(x))}. +\] +We may regard $R$ as a ``proof-relevant relation'' +\index{mathematics!proof-relevant}% +between $A$ and $B$, with $R(a,b)$ the type of witnesses for relatedness of $a:A$ and $b:B$. +Then $\ac$ says intuitively that if we have a dependent function $g$ assigning to every $a:A$ a dependent pair $(b,r)$ where $b:B$ and $r:R(a,b)$, then we have a function $f:A\to B$ and a dependent function assigning to every $a:A$ a witness that $R(a,f(a))$. +Our intuition tells us that we can just split up the values of $g$ into their components. +Indeed, using the projections we have just defined, we can define: +\[ \ac(g) \defeq \Parens{\lamu{x:A} \fst(g(x)),\, \lamu{x:A} \snd(g(x))}. \] +To verify that this is well-typed, note that if $g:\prd{x:A} \sm{y :B} R(x,y)$, we have +\begin{align*} +\lamu{x:A} \fst(g(x)) &: A \to B, \\ +\lamu{x:A} \snd(g(x)) &: \tprd{x:A} R(x,\fst(g(x))). +\end{align*} +Moreover, the type $\prd{x:A} R(x,\fst(g(x)))$ is the result of applying the type family $\lamu{f:A\to B} \tprd{x:A} R(x,f(x))$ being summed over in the codomain of \ac to the function $\lamu{x:A} \fst(g(x))$: +\[ \tprd{x:A} R(x,\fst(g(x))) \jdeq +\Parens{\lamu{f:A\to B} \tprd{x:A} R(x,f(x))}\big(\lamu{x:A} \fst(g(x))\big). \] +Thus, we have +\[ \Parens{\lamu{x:A} \fst(g(x)),\, \lamu{x:A} \snd(g(x))} : \tsm{f:A\to B} \tprd{x:A} R(x,f(x))\] +as required. + +If we read $\Pi$ as ``for all'' and $\Sigma$ as ``there exists'', then the type of the function $\ac$ expresses: +\emph{if for all $x:A$ there is a $y:B$ such that $R(x,y)$, then there is a function $f : A \to B$ such that for all $x:A$ we have $R(x,f(x))$}. +Since this sounds like a version of the axiom of choice, the function \ac has traditionally been called the \define{type-theoretic axiom of choice}, and as we have just shown, it can be proved directly from the rules of type theory, rather than having to be taken as an axiom. +\index{axiom!of choice!type-theoretic}% +However, note that no choice is actually involved, since the choices have already been given to us in the premise: all we have to do is take it apart into two functions: one representing the choice and the other its correctness. +In \cref{sec:axiom-choice} we will give another formulation of an ``axiom of choice'' which is closer to the usual one. + +Dependent pair types are often used to define types of mathematical structures, which commonly consist of several dependent pieces of data. +To take a simple example, suppose we want to define a \define{magma}\indexdef{magma} to be a type $A$ together with a binary operation $m:A\to A\to A$. +The precise meaning of the phrase ``together with''\index{together with} (and the synonymous ``equipped with''\index{equipped with}) is that ``a magma'' is a \emph{pair} $(A,m)$ consisting of a type $A:\UU$ and an operation $m:A\to A\to A$. +Since the type $A\to A\to A$ of the second component $m$ of this pair depends on its first component $A$, such pairs belong to a dependent pair type. +Thus, the definition ``a magma is a type $A$ together with a binary operation $m:A\to A\to A$'' should be read as defining \emph{the type of magmas} to be +\[ \mathsf{Magma} \defeq \sm{A:\UU} (A\to A\to A). \] +Given a magma, we extract its underlying type (its ``carrier''\index{carrier}) with the first projection $\proj1$, and its operation with the second projection $\proj2$. +Of course, structures built from more than two pieces of data require iterated pair types, which may be only partially dependent; for instance the type of pointed magmas (magmas $(A,m)$ equipped with a basepoint $e:A$) is +\[ \mathsf{PointedMagma} \defeq \sm{A:\UU} (A\to A\to A) \times A. \] +We generally also want to impose axioms on such a structure, e.g.\ to make a pointed magma into a monoid or a group. +This can also be done using $\Sigma$-types; see \cref{sec:pat}. + +In the rest of the book, we will sometimes make definitions of this sort explicit, but eventually we trust the reader to translate them from English into $\Sigma$-types. +We also generally follow the common mathematical practice of using the same letter for a structure of this sort and for its carrier (which amounts to leaving the appropriate projection function implicit in the notation): that is, we will speak of a magma $A$ with its operation $m:A\to A\to A$. + +Note that the canonical elements of $\mathsf{PointedMagma}$ are of the form $(A,(m,e))$ where $A:\UU$, $m:A\to A\to A$, and $e:A$. +Because of the frequency with which iterated $\Sigma$-types of this sort arise, we use the usual notation of ordered triples, quadruples and so on to stand for nested pairs (possibly dependent) associating to the right. +That is, we have $(x,y,z) \defeq (x,(y,z))$ and $(x,y,z,w)\defeq (x,(y,(z,w)))$, etc. + +\index{type!dependent pair|)}% + +\section{Coproduct types} +\label{sec:coproduct-types} + +Given $A,B:\UU$, we introduce their \define{coproduct} type $A+B:\UU$. +\indexsee{coproduct}{type, coproduct}% +\index{type!coproduct|(defstyle}% +\indexsee{disjoint!sum}{type, coproduct}% +\indexsee{disjoint!union}{type, coproduct}% +\indexsee{sum!disjoint}{type, coproduct}% +\indexsee{union!disjoint}{type, coproduct}% +This corresponds to the \emph{disjoint union} in set theory, and we may also use that name for it. +In type theory, as was the case with functions and products, the coproduct must be a fundamental construction, since there is no previously given notion of ``union of types''. +We also introduce a +nullary version: the \define{empty type $\emptyt:\UU$}. +\indexsee{nullary!coproduct}{type, empty}% +\indexsee{empty type}{type, empty}% +\index{type!empty|(defstyle}% + +There are two ways to construct elements of $A+B$, either as $\inl(a) : A+B$ for $a:A$, or as +$\inr(b):A+B$ for $b:B$. +(The names $\inl$ and $\inr$ are short for ``left injection'' and ``right injection''.) +There are no ways to construct elements of the empty type. + +\index{recursion principle!for coproduct} +To construct a non-dependent function $f : A+B \to C$, we need +functions $g_0 : A \to C$ and $g_1 : B \to C$. Then $f$ is defined +via the defining equations +\begin{align*} + f(\inl(a)) &\defeq g_0(a), \\ + f(\inr(b)) &\defeq g_1(b). +\end{align*} +That is, the function $f$ is defined by \define{case analysis}. +\indexdef{case analysis}% +As before, we can derive the recursor: +\symlabel{defn:recursor-plus}% +\[ \rec{A+B} : \dprd{C:\UU}(A \to C) \to (B\to C) \to A+B \to C\] +with the defining equations +\begin{align*} +\rec{A+B}(C,g_0,g_1,\inl(a)) &\defeq g_0(a), \\ +\rec{A+B}(C,g_0,g_1,\inr(b)) &\defeq g_1(b). +\end{align*} + +\index{recursion principle!for empty type} +We can always construct a function $f : \emptyt \to C$ without +having to give any defining equations, because there are no elements of \emptyt on which to define $f$. +Thus, the recursor for $\emptyt$ is +\symlabel{defn:recursor-emptyt}% +\[\rec{\emptyt} : \tprd{C:\UU} \emptyt \to C,\] +which constructs the canonical function from the empty type to any other type. +Logically, it corresponds to the principle \textit{ex falso quodlibet}. +\index{ex falso quodlibet@\textit{ex falso quodlibet}} + +\index{induction principle!for coproduct} +To construct a dependent function $f:\prd{x:A+B}C(x)$ out of a coproduct, we assume as given the family +$C: (A + B) \to \UU$, and +require +\begin{align*} + g_0 &: \prd{a:A} C(\inl(a)), \\ + g_1 &: \prd{b:B} C(\inr(b)). +\end{align*} +This yields $f$ with the defining equations:\index{computation rule!for coproduct type} +\begin{align*} + f(\inl(a)) &\defeq g_0(a), \\ + f(\inr(b)) &\defeq g_1(b). +\end{align*} +We package this scheme into the induction principle for coproducts: +\symlabel{defn:induction-plus}% +\begin{narrowmultline*} + \ind{A+B} : + \dprd{C: (A + B) \to \UU} + \Parens{\tprd{a:A} C(\inl(a))} \to \narrowbreak + \Parens{\tprd{b:B} C(\inr(b))} \to \tprd{x:A+B}C(x). +\end{narrowmultline*} +As before, the recursor arises in the case that the family $C$ is +constant. + +\index{induction principle!for empty type} +The induction principle for the empty type +\symlabel{defn:induction-emptyt}% +\[ \ind{\emptyt} : \prd{C:\emptyt \to \UU}{z:\emptyt} C(z) \] +gives us a way to define a trivial dependent function out of the +empty type. % In the presence of $\eta$-equality it is derivable +% from the recursor. +% ex + +\index{type!coproduct|)}% +\index{type!empty|)}% + + +\section{The type of booleans} +\label{sec:type-booleans} + +\indexsee{boolean!type of}{type of booleans}% +\index{type!of booleans|(defstyle}% +The type of booleans $\bool:\UU$ is intended to have exactly two elements +$\bfalse,\btrue : \bool$. It is clear that we could construct this +type out of coproduct +% this one results in a warning message just because it's on the same page as the previous entry +% for {type!coproduct}, so it's not our fault +\index{type!coproduct}% +and unit\index{type!unit} types as $\unit + \unit$. However, +since it is used frequently, we give the explicit rules here. +Indeed, we are going to observe that we can also go the other way +and derive binary coproducts from $\Sigma$-types and $\bool$. + +\index{recursion principle!for type of booleans} +To derive a function $f : \bool \to C$ we need $c_0,c_1 : C$ and +add the defining equations +\begin{align*} + f(\bfalse) &\defeq c_0, \\ + f(\btrue) &\defeq c_1. +\end{align*} +The recursor corresponds to the if-then-else construct in +functional programming: +\symlabel{defn:recursor-bool}% +\[ \rec{\bool} : \prd{C:\UU} C \to C \to \bool \to C \] +with the defining equations +\begin{align*} + \rec{\bool}(C,c_0,c_1,\bfalse) &\defeq c_0, \\ + \rec{\bool}(C,c_0,c_1,\btrue) &\defeq c_1. +\end{align*} + +\index{induction principle!for type of booleans} +Given $C : \bool \to \UU$, to derive a dependent function +$f : \prd{x:\bool}C(x)$ we need $c_0:C(\bfalse)$ and $c_1 : C(\btrue)$, in which case we can give the defining equations +\begin{align*} + f(\bfalse) &\defeq c_0, \\ + f(\btrue) &\defeq c_1. +\end{align*} +We package this up into the induction principle +\symlabel{defn:induction-bool}% +\[ \ind{\bool} : \dprd{C:\bool \to \UU} C(\bfalse) \to C(\btrue) +\to \tprd{x:\bool} C(x) \] +with the defining equations +\begin{align*} + \ind{\bool}(C,c_0,c_1,\bfalse) &\defeq c_0, \\ + \ind{\bool}(C,c_0,c_1,\btrue) &\defeq c_1. +\end{align*} + +As an example, using the induction principle we can deduce that, as we expect, every element of $\bool$ is either $\btrue$ or $\bfalse$. +As before, in order to state this we use the equality types which we have not yet introduced, but we need only the fact that everything is equal to itself by $\refl{x}:x=x$. +Thus, we construct an element of +\begin{equation}\label{thm:allbool-trueorfalse} + \prd{x:\bool}(x=\bfalse)+(x=\btrue), +\end{equation} +i.e.\ a function assigning to each $x:\bool$ either an equality $x=\bfalse$ or an equality $x=\btrue$. +We define this element using the induction principle for \bool, with $C(x) \defeq (x=\bfalse)+(x=\btrue)$; +the two inputs are $\inl(\refl{\bfalse}) : C(\bfalse)$ and $\inr(\refl{\btrue}):C(\btrue)$. +In other words, our element of~\eqref{thm:allbool-trueorfalse} is +\[ \ind{\bool}\big(\lam{x}(x=\bfalse)+(x=\btrue),\, \inl(\refl{\bfalse}),\, \inr(\refl{\btrue})\big). \] + +We have remarked that $\Sigma$-types can be regarded as analogous to indexed disjoint unions, while coproducts are binary disjoint unions. +It is natural to expect that a binary disjoint union $A+B$ could be constructed as an indexed one over the two-element type \bool. +For this we need a type family $P:\bool\to\type$ such that $P(\bfalse)\jdeq A$ and $P(\btrue)\jdeq B$. +Indeed, we can obtain such a family precisely by the recursion principle for $\bool$. +\index{type!family of}% +(The ability to define \emph{type families} by induction and recursion, using the fact that the universe $\UU$ is itself a type, is a subtle and important aspect of type theory.) +Thus, we could have defined +\index{type!coproduct}% +\[ A + B \defeq \sm{x:\bool} \rec{\bool}(\UU,A,B,x) \] +with +\begin{align*} + \inl(a) &\defeq \tup{\bfalse}{a}, \\ + \inr(b) &\defeq \tup{\btrue}{b}. +\end{align*} +We leave it as an exercise to derive the induction principle of a coproduct type from this definition. +(See also \cref{ex:sum-via-bool,sec:appetizer-univalence}.) + +We can apply the same idea to products and $\Pi$-types: we could have defined +\[ A \times B \defeq \prd{x:\bool}\rec{\bool}(\UU,A,B,x). \] +Pairs could then be constructed using induction for \bool: +\[ \tup{a}{b} \defeq \ind{\bool}(\rec{\bool}(\UU,A,B),a,b) \] +while the projections are straightforward applications +\begin{align*} + \fst(p) &\defeq p(\bfalse), \\ + \snd(p) &\defeq p(\btrue). +\end{align*} +The derivation of the induction principle for binary products defined in this way is a bit more involved, and requires function extensionality, which we will introduce in \cref{sec:compute-pi}. +Moreover, we do not get the same judgmental equalities; see \cref{ex:prod-via-bool}. +This is a recurrent issue when encoding one type as another; we will return to it in \cref{sec:htpy-inductive}. + +We may occasionally refer to the elements $\bfalse$ and $\btrue$ of $\bool$ as ``false'' and ``true'' respectively. +However, note that unlike in classical\index{mathematics!classical} mathematics, we do not use elements of $\bool$ as truth values +\index{value!truth}% +or as propositions. +(Instead we identify propositions with types; see \cref{sec:pat}.) +In particular, the type $A \to \bool$ is not generally the power set\index{power set} of $A$; it represents only the ``decidable'' subsets of $A$ (see \cref{cha:logic}). +\index{decidable!subset}% + +\index{type!of booleans|)}% + + +\section{The natural numbers} +\label{sec:inductive-types} + +\indexsee{type!of natural numbers}{natural numbers}% +\index{natural numbers|(defstyle}% +\indexsee{number!natural}{natural numbers}% +So far we have rules for constructing new types by abstract operations, but for doing concrete mathematics we also require some concrete types, such as types of numbers. +The most basic such is the type $\nat : \UU$ of natural numbers; once we have this we can construct integers, rational numbers, real numbers, and so on (see \cref{cha:real-numbers}). + +The elements of $\nat$ are constructed using $0 : \nat$\indexdef{zero} and the successor\indexdef{successor} operation $\suc : \nat \to \nat$. +When denoting natural numbers, we adopt the usual decimal notation $1 \defeq \suc(0)$, $2 \defeq \suc(1)$, $3 \defeq \suc(2)$, \dots. + +The essential property of the natural numbers is that we can define functions by recursion and perform proofs by induction --- where now the words ``recursion'' and ``induction'' have a more familiar meaning. +\index{recursion principle!for natural numbers}% +To construct a non-dependent function $f : \nat \to C$ out of the natural numbers by recursion, it is enough to provide a starting point $c_0 : C$ and a ``next step'' function $c_s : \nat \to C \to C$. +This gives rise to $f$ with the defining equations\index{computation rule!for natural numbers} +\begin{align*} + f(0) &\defeq c_0, \\ + f(\suc(n)) &\defeq c_s(n,f(n)). +\end{align*} +We say that $f$ is defined by \define{primitive recursion}. +\indexdef{primitive!recursion}% +\indexdef{recursion!primitive}% + +As an example, we look at how to define a function on natural numbers which doubles its argument. +In this case we have $C\defeq \nat$. +We first need to supply the value of $\dbl(0)$, which is easy: we put $c_0 \defeq 0$. +Next, to compute the value of $\dbl(\suc(n))$ for a natural number $n$, we first compute the value of $\dbl(n)$ and then perform the successor operation twice. +This is captured by the recurrence\index{recurrence} $c_s(n,y) \defeq \suc(\suc(y))$. +Note that the second argument $y$ of $c_s$ stands for the result of the \emph{recursive call}\index{recursive call} $\dbl(n)$. + +Defining $\dbl:\nat\to\nat$ by primitive recursion in this way, therefore, we obtain the defining equations: +\begin{align*} + \dbl(0) &\defeq 0\\ + \dbl(\suc(n)) &\defeq \suc(\suc(\dbl(n))). +\end{align*} +This indeed has the correct computational behavior: for example, we have +\begin{align*} + \dbl(2) &\jdeq \dbl(\suc(\suc(0)))\\ + & \jdeq c_s(\suc(0), \dbl(\suc(0))) \\ + & \jdeq \suc(\suc(\dbl(\suc(0)))) \\ + & \jdeq \suc(\suc(c_s(0,\dbl(0)))) \\ + & \jdeq \suc(\suc(\suc(\suc(\dbl(0))))) \\ + & \jdeq \suc(\suc(\suc(\suc(c_0)))) \\ + & \jdeq \suc(\suc(\suc(\suc(0))))\\ + &\jdeq 4. +\end{align*} +We can define multi-variable functions by primitive recursion as well, by currying and allowing $C$ to be a function type. +\indexdef{addition!of natural numbers} +For example, we define addition $\add : \nat \to \nat \to \nat$ with $C \defeq \nat \to \nat$ and the following ``starting point'' and ``next step'' data: +\begin{align*} + c_0 & : \nat \to \nat \\ + c_0 (n) & \defeq n \\ + c_s & : \nat \to (\nat \to \nat) \to (\nat \to \nat) \\ + c_s(m,g)(n) & \defeq \suc(g(n)). +\end{align*} +We thus obtain $\add : \nat \to \nat \to \nat$ satisfying the definitional equalities +\begin{align*} + \add(0,n) &\jdeq n \\ + \add(\suc(m),n) &\jdeq \suc(\add(m,n)). +\end{align*} +As usual, we write $\add(m,n)$ as $m+n$. +The reader is invited to verify that $2+2\jdeq 4$. +% ex: define multiplication and exponentiation. + +As in previous cases, we can package the principle of primitive recursion into a recursor: +\[\rec{\nat} : \dprd{C:\UU} C \to (\nat \to C \to C) \to \nat \to C \] +with the defining equations +\symlabel{defn:recursor-nat}% +\begin{align*} +\rec{\nat}(C,c_0,c_s,0) &\defeq c_0, \\ +\rec{\nat}(C,c_0,c_s,\suc(n)) &\defeq c_s(n,\rec{\nat}(C,c_0,c_s,n)). +\end{align*} +%ex derive rec from it +Using $\rec{\nat}$ we can present $\dbl$ and $\add$ as follows: +\begin{align} +\dbl &\defeq \rec\nat\big(\nat,\, 0,\, \lamu{n:\nat}{y:\nat} \suc(\suc(y))\big) \label{eq:dbl-as-rec}\\ +\add &\defeq \rec{\nat}\big(\nat \to \nat,\, \lamu{n:\nat} n,\, \lamu{m:\nat}{g:\nat \to \nat}{n :\nat} \suc(g(n))\big). +\end{align} +Of course, all functions definable only using the primitive recursion principle will be \emph{computable}. +(The presence of higher function types --- that is, functions with other functions as arguments --- does, however, mean we can define more than the usual primitive recursive functions; see e.g.~\cref{ex:ackermann}.) +This is appropriate in constructive mathematics; +\index{mathematics!constructive}% +in \cref{sec:intuitionism,sec:axiom-choice} we will see how to augment type theory so that we can define more general mathematical functions. + +\index{induction principle!for natural numbers} +We now follow the same approach as for other types, generalizing primitive recursion to dependent functions to obtain an \emph{induction principle}. +Thus, assume as given a family $C : \nat \to \UU$, an element $c_0 : C(0)$, and a function $c_s : \prd{n:\nat} C(n) \to C(\suc(n))$; then we can construct $f : \prd{n:\nat} C(n)$ with the defining equations:\index{computation rule!for natural numbers} +\begin{align*} + f(0) &\defeq c_0, \\ + f(\suc(n)) &\defeq c_s(n,f(n)). +\end{align*} +We can also package this into a single function +\symlabel{defn:induction-nat}% +\[\ind{\nat} : \dprd{C:\nat\to \UU} C(0) \to \Parens{\tprd{n : \nat} C(n) \to C(\suc(n))} \to \tprd{n : \nat} C(n) \] +with the defining equations +\begin{align*} +\ind{\nat}(C,c_0,c_s,0) &\defeq c_0, \\ +\ind{\nat}(C,c_0,c_s,\suc(n)) &\defeq c_s(n,\ind{\nat}(C,c_0,c_s,n)). +\end{align*} +Here we finally see the connection to the classical notion of proof by induction. +Recall that in type theory we represent propositions by types, and proving a proposition by inhabiting the corresponding type. +In particular, a \emph{property} of natural numbers is represented by a family of types $P:\nat\to\type$. +From this point of view, the above induction principle says that if we can prove $P(0)$, and if for any $n$ we can prove $P(\suc(n))$ assuming $P(n)$, then we have $P(n)$ for all $n$. +This is, of course, exactly the usual principle of proof by induction on natural numbers. + +\index{associativity!of addition!of natural numbers} +As an example, consider how we might represent an explicit proof that $+$ is associative. +(We will not actually write out proofs in this style, but it serves as a useful example for understanding how induction is represented formally in type theory.) +To derive +\[\assoc : \prd{i,j,k:\nat} \id{i + (j + k)}{(i + j) + k}, \] +it is sufficient to supply +\[ \assoc_0 : \prd{j,k:\nat} \id{0 + (j + k)}{(0+ j) + k} \] +and +\begin{narrowmultline*} + \assoc_s : \prd{i:\nat} \left(\prd{j,k:\nat} \id{i + (j + k)}{(i + j) + k}\right) + \narrowbreak + \to \prd{j,k:\nat} \id{\suc(i) + (j + k)}{(\suc(i) + j) + k}. +\end{narrowmultline*} +To derive $\assoc_0$, recall that $0+n \jdeq n$, and hence $0 + (j + k) \jdeq j+k \jdeq (0+ j) + k$. +Hence we can just set +\[ \assoc_0(j,k) \defeq \refl{j+k}. \] +For $\assoc_s$, recall that the definition of $+$ gives $\suc(m)+n \jdeq \suc(m+n)$, and hence +\begin{align*} + \suc(i) + (j + k) &\jdeq \suc(i+(j+k)) \qquad\text{and}\\ + (\suc(i)+j)+k &\jdeq \suc((i+j)+k). +\end{align*} +Thus, the output type of $\assoc_s$ is equivalently $\id{\suc(i+(j+k))}{\suc((i+j)+k)}$. +But its input (the ``inductive hypothesis'') +\index{hypothesis!inductive}% +\index{inductive!hypothesis}% +yields $\id{i+(j+k)}{(i+j)+k}$, so it suffices to invoke the fact that if two natural numbers are equal, then so are their successors. +(We will prove this obvious fact in \cref{lem:map}, using the induction principle of identity types.) +We call this latter fact +$\apfunc{\suc} : %\prd{m,n:\nat} +(\id[\nat]{m}{n}) \to (\id[\nat]{\suc(m)}{\suc(n)})$, so we can define +\[\assoc_s(i,h,j,k) \defeq \apfunc{\suc}( %n+(j+k),(n+j)+k, +h(j,k)). \] +Putting these together with $\ind{\nat}$, we obtain a proof of associativity. + +\index{natural numbers|)}% + + +\section{Pattern matching and recursion} +\label{sec:pattern-matching} + +\index{pattern matching|(defstyle}% +\indexsee{matching}{pattern matching}% +\index{definition!by pattern matching|(}% +The natural numbers introduce an additional subtlety over the types considered up until now. +In the case of coproducts, for instance, we could define a function $f:A+B\to C$ either with the recursor: +\[ f \defeq \rec{A+B}(C, g_0, g_1) \] +or by giving the defining equations: +\begin{align*} + f(\inl(a)) &\defeq g_0(a)\\ + f(\inr(b)) &\defeq g_1(b). +\end{align*} +To go from the former expression of $f$ to the latter, we simply use the computation rules for the recursor. +Conversely, given any defining equations +\begin{align*} + f(\inl(a)) &\defeq \Phi_0\\ + f(\inr(b)) &\defeq \Phi_1 +\end{align*} +where $\Phi_0$ and $\Phi_1$ are expressions that may involve the variables +\index{variable}% +$a$ and $b$ respectively, we can express these equations equivalently in terms of the recursor by using $\lambda$-abstraction\index{lambda abstraction@$\lambda$-abstraction}: +\[ f\defeq \rec{A+B}(C, \lam{a} \Phi_0, \lam{b} \Phi_1).\] +In the case of the natural numbers, however, the ``defining equations'' of a function such as $\dbl$: +\begin{align} + \dbl(0) &\defeq 0 \label{eq:dbl0}\\ + \dbl(\suc(n)) &\defeq \suc(\suc(\dbl(n)))\label{eq:dblsuc} +\end{align} +involve \emph{the function $\dbl$ itself} on the right-hand side. +However, we would still like to be able to give these equations, rather than~\eqref{eq:dbl-as-rec}, as the definition of \dbl, since they are much more convenient and readable. +The solution is to read the expression ``$\dbl(n)$'' on the right-hand side of~\eqref{eq:dblsuc} as standing in for the result of the recursive call, which in a definition of the form $\dbl\defeq \rec{\nat}(\nat,c_0,c_s)$ would be the second argument of $c_s$. + +More generally, if we have a ``definition'' of a function $f:\nat\to C$ such as +\begin{align*} + f(0) &\defeq \Phi_0\\ + f(\suc(n)) &\defeq \Phi_s +\end{align*} +where $\Phi_0$ is an expression of type $C$, and $\Phi_s$ is an expression of type $C$ which may involve the variable $n$ and also the symbol ``$f(n)$'', we may translate it to a definition +\[ f \defeq \rec{\nat}(C,\,\Phi_0,\,\lam{n}{r} \Phi_s') \] +where $\Phi_s'$ is obtained from $\Phi_s$ by replacing all occurrences of ``$f(n)$'' by the new variable $r$. + +This style of defining functions by recursion (or, more generally, dependent functions by induction) is so convenient that we frequently adopt it. +It is called definition by \define{pattern matching}. +Of course, it is very similar to how a computer programmer may define a recursive function with a body that literally contains recursive calls to itself. +However, unlike the programmer, we are restricted in what sort of recursive calls we can make: in order for such a definition to be re-expressible using the recursion principle, the function $f$ being defined can only appear in the body of $f(\suc(n))$ as part of the composite symbol ``$f(n)$''. +Otherwise, we could write nonsense functions such as +\begin{align*} + f(0)&\defeq 0\\ + f(\suc(n)) &\defeq f(\suc(\suc(n))). +\end{align*} +If a programmer wrote such a function, it would simply call itself forever on any positive input, going into an infinite loop and never returning a value. +In mathematics, however, to be worthy of the name, a \emph{function} must always associate a unique output value to every input value, so this would be unacceptable. + +This point will be even more important when we introduce more complicated inductive types in \cref{cha:induction,cha:hits,cha:real-numbers}. +Whenever we introduce a new kind of inductive definition, we always begin by deriving its induction principle. +Only then do we introduce an appropriate sort of ``pattern matching'' which can be justified as a shorthand for the induction principle. + +\index{pattern matching|)}% +\index{definition!by pattern matching|)}% + +\section{Propositions as types} +\label{sec:pat} + +\index{proposition!as types|(defstyle}% +\index{logic!propositions as types|(}% +As mentioned in the introduction, to show that a proposition is true in type theory corresponds to exhibiting an element of the type corresponding to that proposition. +\index{evidence, of the truth of a proposition}% +\index{witness!to the truth of a proposition}% +\index{proof|(} +We regard the elements of this type as \emph{evidence} or \emph{witnesses} that the proposition is true. (They are sometimes even called \emph{proofs}, but this terminology can be misleading, so we generally avoid it.) +In general, however, we will not construct witnesses explicitly; instead we present the proofs in ordinary mathematical prose, in such a way that they could be translated into an element of a type. +This is no different from reasoning in classical set theory, where we don't expect to see an explicit derivation using the rules of predicate logic and the axioms of set theory. + +However, the type-theoretic perspective on proofs is nevertheless different in important ways. +The basic principle of the logic of type theory is that a proposition is not merely true or false, but rather can be seen as the collection of all possible witnesses of its truth. +Under this conception, proofs are not just the means by which mathematics is communicated, but rather are mathematical objects in their own right, on a par with more familiar objects such as numbers, mappings, groups, and so on. +Thus, since types classify the available mathematical objects and govern how they interact, propositions are nothing but special types --- namely, types whose elements are proofs. + +\index{propositional!logic}% +\index{logic!propositional}% +The basic observation which makes this identification feasible is that we have the following natural correspondence between \emph{logical} operations on propositions, expressed in English, and \emph{type-theoretic} operations on their corresponding types of witnesses. +\index{false}% +\index{true}% +\index{conjunction}% +\index{disjunction}% +\index{implication}% +\begin{center} +\medskip +\begin{tabular}{ll} + \toprule + English & Type Theory\\ + \midrule + True & $\unit$ \\ + False & $\emptyt$ \\ + $A$ and $B$ & $A \times B$ \\ + $A$ or $B$ & $A + B$ \\ + If $A$ then $B$ & $A \to B$ \\ + $A$ if and only if $B$ & $(A \to B) \times (B \to A)$ \\ + Not $A$ & $A \to \emptyt$ \\ + \bottomrule +\end{tabular} +\medskip +\end{center} + +The point of the correspondence is that in each case, the rules for constructing and using elements of the type on the right correspond to the rules for reasoning about the proposition on the left. +For instance, the basic way to prove a statement of the form ``$A$ and $B$'' is to prove $A$ and also prove $B$, while the basic way to construct an element of $A\times B$ is as a pair $(a,b)$, where $a$ is an element (or witness) of $A$ and $b$ is an element (or witness) of $B$. +And if we want to use ``$A$ and $B$'' to prove something else, we are free to use both $A$ and $B$ in doing so, analogously to how the induction principle for $A\times B$ allows us to construct a function out of it by using elements of $A$ and of $B$. + +Similarly, the basic way to prove an implication\index{implication} ``if $A$ then $B$'' is to assume $A$ and prove $B$, while the basic way to construct an element of $A\to B$ is to give an expression which denotes an element (witness) of $B$ which may involve an unspecified variable element (witness) of type $A$. +And the basic way to use an implication ``if $A$ then $B$'' is deduce $B$ if we know $A$, analogously to how we can apply a function $f:A\to B$ to an element of $A$ to produce an element of $B$. +We strongly encourage the reader to do the exercise of verifying that the rules governing the other type constructors translate sensibly into logic. + +Of special note is that the empty type $\emptyt$ corresponds to falsity.\index{false} +When speaking logically, we refer to an inhabitant of $\emptyt$ as a \define{contradiction}: +\indexdef{contradiction}% +thus there is no way to prove a contradiction,% +\footnote{More precisely, there is no \emph{basic} way to prove a contradiction, i.e.\ \emptyt has no constructors. +If our type theory were inconsistent, then there would be some more complicated way to construct an element of \emptyt.} +while from a contradiction anything can be derived. +We also define the \define{negation} +\indexdef{negation}% +of a type $A$ as +% +\begin{equation*} + \neg A \ \defeq\ A \to \emptyt. +\end{equation*} +% +Thus, a witness of $\neg A$ is a function $A \to \emptyt$, which we may construct by assuming $x : A$ and deriving an element of~$\emptyt$. +\index{proof!by contradiction}% +\index{logic!constructive vs classical} +Note that although the logic we obtain is ``constructive'', as discussed in the introduction, this sort of ``proof by contradiction'' (assume $A$ and derive a contradiction, concluding $\neg A$) is perfectly valid constructively: it is simply invoking the \emph{meaning} of ``negation''. +The sort of ``proof by contradiction'' which is disallowed is to assume $\neg A$ and derive a contradiction as a way of proving $A$. +Constructively, such an argument would only allow us to conclude $\neg\neg A$, and the reader can verify that there is no obvious way to get from $\neg\neg A$ (that is, from $(A\to \emptyt)\to\emptyt$) to $A$. + +\mentalpause + +The above translation of logical connectives into type-forming operations is referred to as \define{propositions as types}: it gives us a way to translate propositions and their proofs, written in English, into types and their elements. +For example, suppose we want to prove the following tautology (one of ``de Morgan's laws''): +\index{law!de Morgan's|(}% +\index{de Morgan's laws|(}% +\begin{equation}\label{eq:tautology1} + \text{\emph{``If not $A$ and not $B$, then not ($A$ or $B$)''}.} +\end{equation} +An ordinary English proof of this fact might go as follows. +\begin{quote} + Suppose not $A$ and not $B$, and also suppose $A$ or $B$; we will derive a contradiction. + There are two cases. + If $A$ holds, then since not $A$, we have a contradiction. + Similarly, if $B$ holds, then since not $B$, we also have a contradiction. + Thus we have a contradiction in either case, so not ($A$ or $B$). +\end{quote} +Now, the type corresponding to our tautology~\eqref{eq:tautology1}, according to the rules given above, is +\begin{equation}\label{eq:tautology2} + (A\to \emptyt) \times (B\to\emptyt) \to (A+B\to\emptyt) +\end{equation} +so we should be able to translate the above proof into an element of this type. + +As an example of how such a translation works, let us describe how a mathematician reading the English proof above might simultaneously construct, in their head, an element of~\eqref{eq:tautology2}. +The introductory phrase ``Suppose not $A$ and not $B$'' translates into defining a function, with an implicit application of the recursion principle for the cartesian product in its domain $(A\to\emptyt)\times (B\to\emptyt)$. +This introduces unnamed variables +\index{variable}% +(hypotheses) +\index{hypothesis}% +of types $A\to\emptyt$ and $B\to\emptyt$. +When translating into type theory, we have to give these variables names; let us call them $x$ and $y$. +At this point our partial definition of an element of~\eqref{eq:tautology2} can be written as +\[ f((x,y)) \defeq\; \Box\;:A+B\to\emptyt \] +with a ``hole'' $\Box$ of type $A+B\to\emptyt$ indicating what remains to be done. +(We could equivalently write $f \defeq \rec{(A\to\emptyt)\times (B\to\emptyt)}(A+B\to\emptyt,\lam{x}{y} \Box)$, using the recursor instead of pattern matching.) +The next phrase ``also suppose $A$ or $B$; we will derive a contradiction'' indicates filling this hole by a function definition, introducing another unnamed hypothesis $z:A+B$, leading to the proof state: +\[ f((x,y))(z) \defeq \;\Box\; :\emptyt. \] +Now saying ``there are two cases'' indicates a case split, i.e.\ an application of the recursion principle for the coproduct $A+B$. +If we write this using the recursor, it would be +\[ f((x,y))(z) \defeq \rec{A+B}(\emptyt,\lam{a} \Box,\lam{b}\Box,z) \] +while if we write it using pattern matching, it would be +\begin{align*} + f((x,y))(\inl(a)) &\defeq \;\Box\;:\emptyt\\ + f((x,y))(\inr(b)) &\defeq \;\Box\;:\emptyt. +\end{align*} +Note that in both cases we now have two ``holes'' of type $\emptyt$ to fill in, corresponding to the two cases where we have to derive a contradiction. +Finally, the conclusion of a contradiction from $a:A$ and $x:A\to\emptyt$ is simply application of the function $x$ to $a$, and similarly in the other case. +\index{application!of hypothesis or theorem}% +(Note the convenient coincidence of the phrase ``applying a function'' with that of ``applying a hypothesis'' or theorem.) +Thus our eventual definition is +\begin{align*} + f((x,y))(\inl(a)) &\defeq x(a)\\ + f((x,y))(\inr(b)) &\defeq y(b). +\end{align*} + +As an exercise, you should verify +the converse tautology \emph{``If not ($A$ or $B$), then (not $A$) and (not $B$)}'' by exhibiting an element of +\[ ((A + B) \to \emptyt) \to (A \to \emptyt) \times (B \to \emptyt), \] +for any types $A$ and $B$, using the rules we have just introduced. + +\index{logic!classical vs constructive|(} +However, not all classical\index{mathematics!classical} tautologies hold under this interpretation. +For example, the rule +\emph{``If not ($A$ and $B$), then (not $A$) or (not $B$)''} is not valid: we cannot, in general, construct an element of the corresponding type +\[ ((A \times B) \to \emptyt) \to (A \to \emptyt) + (B \to \emptyt).\] +This reflects the fact that the ``natural'' propositions-as-types logic of type theory is \emph{constructive}. +This means that it does not include certain classical principles, such as the law of excluded middle (\LEM{})\index{excluded middle} +or proof by contradiction,\index{proof!by contradiction} +and others which depend on them, such as this instance of de Morgan's law. +\index{law!de Morgan's|)}% +\index{de Morgan's laws|)}% + +Philosophically, constructive logic is so-called because it confines itself to constructions that can be carried out \emph{effectively}, which is to say those with a computational meaning. +Without being too precise, this means there is some sort of algorithm\index{algorithm} specifying, step-by-step, how to build an object (and, as a special case, how to see that a theorem is true). +This requires omission of \LEM{}, since there is no \emph{effective}\index{effective!procedure} procedure for deciding whether a proposition is true or false. + +The constructivity of type-theoretic logic means it has an intrinsic computational meaning, which is of interest to computer scientists. +It also means that type theory provides \emph{axiomatic freedom}.\index{axiomatic freedom} +For example, while by default there is no construction witnessing \LEM{}, the logic is still compatible with the existence of one (see \cref{sec:intuitionism}). +Thus, because type theory does not \emph{deny} \LEM{}, we may consistently add it as an assumption, and work conventionally without restriction. +In this respect, type theory enriches, rather than constrains, conventional mathematical practice. + +We encourage the reader who is unfamiliar with constructive logic to work through some more examples as a means of getting familiar with it. +See \cref{ex:tautologies,ex:not-not-lem} for some suggestions. +\index{logic!classical vs constructive|)} + +\mentalpause + +So far we have discussed only propositional logic. +\index{quantifier}% +\index{quantifier!existential}% +\index{quantifier!universal}% +\index{predicate!logic}% +\index{logic!predicate}% +Now we consider \emph{predicate} logic, where in addition to logical connectives like ``and'' and ``or'' we have quantifiers ``there exists'' and ``for all''. +In this case, types play a dual role: they serve as propositions and also as types in the conventional sense, i.e., domains we quantify over. +A predicate over a type $A$ is represented as a family $P : A \to \UU$, assigning to every element $a : A$ a type $P(a)$ corresponding to the proposition that $P$ holds for $a$. We now extend the above translation with an explanation of the quantifiers: +\begin{center} + \medskip + \begin{tabular}{ll} + \toprule + English & Type Theory\\ + \midrule + For all $x:A$, $P(x)$ holds & $\prd{x:A} P(x)$ \\ + There exists $x:A$ such that $P(x)$ & $\sm{x:A}$ $P(x)$ \\ + \bottomrule + \end{tabular} + \medskip +\end{center} +As before, we can show that tautologies of (constructive) predicate logic translate into inhabited types. +For example, \emph{If for all $x:A$, $P(x)$ and $Q(x)$ then (for all $x:A$, $P(x)$) and (for all $x:A$, $Q(x)$)} translates to +\[ (\tprd{x:A} P(x) \times Q(x)) \to (\tprd{x:A} P(x)) \times (\tprd{x:A} Q(x)). \] +An informal proof of this tautology might go as follows: +\begin{quote} + Suppose for all $x$, $P(x)$ and $Q(x)$. + First, we suppose given $x$ and prove $P(x)$. + By assumption, we have $P(x)$ and $Q(x)$, and hence we have $P(x)$. + Second, we suppose given $x$ and prove $Q(x)$. + Again by assumption, we have $P(x)$ and $Q(x)$, and hence we have $Q(x)$. +\end{quote} +The first sentence begins defining an implication as a function, by introducing a witness for its hypothesis:\index{hypothesis} +\[ f(p) \defeq \;\Box\; : (\tprd{x:A} P(x)) \times (\tprd{x:A} Q(x)). \] +At this point there is an implicit use of the pairing constructor to produce an element of a product type, which is somewhat signposted in this example by the words ``first'' and ``second'': +\[ f(p) \defeq \Big( \;\Box\; : \tprd{x:A} P(x) \;,\; \Box\; : \tprd{x:A}Q(x) \;\Big). \] +The phrase ``we suppose given $x$ and prove $P(x)$'' now indicates defining a \emph{dependent} function in the usual way, introducing a variable +\index{variable}% +for its input. +Since this is inside a pairing constructor, it is natural to write it as a $\lambda$-abstraction\index{lambda abstraction@$\lambda$-abstraction}: +\[ f(p) \defeq \Big( \; \lam{x} \;\big(\Box\; : P(x)\big) \;,\; \Box\; : \tprd{x:A}Q(x) \;\Big). \] +Now ``we have $P(x)$ and $Q(x)$'' invokes the hypothesis, obtaining $p(x) : P(x)\times Q(x)$, and ``hence we have $P(x)$'' implicitly applies the appropriate projection: +\[ f(p) \defeq \Big( \; \lam{x} \proj1(p(x)) \;,\; \Box\; : \tprd{x:A}Q(x) \;\Big). \] +The next two sentences fill the other hole in the obvious way: +\[ f(p) \defeq \Big( \; \lam{x} \proj1(p(x)) \;,\; \lam{x} \proj2(p(x)) \; \Big). \] +Of course, the English proofs we have been using as examples are much more verbose than those that mathematicians usually use in practice; they are more like the sort of language one uses in an ``introduction to proofs'' class. +The practicing mathematician has learned to fill in the gaps, so in practice we can omit plenty of details, and we will generally do so. +The criterion of validity for proofs, however, is always that they can be translated back into the construction of an element of the corresponding type. + +\symlabel{leq-nat}% +As a more concrete example, consider how to define inequalities of natural numbers. +One natural definition is that $n\le m$ if there exists a $k:\nat$ such that $n+k=m$. +(This uses again the identity types that we will introduce in the next section, but we will not need very much about them.) +Under the propositions-as-types translation, this would yield: +\[ (n\le m) \defeq \sm{k:\nat} (\id{n+k}{m}). \] +The reader is invited to prove the familiar properties of $\le$ from this definition. +For strict inequality, there are a couple of natural choices, such as +\[ (n 0 }$ the type of positive rational numbers. + +\section{Dedekind reals} +\label{sec:dedekind-reals} + +\index{real numbers!Dedekind|(}% +Let us first recall the basic idea of Dedekind's construction. We use two-sided Dedekind +cuts, as opposed to an often used one-sided version, because the symmetry makes +constructions more elegant, and it works constructively as well as classically. +\index{mathematics!constructive}% +A \emph{Dedekind cut}\index{cut!Dedekind} consists of a pair $(L, U)$ of subsets $L, U \subseteq \Q$, called the +\emph{lower} and \emph{upper cut} respectively, which are: +% +\begin{enumerate} +\item \emph{inhabited:} there are $q \in L$ and $r \in U$, +\item \emph{rounded:} $q \in L \Leftrightarrow \exis {r \in \Q} q < r \land r \in L$ + and $r \in U \Leftrightarrow \exis {q \in \Q} q \in U \land q < r$, + \index{rounded!Dedekind cut} +\item \emph{disjoint:} $\lnot (q \in L \land q \in U)$, and +\item \emph{located:} $q < r \Rightarrow q \in L \lor r \in U$. + \index{locatedness}% +\end{enumerate} +% +Reading the roundedness condition from left to right tells us that cuts are \emph{open}, +\index{open!cut}% +and from right to left that they are \emph{lower}, respectively \emph{upper}, sets. The +locatedness condition states that there is no large gap between $L$ and $U$. Because cuts +are always open, they never include the ``point in between'', even when it is rational. A +typical Dedekind cut looks like this: +% +\begin{center} + \begin{tikzpicture}[x=\textwidth] + \draw[<-),line width=0.75pt] (0,0) -- (0.297,0) node[anchor=south east]{$L\ $}; + \draw[(->,line width=0.75pt] (0.300, 0) node[anchor=south west]{$\ U$} -- (0.9, 0) ; + \end{tikzpicture} +\end{center} +% +We might naively translate the informal definition into type theory by saying that a cut +is a pair of maps $L, U : \Q \to \prop$. But we saw in \cref{subsec:prop-subsets} that +$\prop$ is an ambiguous\index{typical ambiguity} notation for $\prop_{\UU_i}$ where~$\UU_i$ is a universe. Once we +use a particular $\UU_i$ to define cuts, the type of reals will reside in the next +universe $\UU_{i+1}$, a property of reals two levels higher in $\UU_{i+2}$, a property of +subsets of reals in $\UU_{i+3}$, etc. In principle we should be able to keep track of the +universe levels\index{universe level}, especially with the help of a proof assistant, but doing so here would +just burden us with bureaucracy that we prefer to avoid. We shall therefore make a +simplifying assumption that a single type of propositions $\Omega$ is sufficient for all +our purposes. + +In fact, the construction of the Dedekind reals is quite resilient to logical +manipulations. There are several ways in which we can make sense of using a single type +$\Omega$: +% +\begin{enumerate} + +\item We could identify $\Omega$ with the ambiguous $\prop$ and track all the universes + that appear in definitions and constructions. + +\item We could assume the propositional resizing axiom, + \index{propositional!resizing}% + as in \cref{subsec:prop-subsets}, which essentially collapses the $\prop_{\UU_i}$'s to the + lowest level\index{universe level}, which we call $\Omega$. + +\item A classical mathematician who is not interested in the intricacies of type-theoretic + universes or computation may simply assume the law of excluded middle~\eqref{eq:lem} for + mere propositions so that $\Omega \jdeq \bool$. + \index{excluded middle} + This not only eradicates questions about + levels\index{universe level} of $\prop$, but also turns everything we do into the standard classical\index{mathematics!classical} + construction of real numbers. + +\item On the other end of the spectrum one might ask for a minimal requirement that makes + the constructions work. The condition that a mere predicate be a Dedekind cut is + expressible using only conjunctions, disjunctions, and existential quantifiers\index{quantifier!existential} over~\Q, which + is a countable set. Thus we could take $\Omega$ to be the initial \emph{$\sigma$-frame}, + \index{initial!sigma-frame@$\sigma$-frame}% + \index{sigma-frame@$\sigma$-frame!initial|defstyle}% + i.e., a lattice\index{lattice} with countable joins\index{join!in a lattice} in which binary meets distribute over countable + joins. (The initial $\sigma$-frame cannot be the two-point lattice $\bool$ because + $\bool$ is not closed under countable joins, unless we assume excluded middle.) This + would lead to a construction of~$\Omega$ as a higher inductive-inductive type, but one + experiment of this kind in \cref{sec:cauchy-reals} is enough. +\end{enumerate} + +In all of the above cases $\Omega$ is a set. +% +Without further ado, we translate the informal definition into type theory. +Throughout this chapter, we use the +logical notation from \cref{defn:logical-notation}. + +\begin{defn} \label{defn:dedekind-reals} + A \define{Dedekind cut} + \indexsee{Dedekind!cut}{cut, Dedekind}% + \indexdef{cut!Dedekind}% + is a pair $(L, U)$ of mere predicates $L : \Q \to \Omega$ and $U + : \Q \to \Omega$ which is: + % + \begin{enumerate} + \item \label{defn:dedekind-reals-inhabited} + \emph{inhabited (i.e., bounded):} $\exis{q : \Q} L(q)$ and $\exis{r : \Q} U(r)$, + \item \emph{rounded:} for all $q, r : \Q$, + \index{rounded!Dedekind cut} + % + \begin{align*} + L(q) &\Leftrightarrow \exis{r : \Q} (q < r) \land L(r) + \qquad\text{and}\\ + U(r) &\Leftrightarrow \exis{q : \Q} (q < r) \land U(q), + \end{align*} + \item \emph{disjoint:} $\lnot (L(q) \land U(q))$ for all $q : \Q$, + \item \emph{located:} $(q < r) \Rightarrow L(q) \lor U(r)$ for all $q, r : \Q$. + \index{locatedness}% + \end{enumerate} + % + We let $\dcut(L, U)$ denote the conjunction of these conditions. The type of + \define{Dedekind reals} is + \indexsee{Dedekind!real numbers}{real numbers, De\-de\-kind}% + \indexdef{real numbers!Dedekind}% + % + \begin{equation*} + \RD \defeq \setof{ (L, U) : (\Q \to \Omega) \times (\Q \to \Omega) | \dcut(L,U)}. + \end{equation*} +\end{defn} + +It is apparent that $\dcut(L, U)$ is a mere proposition, and since $\Q \to \Omega$ is a +set the Dedekind reals form a set too. See +\cref{ex:RD-extended-reals,ex:RD-lower-cuts,ex:RD-interval-arithmetic} for variants of +Dedekind cuts which lead to extended reals, lower and upper reals, and the interval +domain. + +There is an embedding $\Q \to \RD$ which associates with each rational $q : \Q$ the cut +$(L_q, U_q)$ where +% +\begin{equation*} + L_q(r) \defeq (r < q) + \qquad\text{and}\qquad + U_q(r) \defeq (q < r). +\end{equation*} +% +We shall simply write $q$ for the cut $(L_q, U_q)$ associated with a rational number. + +\subsection{The algebraic structure of Dedekind reals} +\label{sec:algebr-struct-dedek} + +The construction of the algebraic and order-theoretic structure of Dedekind reals proceeds +as usual in intuitionistic logic. Rather than dwelling on details we point out the +differences between the classical\index{mathematics!classical} and intuitionistic setup. Writing $L_x$ and $U_x$ for +the lower and upper cut of a real number $x : \RD$, we define addition as% +% +\indexdef{addition!of Dedekind reals}% +\begin{align*} + L_{x + y}(q) &\defeq \exis{r, s : \Q} L_x(r) \land L_y(s) \land q = r + s, \\ + U_{x + y}(q) &\defeq \exis{r, s : \Q} U_x(r) \land U_y(s) \land q = r + s, +\end{align*} +% +and the additive inverse by +% +\begin{align*} + L_{-x}(q) &\defeq \exis{r : \Q} U_x(r) \land q = - r, \\ + U_{-x}(q) &\defeq \exis{r : \Q} L_x(r) \land q = - r. +\end{align*} +% +With these operations $(\RD, 0, {+}, {-})$ is an abelian\index{group!abelian} group. Multiplication is a bit +more cumbersome: +% +\indexdef{multiplication!of Dedekind reals}% +\begin{align*} + L_{x \cdot y}(q) &\defeq + \begin{aligned}[t] + \exis{a, b, c, d : \Q} & L_x(a) \land U_x(b) \land L_y(c) \land U_y(d) \land {}\\ + & \qquad q < \min (a \cdot c, a \cdot d, b \cdot c, b \cdot d), + \end{aligned} \\ + U_{x \cdot y}(q) &\defeq + \begin{aligned}[t] + \exis{a, b, c, d : \Q} & L_x(a) \land U_x(b) \land L_y(c) \land U_y(d) \land {}\\ + & \qquad \max (a \cdot c, a \cdot d, b \cdot c, b \cdot d) < q. + \end{aligned} +\end{align*} +% +\index{interval!arithmetic}% +These formulas are related to multiplication of intervals in interval arithmetic, where +intervals $[a,b]$ and $[c,d]$ with rational endpoints multiply to the interval +% +\begin{equation*} + [a,b] \cdot [c,d] = + [\min(a c, a d, b c, b d), \max(a c, a d, b c, b d)]. +\end{equation*} +% +For instance, the formula for the lower cut can be read as saying that $q < x \cdot y$ +when there are intervals $[a,b]$ and $[c,d]$ containing $x$ and $y$, respectively, such +that $q$ is to the left of $[a,b] \cdot [c,d]$. It is generally useful to think of an +interval $[a,b]$ such that $L_x(a)$ and $U_x(b)$ as an approximation of~$x$, see +\cref{ex:RD-interval-arithmetic}. + +We now have a commutative ring\index{ring} with unit +\index{unit!of a ring}% +$(\RD, 0, 1, {+}, {-}, {\cdot})$. To treat +multiplicative inverses, we must first introduce order. Define $\leq$ and $<$ as +% +\begin{align*} + (x \leq y) &\ \defeq \ \fall{q : \Q} L_x(q) \Rightarrow L_y(q), \\ + (x < y) &\ \defeq \ \exis{q : \Q} U_x(q) \land L_y(q). +\end{align*} + +\begin{lem} \label{dedekind-in-cut-as-le} + For all $x : \RD$ and $q : \Q$, $L_x(q) \Leftrightarrow (q < x)$ and $U_x(q) + \Leftrightarrow (x < q)$. +\end{lem} + +\begin{proof} + If $L_x(q)$ then by roundedness there merely is $r > q$ such that $L_x(r)$, and since + $U_q(r)$ it follows that $q < x$. Conversely, if $q < x$ then there is $r : \Q$ such + that $U_q(r)$ and $L_x(r)$, hence $L_x(q)$ because $L_x$ is a lower set. The other half + of the proof is symmetric. +\end{proof} + +\index{partial order}% +\index{transitivity!of . for reals@of $<$ for reals} +\index{transitivity!of . for reals@of $\leq$ for reals} +\index{relation!irreflexive} +\index{irreflexivity!of . for reals@of $<$ for reals} +The relation $\leq$ is a partial order, and $<$ is transitive and irreflexive. Linearity +\index{order!linear}% +\index{linear order}% +% +\begin{equation*} + (x < y) \lor (y \leq x) +\end{equation*} +% +is valid if we assume excluded middle, but without it we get weak linearity +% +\index{order!weakly linear} +\index{weakly linear order} +\begin{equation} \label{eq:RD-linear-order} + (x < y) \Rightarrow (x < z) \lor (z < y). +\end{equation} +% +At first sight it might not be clear what~\eqref{eq:RD-linear-order} has to do with +linear order. But if we take $x \jdeq u - \epsilon$ and $y \jdeq u + \epsilon$ for +$\epsilon > 0$, then we get +% +\begin{equation*} + (u - \epsilon < z) \lor (z < u + \epsilon). +\end{equation*} +% +This is linearity ``up to a small numerical error'', i.e., since it is unreasonable to +expect that we can actually compute with infinite precision, we should not be surprised +that we can decide~$<$ only up to whatever finite precision we have computed. + +To see that~\eqref{eq:RD-linear-order} holds, suppose $x < y$. Then there merely exists $q : \Q$ such that $U_x(q)$ and +$L_y(q)$. By roundedness there merely exist $r, s : \Q$ such that $r < q < s$, $U_x(r)$ +and $L_y(s)$. Then, by locatedness $L_z(r)$ or $U_z(s)$. In the first case we get $x < z$ +and in the second $z < y$. + +Classically, multiplicative inverses exist for all numbers which are different from zero. +However, without excluded middle, a stronger condition is required. Say that $x, y : \RD$ +are \define{apart} +\indexdef{apartness}% +from each other, written $x \apart y$, when $(x < y) \lor (y < x)$: +% +\symlabel{apart} +\begin{equation*} + (x \apart y) \defeq (x < y) \lor (y < x). +\end{equation*} +% +If $x \apart y$, then $\lnot (x = y)$. +The converse is true if we assume excluded middle, but is not provable constructively. +\index{mathematics!constructive}% +Indeed, if $\lnot (x = y)$ implies $x\apart y$, then a little bit of excluded middle follows; see \cref{ex:reals-apart-neq-MP}. + +\begin{thm} \label{RD-inverse-apart-0} + A real is invertible if, and only if, it is apart from $0$. +\end{thm} + +\begin{rmk} + We observe that a real is invertible if, and only if, it is merely + invertible. Indeed, the same is true in any ring,\index{ring} since a ring is a set, and + multiplicative inverses are unique if they exist. See the discussion + following \cref{cor:UC}. +\end{rmk} + +\begin{proof} + Suppose $x \cdot y = 1$. Then there merely exist $a, b, c, d : \Q$ such that + $a < x < b$, $c < y < d$ and $0 < \min (a c, a d, b c, b d)$. From $0 < a c$ and $0 < b c$ it follows + that $a$, $b$, and $c$ are either all positive or all negative. + Hence either $0 < a < x$ or $x < b < 0$, so that $x \apart 0$. + + Conversely, if $x \apart 0$, then either $x > 0$ or $x < 0$. + If $x > 0$, we define $x^{-1}$ as follows: + % + \begin{align*} + L_{x^{-1}}(q) &\defeq + (q > 0) \Rightarrow \exis{r : \Q} U_x(r) \land (q r < 1), + \\ + U_{x^{-1}}(q) &\defeq + (q > 0) \land \exis{r : \Q} L_x(r) \land (q r > 1). + \end{align*} + % + If $x < 0$, then we define it by + % + \begin{align*} + L_{x^{-1}}(q) &\defeq + (q < 0) \land \exis{r : \Q} U_x(r) \land (q r > 1), + \\ + U_{x^{-1}}(q) &\defeq + (q < 0) \Rightarrow \exis{r : \Q} L_x(r) \land (q r < 1). \qedhere + \end{align*} +\end{proof} + +\index{ordered field!archimedean}% +\index{dense}% +\indexsee{order-dense}{dense}% +The archimedean principle can be stated in several ways. We find it most illuminating in the +form which says that $\Q$ is dense in $\RD$. + +\begin{thm}[Archimedean principle for $\RD$] \label{RD-archimedean} + % + For all $x, y : \RD$ if $x < y$ then there merely exists $q : \Q$ such that + $x < q < y$. +\end{thm} + +\begin{proof} + By definition of $<$. +\end{proof} + +Before tackling completeness of Dedekind reals, let us state precisely what algebraic +structure they possess. In the following definition we are not aiming at a minimal +axiomatization, but rather at a useful amount of structure and properties. + +\begin{defn} \label{ordered-field} An \define{ordered field} + \indexdef{ordered field}% + \indexsee{field!ordered}{ordered field}% + is a set $F$ together with + constants $0$, $1$, operations $+$, $-$, $\cdot$, $\min$, $\max$, and mere relations + $\leq$, $<$, $\apart$ such that: + % + \begin{enumerate} + \item $(F, 0, 1, {+}, {-}, {\cdot})$ is a commutative ring with unit; + \index{unit!of a ring}% + \index{ring}% + \item $x : F$ is invertible if, and only if, $x \apart 0$; + \item $(F, {\leq}, {\min}, {\max})$ is a lattice; + \item the strict order $<$ is transitive, irreflexive, + \index{relation!irreflexive} + \index{irreflexivity!of . in a field@of $<$ in a field}% + and weakly linear ($x < y \Rightarrow x < z \lor z < y$);\index{transitivity!of . in a field@of $<$ in a field} + \index{order!weakly linear} + \index{weakly linear order} + \index{strict!order}% + \index{order!strict}% + \item apartness $\apart$ is irreflexive, symmetric and cotransitive ($x \apart y \Rightarrow x \apart z \lor y \apart z$); + \index{relation!irreflexive} + \index{irreflexivity!of apartness}% + \indexdef{relation!cotransitive}% + \index{cotransitivity of apartness}% + \item for all $x, y, z : F$: + % + \begin{align*} + x \leq y &\Leftrightarrow \lnot (y < x), & + x < y \leq z &\Rightarrow x < z, \\ + x \apart y &\Leftrightarrow (x < y) \lor (y < x), & + x \leq y < z &\Rightarrow x < z, \\ + x \leq y &\Leftrightarrow x + z \leq y + z, & + x \leq y \land 0 \leq z &\Rightarrow x z \leq y z, \\ + x < y &\Leftrightarrow x + z < y + z, & + 0 < z \Rightarrow (x < y &\Leftrightarrow x z < y z), \\ + 0 < x + y &\Rightarrow 0 < x \lor 0 < y, & + 0 &< 1. + \end{align*} + \end{enumerate} + % + Every such field has a canonical embedding $\Q \to F$. An ordered field is + \define{archimedean} + \indexdef{ordered field!archimedean}% + \indexsee{archimedean property}{ordered field, archi\-mede\-an}% + when for all $x, y : F$, if $x < y$ then there merely exists $q : + \Q$ such that $x < q < y$. +\end{defn} + +\begin{thm} \label{RD-archimedean-ordered-field} + The Dedekind reals form an ordered archimedean field. +\end{thm} + +\begin{proof} + We omit the proof in the hope that what we have demonstrated so far makes the theorem + plausible. +\end{proof} + +\subsection{Dedekind reals are Cauchy complete} +\label{sec:RD-cauchy-complete} + +Recall that $x : \N \to \Q$ is a \emph{Cauchy sequence}\indexdef{Cauchy!sequence} when it satisfies +% +\begin{equation} \label{eq:cauchy-sequence} + \prd{\epsilon : \Qp} \sm{n : \N} \prd{m, k \geq n} |x_m - x_k| < \epsilon. +\end{equation} +% +Note that we did \emph{not} truncate the inner existential because we actually want to +compute rates of convergence --- an approximation without an error estimate carries little +useful information. By \cref{thm:ttac}, \eqref{eq:cauchy-sequence} yields a function $M +: \Qp \to \N$, called the \emph{modulus of convergence}\indexdef{modulus!of convergence}, such that $m, k \geq M(\epsilon)$ +implies $|x_m - x_k| < \epsilon$. From this we get $|x_{M(\delta/2)} - x_{M(\epsilon/2)}|< +\delta + \epsilon$ for all $\delta, \epsilon : \Qp$. In fact, the map $(\epsilon \mapsto +x_{M(\epsilon/2)}) : \Qp \to \Q$ carries the same information about the limit as the +original Cauchy condition~\eqref{eq:cauchy-sequence}. We shall work with these +approximation functions rather than with Cauchy sequences. + +\begin{defn} \label{defn:cauchy-approximation} + A \define{Cauchy approximation} + \indexdef{Cauchy!approximation}% + is a map $x : \Qp \to \RD$ which satisfies + % + \begin{equation} + \label{eq:cauchy-approx} + \fall{\delta, \epsilon :\Qp} |x_\delta - x_\epsilon| < \delta + \epsilon. + \end{equation} + % + The \define{limit} + \index{limit!of a Cauchy approximation}% + of a Cauchy approximation $x : \Qp \to \RD$ is a number $\ell : \RD$ such + that + % + \begin{equation*} + \fall{\epsilon, \theta : \Qp} |x_\epsilon - \ell| < \epsilon + \theta. + \end{equation*} +\end{defn} + +\begin{thm} \label{RD-cauchy-complete} + Every Cauchy approximation in $\RD$ has a limit. +\end{thm} + +\begin{proof} + Note that we are showing existence, not mere existence, of the limit. + Given a Cauchy approximation $x : \Qp \to \RD$, define + % + \begin{align*} + L_y(q) &\defeq \exis{\epsilon, \theta : \Qp} L_{x_\epsilon}(q + \epsilon + \theta),\\ + U_y(q) &\defeq \exis{\epsilon, \theta : \Qp} U_{x_\epsilon}(q - \epsilon - \theta). + \end{align*} + % + It is clear that $L_y$ and $U_y$ are inhabited and rounded. Disjointness follows from + the Cauchy approximation condition. To establish locatedness, consider any + $q, r : \Q$ such that $q < r$. There is $\epsilon : \Qp$ such that + $4 \epsilon < r - q$. Since $q + 2 \epsilon < r - 2 \epsilon$ merely + $L_{x_\epsilon}(q + 2 \epsilon)$ or $U_{x_\epsilon}(r - 2 \epsilon)$. In the first case + we have $L_y(q)$ and in the second $U_y(r)$. + + To show that $y$ is the limit of $x$, consider any $\epsilon, \theta : \Qp$. Because + $\Q$ is dense in $\RD$ there merely exist $q, r : \Q$ such that + % + \begin{narrowmultline*} + x_\epsilon - \epsilon - \theta < q < x_\epsilon - \epsilon - \theta/2 + < x_\epsilon < \\ + x_\epsilon + \epsilon + \theta/2 < r < x_\epsilon + \epsilon + \theta, + \end{narrowmultline*} + % + and thus $q < y < r$. It follows that $|y - x_\epsilon| < \epsilon + \theta$. +\end{proof} + +For sake of completeness we record the classic formulation as well. + +\begin{cor} + Suppose $x : \N \to \RD$ satisfies the Cauchy condition~\eqref{eq:cauchy-sequence}. Then + there exists $y : \RD$ such that + % + \begin{equation*} + \prd{\epsilon : \Qp} \sm{n : \N} \prd{m \geq n} |x_m - y| < \epsilon. + \end{equation*} +\end{cor} + +\begin{proof} + By \cref{thm:ttac} there is $M : \Qp \to \N$ such that $\bar{x}(\epsilon) \defeq + x_{M(\epsilon/2)}$ is a Cauchy approximation. Let $y$ be its limit, which exists by + \cref{RD-cauchy-complete}. Given any $\epsilon : \Qp$, let $n \defeq M(\epsilon/4)$ + and observe that, for any $m \geq n$, + % + \begin{narrowmultline*} + |x_m - y| \leq |x_m - x_n| + |x_n - y| = + |x_m - x_n| + |\bar{x}(\epsilon/2) - y| < \narrowbreak + \epsilon/4 + \epsilon/2 + \epsilon/4 = \epsilon.\qedhere + \end{narrowmultline*} +\end{proof} + +\subsection{Dedekind reals are Dedekind complete} +\label{sec:RD-dedekind-complete} + +We obtained $\RD$ as the type of Dedekind cuts on $\Q$. But we could have instead started +with any archimedean ordered field $F$ and constructed Dedekind cuts\index{cut!Dedekind} on $F$. These would +again form an archimedean ordered field $\bar{F}$, the \define{Dedekind completion of $F$},% +\index{completion!Dedekind}% +\indexsee{Dedekind!completion}{completion, Dedekind} +with $F$ contained as a subfield. What happens if we apply this construction to +$\RD$, do we get even more real numbers? The answer is negative. In fact, we shall prove a +stronger result: $\RD$ is final. + +Say that an ordered field~$F$ is \define{admissible for $\Omega$} +\indexsee{admissible!ordered field}{ordered field, admissible}% +\indexdef{ordered field!admissible}% +when the strict order +$<$ on~$F$ is a map ${<} : F \to F \to \Omega$. + +\begin{thm} \label{RD-final-field} + Every archimedean ordered field which is admissible for $\Omega$ is a subfield of~$\RD$. +\end{thm} + +\begin{proof} + Let $F$ be an archimedean ordered field. For every $x : F$ define $L_x, U_x : \Q \to + \Omega$ by + % + \begin{equation*} + L_x(q) \defeq (q < x) + \qquad\text{and}\qquad + U_x(q) \defeq (x < q). + \end{equation*} + % + (We have just used the assumption that $F$ is admissible for $\Omega$.) + Then $(L_x, U_x)$ is a Dedekind cut.\index{cut!Dedekind} Indeed, the cuts are inhabited and rounded because + $F$ is archimedean and $<$ is transitive, disjoint because $<$ is irreflexive, and + located because $<$ is a weak linear order. Let $e : F \to \RD$ be the map $e(x) \defeq (L_x, + U_x)$. + + We claim that $e$ is a field embedding which preserves and reflects the order. First of + all, notice that $e(q) = q$ for a rational number $q$. Next we have the equivalences, + for all $x, y : F$, + % + \begin{narrowmultline*} + x < y \Leftrightarrow + (\exis{q : \Q} x < q < y) \Leftrightarrow \narrowbreak + (\exis{q : \Q} U_x(q) \land L_y(q)) \Leftrightarrow + e(x) < e(y), + \end{narrowmultline*} + % + so $e$ indeed preserves and reflects the order. That $e(x + y) = e(x) + e(y)$ holds + because, for all $q : \Q$, + % + \begin{equation*} + q < x + y \Leftrightarrow + \exis{r, s : \Q} r < x \land s < y \land q = r + s. + \end{equation*} + % + The implication from right to left is obvious. For the other direction, if $q < x + + y$ then there merely exists $r : \Q$ such that $q - y < r < x$, and by taking $s \defeq + q - r$ we get the desired $r$ and $s$. We leave preservation of multiplication by $e$ as + an exercise. +\end{proof} + +To establish that the Dedekind cuts on $\RD$ do not give us anything new, we need just one +more lemma. + +\begin{lem} \label{lem:cuts-preserve-admissibility} + If $F$ is admissible for $\Omega$ then so is its Dedekind completion. + \index{completion!Dedekind}% +\end{lem} + +\begin{proof} + Let $\bar{F}$ be the Dedekind completion of $F$. The strict order on $\bar{F}$ is + defined by + % + \begin{equation*} + ((L,U) < (L',U')) \defeq \exis{q : \Q} U(q) \land L'(q). + \end{equation*} + % + Since $U(q)$ and $L'(q)$ are elements of $\Omega$, the lemma holds as long as $\Omega$ + is closed under conjunctions and countable existentials, which we assumed from the outset. +\end{proof} + + +\begin{cor} \label{RD-dedekind-complete} + % + \indexdef{complete!ordered field, Dedekind}% + \indexdef{Dedekind!completeness}% + The Dedekind reals are Dedekind complete: for every real-valued Dedekind cut $(L, U)$ + there is a unique $x : \RD$ such that $L(y) = (y < x)$ and $U(y) = (x < y)$ for all $y : + \RD$. +\end{cor} + +\begin{proof} + By \cref{lem:cuts-preserve-admissibility} the Dedekind completion $\barRD$ of $\RD$ + is admissible for $\Omega$, so by \cref{RD-final-field} we have an embedding $\barRD + \to \RD$, as well as an embedding $\RD \to \barRD$. But these embeddings must be + isomorphisms, because their compositions are order-preserving field homomorphisms\index{homomorphism!field} which + fix the dense subfield~$\Q$, which means that they are the identity. The corollary now + follows immediately from the fact that $\barRD \to \RD$ is an isomorphism. +\end{proof} + +\index{real numbers!Dedekind|)}% + +\section{Cauchy reals} +\label{sec:cauchy-reals} + +\index{real numbers!Cauchy|(}% +\index{completion!Cauchy|(}% +\indexsee{Cauchy!completion}{completion, Cauchy}% +The Cauchy reals are, by intent, the completion of \Q under limits of Cauchy sequences.\index{Cauchy!sequence} +In the classical construction of the Cauchy reals, we consider the set $\mathcal{C}$ of all Cauchy sequences in \Q and then form a suitable quotient $\mathcal{C}/{\approx}$. +Then, to show that $\mathcal{C}/{\approx}$ is Cauchy complete, we consider a Cauchy sequence $x : \N \to \mathcal{C}/{\approx}$, lift it to a sequence of sequences $\bar{x} : \N \to \mathcal{C}$, and construct the limit of $x$ using $\bar{x}$. However, the lifting of~$x$ to $\bar{x}$ uses +the axiom of countable choice (the instance of~\eqref{eq:ac} where $X=\N$) or the law of excluded middle, which we may wish to avoid. +\indexdef{axiom!of choice!countable}% +Every construction of reals whose last step is a quotient suffers from this deficiency. +There are three common ways out of the conundrum in constructive mathematics: +\index{mathematics!constructive}% +% +\index{bargaining}% +\begin{enumerate} +\item Pretend that the reals are a setoid $(\mathcal{C}, {\approx})$, i.e., the type of + Cauchy sequences $\mathcal{C}$ with a coincidence\index{coincidence, of Cauchy approximations} relation attached to it by + administrative decree. A sequence of reals then simply \emph{is} a sequence of Cauchy + sequences representing them. +\item Give in to temptation and accept the axiom of countable choice. After all, the axiom + is valid in most models of constructive mathematics based on a computational viewpoint, + such as realizability models. +\item Declare the Cauchy reals unworthy and construct the Dedekind reals instead. + Such a verdict is perfectly valid in certain contexts, such as in sheaf-theoretic models of constructive mathematics. + However, as we saw in \cref{sec:dedekind-reals}, the constructive Dedekind reals have their own problems. +\end{enumerate} + +Using higher inductive types, however, there is a fourth solution, which we believe to be preferable to any of the above, and interesting even to a classical mathematician. +The idea is that the Cauchy real numbers should be the \emph{free complete metric space}\index{free!complete metric space} generated by~\Q. +In general, the construction of a free gadget of any sort requires applying the gadget operations repeatedly many times to the generators. +For instance, the elements of the free group on a set $X$ are not just binary products and inverses of elements of $X$, but words obtained by iterating the product and inverse constructions. +Thus, we might naturally expect the same to be true for Cauchy completion, with the relevant ``operation'' being ``take the limit of a Cauchy sequence''. +(In this case, the iteration would have to take place transfinitely, since even after infinitely many steps there will be new Cauchy sequences to take the limit of.) + +The argument referred to above shows that if excluded middle or countable choice hold, then Cauchy completion is very special: when building the completion of a space, it suffices to stop applying the operation after \emph{one step}. +This may be regarded as analogous to the fact that free monoids and free groups can be given explicit descriptions in terms of (reduced) words. +However, we saw in \cref{sec:free-algebras} that higher inductive types allow us to construct free gadgets \emph{directly}, whether or not there is also an explicit description available. +In this section we show that the same is true for the Cauchy reals (a similar technique would construct the Cauchy completion of any metric space; see \cref{ex:metric-completion}). +Specifically, higher inductive types allow us to \emph{simultaneously} add limits of Cauchy sequences and quotient by the coincidence relation, so that we can avoid the problem of lifting a sequence of reals to a sequence of representatives. +\index{completion!Cauchy|)}% + + +\subsection{Construction of Cauchy reals} +\label{sec:constr-cauchy-reals} + +The construction of the Cauchy reals $\RC$ as a higher inductive type is a bit more subtle than that of the free algebraic structures considered in \cref{sec:free-algebras}. +We intend to include a ``take the limit'' constructor whose input is a Cauchy sequence of reals, but the notion of ``Cauchy sequence of reals'' depends on having some way to measure the ``distance'' between real numbers. +In general, of course, the distance between two real numbers will be another real number, leading to a potentially problematic circularity. + +However, what we actually need for the notion of Cauchy sequence of reals is not the general notion of ``distance'', but a way to say that ``the distance\index{distance} between two real numbers is less than $\epsilon$'' for any $\epsilon:\Qp$. +This can be represented by a family of binary relations, which we will denote $\mathord{\close\epsilon} : \RC\to\RC\to \prop$. +The intended meaning of $x \close\epsilon y$ is $|x - y| < \epsilon$, but since we do not have notions of subtraction, absolute value, or inequality available yet (we are only just defining $\RC$, after all), we will have to define these relations $\close\epsilon$ at the same time as we define $\RC$ itself. +And since $\close\epsilon$ is a type family indexed by two copies of $\RC$, we cannot do this with an ordinary mutual (higher) inductive definition; instead we have to use a \emph{higher inductive-inductive definition}. +\index{inductive-inductive type!higher} + +Recall from \cref{sec:generalizations} that the ordinary notion of inductive-inductive definition allows us to define a type and a type family indexed by it by simultaneous induction. +Of course, the ``higher'' version of this allows both the type and the family to have path constructors as well as point constructors. +We will not attempt to formulate any general theory of higher inductive-inductive definitions, but hopefully the description we will give of $\RC$ and $\close\epsilon$ will make the idea transparent. + +\begin{rmk} + We might also consider a \emph{higher inductive-recursive definition}, in which $\close\epsilon$ is defined using the \emph{recursion} principle of $\RC$, simultaneously with the \emph{inductive} definition of $\RC$. + We choose the inductive-inductive route instead for two reasons. + Firstly, higher inductive-re\-cur\-sive definitions seem to be more difficult to justify in homotopical semantics. + Secondly, and more importantly, the inductive-inductive definition yields a more powerful induction principle, which we will need in order to develop even the basic theory of Cauchy reals. +\end{rmk} + +Finally, as we did for the discussion of Cauchy completeness of the Dedekind reals in \cref{sec:RD-cauchy-complete}, we will work with \emph{Cauchy approximations} (\cref{defn:cauchy-approximation}) instead of Cauchy sequences. +Of course, our Cauchy approximations will now consist of Cauchy reals, rather than Dedekind reals or rational numbers. + +\begin{defn}\label{defn:cauchy-reals} + Let $\RC$ and the relation $\closesym:\RC \times \RC \times \Qp \to \type$ be the following higher inductive-inductive type family. + The type $\RC$ of \define{Cauchy reals} + \indexdef{real numbers!Cauchy}% + \indexsee{Cauchy!real numbers}{real numbers, Cau\-chy}% + is generated by the following constructors: + \begin{itemize} + \item \emph{rational points:} + for any $q : \Q$ there is a real $\rcrat(q)$. + \index{rational numbers!as Cauchy real numbers}% + \item \emph{limit points}: + for any $x : \Qp \to \RC$ such that + % + \begin{equation} + \label{eq:RC-cauchy} + \fall{\delta, \epsilon : \Qp} x_\delta \close{\delta + \epsilon} x_\epsilon + \end{equation} + % + there is a point $\rclim(x) : \RC$. We call $x$ a \define{Cauchy approximation}. + \indexdef{Cauchy!approximation}% + \index{limit!of a Cauchy approximation}% + % + \item \emph{paths:} + for $u, v : \RC$ such that + % + \begin{equation} + \label{eq:RC-path} + \fall{\epsilon : \Qp} u \close\epsilon v + \end{equation} + % + then there is a path $\rceq(u, v) : \id[\RC]{u}{v}$. + \end{itemize} + Simultaneously, the type family $\closesym:\RC\to\RC\to\Qp \to\type$ is generated by the following constructors. + Here $q$ and $r$ denote rational numbers; $\delta$, $\epsilon$, and $\eta$ denote positive rationals; $u$ and $v$ denote Cauchy reals; and $x$ and $y$ denote Cauchy approximations: + \begin{itemize} + \item for any $q,r,\epsilon$, if $-\epsilon < q - r < \epsilon$, then $\rcrat(q) \close\epsilon \rcrat(r)$, + \item for any $q,y,\epsilon,\delta$, if $\rcrat(q) \close{\epsilon - \delta} y_\delta$, then $\rcrat(q) \close{\epsilon} \rclim(y)$, + \item for any $x,r,\epsilon,\delta$, if $x_\delta \close{\epsilon - \delta} \rcrat(r)$, then $\rclim(x) \close\epsilon \rcrat(r)$, + \item for any $x,y,\epsilon,\delta,\eta$, if $x_\delta \close{\epsilon - \delta - \eta} y_\eta$, then $\rclim(x) \close\epsilon \rclim(y)$, + \item for any $u,v,\epsilon$, if $\xi,\zeta : u \close{\epsilon} v$, then $\xi=\zeta$ (propositional truncation). + \end{itemize} +\end{defn} + +\mentalpause + +The first constructor of $\RC$ says that any rational number can be regarded as a real number. +The second says that from any Cauchy approximation to a real number, we can obtain a new real number called its ``limit''. +And the third expresses the idea that if two Cauchy approximations coincide, then their limits are equal. + +The first four constructors of $\closesym$ specify when two rational numbers are close, when a rational is close to a limit, and when two limits are close. +In the case of two rational numbers, this is just the usual notion of $\epsilon$-closeness for rational numbers, whereas the other cases can be derived by noting that each approximant $x_\delta$ is supposed to be within $\delta$ of the limit $\rclim(x)$. + +We remind ourselves of proof-relevance: a real number obtained from $\rclim$ is represented not +just by a Cauchy approximation $x$, but also a proof $p$ of~\eqref{eq:RC-cauchy}, so we +should technically have written $\rclim(x,p)$ instead of just $\rclim(x)$. +A similar observation also applies to $\rceq$ and~\eqref{eq:RC-path}, but we shall write just +$\rceq : u = v$ instead of $\rceq(u, v, p) : u = v$. These abuses of notation are +mitigated by the fact that we are omitting mere propositions and information that is +readily guessed. +Likewise, the last constructor of $\mathord{\close\epsilon}$ justifies our leaving the other four nameless. + +We are immediately able to populate $\RC$ with many real numbers. For suppose $x : \N \to +\Q$ is a traditional Cauchy sequence\index{Cauchy!sequence} of rational numbers, and let $M : \Qp \to \N$ be its +modulus of convergence. Then $\rcrat \circ x \circ M : \Qp \to \RC$ is a Cauchy +approximation, using the first constructor of $\closesym$ to produce the necessary witness. +Thus, $\rclim(\rcrat \circ x \circ M)$ is a real number. Various famous +real numbers such as $\sqrt{2}$, $\pi$, $e$, \dots{} are all limits of such Cauchy sequences of +rationals. + +\subsection{Induction and recursion on Cauchy reals} +\label{sec:induct-recurs-cauchy} + +In order to do anything useful with $\RC$, of course, we need to give its induction principle. +As is the case whenever we inductively define two or more objects at once, the basic induction principle for $\RC$ and $\closesym$ requires a simultaneous induction over both at once. +Thus, we should expect it to say that assuming two type families over $\RC$ and $\closesym$, respectively, together with data corresponding to each constructor, there exist sections of both of these families. +However, since $\closesym$ is indexed on two copies of $\RC$, the precise dependencies of these families is a bit subtle. +The induction principle will apply to any pair of type families: +\begin{align*} +A&:\RC\to\type\\ +B&:\prd{x,y:\RC} A(x) \to A(y) \to \prd{\epsilon:\Qp} (x\close\epsilon y) \to \type. +\end{align*} +The type of $A$ is obvious, but the type of $B$ requires a little thought. +Since $B$ must depend on $\closesym$, but $\closesym$ in turn depends on two copies of $\RC$ and one copy of $\Qp$, it is fairly obvious that $B$ must also depend on the variables $x,y:\RC$ and $\epsilon:\Qp$ as well as an element of $(x\close\epsilon y)$. +What is slightly less obvious is that $B$ must also depend on $A(x)$ and $A(y)$. + +This may be more evident if we consider the non-dependent case (the recursion principle), where $A$ is a simple type (rather than a type family). +In this case we would expect $B$ not to depend on $x,y:\RC$ or $x\close\epsilon y$. +But the recursion principle (along with its associated uniqueness principle) is supposed to say that $\RC$ with $\close\epsilon$ is an ``initial object'' in some category, so in this case the dependency structure of $A$ and $B$ should mirror that of $\RC$ and $\close\epsilon$: that is, we should have $B:A\to A\to \Qp \to \type$. +Combining this observation with the fact that, in the dependent case, $B$ must also depend on $x,y:\RC$ and $x\close\epsilon y$, leads inevitably to the type given above for $B$. + +\symlabel{RC-recursion} +It is helpful to think of $B$ as an $\epsilon$-indexed family of relations between the types $A(x)$ and $A(y)$. +With this in mind, we may write $B(x,y,a,b,\epsilon,\xi)$ as $(x,a) \bsim_\epsilon^\xi (y,b)$. +Since $\xi:x\close\epsilon y$ is unique when it exists, we generally omit it from the notation and write $(x,a) \bsim_\epsilon (y,b)$; this is harmless as long as we keep in mind that this relation is only defined when $x\close\epsilon y$. +We may also sometimes simplify further and write $a\bsim_\epsilon b$, with $x$ and $y$ inferred from the types of $a$ and $b$, but sometimes it will be necessary to include them for clarity. + +\index{induction principle!for Cauchy reals}% +Now, given a type family $A:\RC\to\type$ and a family of relations $\bsim$ as above, the hypotheses of the induction principle consist of the following data, one for each constructor of $\RC$ or $\closesym$: +\begin{itemize} +\item For any $q : \Q$, an element $f_q:A(\rcrat(q))$. +\item For any Cauchy approximation $x$, and any $a:\prd{\epsilon:\Qp} A(x_\epsilon)$ such that + \begin{equation} + \fall{\delta, \epsilon : \Qp} + (x_\delta,a_\delta) \bsim_{\delta+\epsilon} (x_\epsilon,a_\epsilon), + \label{eq:depCauchyappx} + \end{equation} + an element $f_{x,a}:A(\rclim(x))$. + We call such $a$ a \define{dependent Cauchy approximation} + \indexdef{Cauchy!approximation!dependent}% + \indexsee{approximation, Cauchy}{Cauchy approximation}% + \indexdef{dependent!Cauchy approximation}% + over $x$. +\item For $u, v : \RC$ such that $h:\fall{\epsilon : \Qp} u \close\epsilon v$, and all $a:A(u)$ and $b:A(v)$ such that + $\fall{\epsilon:\Qp} (u,a) \bsim_\epsilon (v,b)$, + a dependent path $\dpath{A}{\rceq(u,v)}{a}{b}$. +\item For $q,r:\Q$ and $\epsilon:\Qp$, if $-\epsilon < q - r < \epsilon$, we have + \narrowequation{(\rcrat(q),f_q) \bsim_\epsilon (\rcrat(r),f_r).} +\item For $q:\Q$ and $\delta,\epsilon:\Qp$ and $y$ a Cauchy approximation, and $b$ a dependent Cauchy approximation over $y$, if $\rcrat(q) \close{\epsilon - \delta} y_\delta$, then + \[(\rcrat(q),f_q) \bsim_{\epsilon-\delta} (y_\delta,b_\delta) + \;\Rightarrow\; + (\rcrat(q),f_q) \bsim_\epsilon (\rclim(y),f_{y,b}).\] +\item Similarly, for $r:\Q$ and $\delta,\epsilon:\Qp$ and $x$ a Cauchy approximation, and $a$ a dependent Cauchy approximation over $x$, if $x_\delta \close{\epsilon - \delta} \rcrat(r)$, then + \[(x_\delta,a_\delta) \bsim_{\epsilon-\delta} (\rcrat(r),f_r) + \;\Rightarrow\; + (\rclim(x),f_{x,a}) \bsim_\epsilon (\rcrat(q),f_r). + \] +\item For $\epsilon,\delta,\eta:\Qp$ and $x,y$ Cauchy approximations, and $a$ and $b$ dependent Cauchy approximations over $x$ and $y$ respectively, if we have $x_\delta \close{\epsilon - \delta - \eta} y_\eta$, then + \[ (x_\delta,a_\delta) \bsim_{\epsilon - \delta - \eta} (y_\eta,b_\eta) + \;\Rightarrow\; + (\rclim(x),f_{x,a}) \bsim_\epsilon (\rclim(y),f_{y,b}).\] +\item For $\epsilon:\Qp$ and $x,y:\RC$ and $\xi,\zeta:x\close{\epsilon} y$, and $a:A(x)$ and $b:A(y)$, any two elements of $(x,a) \bsim_\epsilon^\xi (y,b)$ and $(x,a) \bsim_\epsilon^\zeta (y,b)$ are dependently equal over $\xi=\zeta$. + Note that as usual, this is equivalent to asking that $\bsim$ takes values in mere propositions. +\end{itemize} +Under these hypotheses, we deduce functions +\begin{align*} + f&:\prd{x:\RC} A(x)\\ + g&:\prd{x,y:\RC}{\epsilon:\Qp}{\xi:x\close{\epsilon} y} + (x,f(x)) \bsim_\epsilon^\xi (y,f(y)) +\end{align*} +which compute as expected: +\begin{align} + f(\rcrat(q)) &\defeq f_q, \label{eq:rcsimind1}\\ + f(\rclim(x)) &\defeq f_{x,(f,g)[x]}. \label{eq:rcsimind2} +\end{align} +Here $(f,g)[x]$ denotes the result of applying $f$ and $g$ to a Cauchy approximation $x$ to obtain a dependent Cauchy approximation over $x$. +That is, we define $(f,g)[x]_\epsilon \defeq f(x_\epsilon) : A(x_\epsilon)$, and then for any $\epsilon,\delta:\Qp$ we have $g(x_\epsilon,x_\delta,\epsilon+\delta,\xi)$ to witness the fact that $(f,g)[x]$ is a dependent Cauchy approximation, where $\xi: x_\epsilon \close{\epsilon+\delta} x_\delta$ arises from the assumption that $x$ is a Cauchy approximation. + +We will never use this notation again, so don't worry about remembering it. +Generally we use the pattern-matching convention, where $f$ is defined by equations such as~\eqref{eq:rcsimind1} and~\eqref{eq:rcsimind2} in which the right-hand side of~\eqref{eq:rcsimind2} may involve the symbols $f(x_\epsilon)$ and an assumption that they form a dependent Cauchy approximation. + +However, this induction principle is admittedly still quite a mouthful. +To help make sense of it, we observe that it contains as special cases two separate induction principles for~$\RC$ and for~$\closesym$. +Firstly, suppose given only a type family $A:\RC\to\type$, and define $\bsim$ to be constant at \unit. +Then much of the required data becomes trivial, and we are left with: +\begin{itemize} +\item for any $q : \Q$, an element $f_q:A(\rcrat(q))$, +\item for any Cauchy approximation $x$, and any $a:\prd{\epsilon:\Qp} A(x_\epsilon)$, an element $f_{x,a}:A(\rclim(x))$, +\item for $u, v : \RC$ and $h:\fall{\epsilon : \Qp} u \close\epsilon v$, and $a:A(u)$ and $b:A(v)$, we have $\dpath{A}{\rceq(u,v)}{a}{b}$. +\end{itemize} +Given these data, the induction principle yields a function $f:\prd{x:\RC} A(x)$ such that +\begin{align*} + f(\rcrat(q)) &\defeq f_q,\\ + f(\rclim(x)) &\defeq f_{x,f(x)}. +\end{align*} +We call this principle \define{$\RC$-induction}; it says essentially that if we take $\close\epsilon$ as given, then $\RC$ is inductively generated by its constructors. + +Note that, if $A$ is a mere property, then the third hypothesis in $\RC$-induction is automatic (we will see in a moment that these are in fact equivalent statements). +Thus, we may prove mere properties of real numbers by simply proving them for rationals and for limits of Cauchy approximations. +Here is an example. + +\begin{lem} \label{lem:close-reflexive} + For any $u:\RC$ and $\epsilon:\Qp$, we have $u\close\epsilon u$. +\end{lem} +\begin{proof} + Define $A(u) \defeq \fall{\epsilon:\Qp} (u\close\epsilon u)$. + Since this is a mere proposition (by the last constructor of $\closesym$), by $\RC$-induction, it suffices to prove it when $u$ is $\rcrat(q)$ and when $u$ is $\rclim(x)$. + In the first case, we obviously have $|q-q|<\epsilon$ for any $\epsilon$, hence $\rcrat(q) \close\epsilon \rcrat(q)$ by the first constructor of $\closesym$. + % + And in the second case, we may assume inductively that $x_\delta \close\epsilon x_\delta$ for all $\delta,\epsilon:\Qp$. + Then in particular, we have $x_{\epsilon/3} \close{\epsilon/3} x_{\epsilon/3}$, whence $\rclim(x) \close{\epsilon} \rclim(x)$ by the fourth constructor of $\closesym$. +\end{proof} + +From \cref{lem:close-reflexive}, we infer that a direct application of $\RC$-induction only has a chance to succeed if the family $A:\RC\to\type$ is a mere property. +To see this, fix $u:\RC$. +Taking $v$ to be $u$, the third hypothesis of $\RC$-induction tells us that, for any $a : A(u)$, we have $\dpath{A}{\rceq(u,u)}{a}{a}$. +Given a point $b : A(u)$ in addition, we also get $\dpath{A}{\rceq(u,u)}{a}{b}$. +From the definition of the dependent path type, we conclude that the combination of these two paths implies $a = b$, i.e.\ all points in $A(u)$ are equal. + +\begin{thm}\label{thm:Cauchy-reals-are-a-set} + $\RC$ is a set. +\end{thm} +\begin{proof} + We have just shown that the mere relation + \narrowequation{P(u,v) \defeq \fall{\epsilon:\Qp} (u\close\epsilon v)} + is reflexive. + Since it implies identity, by the path constructor of $\RC$, the result follows from \cref{thm:h-set-refrel-in-paths-sets}. +\end{proof} + +We can also show that although $\RC$ may not be a quotient of the set of Cauchy sequences of \emph{rationals}, it is nevertheless a quotient of the set of Cauchy sequences of \emph{reals}. +(Of course, this is not a valid \emph{definition} of $\RC$, but it is a useful property.) +We define the type of Cauchy approximations to be +% +\symlabel{cauchy-approximations}% +\index{Cauchy!approximation!type of}% +\begin{equation*} + \CAP \defeq + \setof{ x : \Qp \to \RC | + \fall{\epsilon, \delta : \Qp} x_\delta \close{\delta + \epsilon} x_\epsilon + }. +\end{equation*} +The second constructor of $\RC$ gives a function $\rclim:\CAP\to\RC$. + +\begin{lem} \label{RC-lim-onto} + Every real merely is a limit point: $\fall{u : \RC} \exis{x : \CAP} u = \rclim(x)$. + In other words, $\rclim:\CAP\to\RC$ is surjective. +\end{lem} +\begin{proof} + By $\RC$-induction, we may divide into cases on $u$. + Of course, if $u$ is a limit $\rclim(x)$, the statement is trivial. + So suppose $u$ is a rational point $\rcrat(q)$; we claim $u$ is equal to $\rclim(\lam{\epsilon} \rcrat(q))$. + By the path constructor of $\RC$, it suffices to show $\rcrat(q) \close\epsilon \rclim(\lam{\epsilon} \rcrat(q))$ for all $\epsilon:\Qp$. + And by the second constructor of $\closesym$, for this it suffices to find $\delta:\Qp$ such that $\rcrat(q)\close{\epsilon-\delta} \rcrat(q)$. + But by the first constructor of $\closesym$, we may take any $\delta:\Qp$ with $\delta<\epsilon$. +\end{proof} + +% + +\begin{lem} \label{RC-lim-factor} + If $A$ is a set and $f : \CAP \to A$ respects coincidence\index{coincidence!of Cauchy approximations} of Cauchy approximations, in the sense that + % + \begin{equation*} + \fall{x, y : \CAP} \rclim(x) = \rclim(y) \Rightarrow f(x) = f(y), + \end{equation*} + % + then $f$ factors uniquely through $\rclim : \CAP \to \RC$. +\end{lem} +\begin{proof} + Since $\rclim$ is surjective, by \cref{lem:images_are_coequalizers}, $\RC$ is the quotient of $\CAP$ by the kernel pair\index{kernel!pair} of $\rclim$. + But this is exactly the statement of the lemma. +\end{proof} + +For the second special case of the induction principle, suppose instead that we take $A$ to be constant at $\unit$. +In this case, $\bsim$ is simply an $\epsilon$-indexed family of relations on $\epsilon$-close pairs of real numbers, so we may write $u\bsim_\epsilon v$ instead of $(u,\ttt)\bsim_\epsilon (v,\ttt)$. +Then the required data reduces to the following, where $q, r$ denote rational numbers, $\epsilon, \delta, \eta$ positive rational numbers, and $x, y$ Cauchy approximations: +\begin{itemize} +\item if $-\epsilon < q - r < \epsilon$, then + $\rcrat(q) \bsim_\epsilon \rcrat(r)$, +\item if $\rcrat(q) \close{\epsilon - \delta} y_\delta$ and + $\rcrat(q)\bsim_{\epsilon-\delta} y_\delta$, + then $\rcrat(q) \bsim_\epsilon \rclim(y)$, +\item if $x_\delta \close{\epsilon - \delta} \rcrat(r)$ and + $x_\delta \bsim_{\epsilon-\delta} \rcrat(r)$, + then $\rclim(y) \bsim_\epsilon \rcrat(q)$, +\item if $x_\delta \close{\epsilon - \delta - \eta} y_\eta$ and + $x_\delta\bsim_{\epsilon - \delta - \eta} y_\eta$, + then $\rclim(x) \bsim_\epsilon \rclim(y)$. +\end{itemize} +The resulting conclusion is $\fall{u,v:\RC}{\epsilon:\Qp} (u\close\epsilon v) \to (u \bsim_\epsilon v)$. +We call this principle \define{$\closesym$-induction}; it says essentially that if we take $\RC$ as given, then $\close\epsilon$ is inductively generated (as a family of types) by \emph{its} constructors. +For example, we can use this to show that $\closesym$ is symmetric. + +\begin{lem}\label{thm:RCsim-symmetric} + For any $u,v:\RC$ and $\epsilon:\Qp$, we have $(u\close\epsilon v) = (v\close\epsilon u)$. +\end{lem} +\begin{proof} + Since both are mere propositions, by symmetry it suffices to show one implication. + Thus, let $(u\bsim_\epsilon v) \defeq (v\close\epsilon u)$. + By $\closesym$-induction, we may reduce to the case that $u\close\epsilon v$ is derived from one of the four interesting constructors of $\closesym$. + In the first case when $u$ and $v$ are both rational, the result is trivial (we can apply the first constructor again). + In the other three cases, the inductive hypothesis (together with commutativity of addition in $\Q$) yields exactly the input to another of the constructors of $\closesym$ (the second and third constructors switch, while the fourth stays put). +\end{proof} + +The general induction principle, which we may call \define{$(\RC,\closesym)$-induction}, is therefore a sort of joint $\RC$-induction and $\closesym$-induction. +Consider, for instance, its non-dependent version, which we call \define{$(\RC,\closesym)$-recursion}, which is the one that we will have the most use for. +\index{recursion principle!for Cauchy reals}% +Ordinary $\RC$-recursion tells us that to define a function $f : \RC \to A$ it suffices to: +\begin{enumerate} +\item for every $q : \Q$ construct $f(\rcrat(q)) : A$, +\item for every Cauchy approximation $x : \Qp \to \RC$, construct $f(x) : A$, + assuming that $f(x_\epsilon)$ has already been defined for all $\epsilon : \Qp$, +\item prove $f(u) = f(v)$ for all $u, v : \RC$ satisfying $\fall{\epsilon:\Qp} u\close\epsilon v$.\label{item:rcrec3} +\end{enumerate} +However, it is generally quite difficult to show~\ref{item:rcrec3} without knowing something about how $f$ acts on $\epsilon$-close Cauchy reals. +The enhanced principle of $(\RC,\closesym)$-recursion remedies this deficiency, allowing us to specify an \emph{arbitrary} ``way in which $f$ acts on $\epsilon$-close Cauchy reals'', which we can then prove to be the case by a simultaneous induction with the definition of $f$. +This is the family of relations $\bsim$. +Since $A$ is independent of $\RC$, we may assume for simplicity that $\bsim$ depends only on $A$ and $\Qp$, and thus there is no ambiguity in writing $a\bsim_\epsilon b$ instead of $(u,a) \bsim_\epsilon (v,b)$. +In this case, defining a function $f:\RC\to A$ by $(\RC,\closesym)$-recursion requires the following cases (which we now write using the pattern-matching convention). +\begin{itemize} +\item For every $q : \Q$, construct $f(\rcrat(q)) : A$. +\item For every Cauchy approximation $x : \Qp \to \RC$, construct $f(\rclim(x)) : A$, assuming inductively that $f(x_\epsilon)$ has already been defined for all $\epsilon : \Qp$ and form a ``Cauchy approximation with respect to $\bsim$'', i.e.\ that $\fall{\epsilon,\delta:\Qp} (f(x_\epsilon) \bsim_{\epsilon+\delta} f(x_\delta))$. +\item Prove that the relations $\bsim$ are \emph{separated}, i.e.\ that, for any $a,b:A$, + \indexdef{relation!separated family of}% + \indexdef{separated family of relations}% +\narrowequation{(\fall{\epsilon:\Qp} a\bsim_\epsilon b) \Rightarrow (a=b).} +\item Prove that if $-\epsilon< q-r <\epsilon$ for $q,r:\Q$, then $f(\rcrat(q))\bsim_\epsilon f(\rcrat(r))$. +\item For any $q:\Q$ and any Cauchy approximation $y$, prove that +\narrowequation{f(\rcrat(q)) \bsim_\epsilon f(\rclim(y)),} assuming inductively that $\rcrat(q)\close{\epsilon-\delta} y_\delta$ and $f(\rcrat(q)) \bsim_{\epsilon-\delta} f(y_\delta)$ for some $\delta:\Qp$, and that $\eta \mapsto f(x_\eta)$ is a Cauchy approximation with respect to $\bsim$. +\item For any Cauchy approximation $x$ and any $r:\Q$, prove that +\narrowequation{f(\rclim(x)) \bsim_\epsilon f(\rcrat(r)),} +assuming inductively that $x_\delta \close{\epsilon-\delta} \rcrat(r)$ and $f(x_\delta) \bsim_{\epsilon-\delta} f(\rcrat(r))$ for some $\delta:\Qp$, and that $\eta\mapsto f(x_\eta)$ is a Cauchy approximation with respect to $\bsim$. +\item For any Cauchy approximations $x,y$, prove that +\narrowequation{f(\rclim(x)) \bsim_\epsilon f(\rclim(y)),} +assuming inductively that $x_\delta \close{\epsilon-\delta-\eta} y_\eta$ and $f(x_\delta) \bsim_{\epsilon-\delta-\eta} f(y_\eta)$ for some $\delta,\eta:\Qp$, and that $\theta\mapsto f(x_\theta)$ and $\theta\mapsto f(y_\theta)$ are Cauchy approximations with respect to $\bsim$. +\end{itemize} +Note that in the last four proofs, we are free to use the specific definitions of $f(\rcrat(q))$ and $f(\rclim(x))$ given in the first two data. +However, the proof of separatedness must apply to \emph{any} two elements of $A$, without any relation to $f$: it is a sort of ``admissibility'' condition on the family of relations $\bsim$. +Thus, we often verify it first, immediately after defining $\bsim$, before going on to define $f(\rcrat(q))$ and $f(\rclim(x))$. + +Under the above hypotheses, $(\RC,\closesym)$-recursion yields a function $f:\RC\to A$ such that $f(\rcrat(q))$ and $f(\rclim(x))$ are judgmentally equal to the definitions given for them in the first two clauses. +Moreover, we may also conclude +\begin{equation} + \fall{u,v:\RC}{\epsilon:\Qp} (u\close\epsilon v) \to (f(u) \bsim_\epsilon f(v)).\label{eq:RC-sim-recursion-extra} +\end{equation} + +As a paradigmatic example, $(\RC,\closesym)$-recursion allows us to extend functions defined on $\Q$ to all of $\RC$, as long as they are sufficiently continuous. +\index{function!continuous}% + +\begin{defn}\label{defn:lipschitz} + A function $f:\Q\to\RC$ is \define{Lipschitz} + \indexdef{function!Lipschitz}% + \indexdef{Lipschitz!function}% + \indexdef{Lipschitz!constant}% + \indexdef{constant!Lipschitz}% + if there exists $L:\Qp$ (the \define{Lipschitz constant}) such that + \[ |q - r|<\epsilon \Rightarrow (f(q) \close{L\epsilon} f(r)) \] + for all $\epsilon:\Qp$ and $q,r:\Q$. + % + Similarly, $g:\RC\to\RC$ is \define{Lipschitz} if there exists $L:\Qp$ such that + \[ (u\close\epsilon v) \Rightarrow (g(u) \close{L\epsilon} g(v)) \] + for all $\epsilon:\Qp$ and $u,v:\RC$.. +\end{defn} + +In particular, note that by the first constructor of $\closesym$, if $f:\Q\to\Q$ is Lipschitz in the obvious sense, then so is the composite $\Q\xrightarrow{f} \Q \to \RC$. + +\begin{lem}\label{RC-extend-Q-Lipschitz} + Suppose $f : \Q \to \RC$ is Lipschitz with constant $L : \Qp$. + Then there exists a Lipschitz map $\bar{f} : \RC \to \RC$, also with constant $L$, such that $\bar{f}(\rcrat(q)) \jdeq f(q)$ for all $q:\Q$. +\end{lem} + +\begin{proof} + % Uniqueness follows directly from \cref{RC-continuous-eq}. + We define $\bar{f}$ by $(\RC,\closesym)$-recursion, with codomain $A\defeq \RC$. + We define the relation $\mathord{\bsim}: \RC \to \RC \to \Qp \to \prop$ to be + \begin{align*} + (u \bsim_\epsilon v) &\defeq (u \close{L\epsilon} v). + \end{align*} + For $q : \Q$, we define + % + \begin{equation*} + \bar{f}(\rcrat(q)) \defeq \rcrat(f(q)). + \end{equation*} + % + For a Cauchy approximation $x : \Qp \to \RC$, we define + % + \begin{equation*} + \bar{f}(\rclim(x)) \defeq \rclim(\lamu{\epsilon : \Qp} \bar{f}(x_{\epsilon/L})). + \end{equation*} + % + For this to make sense, we must verify that $y \defeq \lamu{\epsilon : \Qp} \bar{f}(x_{\epsilon/L})$ is a Cauchy approximation. + However, the inductive hypothesis for this step is that for any $\delta,\epsilon:\Qp$ we have $\bar{f}(x_\delta) \bsim_{\delta+\epsilon} \bar{f}(x_\epsilon)$, i.e.\ $\bar{f}(x_\delta) \close{L\delta+L\epsilon} \bar{f}(x_\epsilon)$. + Thus we have + \[y_\delta \jdeq f(x_{\delta/L}) \close{\delta + \epsilon} f(x_{\epsilon/L}) \jdeq y_\epsilon. \] + + For proving separatedness, we simply observe that $\fall{\epsilon:\Qp} a\bsim_\epsilon b$ means $\fall{\epsilon:\Qp} a\close{L\epsilon} b$, which implies $\fall{\epsilon:\Qp}a\close\epsilon b$ and thus $a=b$. + + To complete the $(\RC,\closesym)$-recursion, it remains to verify the four conditions on $\bsim$. + This basically amounts to proving that $\bar f$ is Lipschitz for all the four constructors of $\closesym$. + \begin{enumerate} + \item When $u$ is $\rcrat(q)$ and $v$ is $\rcrat(r)$ with $-\epsilon < |q-r| <\epsilon$, the assumption that $f$ is Lipschitz yields $f(q) \close{L\epsilon} f(r)$, hence $\bar{f}(\rcrat(q)) \bsim_\epsilon \bar{f}(\rcrat(r))$ by definition. + \item When $u$ is $\rclim(x)$ and $v$ is $\rcrat(q)$ with $x_\eta \close{\epsilon - \eta} \rcrat(q)$, then the + inductive hypothesis is $\bar{f}(x_\eta) \close{L \epsilon - L \eta} \rcrat(f(q))$, which proves + \narrowequation{\bar{f}(\rclim(x)) \close{L \epsilon} \bar{f}(\rcrat(q))} + by the third constructor of $\closesym$. + \item The symmetric case when $u$ is rational and $v$ is a limit is essentially identical. + \item When $u$ is $\rclim(x)$ and $v$ is $\rclim(y)$, with $\delta, \eta : \Qp$ such that $x_\delta \close{\epsilon - \delta - \eta} y_\eta$, + the inductive hypothesis is $\bar{f}(x_\delta) \close{L \epsilon - L \delta - L \eta} \bar{f}(y_\eta)$, which proves $\bar{f}(\rclim(x)) \close{L + \epsilon} \bar{f}(\rclim(y))$ by the fourth constructor of $\closesym$. + \end{enumerate} + This completes the $(\RC,\closesym)$-recursion, and hence the construction of $\bar f$. + The desired equality $\bar f(\rcrat(q))\jdeq f(q)$ is exactly the first computation rule for $(\RC,\closesym)$-recursion, and the additional condition~\eqref{eq:RC-sim-recursion-extra} says exactly that $\bar f$ is Lipschitz with constant $L$. +\end{proof} + +At this point we have gone about as far as we can without a better characterization of $\closesym$. +We have specified, in the constructors of $\closesym$, the conditions under which we want Cauchy reals of the two different forms to be $\epsilon$-close. +However, how do we know that in the resulting inductive-inductive type family, these are the \emph{only} witnesses to this fact? +We have seen that inductive type families (such as identity types, see \cref{sec:identity-systems}) and higher inductive types have a tendency to contain ``more than was put into them'', so this is not an idle question. + +In order to characterize $\closesym$ more precisely, we will define a family of relations $\approx_\epsilon$ on $\RC$ \emph{recursively}, so that they will compute on constructors, and prove that this family is equivalent to $\close\epsilon$. + +\begin{thm}\label{defn:RC-approx} + There is a family of mere relations $\mathord\approx:\RC\to\RC\to\Qp\to\prop$ such that + \begin{align} + (\rcrat(q) \approx_\epsilon \rcrat(r)) &\defeq + (-\epsilon < q - r < \epsilon)\label{eq:RCappx1}\\ + (\rcrat(q) \approx_\epsilon \rclim(y)) &\defeq + \exis{\delta : \Qp} \rcrat(q) \approx_{\epsilon - \delta} y_\delta\label{eq:RCappx2}\\ + (\rclim(x) \approx_\epsilon \rcrat(r)) &\defeq + \exis{\delta : \Qp} x_\delta \approx_{\epsilon - \delta} \rcrat(r)\label{eq:RCappx3}\\ + (\rclim(x) \approx_\epsilon \rclim(y)) &\defeq + \exis{\delta, \eta : \Qp} x_\delta \approx_{\epsilon - \delta - \eta} y_\eta.\label{eq:RCappx4} + \end{align} + Moreover, we have + \begin{gather} + (u \approx_\epsilon v) \Leftrightarrow \exis{\theta:\Qp} (u \approx_{\epsilon-\theta} v) \label{RC-sim-rounded}\\ + (u \approx_\epsilon v) \to (v\close\delta w) \to (u\approx_{\epsilon+\delta} w)\label{eq:RC-sim-rtri}\\ + (u \close\epsilon v) \to (v\approx_\delta w) \to (u\approx_{\epsilon+\delta} w)\label{eq:RC-sim-ltri}. + \end{gather} +\end{thm} + +The additional conditions~\eqref{RC-sim-rounded}--\eqref{eq:RC-sim-ltri} turn out to be required in order to make the inductive definition go through. +Condition~\eqref{RC-sim-rounded} is called being \define{rounded}. +\indexsee{relation!rounded}{rounded relation}% +\indexdef{rounded!relation}% +Reading it from right to left gives \define{monotonicity} of $\approx$, +\index{monotonicity}% +\index{relation!monotonic}% +% +\begin{equation*} + (\delta < \epsilon) \land (u \approx_\delta v) \Rightarrow (u \approx_\epsilon v) +\end{equation*} +% +while reading it left to right to \define{openness} of $\approx$, +\index{open!relation}% +\index{relation!open}% +% +\begin{equation*} + (u \approx_\epsilon v) \Rightarrow \exis{\delta : \Qp} (\delta < \epsilon) \land (u \approx_\delta v). +\end{equation*} +% +Conditions~\eqref{eq:RC-sim-rtri} and~\eqref{eq:RC-sim-ltri} are forms of the triangle inequality, which say that $\approx$ is a ``module'' over $\closesym$ on both sides. + +\begin{proof} + We will define $\mathord\approx:\RC\to\RC\to\Qp\to\prop$ by double $(\RC,\closesym)$-recursion. + First we will apply $(\RC,\closesym)$-recursion with codomain the subset of $\RC\to\Qp\to\prop$ consisting of those families of predicates which are rounded and satisfy the one appropriate form of the triangle inequality. + Thinking of these predicates as half of a binary relation, we will write them as $(u,\epsilon) \mapsto (\hapx_\epsilon u)$, with the symbol $\hapname$ referring to the whole relation. + Now we can write $A$ precisely as + \begin{multline*} + A \defeq\; \Bigg\{ \hapname :\RC\to\Qp\to\prop \;\bigg|\; \\ + \Big(\fall{u:\RC}{\epsilon:\Qp} + \big((\hapx_\epsilon u) \Leftrightarrow \exis{\theta:\Qp} (\hapx_{\epsilon-\theta} u)\big)\Big) \\ + \land \Big(\fall{u,v:\RC}{\eta,\epsilon:\Qp} (u\close\epsilon v) \to\\ + \big((\hapx_\eta u) \to (\hapx_{\eta+\epsilon} v) \big) \land \big((\hapx_\eta v) \to (\hapx_{\eta+\epsilon} u) \big)\Big)\Bigg\} + \end{multline*} + As usual with subsets, we will use the same notation for an inhabitant of $A$ and its first component $\hapname$. + As the family of relations required for $(\RC,\closesym)$-recursion, we consider the following, which will ensure the other form of the triangle inequality: + \begin{narrowmultline*} + (\hapname \bsim_\epsilon \hapbname ) \defeq \narrowbreak + \fall{u:\RC}{\eta:\Qp} ((\hapx_\eta u) \to (\hapxb_{\epsilon+\eta} u)) + \land \narrowbreak + ((\hapxb_\eta u) \to (\hapx_{\epsilon+\eta} u)). + \end{narrowmultline*} + We observe that these relations are separated. + For assuming + \narrowequation{\fall{\epsilon:\Qp} (\hapname \bsim_\epsilon \hapbname),} + to show $\hapname = \hapbname$ it suffices to show $(\hapx_\epsilon u) \Leftrightarrow (\hapxb_\epsilon u)$ for all $u:\RC$. + But $\hapx_\epsilon u$ implies $\hapx_{\epsilon-\theta} u$ for some $\theta$, by roundedness, which together with $\hapname \bsim_\epsilon \hapbname$ implies $\hapxb_\epsilon u$; and the converse is identical. + + Now the first two data the recursion principle requires are the following. + \begin{itemize} + \item For any $q:\Q$, we must give an element of $A$, which we denote $(\rcrat(q)\approx_{(\blank)} \blank)$. + \item For any Cauchy approximation $x$, if we assume defined a function $\Qp \to A$, which we will denote by $\epsilon \mapsto (x_\epsilon \approx_{(\blank)} \blank)$, with the property that + % \[ \fall{u,v:\RC}{\delta,\epsilon,\eta:\Qp} (x_\delta \approx_\eta u) \to (u\close{\delta+\epsilon} v) \to (x_\epsilon \approx_{\eta+\delta+\epsilon} v) \] + \begin{equation} + \fall{u:\RC}{\delta,\epsilon,\eta:\Qp} (x_\delta \approx_\eta u) \to (x_\epsilon \approx_{\eta+\delta+\epsilon} u),\label{eq:appxrec2} + \end{equation} + we must give an element of $A$, which we write as $(\rclim(x)\approx_{(\blank)} \blank)$. + \end{itemize} + In both cases, we give the required definition by using a nested $(\RC,\closesym)$-recursion, with codomain the subset of $\Qp\to\prop$ consisting of rounded families of mere propositions. + Thinking of these propositions as zero halves of a binary relation, we will write them as $\epsilon \mapsto (\tap{\epsilon})$, with the symbol $\tapname$ referring to the whole family. + Now we can write the codomain of these inner recursions precisely as + \begin{narrowmultline*} + C \defeq + \bigg\{ \tapname :\Qp\to\prop \;\;\Big|\;\; \narrowbreak + \fall{\epsilon:\Qp} \Big((\tap\epsilon) \Leftrightarrow \exis{\theta:\Qp} (\tap{\epsilon-\theta})\Big)\bigg\} + \end{narrowmultline*} + We take the required family of relations to be the remnant of the triangle inequality: + \begin{narrowmultline*} + (\tapname \bbsim_\epsilon \tapbname) \defeq + \fall{\eta:\Qp} ((\tap\eta) \to (\tapb{\epsilon+\eta})) \land + \narrowbreak + ((\tapb\eta) \to (\tap{\epsilon+\eta})). + \end{narrowmultline*} + These relations are separated by the same argument as for $\bsim$, using roundedness of all elements of $C$. + + Note that if such an inner recursion succeeds, it will yield a family of predicates $\hapname : \RC\to\Qp\to \prop$ which are rounded +(since their image in $\Qp\to\prop$ lies in $C$) and satisfy + \[ \fall{u,v:\RC}{\epsilon:\Qp} (u\close\epsilon v) \to \big((\hapx_{(\blank)} u) \bbsim_\epsilon (\hapx_{(\blank)} u)\big). \] + Expanding out the definition of $\bbsim$, this yields precisely the third condition for $\hapname$ to belong to $A$; thus it is exactly what we need. + + It is at this point that we can give the definitions~\eqref{eq:RCappx1}--\eqref{eq:RCappx4}, as the first two clauses of each of the two inner recursions, corresponding to rational points and limits. + In each case, we must verify that the relation is rounded and hence lies in $C$. + In the rational-rational case~\eqref{eq:RCappx1} this is clear, while in the other cases it follows from an inductive hypothesis. + (In~\eqref{eq:RCappx2} the relevant inductive hypothesis is that $(\rcrat(q) \approx_{(\blank)} y_\delta) : C$, while in~\eqref{eq:RCappx3} and~\eqref{eq:RCappx4} it is that $(x_\delta \approx_{(\blank)} \blank) : A$.) + + The remaining data of the sub-recursions consist of showing that \eqref{eq:RCappx1}--\eqref{eq:RCappx4} satisfy the triangle inequality on the right with respect to the constructors of $\closesym$. + There are eight cases --- four in each sub-recursion --- corresponding to the eight possible ways that $u$, $v$, and $w$ in~\eqref{eq:RC-sim-rtri} can be chosen to be rational points or limits. + First we consider the cases when $u$ is $\rcrat(q)$. + \begin{enumerate} + \item Assuming $\rcrat(q)\approx_\phi \rcrat(r)$ and $-\epsilon<|r-s|<\epsilon$, we must show $\rcrat(q)\approx_{\phi+\epsilon} \rcrat(s)$. + But by definition of $\approx$, this reduces to the triangle inequality for rational numbers. + \item We assume $\phi,\epsilon,\delta:\Qp$ such that $\rcrat(q)\approx_\phi \rcrat(r)$ and $\rcrat(r) \close{\epsilon-\delta} y_\delta$, and inductively that + \begin{equation} + \fall{\psi:\Qp}(\rcrat(q) \approx_{\psi} \rcrat(r)) \to (\rcrat(q) \approx_{\psi+\epsilon-\delta} y_\delta).\label{eq:RCappx-rtri-rrl1} + \end{equation} + We assume also that $\psi,\delta\mapsto (\rcrat(q) \approx_{\psi} y_\delta)$ is a Cauchy approximation with respect to $\bbsim$, i.e.\ + \begin{equation} + \fall{\psi,\xi,\zeta:\Qp} (\rcrat(q) \approx_{\psi} y_\xi) \to (\rcrat(q) \approx_{\psi+\xi+\zeta} y_\zeta),\label{eq:RCappx-rtri-rrl2} + \end{equation} + although we do not need this assumption in this case. + Indeed, \eqref{eq:RCappx-rtri-rrl1} with $\psi\defeq \phi$ yields immediately $\rcrat(q) \approx_{\phi+\epsilon-\delta} y_\delta$, and hence $\rcrat(q) \approx_{\phi+\epsilon} \rclim(y)$ by definition of $\approx$. + \item We assume $\phi,\epsilon,\delta:\Qp$ such that $\rcrat(q)\approx_\phi \rclim(y)$ and $y_\delta \close{\epsilon-\delta} \rcrat(r)$, and inductively that + \begin{gather} + \fall{\psi:\Qp}(\rcrat(q) \approx_{\psi} y_\delta) \to (\rcrat(q) \approx_{\psi+\epsilon-\delta} \rcrat(r)).\label{eq:RCappx-rtri-rlr1}\\ + \fall{\psi,\xi,\zeta:\Qp} (\rcrat(q) \approx_{\psi} y_\xi) \to (\rcrat(q) \approx_{\psi+\xi+\zeta} y_\zeta).\label{eq:RCappx-rtri-rlr2} + \end{gather} + By definition, $\rcrat(q)\approx_\phi \rclim(y)$ means that we have $\theta:\Qp$ with $\rcrat(q) \approx_{\phi-\theta} y_\theta$. + By assumption~\eqref{eq:RCappx-rtri-rlr2}, therefore, we have also $\rcrat(q) \approx_{\phi+\delta} y_\delta$, and then by~\eqref{eq:RCappx-rtri-rlr1} it follows that $\rcrat(q) \approx_{\phi+\epsilon} \rcrat(r)$, as desired. + \item We assume $\phi,\epsilon,\delta,\eta:\Qp$ such that $\rcrat(q)\approx_\phi \rclim(y)$ and $y_\delta \close{\epsilon-\delta-\eta} z_\eta$, and inductively that + \begin{gather} + \fall{\psi:\Qp}(\rcrat(q) \approx_{\psi} y_\delta) \to (\rcrat(q) \approx_{\psi+\epsilon-\delta-\eta} z_\eta), \label{eq:RCappx-rtri-rll1}\\ + \fall{\psi,\xi,\zeta:\Qp} (\rcrat(q) \approx_{\psi} y_\xi) \to (\rcrat(q) \approx_{\psi+\xi+\zeta} y_\zeta), \label{eq:RCappx-rtri-rll2}\\ + \fall{\psi,\xi,\zeta:\Qp} (\rcrat(q) \approx_{\psi} z_\xi) \to (\rcrat(q) \approx_{\psi+\xi+\zeta} z_\zeta). \label{eq:RCappx-rtri-rll3} + \end{gather} + Again, $\rcrat(q)\approx_\phi \rclim(y)$ means we have $\xi:\Qp$ with $\rcrat(q) \approx_{\phi-\xi} y_\xi$, while~\eqref{eq:RCappx-rtri-rll2} then implies $\rcrat(q) \approx_{\phi+\delta} y_\delta$ and~\eqref{eq:RCappx-rtri-rll1} implies $\rcrat(q) \approx_{\phi+\epsilon-\eta} z_\eta$. + But by definition of $\approx$, this implies $\rcrat(q) \approx_{\phi+\epsilon} \rclim(z)$ as desired. + \end{enumerate} + Now we move on to the cases when $u$ is $\rclim(x)$, with $x$ a Cauchy approximation. + In this case, the ambient inductive hypothesis of the definition of $(\rclim(x) \approx_{(\blank)} {\blank}) : A$ is that we have ${(x_\delta \approx_{(\blank)} {\blank})}: A$, so that in addition to being rounded they satisfy the triangle inequality on the right. + \begin{enumerate}\setcounter{enumi}{4} + \item Assuming $\rclim(x)\approx_\phi \rcrat(r)$ and $-\epsilon<|r-s|<\epsilon$, we must show $\rclim(x)\approx_{\phi+\epsilon} \rcrat(s)$. + By definition of $\approx$, the former means $x_\delta \approx_{\phi-\delta} \rcrat(r)$, so that above triangle inequality implies $x_\delta \approx_{\epsilon+\phi-\delta} \rcrat(s)$, hence $\rclim(x)\approx_{\phi+\epsilon} \rcrat(s)$ as desired. + \item We assume $\phi,\epsilon,\delta:\Qp$ such that $\rclim(x)\approx_\phi \rcrat(r)$ and $\rcrat(r) \close{\epsilon-\delta} y_\delta$, and two unneeded inductive hypotheses. + % + By definition, we have $\eta:\Qp$ such that $x_\eta \approx_{\phi-\eta} \rcrat(r)$, so the inductive triangle inequality gives $x_\eta \approx_{\phi+\epsilon-\eta-\delta} y_\delta$. + The definition of $\approx$ then immediately yields $\rclim(x) \approx_{\phi+\epsilon} \rclim(y)$. + \item We assume $\phi,\epsilon,\delta:\Qp$ such that $\rclim(x)\approx_\phi \rclim(y)$ and $y_\delta \close{\epsilon-\delta} \rcrat(r)$, and two unneeded inductive hypotheses. + By definition we have $\xi,\theta:\Qp$ such that $x_\xi \approx_{\phi-\xi-\theta} y_\theta$. + Since $y$ is a Cauchy approximation, we have $y_\theta \close{\theta+\delta} y_\delta$, so the inductive triangle inequality gives $x_\xi \approx_{\phi+\delta-\xi} y_\delta$ and then $x_\xi \close{\phi+\epsilon-\xi} \rcrat(r)$. + The definition of $\approx$ then gives $\rclim(x) \approx_{\phi+\epsilon}\rcrat(r)$, as desired. + \item Finally, we assume $\phi,\epsilon,\delta,\eta:\Qp$ such that $\rclim(x)\approx_\phi \rclim(y)$ and $y_\delta \close{\epsilon-\delta-\eta} z_\eta$. + Then as before we have $\xi,\theta:\Qp$ with $x_\xi \approx_{\phi-\xi-\theta} y_\theta$, and two applications of the triangle inequality suffices as before. + \end{enumerate} + + This completes the two inner recursions, and thus the definitions of the families of relations $(\rcrat(q)\approx_{(\blank)}\blank)$ and $(\rclim(x)\approx_{(\blank)}\blank)$. + Since all are elements of $A$, they are rounded and satisfy the triangle inequality on the right with respect to $\closesym$. +% , and satisfy~\eqref{eq:appxrec2}. + What remains is to verify the conditions relating to $\bsim$, which is to say that these relations satisfy the triangle inequality on the \emph{left} with respect to the constructors of $\closesym$. + The four cases correspond to the four choices of rational or limit points for $u$ and $v$ in~\eqref{eq:RC-sim-ltri}, and since they are all mere propositions, we may apply $\RC$-induction and assume that $w$ is also either rational or a limit. + This yields another eight cases, whose proofs are essentially identical to those just given; so we will not subject the reader to them. +\end{proof} + +We can now prove: + +\begin{thm}\label{thm:RC-sim-characterization} + For any $u,v:\RC$ and $\epsilon:\Qp$ we have $(u\close\epsilon v) = (u\approx_\epsilon v)$. +\end{thm} +\begin{proof} + Since both are mere propositions, it suffices to prove bidirectional implication. + For the left-to-right direction, we use $\closesym$-induction applied to $C(u,v,\epsilon)\defeq (u\approx_\epsilon v)$. + Thus, it suffices to consider the four constructors of $\closesym$. + In each case, $u$ and $v$ are specialized to either rational points or limits, so that the definition of $\approx$ evaluates, and the inductive hypothesis always applies. + + For the right-to-left direction, we use $\RC$-induction to assume that $u$ and $v$ are rational points or limits, allowing $\approx$ to evaluate. + But now the definitions of $\approx$, and the inductive hypotheses, supply exactly the data required for the relevant constructors of $\closesym$. +\end{proof} + +\index{encode-decode method}% +Stretching a point, one might call $\approx$ a fibration of ``codes'' for $\closesym$, with the two directions of the above proof being \encode and \decode respectively. +By the definition of $\approx$, from \cref{thm:RC-sim-characterization} we get equivalences +\begin{align*} + (\rcrat(q) \close\epsilon \rcrat(r)) &= + (-\epsilon < q - r < \epsilon)\\ + (\rcrat(q) \close\epsilon \rclim(y)) &= + \exis{\delta : \Qp} \rcrat(q) \close{\epsilon - \delta} y_\delta\\ + (\rclim(x) \close\epsilon \rcrat(r)) &= + \exis{\delta : \Qp} x_\delta \close{\epsilon - \delta} \rcrat(r)\\ + (\rclim(x) \close\epsilon \rclim(y)) &= + \exis{\delta, \eta : \Qp} x_\delta \close{\epsilon - \delta - \eta} y_\eta. +\end{align*} +Our proof also provides the following additional information. + +\begin{cor} + \index{triangle!inequality for R@inequality for $\RC$}% + \indexsee{inequality!triangle}{triangle inequality}% + $\closesym$ is rounded\index{rounded!relation} and satisfies the triangle inequality: + \begin{gather} + \eqvspaced{ + (u \close\epsilon v) + }{ + \exis{\theta : \Qp} u \close{\epsilon - \theta} v + }\\ + (u\close\epsilon v) \to (v\close\delta w) \to (u\close{\epsilon+\delta} w). \label{item:RC-sim-triangle} + \end{gather} +\end{cor} +% \begin{proof} +% The construction of $\approx$ showed simultaneously that it is rounded, and satisfies ``triangle inequalities'' such as +% \[ (u\approx_\epsilon v) \to (v\close\delta w) \to (u\approx_{\epsilon+\delta} w). \] +% Thus, both properties follow from \cref{thm:RC-sim-characterization}. +% \end{proof} + +With the triangle inequality in hand, we can show that ``limits'' of Cauchy approximations actually behave like limits. + +\begin{lem}\label{thm:RC-sim-lim} + For any $u:\RC$, Cauchy approximation $y$, and $\epsilon,\delta:\Qp$, if $u\close\epsilon y_\delta$ then $u\close{\epsilon+\delta} \rclim(y)$. +\end{lem} +\begin{proof} + We use $\RC$-induction on $u$. + If $u$ is $\rcrat(q)$, then this is exactly the second constructor of $\closesym$. + Now suppose $u$ is $\rclim(x)$, and that each $x_\eta$ has the property that for any $y,\epsilon,\delta$, if $x_\eta\close\epsilon y_\delta$ then $x_\eta \close{\epsilon+\delta} \rclim(y)$. + In particular, taking $y\defeq x$ and $\delta\defeq\eta$ in this assumption, we conclude that $x_\eta \close{\eta+\theta} \rclim(x)$ for any $\eta,\theta:\Qp$. + + Now let $y,\epsilon,\delta$ be arbitrary and assume $\rclim(x) \close\epsilon y_\delta$. + By roundedness, there is a $\theta$ such that $\rclim(x) \close{\epsilon-\theta} y_\delta$. + Then by the above observation, for any $\eta$ we have $x_\eta \close{\eta+\theta/2} \rclim(x)$, and hence $x_\eta \close{\epsilon+\eta-\theta/2} y_\delta$ by the triangle inequality. + Hence, the fourth constructor of $\closesym$ yields $\rclim(x) \close{\epsilon+2\eta+\delta-\theta/2} \rclim(y)$. + Thus, if we choose $\eta \defeq \theta/4$, the result follows. +\end{proof} + +\begin{lem}\label{thm:RC-sim-lim-term} + For any Cauchy approximation $y$ and any $\delta,\eta:\Qp$ we have $y_\delta \close{\delta+\eta} \rclim(y)$. +\end{lem} +\begin{proof} + Take $u\defeq y_\delta$ and $\epsilon\defeq \eta$ in the previous lemma. +\end{proof} + +\begin{rmk} + We might have expected to have $y_\delta \close{\delta} \rclim(y)$, but this fails in examples. + For instance, consider $x$ defined by $x_\epsilon \defeq \epsilon$. + Its limit is clearly $0$, but we do not have $|\epsilon - 0 |<\epsilon$, only $\le$. +\end{rmk} + +As an application, \cref{thm:RC-sim-lim-term} enables us to show that the extensions of Lipschitz functions from \cref{RC-extend-Q-Lipschitz} are unique. + +\begin{lem}\label{RC-continuous-eq} + \index{function!continuous}% + Let $f,g:\RC\to\RC$ be continuous, in the sense that + \[ \fall{u:\RC}{\epsilon:\Qp}\exis{\delta:\Qp}\fall{v:\RC} (u\close\delta v) \to (f(u) \close\epsilon f(v)) \] + and analogously for $g$. + If $f(\rcrat(q))=g(\rcrat(q))$ for all $q:\Q$, then $f=g$. +\end{lem} +\begin{proof} + We prove $f(u)=g(u)$ for all $u$ by $\RC$-induction. + The rational case is just the hypothesis. + Thus, suppose $f(x_\delta)=g(x_\delta)$ for all $\delta$. + We will show that $f(\rclim(x))\close\epsilon g(\rclim(x))$ for all $\epsilon$, so that the path constructor of $\RC$ applies. + + Since $f$ and $g$ are continuous, there exist $\theta,\eta$ such that for all $v$, we have + \begin{align*} + (\rclim(x)\close\theta v) &\to (f(\rclim(x)) \close{\epsilon/2} f(v))\\ + (\rclim(x)\close\eta v) &\to (g(\rclim(x)) \close{\epsilon/2} g(v)). + \end{align*} + Choosing $\delta < \min(\theta,\eta)$, by \cref{thm:RC-sim-lim-term} we have both $\rclim(x)\close\theta y_\delta$ and $\rclim(x)\close\eta y_\delta$. + Hence + \[ f(\rclim(x)) \close{\epsilon/2} f(y_\delta) = g(y_\delta) \close{\epsilon/2} g(\rclim(x))\] + and thus $f(\rclim(x))\close\epsilon g(\rclim(x))$ by the triangle inequality. +\end{proof} + +\subsection{The algebraic structure of Cauchy reals} +\label{sec:algebr-struct-cauchy} + +We first define the additive structure $(\RC, 0, {+}, {-})$. Clearly, the additive unit element +$0$ is just $\rcrat(0)$, while the additive inverse ${-} : \RC \to \RC$ is obtained as the +extension of the additive inverse ${-} : \Q \to \Q$, using \cref{RC-extend-Q-Lipschitz} +with Lipschitz constant~$1$. We have to work a bit harder for addition. + +\begin{lem} \label{RC-binary-nonexpanding-extension} + Suppose $f : \Q \times \Q \to \Q$ satisfies, for all $q, r, s : \Q$, + % + \begin{equation*} + |f(q, s) - f(r, s)| \leq |q - r| + \qquad\text{and}\qquad + |f(q, r) - f(q, s)| \leq |r - s|. + \end{equation*} + % + Then there is a function $\bar{f} : \RC \times \RC \to \RC$ such that + $\bar{f}(\rcrat(q), \rcrat(r)) = f(q,r)$ for all $q, r : \Q$. Furthermore, + for all $u, v, w : \RC$ and $q : \Qp$, + % + \begin{equation*} + u \close\epsilon v \Rightarrow \bar{f}(u,w) \close\epsilon \bar{f}(v,w) + \quad\text{and}\quad + v \close\epsilon w \Rightarrow \bar{f}(u,v) \close\epsilon \bar{f}(u,w). + \end{equation*} +\end{lem} + +\begin{proof} + We use $(\RC, {\closesym})$-recursion to construct the curried form of $\bar{f}$ as a map + $\RC \to A$ where $A$ is the space of non-expanding\index{function!non-expanding}\index{non-expanding function} real-valued + functions: + % + \begin{equation*} + A \defeq + \setof{ h : \RC \to \RC | + \fall{\epsilon : \Qp} \fall{u, v : \RC} + u \close\epsilon v \Rightarrow h(u) \close\epsilon h(v) + }. + \end{equation*} + % + We shall also need a suitable $\bsim_\epsilon$ on $A$, which we define as + % + \begin{equation*} + (h \bsim_\epsilon k) \defeq \fall{u : \RC} h(u) \close\epsilon k(u). + \end{equation*} + % + Clearly, if $\fall{\epsilon : \Qp} h \bsim_\epsilon k$ then $h(u) = k(u)$ for all $u : + \RC$, so $\bsim$ is separated. + + For the base case we define $\bar{f}(\rcrat(q)) : A$, where $q : \Q$, as the + extension of the Lipschitz map $\lam{r} f(q,r)$ from $\Q \to \Q$ to $\RC \to \RC$, as + constructed in \cref{RC-extend-Q-Lipschitz} with Lipschitz constant~$1$. Next, for a + Cauchy approximation $x$, we define $\bar{f}(\rclim(x)) : \RC \to \RC$ as + % + \begin{equation*} + \bar{f}(\rclim(x))(v) \defeq \rclim (\lam{\epsilon} \bar{f}(x_\epsilon)(v)). + \end{equation*} + % + For this to be a valid definition, $\lam{\epsilon} \bar{f}(x_\epsilon)(v)$ should be a + Cauchy approximation, so consider any $\delta, \epsilon : \Q$. Then by assumption + $\bar{f}(x_\delta) \bsim_{\delta + \epsilon} \bar{f}(x_\epsilon)$, hence + $\bar{f}(x_\delta)(v) \close{\delta + \epsilon} \bar{f}(x_\epsilon)(v)$. Furthermore, + $\bar{f}(\rclim(x))$ is non-expanding because $\bar{f}(x_\epsilon)$ is such by induction + hypothesis. Indeed, if $u \close\epsilon v$ then, for all $\epsilon : \Q$, + % + \begin{equation*} + \bar{f}(x_{\epsilon/3})(u) \close{\epsilon/3} \bar{f}(x_{\epsilon/3})(v), + \end{equation*} + % + therefore $\bar{f}(\rclim(x))(u) \close\epsilon \bar{f}(\rclim(x))(v)$ by the fourth constructor of $\closesym$. + + We still have to check four more conditions, let us illustrate just one. Suppose + $\epsilon : \Qp$ and for some $\delta : \Qp$ we have $\rcrat(q) \close{\epsilon - \delta} + y_\delta$ and $\bar{f}(\rcrat(q)) \bsim_{\epsilon - \delta} \bar{f}(y_\delta)$. To show + $\bar{f}(\rcrat(q)) \bsim_\epsilon \bar{f}(\rclim(y))$, consider any $v : \RC$ and observe that + % + \begin{equation*} + \bar{f}(\rcrat(q))(v) \close{\epsilon - \delta} \bar{f}(y_\delta)(v). + \end{equation*} + % + Therefore, by the second constructor of $\closesym$, we have + \narrowequation{\bar{f}(\rcrat(q))(v) \close\epsilon \bar{f}(\rclim(y))(v)} + as required. +\end{proof} + +We may apply \cref{RC-binary-nonexpanding-extension} to any bivariate rational function +which is non-expanding separately in each variable. Addition is such a function, therefore +we get ${+} : \RC \times \RC \to \RC$. +\indexdef{addition!of Cauchy reals}% +Furthermore, the extension is unique as long as we +require it to be non-expanding in each variable, and just as in the univariate case, +identities on rationals extend to identities on reals. Since composition of non-expanding +maps is again non-expanding, we may conclude that addition satisfies the usual properties, +such as commutativity and associativity. +\index{associativity!of addition!of Cauchy reals}% +Therefore, $(\RC, 0, {+}, {-})$ is a commutative +group. + +We may also apply \cref{RC-binary-nonexpanding-extension} to the functions $\min : \Q \times +\Q \to \Q$ and $\max : \Q \times \Q \to \Q$, which turns $\RC$ into a lattice. The partial +order $\leq$ on $\RC$ is defined in terms of $\max$ as +% +\symlabel{leq-RC} +\index{order!non-strict}% +\index{non-strict order}% +\begin{equation*} + (u \leq v) \defeq (\max(u, v) = v). +\end{equation*} +% +The relation $\leq$ is a partial order because it is such on $\Q$, and the axioms of a +partial order are expressible as equations in terms of $\min$ and $\max$, so they transfer +to $\RC$. + +\index{absolute value}% +Another function which extends to $\RC$ by the same method is the absolute value $|{\blank}|$. +Again, it has the expected properties because they transfer from $\Q$ to $\RC$. + +\symlabel{lt-RC} +From $\leq$ we get the strict order $<$ by +\index{strict!order}% +\index{order!strict}% +% +\begin{equation*} + (u < v) \defeq \exis{q, r : \Q} (u \leq \rcrat(q)) \land (q < r) \land (\rcrat(r) \leq v). +\end{equation*} +% +That is, $u < v$ holds when there merely exists a pair of rational numbers $q < r$ such that $x \leq +\rcrat(q)$ and $\rcrat(r) \leq v$. It is not hard to check that $<$ is irreflexive and +transitive, and has other properties that are expected for an ordered field. +The archimedean principle follows directly from the definition of~$<$. + +\index{ordered field!archimedean}% +\begin{thm}[Archimedean principle for $\RC$] \label{RC-archimedean} + % + For every $u, v : \RC$ such that $u < v$ there merely exists $q : \Q$ such that $u < q < v$. +\end{thm} + +\begin{proof} + From $u < v$ we merely get $r, s : \Q$ such that $u \leq r < s \leq v$, and we may take $q + \defeq (r + s) / 2$. +\end{proof} + +We now have enough structure on $\RC$ to express $u \close\epsilon v$ with standard concepts. + +\begin{lem}\label{thm:RC-le-grow} + If $q:\Q$ and $u:\RC$ satisfy $u\le \rcrat(q)$, then for any $v:\RC$ and $\epsilon:\Qp$, if $u\close\epsilon v$ then $v\le \rcrat(q+\epsilon)$. +\end{lem} +\begin{proof} + Note that the function $\max(\rcrat(q),\blank):\RC\to\RC$ is Lipschitz with constant $1$. + First consider the case when $u=\rcrat(r)$ is rational. + For this we use induction on $v$. + If $v$ is rational, then the statement is obvious. + If $v$ is $\rclim(y)$, we assume inductively that for any $\epsilon,\delta$, if $\rcrat(r)\close\epsilon y_\delta$ then $y_\delta \le \rcrat(q+\epsilon)$, i.e.\ $\max(\rcrat(q+\epsilon),y_\delta)=\rcrat(q+\epsilon)$. + + Now assuming $\epsilon$ and $\rcrat(r)\close\epsilon \rclim(y)$, we have $\theta$ such that $\rcrat(r)\close{\epsilon-\theta} \rclim(y)$, hence $\rcrat(r)\close\epsilon y_\delta$ whenever $\delta<\theta$. + Thus, the inductive hypothesis gives $\max(\rcrat(q+\epsilon),y_\delta)=\rcrat(q+\epsilon)$ for such $\delta$. + But by definition, + \[\max(\rcrat(q+\epsilon),\rclim(y)) \jdeq \rclim(\lam{\delta} \max(\rcrat(q+\epsilon),y_\delta)).\] + Since the limit of an eventually constant Cauchy approximation is that constant, we have + \[\max(\rcrat(q+\epsilon),\rclim(y)) = \rcrat(q+\epsilon),\] hence $\rclim(y)\le \rcrat(q+\epsilon)$. + + Now consider a general $u:\RC$. + Since $u\le \rcrat(q)$ means $\max(\rcrat(q),u)=\rcrat(q)$, the assumption $u\close\epsilon v$ and the Lipschitz property of $\max(\rcrat(q),-)$ imply $\max(\rcrat(q),v) \close\epsilon \rcrat(q)$. + Thus, since $\rcrat(q)\le \rcrat(q)$, the first case implies $\max(\rcrat(q),v) \le \rcrat(q+\epsilon)$, and hence $v\le \rcrat(q+\epsilon)$ by transitivity of $\le$. +\end{proof} + +\begin{lem}\label{thm:RC-lt-open} + Suppose $q:\Q$ and $u:\RC$ satisfy $u<\rcrat(q)$. Then: + \begin{enumerate} + \item For any $v:\RC$ and $\epsilon:\Qp$, if $u\close\epsilon v$ then $v< \rcrat(q+\epsilon)$.\label{item:RCltopen1} + \item There exists $\epsilon:\Qp$ such that for any $v:\RC$, if $u\close\epsilon v$ we have $v<\rcrat(q)$.\label{item:RCltopen2} + \end{enumerate} +\end{lem} +\begin{proof} + By definition, $u<\rcrat(q)$ means there is $r:\Q$ with $r + 1/q$, which is to say that $u \apart 0$. + + For the converse we construct the inverse map + % + \begin{equation*} + ({\blank})^{-1} : \setof{ u : \RC | u \apart 0 } \to \RC + \end{equation*} + % + by patching together functions, similarly to the construction of squaring in + \cref{RC-squaring}. We only outline the main steps. For every $q : \Q$ let + % + \begin{equation*} + [q, \infty) \defeq \setof{u : \RC | q \leq u} + \qquad\text{and}\qquad + (-\infty, q] \defeq \setof{u : \RC | u \leq -q}. + \end{equation*} + % + Then, as $q$ ranges over $\Qp$, the types $(-\infty, q]$ and $[q, \infty)$ jointly cover + $\setof{u : \RC | u \apart 0}$. On each such $[q, \infty)$ and $(-\infty, q]$ the + inverse function is obtained by an application of \cref{RC-extend-Q-Lipschitz} + with Lipschitz constant $1/q^2$. Finally, \cref{lem:images_are_coequalizers} + guarantees that the inverse function factors uniquely through $\setof{ u : \RC | u + \apart 0 }$. +\end{proof} + +We summarize the algebraic structure of $\RC$ with a theorem. + +\begin{thm} \label{RC-archimedean-ordered-field} + The Cauchy reals form an archimedean ordered field. +\end{thm} + +\subsection{Cauchy reals are Cauchy complete} +\label{sec:cauchy-reals-cauchy-complete} + +We constructed $\RC$ by closing $\Q$ under limits of Cauchy approximations, so it better +be the case that $\RC$ is Cauchy complete. Thanks to \cref{RC-sim-eqv-le} there is no +difference between a Cauchy approximation $x : \Qp \to \RC$ as defined in the construction +of $\RC$, and a Cauchy approximation in the sense of \cref{defn:cauchy-approximation} +(adapted to $\RC$). + +Thus, given a Cauchy approximation $x : \Qp \to \RC$ it is quite natural to expect that +$\rclim(x)$ is its limit, where the notion of limit is defined as in +\cref{defn:cauchy-approximation}. But this is so by \cref{RC-sim-eqv-le} and +\cref{thm:RC-sim-lim-term}. We have proved: + +\begin{thm} + Every Cauchy approximation in $\RC$ has a limit. +\end{thm} + +An archimedean ordered field in which every Cauchy approximation has a limit is called +\define{Cauchy complete}. +\indexdef{Cauchy!completeness}% +\indexdef{complete!ordered field, Cauchy}% +\index{ordered field}% +The Cauchy reals are the least such field. + +\begin{thm} \label{RC-initial-Cauchy-complete} + The Cauchy reals embed into every Cauchy complete ar\-chi\-me\-de\-an ordered field. +\end{thm} + +\begin{proof} + \index{limit!of a Cauchy approximation}% + Suppose $F$ is a Cauchy complete archimedean ordered field. Because limits are unique, + there is an operator $\lim$ which takes Cauchy approximations in $F$ to their limits. We + define the embedding $e : \RC \to F$ by $(\RC, {\closesym})$-recursion as + % + \begin{equation*} + e(\rcrat(q)) \defeq q + \qquad\text{and}\qquad + e(\rclim(x)) \defeq \lim (e \circ x). + \end{equation*} + % + A suitable $\bsim$ on $F$ is + % + \begin{equation*} + (a \bsim_\epsilon b) \defeq |a - b| < \epsilon. + \end{equation*} + % + This is a separated relation because $F$ is archimedean. The rest of the clauses for + $(\RC, {\closesym})$-recursion are easily checked. One would also have to check that $e$ is + an embedding of ordered fields which fixes the rationals. +\end{proof} + +\index{real numbers!Cauchy|)}% + +\section{Comparison of Cauchy and Dedekind reals} +\label{sec:comp-cauchy-dedek} + +\index{real numbers!Dedekind|(}% +\index{real numbers!Cauchy|(}% +\index{depression|(} + +Let us also say something about the relationship between the Cauchy and Dedekind reals. By +\cref{RC-archimedean-ordered-field}, $\RC$ is an archimedean ordered field. It is also +admissible\index{ordered field!admissible} for $\Omega$, as can be easily checked. (In case $\Omega$ is the initial +$\sigma$-frame +\index{initial!sigma-frame@$\sigma$-frame}% +\index{sigma-frame@$\sigma$-frame!initial}% +it takes a simple induction, while in other cases it is immediate.) +Therefore, by \cref{RD-final-field} there is an embedding of ordered fields +% +\begin{equation*} + \RC \to \RD +\end{equation*} +% +which fixes the rational numbers. +(We could also obtain this from \cref{RC-initial-Cauchy-complete,RD-cauchy-complete}.) +In general we do not expect $\RC$ and $\RD$ to coincide +without further assumptions. + +\begin{lem} \label{lem:untruncated-linearity-reals-coincide} + % + If for every $x : \RD$ there merely exists + % + \begin{equation} + \label{eq:untruncated-linearity} + c : \prd{q, r : \Q} (q < r) \to (q < x) + (x < r) + \end{equation} + % + then the Cauchy and Dedekind reals coincide. +\end{lem} + +\begin{proof} + Note that the type in~\eqref{eq:untruncated-linearity} is an untruncated variant + of~\eqref{eq:RD-linear-order}, which states that~$<$ is a weak linear order. + We already know that $\RC$ embeds into $\RD$, so it suffices to show that every Dedekind + real merely is the limit of a Cauchy sequence\index{Cauchy!sequence} of rational numbers. + + Consider any $x : \RD$. By assumption there merely exists $c$ as in the statement of the + lemma, and by inhabitation of cuts\index{cut!Dedekind} there merely exist $a, b : \Q$ such that $a < x < b$. + We construct a sequence\index{sequence} $f : \N \to \setof{ \pairr{q, r} \in \Q \times \Q | q < r }$ by + recursion: + % + \begin{enumerate} + \item Set $f(0) \defeq \pairr{a, b}$. + \item Suppose $f(n)$ is already defined as $\pairr{q_n, r_n}$ such that $q_n < r_n$. + Define $s \defeq (2 q_n + r_n)/3$ and $t \defeq (q_n + 2 r_n)/3$. Then $c(s,t)$ + decides between $s < x$ and $x < t$. If it decides $s < x$ then we set $f(n+1) \defeq + \pairr{s, r_n}$, otherwise $f(n+1) \defeq \pairr{q_n, t}$. + \end{enumerate} + % + Let us write $\pairr{q_n, r_n}$ for the $n$-th term of the sequence~$f$. Then it is easy + to see that $q_n < x < r_n$ and $|q_n - r_n| \leq (2/3)^n \cdot |q_0 - r_0|$ for all $n + : \N$. Therefore $q_0, q_1, \ldots$ and $r_0, r_1, \ldots$ are both Cauchy sequences + converging to the Dedekind cut~$x$. We have shown that for every $x : \RD$ there merely + exists a Cauchy sequence converging to $x$. +\end{proof} + +The lemma implies that either countable choice or excluded middle suffice for coincidence +of $\RC$ and $\RD$. + +\begin{cor} \label{when-reals-coincide} + \index{axiom!of choice!countable}% + \index{excluded middle}% + If excluded middle or countable choice holds then $\RC$ and $\RD$ are equivalent. +\end{cor} + +\begin{proof} + If excluded middle holds then $(x < y) \to (x < z) + (z < y)$ can be proved: either $x < + z$ or $\lnot (x < z)$. In the former case we are done, while in the latter we get $z < + y$ because $z \leq x < y$. Therefore, we get~\eqref{eq:untruncated-linearity} so that we + can apply \cref{lem:untruncated-linearity-reals-coincide}. + + Suppose countable choice holds. The set $S = \setof{ \pairr{q, r} \in \Q \times \Q | q < + r }$ is equivalent to $\N$, so we may apply countable choice to the statement that $x$ + is located, + % + \begin{equation*} + \fall{\pairr{q, r} : S} (q < x) \lor (x < r). + \end{equation*} + % + Note that $(q < x) \lor (x < r)$ is expressible as an existential statement $\exis{b : + \bool} (b = \bfalse \to q < x) \land (b = \btrue \to x < r)$. The (curried form) of + the choice function is then precisely~\eqref{eq:untruncated-linearity} so that + \cref{lem:untruncated-linearity-reals-coincide} is applicable again. +\end{proof} + +\index{real numbers!Dedekind|)}% +\index{real numbers!Cauchy|)}% +\index{real numbers!agree}% + +\index{depression|)} + +\section{Compactness of the interval} +\label{sec:compactness-interval} + +\index{mathematics!classical|(}% +\index{mathematics!constructive|(}% + +We already pointed out that our constructions of reals are entirely compatible with +classical logic. Thus, by assuming the law of excluded middle~\eqref{eq:lem} and the axiom +of choice~\eqref{eq:ac} we could develop classical analysis,\index{classical!analysis}\index{analysis!classical} which would essentially +amount to copying any standard book on analysis. + +\index{analysis!constructive}% +\index{constructive!analysis}% +Nevertheless, anyone interested in computation, for example a numerical analyst, ought to +be curious about developing analysis in a computationally meaningful setting. That +analysis in a constructive setting is even possible was demonstrated by~\cite{Bishop1967}. +As a sample of the differences and similarities between classical and constructive +analysis we shall briefly discuss just one topic --- compactness of the closed interval +$[0,1]$ and a couple of theorems surrounding the concept. + +Compactness is no exception to the common phenomenon in constructive mathematics that +classically equivalent notions bifurcate. The three most frequently used notions of +compactness are: +% +\indexdef{compactness}% +\begin{enumerate} +\item \define{metrically compact:} ``Cauchy complete and totally bounded'', + \indexdef{metrically compact}% + \indexdef{compactness!metric}% +\item \define{Bolzano--Weierstra\ss{} compact:} ``every sequence has a convergent subsequence'', + \index{compactness!Bolzano--Weierstrass@Bolzano--Weierstra\ss{}}% + \indexsee{Bolzano--Weierstrass@Bolzano--Weierstra\ss{}}{compactness}% + \index{sequence}% +\item \define{Heine--Borel compact:} ``every open cover has a finite subcover''. + \index{compactness!Heine--Borel}% + \indexsee{Heine--Borel}{compactness}% +\end{enumerate} +% +These are all equivalent in classical mathematics. +Let us see how they fare in homotopy type theory. We can use either the Dedekind or the +Cauchy reals, so we shall denote the reals just as~$\R$. We first recall several basic +definitions. + +\indexsee{space!metric}{metric space} +\index{metric space|(}% + +\begin{defn} \label{defn:metric-space} + A \define{metric space} + \indexdef{metric space}% + $(M, d)$ is a set $M$ with a map $d : M \times M \to \R$ + satisfying, for all $x, y, z : M$, + % + \begin{align*} + d(x,y) &\geq 0, & + d(x,y) &= d(y,x), \\ + d(x,y) &= 0 \Leftrightarrow x = y, & + d(x,z) &\leq d(x,y) + d(y,z). + \end{align*} + % +\end{defn} + +\begin{defn} \label{defn:complete-metric-space} + A \define{Cauchy approximation} + \index{Cauchy!approximation}% + in $M$ is a sequence $x : \Qp \to M$ satisfying + % + \begin{equation*} + \fall{\delta, \epsilon} d(x_\delta, x_\epsilon) < \delta + \epsilon. + \end{equation*} + % + \index{limit!of a Cauchy approximation}% + The \define{limit} of a Cauchy approximation $x : \Qp \to M$ is a point $\ell : M$ + satisfying + % + \begin{equation*} + \fall{\epsilon, \theta : \Qp} d(x_\epsilon, \ell) < \epsilon + \theta. + \end{equation*} + % + \indexdef{metric space!complete}% + \indexdef{complete!metric space}% + A \define{complete metric space} is one in which every Cauchy approximation has a limit. +\end{defn} + +\begin{defn} \label{defn:total-bounded-metric-space} + For a positive rational $\epsilon$, an \define{$\epsilon$-net} + \indexdef{epsilon-net@$\epsilon$-net}% + in a metric space $(M, + d)$ is an element of + % + \begin{equation*} + \sm{n : \N}{x_1, \ldots, x_n : M} + \fall{y : M} \exis{k \leq n} d(x_k, y) < \epsilon. + \end{equation*} + % + In words, this is a finite sequence of points $x_1, \ldots, x_n$ such that every point + in $M$ merely is within $\epsilon$ of some~$x_k$. + + A metric space $(M, d)$ is \define{totally bounded} + \indexdef{totally bounded metric space}% + \indexdef{metric space!totally bounded}% + when it has $\epsilon$-nets of all + sizes: + % + \begin{equation*} + \prd{\epsilon : \Qp} + \sm{n : \N}{x_1, \ldots, x_n : M} + \fall{y : M} \exis{k \leq n} d(x_k, y) < \epsilon. + \end{equation*} +\end{defn} + +\begin{rmk} + In the definition of total boundedness we used sloppy notation $\sm{n : \N}{x_1, \ldots, x_n : M}$. Formally, we should have written $\sm{x : \lst{M}}$ instead, + where $\lst{M}$ is the inductive type of finite lists\index{type!of lists} from \cref{sec:bool-nat}. + However, that would make the rest of the statement a bit more cumbersome to express. +\end{rmk} + +Note that in the definition of total boundedness we require pure existence of an +$\epsilon$-net, not mere existence. This way we obtain a function which assigns to each +$\epsilon : \Qp$ a specific $\epsilon$-net. Such a function might be called a ``modulus of +total boundedness''. In general, when porting classical metric notions to homotopy type +theory, we should use propositional truncation sparingly, typically so that we avoid +asking for a non-constant map from $\R$ to $\Q$ or $\N$. For instance, here is the +``correct'' definition of uniform continuity. + +\begin{defn} \label{defn:uniformly-continuous} + A map $f : M \to \R$ on a metric space is \define{uniformly continuous} + \indexdef{function!uniformly continuous}% + \indexdef{uniformly continuous function}% + when + % + \begin{equation*} + \prd{\epsilon : \Qp} + \sm{\delta : \Qp} + \fall{x, y : M} + d(x,y) < \delta \Rightarrow |f(x) - f(y)| < \epsilon. + \end{equation*} + % + In particular, a uniformly continuous map has a modulus of uniform continuity\indexdef{modulus!of uniform continuity}, + which is a function that assigns to each $\epsilon$ a corresponding $\delta$. +\end{defn} + +Let us show that $[0,1]$ is compact in the first sense. + +\begin{thm} \label{analysis-interval-ctb} + \index{compactness!metric}% + \index{interval!open and closed}% + The closed interval $[0,1]$ is complete and totally bounded. +\end{thm} + +\begin{proof} + Given $\epsilon : \Qp$, there is $k : \N$ such that $2/k < \epsilon$, so we may take the + $\epsilon$-net $x_i = i/k$ for $i = 0, \ldots, k$. This is an $\epsilon$-net because, + for every $y : [0,1]$ there merely exists $i$ such that $0 \leq i \leq k$ and $(i - + 1)/k < y < (i+1)/k$, and so $|y - x_i| < 2/k < \epsilon$. + + For completeness of $[0,1]$, consider a Cauchy approximation $x : \Qp \to + [0,1]$ and let $\ell$ be its limit in $\R$. Since $\max$ and $\min$ are Lipschitz maps, + the retraction $r : \R \to [0,1]$ defined by $r(x) \defeq \max(0, \min(1, x))$ commutes + with limits of Cauchy approximations, therefore + % + \begin{equation*} + r(\ell) = + r (\lim x) = + \lim (r \circ x) = + \lim x = + \ell, + \end{equation*} + % + which means that $0 \leq \ell \leq 1$, as required. +\end{proof} + +We thus have at least one good notion of compactness in homotopy type theory. +Unfortunately, it is limited to metric spaces because total boundedness is a metric +notion. We shall consider the other two notions shortly, but first we prove that a +uniformly continuous map on a totally bounded space has a \define{supremum}, +\indexsee{least upper bound}{supremum}% +i.e.\ an upper bound which is less than or equal to all other upper bounds. + +\begin{thm} \label{ctb-uniformly-continuous-sup} + % + \indexdef{supremum!of uniformly continuous function}% + A uniformly continuous map $f : M \to \R$ on a totally bounded metric space + $(M, d)$ has a supremum $m : \R$. For every $\epsilon : \Qp$ there exists $u : M$ such + that $|m - f(u)| < \epsilon$. +\end{thm} + +\begin{proof} + Let $h : \Qp \to \Qp$ be the modulus of uniform continuity of~$f$. + We define an approximation $x : \Qp \to \R$ as follows: for any $\epsilon : \Q$ total + boundedness of $M$ gives a $h(\epsilon)$-net $y_0, \ldots, y_n$. Define + % + \begin{equation*} + x_\epsilon \defeq \max (f(y_0), \ldots, f(y_n)). + \end{equation*} + % + We claim that $x$ is a Cauchy approximation. Consider any $\epsilon, \eta : \Q$, so that + % + \begin{equation*} + x_\epsilon \jdeq \max (f(y_0), \ldots, f(y_n)) + \quad\text{and}\quad + x_\eta \jdeq \max (f(z_0), \ldots, f(z_m)) + \end{equation*} + % + for some $h(\epsilon)$-net $y_0, \ldots, y_n$ and $h(\eta)$-net $z_0, \ldots, z_m$. + Every $z_i$ is merely $h(\epsilon)$-close to some $y_j$, therefore $|f(z_i) - f(y_j)| < + \epsilon$, from which we may conclude that + % + \begin{equation*} + f(z_i) < \epsilon + f(y_j) \leq \epsilon + x_\epsilon, + \end{equation*} + % + therefore $x_\eta < \epsilon + x_\epsilon$. Symmetrically we obtain $x_\eta < \eta + + x_\eta$, therefore $|x_\eta - x_\epsilon| < \eta + \epsilon$. + + We claim that $m \defeq \lim x$ is the supremum of~$f$. To prove that $f(x) \leq m$ for + all $x : M$ it suffices to show $\lnot (m < f(x))$. So suppose to the contrary that $m < + f(x)$. There is $\epsilon : \Qp$ such that $m + \epsilon < f(x)$. But now merely for + some $y_i$ participating in the definition of $x_\epsilon$ we get $|f(x) - f(y_i)| < + \epsilon$, therefore $m < f(x) - \epsilon < f(y_i) \leq m$, a contradiction. + + We finish the proof by showing that $m$ satisfies the second part of the theorem, because + it is then automatically a least upper bound. Given any $\epsilon : \Qp$, on one hand + $|m - f(x_{\epsilon/2})| < 3 \epsilon/4$, and on the other $|f(x_{\epsilon/2}) - f(y_i)| < + \epsilon/4$ merely for some $y_i$ participating in the definition of $x_{\epsilon/2}$, + therefore by taking $u \defeq y_i$ we obtain $|m - f(u)| < \epsilon$ by triangle + inequality. +\end{proof} + +Now, if in \cref{ctb-uniformly-continuous-sup} we also knew that $M$ were complete, we +could hope to weaken the assumption of uniform continuity to continuity, and strengthen +the conclusion to existence of a point at which the supremum is attained. The usual proofs +of these improvements rely on the facts that in a complete totally bounded space +% +\begin{enumerate} +\item continuity implies uniform continuity, and +\item every sequence has a convergent subsequence. +\end{enumerate} +% +The first statement follows easily from Heine--Borel compactness, and the second is just +Bolzano--Weierstra\ss{} compactness. +\index{compactness!Bolzano--Weierstrass@Bolzano--Weierstra\ss{}}% +Unfortunately, these are both somewhat problematic. Let +us first show that Bolzano--Weierstra\ss{} compactness implies an instance of excluded middle +known as the \define{limited principle of omniscience}: +\indexsee{axiom!limited principle of omniscience}{limited principle of omniscience}% +\indexdef{limited principle of omniscience}% +for every $\alpha : \N \to \bool$, +% +\begin{equation} \label{eq:lpo} + \Parens{\sm{n : \N} \alpha(n) = \btrue} + + \Parens{\prd{n : \N} \alpha(n) = \bfalse}. +\end{equation} +% +Computationally speaking, we would not expect this principle to hold, because it asks us to decide +whether infinitely many values of a function are~$\bfalse$. + +\begin{thm} \label{analysis-bw-lpo} + % + Bolzano--Weierstra\ss{} compactness of $[0,1]$ implies the limited principle of omniscience. + \index{compactness!Bolzano--Weierstrass@Bolzano--Weierstra\ss{}}% +\end{thm} + +\begin{proof} + Given any $\alpha : \N \to \bool$, define the sequence\index{sequence} $x : \N \to [0,1]$ by + % + \begin{equation*} + x_n \defeq + \begin{cases} + 0 & \text{if $\alpha(k) = \bfalse$ for all $k < n$,}\\ + 1 & \text{if $\alpha(k) = \btrue$ for some $k < n$}. + \end{cases} + \end{equation*} + % + If the Bolzano--Weierstra\ss{} property holds, there exists a strictly increasing $f : \N \to + \N$ such that $x \circ f$ is a Cauchy sequence\index{Cauchy!sequence}. For a sufficiently large $n : + \N$ the $n$-th term $x_{f(n)}$ is within $1/6$ of its limit. Either $x_{f(n)} < 2/3$ or + $x_{f(n)} > 1/3$. If $x_{f(n)} < 2/3$ then~$x_n$ converges to $0$ and so $\prd{n : \N} + \alpha(n) = \bfalse$. If $x_{f(n)} > 1/3$ then $x_{f(n)} = 1$, therefore $\sm{n : \N} + \alpha(n) = \btrue$. +\end{proof} + +While we might not mourn Bolzano--Weierstra\ss{} compactness too much, it seems harder to live +without Heine--Borel compactness, as attested by the fact that both classical mathematics +and Brouwer's Intuitionism accepted it. As we do not want to wade too deeply into general +topology, we shall work with basic open sets. In the case of $\R$ these are the open +intervals with rational endpoints. A family of such intervals, indexed by a type~$I$, +would be a map +% +\begin{equation*} + \mathcal{F} : I \to \setof{(q, r) : \Q \times \Q | q < r}, +\end{equation*} +% +with the idea that a pair of rationals $(q, r)$ with $q < r$ determines the type $\setof{ x : \R | q < x < r}$. It is slightly more convenient to allow degenerate intervals as well, so we take a +\define{family of basic intervals} +\indexdef{family!of basic intervals}% +\indexdef{interval!family of basic}% +to be a map +% +\begin{equation*} + \mathcal{F} : I \to \Q \times \Q. +\end{equation*} +% +To be quite precise, a family is a dependent pair $(I, \mathcal{F})$, not just +$\mathcal{F}$. A \define{finite family of basic intervals} is one indexed by $\setof{ m : + \N | m < n}$ for some $n : \N$. We usually present it by a finite list $[(q_0, r_0), \ldots, +(q_{n-1}, r_{n-1})]$. Finally, a \define{finite subfamily}\indexdef{subfamily, finite, of intervals} of $(I, \mathcal{F})$ is given +by a list of indices $[i_1, \ldots, i_n]$ which then determine the finite family +$[\mathcal{F}(i_1), \ldots, \mathcal{F}(i_n)]$. + +As long as we are aware of the distinction between a pair $(q, r)$ and the corresponding +interval $\setof{ x : \R | q < x < r}$, we may safely use the same notation $(q, r)$ for +both. Intersections\indexdef{intersection!of intervals} and inclusions\indexdef{inclusion!of intervals}\indexdef{containment!of intervals} of intervals are expressible in terms of their +endpoints: +% +\symlabel{interval-intersection} +\symlabel{interval-subset} +\begin{align*} + (q, r) \cap (s, t) &\ \defeq\ (\max(q, s), \min(r, t)),\\ + (q, r) \subseteq (s, t) &\ \defeq\ (q < r \Rightarrow s \leq q < r \leq t). +\end{align*} +% +We say that $\intfam{i}{I}{(q_i, r_i)}$ \define{(pointwise) covers $[a,b]$} +\indexdef{interval!pointwise cover}% +\indexdef{cover!pointwise}% +\indexdef{pointwise!cover}% +when +% +\begin{equation} \label{eq:cover-pointwise-truncated} + \fall{x : [a,b]} \exis{i : I} q_i < x < r_i. +\end{equation} +% +The \define{Heine--Borel compactness for $[0,1]$} +\indexdef{compactness!Heine--Borel}% +states that every covering family of $[0,1]$ +merely has a finite subfamily which still covers $[0,1]$. + +\index{depression} +\begin{thm} \label{classical-Heine-Borel} + \index{excluded middle}% + If excluded middle holds then $[0,1]$ is Heine--Borel compact. +\end{thm} + +\begin{proof} + Assume for the purpose of reaching a contradiction that a family $\intfam{i}{I}{(a_i, + b_i)}$ covers $[0,1]$ but no finite subfamily does. We construct a sequence of closed + intervals $[q_n, r_n]$ which are nested, their sizes shrink to~$0$, and none of them is covered + by a finite subfamily of $\intfam{i}{I}{(a_i, b_i)}$. + + We set $[q_0, r_0] \defeq [0,1]$. Assuming $[q_n, r_n]$ has been constructed, let $s + \defeq (2 q_n + r_n)/3$ and $t \defeq (q_n + 2 r_n)/3$. Both $[q_n, t]$ and $[s, r_n]$ + are covered by $\intfam{i}{I}{(a_i, b_i)}$, but they cannot both have a finite subcover, + or else so would $[q_n, r_n]$. Either $[q_n, t]$ has a finite subcover or it does not. + If it does we set $[q_{n+1}, r_{n+1}] \defeq [s, r_n]$, otherwise we set $[q_{n+1}, + r_{n+1}] \defeq [q_n, t]$. + + The sequences $q_0, q_1, \ldots$ and $r_0, r_1, \ldots$ are both Cauchy and they + converge to a point $x : [0,1]$ which is contained in every $[q_n, r_n]$. + There merely exists $i : I$ such that $a_i < x < b_i$. Because the sizes of the + intervals $[q_n, r_n]$ shrink to zero, there is $n : \N$ such that $a_i < q_n \leq x + \leq r_n < b_i$, but this means that $[q_n, r_n]$ is covered by a single interval $(a_i, + b_i)$, while at the same time it has no finite subcover. A contradiction. +\end{proof} + +Without excluded middle, or a pinch of Brouwerian Intuitionism, we seem to be stuck. +Nevertheless, Heine--Borel compactness of $[0,1]$ \emph{can} be recovered in a constructive +setting, in a fashion that is still compatible with classical mathematics! For this to be +done, we need to revisit the notion of cover. The trouble with +\eqref{eq:cover-pointwise-truncated} is that the truncated existential allows a space to +be covered in any haphazard way, and so computationally speaking, we stand no chance of +merely extracting a finite subcover. By removing the truncation we get +% +\begin{equation} \label{eq:cover-pointwise} + \prd{x : [0,1]} \sm{i : I} q_i < x < r_i, +\end{equation} +% +which might help, were it not too demanding of covers. With this definition we +could not even show that $(0,3)$ and $(2,5)$ cover $[1,4]$ because that would amount +to exhibiting a non-constant map $[1,4] \to \bool$, see +\cref{ex:reals-non-constant-into-Z}. Here we can take a lesson from ``pointfree topology'' +\index{pointfree topology}% +\index{topology!pointfree}% +(i.e.\ locale theory): +\index{locale}% +the notion of cover ought to be expressed in terms of open sets, without +reference to points. Such a ``holistic'' view of space will then allow us to analyze the +notion of cover, and we shall be able to recover Heine--Borel compactness. Locale +theory uses power sets, +\index{power set}% +which we could obtain by assuming propositional resizing; +\index{propositional!resizing}% +but instead we can steal ideas from the predicative cousin of locale theory, +\index{mathematics!predicative}% +which is called ``formal topology''. +\index{formal!topology}% + +\index{acceptance|(} + +Suppose that we have a family $\pairr{I, \mathcal{F}}$ and an interval $(a, b)$. How might +we express the fact that $(a,b)$ is covered by the family, without referring to points? +Here is one: if $(a, b)$ equals some $\mathcal{F}(i)$ then it is covered by the family. +And another one: if $(a,b)$ is covered by some other family $(J, \mathcal{G})$, and in +turn each $\mathcal{G}(j)$ is covered by $\pairr{I, \mathcal{F}}$, then $(a,b)$ is covered +$\pairr{I, \mathcal{F}}$. Notice that we are listing \emph{rules} which can be used to +\emph{deduce} that $\pairr{I, \mathcal{F}}$ covers $(a,b)$. We should find sufficiently +good rules and turn them into an inductive definition. + +\begin{defn} \label{defn:inductive-cover} + % + The \define{inductive cover $\cover$} + \indexdef{inductive!cover}% + \indexdef{cover!inductive}% + is a mere relation + % + \begin{equation*} + {\cover} : (\Q \times \Q) \to \Parens{\sm{I : \type} (I \to \Q \times \Q)} \to \prop + \end{equation*} + % + defined inductively by the following rules, where $q, r, s, t$ are rational numbers and + $\pairr{I, \mathcal{F}}$, $\pairr{J, \mathcal{G}}$ are families of basic intervals: + % + \begin{enumerate} + + \item \emph{reflexivity:} + \index{reflexivity!of inductive cover}% + $\mathcal{F}(i) \cover \pairr{I, \mathcal{F}}$ for all $i : I$, + + \item \emph{transitivity:} + \index{transitivity!of inductive cover}% + if $(q, r) \cover \pairr{J, \mathcal{G}}$ and $\fall{j : J} \mathcal{G}(j) \cover \pairr{I,\mathcal{F}}$ + then $(q, r) \cover \pairr{I, \mathcal{F}}$, + + \item \emph{monotonicity:} + \index{monotonicity!of inductive cover}% + if $(q, r) \subseteq (s, t)$ and $(s,t) \cover \pairr{I, \mathcal{F}}$ then $(q, r) \cover + \pairr{I, \mathcal{F}}$, + + \item \emph{localization:} + \index{localization of inductive cover}% + if $(q, r) \cover (I, \mathcal{F})$ then $(q, r) \cap (s, t) \cover + \intfam{i}{I}{(\mathcal{F}(i) \cap (s, t))}$. + + \item \label{defn:inductive-cover-interval-1} + if $q < s < t < r$ then $(q, r) \cover [(q, t), (s, r)]$, + + \item \label{defn:inductive-cover-interval-2} + $(q, r) \cover \intfam{u}{\setof{ (s,t) : \Q \times \Q | q < s < t < r}}{u}$. + \end{enumerate} +\end{defn} + +The definition should be read as a higher-inductive type in which the listed rules are +point constructors, and the type is $(-1)$-truncated. The first four clauses are of a +general nature and should be intuitively clear. The last two clauses are specific to the +real line: one says that an interval may be covered by two intervals if they overlap, +while the other one says that an interval may be covered from within. Incidentally, if $r +\leq q$ then $(q, r)$ is covered by the empty family by the last clause. + +Inductive covers enjoy the Heine--Borel property, the proof of which requires a lemma. + +\begin{lem} \label{reals-formal-topology-locally-compact} + Suppose $q < s < t < r$ and $(q, r) \cover \pairr{I, \mathcal{F}}$. Then there merely + exists a finite subfamily of $\pairr{I, \mathcal{F}}$ which inductively covers $(s, t)$. +\end{lem} + +\begin{proof} + We prove the statement by induction on $(q, r) \cover \pairr{I, \mathcal{F}}$. There are + six cases: + % + \begin{enumerate} + + \item Reflexivity: if $(q, r) = \mathcal{F}(i)$ then by monotonicity $(s, t)$ is covered + by the finite subfamily $[\mathcal{F}(i)]$. + + \item Transitivity: + suppose $(q, r) \cover \pairr{J, \mathcal{G}}$ and $\fall{j : J} \mathcal{G}(j) \cover + \pairr{I, \mathcal{F}}$. By the inductive hypothesis there merely exists + $[\mathcal{G}(j_1), \ldots, \mathcal{G}(j_n)]$ which covers $(s, t)$. + Again by the inductive hypothesis, each of $\mathcal{G}(j_k)$ is covered by a finite + subfamily of $\pairr{I, \mathcal{F}}$, and we can collect these into a finite + subfamily which covers $(s, t)$. + + \item Monotonicity: + if $(q, r) \subseteq (u, v)$ and $(u, v) \cover \pairr{I, \mathcal{F}}$ then we may + apply the inductive hypothesis to $(u, v) \cover \pairr{I, \mathcal{F}}$ because $u < + s < t < v$. + + \item Localization: + suppose $(q', r') \cover \pairr{I, \mathcal{F}}$ and $(q, r) = (q', r') \cap (a, b)$. + Because $q' < s < t < r'$, by the inductive hypothesis there is a finite subcover + $[\mathcal{F}(i_1), \ldots, \mathcal{F}(i_n)]$ of $(s, t)$. We also know that $a < s < + t < b$, therefore $(s, t) = (s, t) \cap (a, b)$ is covered by + $[\mathcal{F}(i_1) \cap (a,b), \ldots, \mathcal{F}(i_n) \cap (a,b)]$, which is a + finite subfamily of $\intfam{i}{I}{(\mathcal{F}(i) \cap (a, b))}$. + + \item If $(q, r) \cover [(q, v), (u, r)]$ for some $q < u < v < r$ then by monotonicity + $(s, t) \cover [(q, v), (u, r)]$. + + \item Finally, $(s, t) \cover \intfam{z}{\setof{ (u,v):\Q \times \Q | q < u < v < r}}{z}$ by + reflexivity. \qedhere + \end{enumerate} +\end{proof} + +Say that \define{$\pairr{I, \mathcal{F}}$ inductively covers + $[a, b]$} when there merely exists $\epsilon : \Qp$ such that $(a - \epsilon, b + +\epsilon) \cover \pairr{I, \mathcal{F}}$. + +\begin{cor} \label{interval-Heine-Borel} + \index{compactness!Heine-Borel}% + \index{interval!open and closed}% + A closed interval is Heine--Borel compact for inductive covers. +\end{cor} + +\begin{proof} + Suppose $[a, b]$ is inductively covered by $\pairr{I, \mathcal{F}}$, so there merely is + $\epsilon : \Qp$ such that $(a - \epsilon, b + \epsilon) \cover \pairr{I, \mathcal{F}}$. + By \cref{reals-formal-topology-locally-compact} there is a finite subcover of + $(a - \epsilon/2, b + \epsilon/2)$, which is therefore a finite subcover of $[a, b]$. +\end{proof} + +Experience from formal topology\index{topology!formal} shows that the rules for inductive covers are sufficient +for a constructive development of pointfree topology. But we can also provide our own +evidence that they are a reasonable notion. + +\begin{thm} \label{inductive-cover-classical} + \mbox{} + % + \begin{enumerate} + \item An inductive cover is also a pointwise cover. + \item Assuming excluded middle, a pointwise cover is also an inductive cover. + \end{enumerate} +\end{thm} + +\begin{proof} + \mbox{} + % + \begin{enumerate} + + \item + Consider a family of basic intervals $\pairr{I, \mathcal{F}}$, where we write $(q_i, + r_i) \defeq \mathcal{F}(i)$, an interval $(a,b)$ inductively covered by $\pairr{I, + \mathcal{F}}$, and $x$ such that $a < x < b$. + % + We prove by induction on $(a,b) \cover \pairr{I, \mathcal{F}}$ that there merely + exists $i : I$ such that $q_i < x < r_i$. Most cases are pretty obvious, so we show + just two. If $(a,b) \cover \pairr{I, \mathcal{F}}$ by reflexivity, then there merely + is some $i : I$ such that $(a,b) = (q_i, r_i)$ and so $q_i < x < r_i$. If $(a,b) + \cover \pairr{I, \mathcal{F}}$ by transitivity via $\intfam{j}{J}{(s_j, t_j)}$ then by + the inductive hypothesis there merely is $j : J$ such that $s_j < x < t_j$, and then since + $(s_j, t_j) \cover \pairr{I, \mathcal{F}}$ again by the inductive hypothesis there merely + exists $i : I$ such that $q_i < x < r_i$. Other cases are just as exciting. + + \item Suppose $\intfam{i}{I}{(q_i, r_i)}$ pointwise covers $(a, b)$. By + \cref{defn:inductive-cover-interval-2} of \cref{defn:inductive-cover} it + suffices to show that $\intfam{i}{I}{(q_i, r_i)}$ inductively covers $(c, d)$ whenever + $a < c < d < b$, so consider such $c$ and $d$. By \cref{classical-Heine-Borel} + there is a finite subfamily $[i_1, \ldots, i_n]$ which already pointwise covers $[c, + d]$, and hence $(c,d)$. Let $\epsilon : \Qp$ be a Lebesgue number + \index{Lebesgue number} + for $(q_{i_1}, r_{i_1}), \ldots, (q_{i_n}, r_{i_n})$ as in + \cref{ex:finite-cover-lebesgue-number}. There is a positive $k : \N$ such that $2 (d - c)/k + < \min(1, \epsilon)$. For $0 \leq i \leq k$ let + % + \begin{equation*} + c_k \defeq ((k - i) c + i d) / k. + \end{equation*} + % + The intervals $(c_0, c_2)$, $(c_1, c_3)$, \dots, $(c_{k-2}, c_k)$ inductively cover + $(c,d)$ by repeated use of transitivity and~\cref{defn:inductive-cover-interval-1} + in \cref{defn:inductive-cover}. Because their widths are below $\epsilon$ each of + them is contained in some $(q_i, r_i)$, and we may use transitivity and monotonicity to + conclude that $\intfam{i}{I}{(q_i, r_i)}$ inductively cover $(c, d)$. \qedhere + \end{enumerate} +\end{proof} + +The upshot of the previous theorem is that, as far as classical mathematics is concerned, +there is no difference between a pointwise and an inductive cover. In particular, since it +is consistent to assume excluded middle in homotopy type theory, we cannot exhibit an +inductive cover which fails to be a pointwise cover. Or to put it in a different way, the +difference between pointwise and inductive covers is not what they cover but in the +\emph{proofs} that they cover. + +We could write another book by going on like this, but let us stop here and hope that we +have provided ample justification for the claim that analysis can be developed in homotopy +type theory. The curious reader should consult \cref{ex:mean-value-theorem} for +constructive versions of the intermediate value theorem. + +\index{acceptance|)} + +\index{mathematics!classical|)}% +\index{mathematics!constructive|)}% + +\section{The surreal numbers} +\label{sec:surreals} + +\index{surreal numbers|(}% + +In this section we consider another example of a higher inductive-in\-duc\-tive type, which draws together many of our threads: Conway's field \NO of \emph{surreal numbers}~\cite{conway:onag}. +The surreal numbers are the natural common generalization of the (Dedekind) real numbers (\cref{sec:dedekind-reals}) and the ordinal numbers (\cref{sec:ordinals}). +Conway, working in classical\index{mathematics!classical} mathematics with excluded middle and Choice, defines a surreal number to be a pair of \emph{sets} of surreal numbers, written $\surr L R$, such that every element of $L$ is strictly less than every element of $R$. +This obviously looks like an inductive definition, but there are three issues with regarding it as such. + +Firstly, the definition requires the relation of (strict) inequality between surreals, so that relation must be defined simultaneously with the type \NO of surreals. +(Conway avoids this issue by first defining \emph{games}\index{game!Conway}, which are like surreals but omit the compatibility condition on $L$ and $R$.) +As with the relation $\closesym$ for the Cauchy reals, this simultaneous definition could \emph{a priori} be either inductive-inductive or inductive-recursive. +We will choose to make it inductive-inductive, for the same reasons we made that choice for $\closesym$. + +Moreover, we will define strict inequality $<$ and non-strict inequality $\le$ for surreals separately (and mutually inductively). +Conway defines $<$ in terms of $\le$, in a way which is sensible classically but not constructively. +\index{mathematics!constructive}% +Furthermore, a negative definition of $<$ would make it unacceptable as a hypothesis of the constructor of a higher inductive type (see \cref{sec:strictly-positive}). + +Secondly, Conway says that $L$ and $R$ in $\surr L R$ should be ``sets of surreal numbers'', but the naive meaning of this as a predicate $\NO\to\prop$ is not positive, hence cannot be used as input to an inductive constructor. +However, this would not be a good type-theoretic translation of what Conway means anyway, because in set theory the surreal numbers form a proper class, whereas the sets $L$ and $R$ are true (small) sets, not arbitrary subclasses of \NO. +In type theory, this means that \NO will be defined relative to a universe \UU, but will itself belong to the next higher universe $\UU'$, like the sets \ord and \card of ordinals and cardinals, the cumulative hierarchy $V$, or even the Dedekind reals in the absence of propositional resizing. +\index{propositional!resizing}% +We will then require the ``sets'' $L$ and $R$ of surreals to be \UU-small, and so it is natural to represent them by \emph{families} of surreals indexed by some \UU-small type. +(This is all exactly the same as what we did with the cumulative hierarchy in \cref{sec:cumulative-hierarchy}.) +That is, the constructor of surreals will have type +\[ \prd{\LL,\RR:\UU} (\LL\to\NO) \to (\RR\to \NO) \to (\text{some condition}) \to \NO \] +which is indeed strictly positive.\index{strict!positivity} + +Finally, after giving the mutual definitions of \NO and its ordering, Conway declares two surreal numbers $x$ and $y$ to be \emph{equal} if $x\le y$ and $y\le x$. +This is naturally read as passing to a quotient of the set of ``pre-surreals'' by an equivalence relation. +%(In set-theoretic foundations, one has to us an additional trick to deal with large equivalence classes.) +However, in the absence of the axiom of choice, such a quotient presents the same problem as the quotient in the usual construction of Cauchy reals: it will no longer be the case that a pair of families \emph{of surreals} yield a new surreal $\surr L R$, since we cannot necessarily ``lift'' $L$ and $R$ to families of pre-surreals. +Of course, we can solve this problem in the same way we did for Cauchy reals, by using a \emph{higher} inductive-inductive definition. + +\begin{defn}\label{defn:surreals} + The type \NO of \define{surreal numbers}, + \indexdef{surreal numbers}% + \indexsee{number!surreal}{surreal numbers}% + along with the relations $\mathord<:\NO\to\NO\to\type$ and $\mathord\le:\NO\to\NO\to\type$, are defined higher inductive-inductively as follows. + The type \NO has the following constructors. + \begin{itemize} + \item For any $\LL,\RR:\UU$ and functions $\LL\to \NO$ and $\RR\to \NO$, whose values we write as $x^L$ and $x^R$ for $L:\LL$ and $R:\RR$ respectively, if $\fall{L:\LL}{R:\RR} x^Ly$ iff ($x\ge y$ and $y\not\ge x$). +\end{itemize} +The inclusion of $x\ge y$ in the definition of $x>y$ is unnecessary if all objects are [surreal] numbers rather than ``games''\index{game!Conway}. +Thus, Conway's $<$ is just the negation of his $\ge$, so that his condition for $\surr L R$ to be a surreal is the same as ours. +Negating Conway's $\le$ and canceling double negations, we arrive at our definition of $<$, and we can then reformulate his $\le$ in terms of $<$ without negations. + +We can immediately populate $\NO$ with many surreal numbers. +Like Conway, we write +\symlabel{surreal-cut} +\[\surr{x,y,z,\dots}{u,v,w,\dots}\] +for the surreal number defined by a cut where $\LL\to\NO$ and $\RR\to\NO$ are families described by $x,y,z,\dots$ and $u,v,w,\dots$. +Of course, if $\LL$ or $\RR$ are $\emptyt$, we leave the corresponding part of the notation empty. +There is an unfortunate clash with the standard notation $\setof{x:A | P(x)}$ for subsets, but we will not use the latter in this section. +\begin{itemize} +\item We define $\iota_{\nat}:\nat\to\NO$ recursively by + \begin{align*} + \iota_{\nat}(0) &\defeq \surr{}{},\\ + \iota_\nat(\suc(n)) &\defeq \surr{\iota_\nat(n)}{}. + \end{align*} + That is, $\iota_\nat(0)$ is defined by the cut consisting of $\emptyt\to\NO$ and $\emptyt\to\NO$. + Similarly, $\iota_\nat(\suc(n))$ is defined by $\unit\to\NO$ (picking out $\iota_\nat(n)$) and $\emptyt\to\NO$. +\item Similarly, we define $\iota_{\Z}:\Z\to\NO$ using the sign-case recursion principle (\cref{thm:sign-induction}): + \begin{align*} + \iota_{\Z}(0) &\defeq \surr{}{},\\ + \iota_\Z(n+1) &\defeq \surr{\iota_\Z(n)}{} & &\text{$n\ge 0$,}\\ + \iota_\Z(n-1) &\defeq \surr{}{\iota_\Z(n)} & &\text{$n\le 0$.} + \end{align*} +\item By a \define{dyadic rational} + \indexdef{rational numbers!dyadic}% + \indexsee{dyadic rational}{rational numbers, dyadic}% + we mean a pair $(a,n)$ where $a:\Z$ and $n:\nat$, and such that if $n>0$ then $a$ is odd. + We will write it as $a/2^n$, and identify it with the corresponding rational number. + If $\Q_D$ denotes the set of dyadic rationals, we define $\iota_{\Q_D}:\Q_D\to\NO$ by induction on $n$: + \begin{align*} + \iota_{\Q_D}(a/2^0) &\defeq \iota_\Z(a),\\ + \iota_{\Q_D}(a/2^n) &\defeq \surr{\iota_{\Q_D}(a/2^n - 1/2^n)}{\iota_{\Q_D}(a/2^n + 1/2^n)}, + \quad \text{for $n>0$.} + \end{align*} + Here we use the fact that if $n>0$ and $a$ is odd, then $a/2^n \pm 1/2^n$ is a dyadic rational with a smaller denominator than $a/2^n$. +\item We define $\iota_{\RD}:\RD\to\NO$,\label{reals-into-surreals} where $\RD$ is (any version of) the Dedekind reals from \cref{sec:dedekind-reals}, by + \begin{align*} + \iota_{\RD}(x) &\defeq + \surr{q\in\Q_D \text{ such that } q z$. +We equip $A$ with the relations $\le$ and $<$ induced from $\NO$, so that antisymmetry is obvious. +For the primary clause of the inner recursion, we suppose also $y$ defined by a cut, with each $x+y^L$ and $x+y^R$ defined and satisfying $x^L+y^L < x+y^L$, $x^L+y^R < x+y^R$, $x+y^L < x^R + y^L$, and $x+y^R < x^R+y^R$ (these come from the additional conditions imposed on elements of $A(y)$), and also $x+y^L < x+y^R$ (since the elements $x+y^L$ and $x+y^R$ of $A(y)$ form a dependent cut). +Now we give Conway's definition: +\[ x+y \defeq \surr{x^L+y, x+y^L}{x^R+y,x+y^R}. \] +In other words, the left options of $x+y$ are all numbers of the form $x^L+y$ for some left option $x^L$, or $x+y^L$ for some left option $y^L$. +We must show that each of these left options is less than each of these right options: +\begin{itemize} +\item $x^L+y < x^R+y$ by the outer inductive hypothesis. +\item $x^L+y < x^L + y^R < x + y^R$, the first since $(x^L+\blank)$ preserves inequalities, and the second since $x+y^R : A(y^R)$. +\item $x+y^L < x^R+ y^L < x^R + y$, the first since $x+y^L : A(y^L)$ and the second since $(x^R+\blank)$ preserves inequalities. +\item $x+y^L < x+y^R$ by the inner inductive hypothesis (specifically, the fact that we have a dependent cut). +\end{itemize} +We also have to show that $x+y$ thusly defined lies in $A(y)$, i.e.\ that $x^L + y < x+y$ and $x+y < x^R + y$; but this is true by \cref{thm:NO-refl-opt}\ref{item:NO-lt-opt}. + +Next we have to verify that the definition of $(x+\blank)$ preserves inequality: +\begin{itemize} +\item If $y\le z$ arises from knowing that $y^L + 0$. Derive from this the limited principle of omniscience~\eqref{eq:lpo}. +\index{limited principle of omniscience}% + \end{enumerate} +\end{ex} + +\begin{ex} \label{ex:traditional-archimedean} + \index{ordered field!archimedean}% + Show that in an ordered field $F$, density of $\Q$ and the traditional archimedean axiom + are equivalent: + % + \begin{equation*} + (\fall{x, y : F} x < y \Rightarrow \exis{q : \Q} x < q < y) + \Leftrightarrow + (\fall{x : F} \exis{k : \Z} x < k). + \end{equation*} +\end{ex} + +\begin{ex} \label{RC-Lipschitz-on-interval} Suppose $a, b : \Q$ and $f : \setof{ q : \Q | + a \leq q \leq b } \to \RC$ is Lipschitz with constant~$L$. Show that there exists a unique + extension $\bar{f} : [a,b] \to \RC$ of $f$ which is Lipschitz with + constant~$L$. Hint: rather than redoing \cref{RC-extend-Q-Lipschitz} for closed + intervals, observe that there is a retraction $r : \RC \to [-n,n]$ and apply + \cref{RC-extend-Q-Lipschitz} to $f \circ r$. +\end{ex} + +\begin{ex} \label{ex:metric-completion} + \index{completion!of a metric space}% + Generalize the construction of $\RC$ to construct the Cauchy completion of any metric space. First, think about which notion of real numbers is most natural as the codomain for the distance\index{distance} function of a metric space. Does it matter? Next, work out the details of two constructions: + % + \begin{enumerate} + \item Follow the construction of Cauchy reals to define the completion of a metric space as an inductive-inductive type closed under limits of Cauchy sequences.\index{Cauchy!sequence} + \item Use the following construction due to Lawvere~\cite{lawvere:metric-spaces}\index{Lawvere} and Richman~\cite{Richman00thefundamental}, where the completion of a metric space $(M, d)$ is given as the type of \define{locations}. + \indexdef{location}% + A location is a function $f : M \to \R$ such that + % + \begin{enumerate} + \item $f(x) \geq |f(y) - d(x,y)|$ for all $x, y : M$, and + \item $\inf_{x \in M} f(x) = 0$, by which we mean $\fall{\epsilon : \Qp} \exis{x : M} |f(x)| < \epsilon$ and $\fall{x : M} f(x) \geq 0$. + \end{enumerate} + % + The idea is that $f$ looks like it is measuring the distance from a point. + \end{enumerate} + % + \index{universal!property!of metric completion}% + Finally, prove the following universal property of metric completions: a locally uniformly continuous map from a metric space to a Cauchy complete metric space extends uniquely to a locally uniformly continuous map on the completion. (We say that a map is \define{locally uniformly continuous} + \indexdef{function!locally uniformly continuous}% + \indexdef{locally uniformly continuous map}% + if it is uniformly continuous on open balls.) +\end{ex} + +\index{metric space|)}% + +\begin{ex} \label{ex:reals-apart-neq-MP} + \define{Markov's principle} + \indexdef{axiom!Markov's principle}% + \indexdef{Markov's principle}% + says that for all $f : \nat \to \bool$, + % + \begin{equation*} + (\lnot \lnot \exis{n : \nat} f(n) = \btrue) + \Rightarrow + \exis{n : \nat} f(n) = \btrue. + \end{equation*} + % + This is a particular instance of the law of double negation~\eqref{eq:ldn}. Show that + $\fall{x, y: \RD} x \neq y \Rightarrow x \apart y$ implies Markov's principle. Does the + converse hold as well? +\end{ex} + +\begin{ex} \label{ex:reals-apart-zero-divisors} + \index{apartness}% + Verify that the following ``no zero divisors'' property holds for the real numbers: + $x y \apart 0 \Leftrightarrow x \apart 0 \land y \apart 0$. +\end{ex} + +\begin{ex} \label{ex:finite-cover-lebesgue-number} + % + Suppose $(q_1, r_1), \ldots, (q_n, r_n)$ pointwise cover $(a, b)$. Then there is + $\epsilon : \Qp$ such that whenever $a < x < y < b$ and $|x - y| < \epsilon$ + then there merely exists $i$ such that $q_i < x < r_i$ and $q_i < y < r_i$. Such an + $\epsilon$ is called a \define{Lebesgue number} + \indexdef{Lebesgue number}% + for the given cover. +\end{ex} + +\begin{ex} \label{ex:mean-value-theorem} + % + Prove the following approximate version of the intermediate value theorem: + % + \begin{quote} + \emph{ + If $f : [0,1] \to \R$ is uniformly continuous and $f(0) < 0 < f(1)$ then + for every $\epsilon : \Qp$ there merely exists $x : [0,1]$ such that $|f(x)| < + \epsilon$. + } + \end{quote} + % + Hint: do not try to use the bisection method because it leads to the axiom of choice. + Instead, approximate $f$ with a piecewise linear map. How do you construct a piecewise + linear map? +\end{ex} + +\begin{ex}\label{ex:knuth-surreal-check} + Check whether everything in~\cite{knuth74:_surreal_number} can be done using the higher + inductive-inductive surreals of \cref{sec:surreals}. +\end{ex} + +\begin{ex}\label{ex:reals-into-surreals} + Recall the function $\iota_{\RD}:\RD\to\NO$ defined on page~\pageref{reals-into-surreals}. + \begin{enumerate} + \item Show that $\iota_{\RD}$ is injective. + \item There are obvious extensions of $\iota_{\RD}$ to the extended reals (\cref{ex:RD-extended-reals}) and the interval domain (\cref{ex:RD-interval-arithmetic}). + Are they injective? + \end{enumerate} +\end{ex} + +\begin{ex}\label{ex:ord-into-surreals} + Show that the function $\iota_{\ord}:\ord\to\NO$ defined on page~\pageref{ord-into-surreals} is injective if and only if \LEM{} holds. +\end{ex} + +\begin{ex}\label{ex:hiit-plump} + Define a type $\mathsf{POrd}$ equipped with binary relations $\le$ and $<$ by mimicking the definition of \NO but using only left options. + \begin{enumerate} + \item Construct a map $j:\mathsf{POrd} \to \NO$ and show that it is an embedding. + \item Show that $\mathsf{POrd}$ is an ordinal (in the next higher universe, like \ord) under the relation $<$. + \item Assuming propositional resizing, show that $\mathsf{POrd}$ is equivalent to the subset + \[\setof{A:\ord | \mathsf{isPlump}(A)}\] + of \ord from \cref{ex:plump-ordinals}. + Conclude that $\iota_{\ord}:\ord\to\NO$ is injective when restricted to plump ordinals. + \end{enumerate} + In the absence of propositional resizing, we may still refer to elements of $\mathsf{POrd}$ (or their images in \NO) as \define{plump ordinals}.\index{ordinal!plump}\index{plump!ordinal} +\end{ex} + +\begin{ex}\label{ex:pseudo-ordinals} + Define a surreal number to be a \define{pseudo-ordinal}\index{pseudo-ordinal}\index{ordinal!pseudo-} if it is equal to a cut $\surr{x^L}{}$ with no right options (but its left options may themselves have right options). + Show that the statement ``every pseudo-ordinal is a plump ordinal'' is equivalent to \LEM{}. +\end{ex} + +\begin{ex}\label{ex:double-No-recursion} + Note that \cref{defn:No-codes} and \cref{eg:surreal-addition} both use a similar pattern to define a function $\NO \to \NO \to B$: an outer \NO-recursion whose codomain is the set of order-preserving functions $\NO\to B$, followed by an inner \NO-induction into a family $A:\NO\to\type$ where $A(y)$ is a subset of $B$ ensuring that the inequalities $x^L[r]^{\proj1} + \ar@<-0.25em>[r]_{\proj2} + & + {A} + \ar[r]^(0.4){\tilde{f}} + \ar[rd]_{f} + & + {\im(f)} + \ar@{..>}[d]^{i_f} + \\ & & + B + } +\end{equation*} + +Recall that a function $f:A\to B$ is called \emph{surjective} if +\index{function!surjective}% +\narrowequation{\fall{b:B}\brck{\hfib f b},} +or equivalently $\fall{b:B} \exis{a:A} f(a)=b$. +We have also said that a function $f:A\to B$ between sets is called \emph{injective} if +\index{function!injective}% +$\fall{a,a':A} (f(a) = f(a')) \Rightarrow (a=a')$, or equivalently if each of its fibers is a mere proposition. +Since these are the $(-1)$-connected and $(-1)$-truncated maps in the sense of \cref{cha:hlevels}, the general theory there implies that $\tilde f$ above is surjective and $i_f$ is injective, and that this factorization is stable under pullback. + +We now identify surjectivity and injectivity with the appropriate cat\-e\-go\-ry-theoretic notions. +First we observe that categorical monomorphisms and epimorphisms have a slightly stronger equivalent formulation. + +\begin{lem}\label{thm:mono} + For a morphism $f:\hom_A(a,b)$ in a category $A$, the following are equivalent. + \begin{enumerate} + \item $f$ is a \define{monomorphism}: + \indexdef{monomorphism}% + for all $x:A$ and ${g,h:\hom_A(x,a)}$, if $f\circ g = f\circ h$ then $g=h$.\label{item:mono1} + \item (If $A$ has pullbacks) the diagonal map $a\to a\times_b a$ is an isomorphism.\label{item:mono4} + \item For all $x:A$ and $k:\hom_A(x,b)$, the type $\sm{h:\hom_A(x,a)} (k = f\circ h)$ is a mere proposition.\label{item:mono2} + \item For all $x:A$ and ${g:\hom_A(x,a)}$, the type $\sm{h:\hom_A(x,a)} (f\circ g = f\circ h)$ is contractible.\label{item:mono3} + \end{enumerate} +\end{lem} +\begin{proof} + The equivalence of conditions~\ref{item:mono1} and~\ref{item:mono4} is standard category theory. + Now consider the function $(f\circ \blank ):\hom_A(x,a) \to \hom_A(x,b)$ between sets. + Condition~\ref{item:mono1} says that it is injective, while~\ref{item:mono2} says that its fibers are mere propositions; hence they are equivalent. + And~\ref{item:mono2} implies~\ref{item:mono3} by taking $k\defeq f\circ g$ and recalling that an inhabited mere proposition is contractible. + Finally,~\ref{item:mono3} implies~\ref{item:mono1} since if $p:f\circ g= f\circ h$, then $(g,\refl{})$ and $(h,p)$ both inhabit the type in~\ref{item:mono3}, hence are equal and so $g=h$. +\end{proof} + +\begin{lem}\label{thm:inj-mono} + A function $f:A\to B$ between sets is injective if and only if it is a monomorphism\index{monomorphism} in \uset. +\end{lem} +\begin{proof} + Left to the reader. +\end{proof} + +Of course, an \define{epimorphism} +\indexdef{epimorphism}% +\indexsee{epi}{epimorphism}% +is a monomorphism in the opposite category. +We now show that in \uset, the epimorphisms are precisely the surjections, and also precisely the coequalizers (regular epimorphisms). + +The coequalizer of a pair of maps $f,g:A\to B$ in $\uset$ is defined as the 0-truncation of a general (homotopy) coequalizer. +For clarity, we may call this the \define{set-coequalizer}. +\indexdef{set-coequalizer}% +\indexsee{coequalizer!of sets}{set-coequalizer}% +It is convenient to express its universal property as follows. + +\begin{lem} +\index{universal!property!of set-coequalizer}% +Let $f,g:A\to B$ be functions between sets $A$ and $B$. The +{set-co}equalizer $c_{f,g}:B\to Q$ has the property that, for any set $C$ and any $h:B\to C$ with $h\circ f = h\circ g$, the type +\begin{equation*} +\sm{k:Q\to C} (k\circ c_{f,g} = h) +\end{equation*} +is contractible. +\end{lem} + +\begin{lem}\label{epis-surj} +For any function $f:A\to B$ between sets, the following are equivalent: +\begin{enumerate} +\item $f$ is an epimorphism. +\item Consider the pushout diagram +\begin{equation*} + \xymatrix{ + {A} + \ar[r]^{f} + \ar[d] + & + {B} + \ar[d]^{\iota} + \\ + {\unit} + \ar[r]_{t} + & + {C_f} + } +\end{equation*} +in $\uset$ defining the mapping cone\index{cone!of a function}. Then the type $C_f$ is contractible. +\item $f$ is surjective. +\end{enumerate} +\end{lem} + +\begin{proof} +Let $f:A\to B$ be a function between sets, and suppose it to be an epimorphism; we show $C_f$ is contractible. +The constructor $\unit\to C_f$ of $C_f$ gives us an element $t:C_f$. +We have to show that +\begin{equation*} +\prd{x:C_f} x= t. +\end{equation*} +Note that $x= t$ is a mere proposition, hence we can use induction on $C_f$. +Of course when $x$ is $t$ we have $\refl{t}:t=t$, so it suffices to find +\begin{align*} +I_0 & : \prd{b:B} \iota(b)= t\\ +I_1 & : \prd{a:A} \opp{\alpha_1(a)} \ct I_0(f(a))=\refl{t} +\end{align*} +where $\iota:B\to C_f$ and $\alpha_1:\prd{a:A} \iota(f(a))= t$ are the other constructors +of $C_f$. Note that $\alpha_1$ is a homotopy from $\iota\circ f$ to +$\mathsf{const}_t\circ f$, so we find the elements +\begin{equation*} +\pairr{\iota,\refl{\iota\circ f}},\pairr{\mathsf{const}_t,\alpha_1}: +\sm{h:B\to C_f} \iota\circ f \htpy h\circ f. +\end{equation*} +By the dual of \cref{thm:mono}\ref{item:mono3} (and function extensionality), there is a path +\begin{equation*} +\gamma:\pairr{\iota,\refl{\iota\circ f}}=\pairr{\mathsf{const}_t,\alpha_1}. +\end{equation*} +Hence, we may define $I_0(b)\defeq \happly(\projpath1(\gamma),b):\iota(b)=t$. +We also have +\[\projpath2(\gamma) : \trans{\projpath1(\gamma)}{\refl{\iota\circ f}} = \alpha_1. \] +This transport involves precomposition with $f$, which commutes with $\happly$. +Thus, from transport in path types we obtain $I_0(f(a)) = \alpha_1(a)$ for any $a:A$, which gives us $I_1$. + +Now suppose $C_f$ is contractible; we show $f$ is surjective. +We first construct a type family $P:C_f\to\prop$ by recursion on $C_f$, which is valid since \prop is a set. +On the point constructors, we define +\begin{align*} +P(t) & \defeq \unit\\ +P(\iota(b)) & \defeq \brck{\hfiber{f}b}. +\end{align*} +To complete the construction of $P$, it remains to give a path +\narrowequation{\brck{\hfiber{f}{f(a)}} =_\prop \unit} +for all $a:A$. +However, $\brck{\hfiber{f}{f(a)}}$ is inhabited by $(f(a),\refl{f(a)})$. +Since it is a mere proposition, this means it is contractible --- and thus equivalent, hence equal, to \unit. +This completes the definition of $P$. +Now, since $C_f$ is assumed to be contractible, it follows that $P(x)$ is equivalent to $P(t)$ for any $x:C_f$. +In particular, $P(\iota(b))\jdeq \brck{\hfiber{f}b}$ is equivalent to $P(t)\jdeq \unit$ for each $b:B$, and hence contractible. +Thus, $f$ is surjective. + +Finally, suppose $f:A\to B$ to be surjective, and consider a set $C$ and two functions +$g,h:B\to C$ with the property that $g\circ f = h\circ f$. Since $f$ +is assumed to be surjective, for all $b:B$ the type $\brck{\hfib f b}$ is contractible. +Thus we have the following equivalences: +\begin{align*} +\prd{b:B} (g(b)= h(b)) +& \eqvsym \prd{b:B} \Parens{\brck{\hfib f b} \to (g(b)= h(b))}\\ +& \eqvsym \prd{b:B} \Parens{\hfib f b \to (g(b)= h(b))}\\ +& \eqvsym \prd{b:B}{a:A}{p:f(a)= b} g(b)= h(b)\\ +& \eqvsym \prd{a:A} g(f(a))= h(f(a)) +\end{align*} +using on the second line the fact that $g(b)=h(b)$ is a mere proposition, since $C$ is a set. +But by assumption, there is an element of the latter type. +\end{proof} + +% \begin{rem} +% The above theorem is not true when we replace $\set$ by $\type$ +% (replacing it also in the definition of $\mathsf{epi}$ and $\mathsf{epi}'$). +% However, we do +% get the implications $\textit{ii.}\Rightarrow\textit{iii.}\Rightarrow +% \textit{iv.}$ +% \end{rem} + +\begin{thm}\label{thm:set_regular}\label{lem:images_are_coequalizers} +The category $\uset$ is regular. Moreover, surjective functions between sets are regular epimorphisms. +\end{thm} + +\begin{proof} +It is a standard lemma in category theory that a category is regular as soon as it admits finite limits and a pullback-stable orthogonal +factorization system\index{orthogonal factorization system} $(\mathcal{E},\mathcal{M})$ with $\mathcal{M}$ the monomorphisms, in which case $\mathcal{E}$ consists automatically of +the regular epimorphisms. +(See e.g.~\cite[A1.3.4]{elephant}.) +The existence of the factorization system was proved in \cref{thm:orth-fact}. +\end{proof} + +\begin{lem}\label{lem:pb_of_coeq_is_coeq} +Pullbacks of regular epis in \uset are regular epis. +\end{lem} +\begin{proof} + We showed in \cref{thm:stable-images} that pullbacks of $n$-connected functions are $n$-connected. + By \cref{lem:images_are_coequalizers}, it suffices to apply this when $n=-1$. +\end{proof} + +\indexdef{image!of a subset} +One of the consequences of \uset being a regular category is that we have an ``image'' operation on subsets. +That is, given $f:A\to B$, any subset $P:\power A$ (i.e.\ a predicate $P:A\to \prop$) has an \define{image} which is a subset of $B$. +This can be defined directly as $\setof{ y:B | \exis{x:A} f(x)=y \land P(x)}$, or indirectly as the image (in the previous sense) of the composite function +\[ \setof{ x:A | P(x) } \to A \xrightarrow{f} B.\] +\symlabel{subset-image} +We will also sometimes use the common notation $\setof{f(x) | P(x)}$ for the image of $P$. + + +\subsection{Quotients}\label{subsec:quotients} + +\index{set-quotient|(}% +Now that we know that $\uset$ is regular, to show that $\uset$ is exact, we need to show that every +equivalence relation is effective. +\index{effective!equivalence relation|(}% +\index{relation!effective equivalence|(}% +In other words, given an equivalence +relation $R:A\to A\to\prop$, there is a coequalizer $c_R$ of the pair +$\proj1,\proj2:\sm{x,y:A} R(x,y)\to A$ and, moreover, the $\proj1$ and $\proj2$ +form the kernel\index{kernel!pair} pair of $c_R$. + +We have already seen, in \cref{sec:set-quotients}, two general ways to construct the quotient of a set by an equivalence relation $R:A\to A\to\prop$. +The first can be described as the set-coequalizer of the two projections +\[\proj1,\proj2:\Parens{\sm{x,y:A} R(x,y)} \to A.\] +The important property of such a quotient is the following. + +\begin{defn} + A relation $R:A\to A\to\prop$ is said to be \define{effective} + \indexdef{effective!relation} + \indexdef{effective!equivalence relation}% + \indexdef{relation!effective equivalence}% + if the square +\begin{equation*} + \xymatrix{ + {\sm{x,y:A} R (x,y)} + \ar[r]^(0.7){\proj1} + \ar[d]_{\proj2} + & + {A} + \ar[d]^{c_R} + \\ + {A} + \ar[r]_{c_R} + & + {A/R} + } +\end{equation*} +is a pullback. +\end{defn} + +Since the standard pullback of $c_R$ and itself is $\sm{x,y:A} (c_R(x)=c_R(y))$, by \cref{thm:total-fiber-equiv} this is equivalent to asking that the canonical transformation $\prd{x,y:A} R(x,y) \to (c_R(x)=c_R(y))$ be a fiberwise equivalence. + +\begin{lem}\label{lem:sets_exact} +Suppose $\pairr{A,R}$ is an equivalence relation. Then there is an equivalence +\begin{equation*} +(c_R(x)= c_R(y))\eqvsym R(x,y) +\end{equation*} +for any $x,y:A$. In other words, equivalence relations are effective. +\end{lem} + +\begin{proof} +We begin by extending $R$ to a relation $\widetilde{R}:A/R\to A/R\to\prop$, which we will then show is equivalent +to the identity type on $A/R$. We define $\widetilde{R}$ by double induction on +$A/R$ (note that $\prop$ is a set by univalence for mere propositions). We +define $\widetilde{R}(c_R(x),c_R(y)) \defeq R(x,y)$. For $r:R(x,x')$ and $s:R(y,y')$, +the transitivity and symmetry +of $R$ gives an equivalence from $R(x,y)$ to $R(x',y')$. This completes the +definition of $\widetilde{R}$. + +It remains to show that $\widetilde{R}(w,w')\eqvsym (w= w')$ for every $w,w':A/R$. +The direction $(w=w')\to \widetilde{R}(w,w')$ follows by transport once we show that $\widetilde{R}$ is reflexive, which is an easy induction. +The other direction $\widetilde{R}(w,w')\to (w= w')$ is a mere proposition, so since $c_R:A\to A/R$ is surjective, it suffices to assume that $w$ and $w'$ are of the form $c_R(x)$ and $c_R(y)$. +But in this case, we have the canonical map $\widetilde{R}(c_R(x),c_R(y)) \defeq R(x,y) \to (c_R(x)=c_R(y))$. +(Note again the appearance of the encode-decode method.\index{encode-decode method}) +\end{proof} + +The second construction of quotients is as the set of equivalence classes of $R$ (a subset +of its power set\index{power set}): +\[ A\sslash R \defeq \setof{ P:A\to\prop | P \text{ is an equivalence class of } R}. \] +This requires propositional resizing\index{propositional resizing}\index{impredicative!quotient}\index{resizing} in order to remain in the same universe as $A$ and $R$. + +Note that if we regard $R$ as a function from $A$ to $A\to \prop$, then $A\sslash R$ is equivalent to $\im(R)$, as constructed in \cref{sec:image}. +Now in \cref{lem:images_are_coequalizers} we have shown that images are +coequalizers. In particular, we immediately get the coequalizer diagram +\begin{equation*} + \xymatrix{ + **[l]{\sm{x,y:A} R (x)= R (y)} + \ar@<0.25em>[r]^{\proj1} + \ar@<-0.25em>[r]_{\proj2} + & + {A} + \ar[r] + & + {A \sslash R.} + } +\end{equation*} +We can use this to give an alternative proof that any equivalence relation is effective and that the two definitions of quotients agree. + +\begin{thm}\label{prop:kernels_are_effective} +For any function $f:A\to B$ between any two sets, +the relation $\ker(f):A\to A\to\prop$ given by +$\ker(f,x,y)\defeq (f(x)= f(y))$ is effective. +\end{thm} + +\begin{proof} +We will use that $\im(f)$ is the coequalizer of $\proj1,\proj2: +(\sm{x,y:A} f(x)= f(y))\to A$. +%we get this equivalence from~\cref{prop:images_are_coequalizers} +Note that the kernel pair of the function +\[c_f\defeq\lam{a} \Parens{f(a),\brck{\pairr{a,\refl{f(a)}}}} +: A \to \im(f) +\] +consists of the two projections +\begin{equation*} +\proj1,\proj2:\Parens{\sm{x,y:A} c_f(x)= c_f(y)}\to A. +\end{equation*} +For any $x,y:A$, we have equivalences +\begin{align*} + (c_f(x)= c_f(y)) + & \eqvsym \Parens{\sm{p:f(x)= f(y)} \trans{p}{\brck{\pairr{x,\refl{f(x)}}}} =\brck{\pairr{y,\refl{f(x)}}}}\\ + & \eqvsym (f(x)= f(y)), +\end{align*} +where the last equivalence holds because +$\brck{\hfiber{f}b}$ is a mere proposition for any $b:B$. +Therefore, we get that +\begin{equation*} +\Parens{\sm{x,y:A} c_f(x)= c_f(y)}\eqvsym \Parens{\sm{x,y:A} f(x)= f(y)} +\end{equation*} +and hence we may conclude that $\ker f$ is an effective relation +for any function $f$. +\end{proof} + +\begin{thm} +Equivalence relations are effective and there is an equivalence $A/R \eqvsym A\sslash R $. +\end{thm} + +\begin{proof} +We need to analyze the coequalizer diagram +\begin{equation*} + \xymatrix{ + **[l]{\sm{x,y:A} R (x)= R (y)} + \ar@<0.25em>[r]^{\proj1} + \ar@<-0.25em>[r]_{\proj2} + & + {A} + \ar[r] + & + {A \sslash R} + } +\end{equation*} +By the univalence axiom, the type $R(x) = R(y)$ is equivalent to the type of homotopies from $R(x)$ to $R(y)$, which is +equivalent to +\narrowequation{\prd{z:A} R (x,z)\eqvsym R (y,z).} +Since $R$ is an equivalence relation, the latter space is equivalent to $R(x,y)$. To +summarize, we get that $(R(x) = R(y)) \eqvsym R(x,y)$, so $R $ is effective since it is equivalent to an effective relation. Also, +the diagram +\begin{equation*} + \xymatrix{ + **[l]{\sm{x,y:A} R(x, y)} + \ar@<0.25em>[r]^{\proj1} + \ar@<-0.25em>[r]_{\proj2} + & + {A} + \ar[r] + & + {A \sslash R.} + } +\end{equation*} +is a coequalizer diagram. Since coequalizers are unique up to equivalence, it follows that $A/R \eqvsym A\sslash R $. +\end{proof} + +We finish this section by mentioning a possible third construction of the quotient of a set $A$ by an equivalence relation $R$. +Consider the precategory with objects $A$ and hom-sets $R$; the type of objects of the Rezk completion +\index{completion!Rezk}% +(see \cref{sec:rezk}) of this precategory will then be the +quotient. The reader is invited to check the details. + +\index{effective!equivalence relation|)}% +\index{relation!effective equivalence|)}% +\index{set-quotient|)}% + +\subsection{\texorpdfstring{$\uset$}{Set} is a \texorpdfstring{$\Pi\mathsf{W}$}{ΠW}-pretopos} +\label{subsec:piw} + +\index{structural!set theory|(}% + +The notion of a \emph{$\Pi\mathsf{W}$-pretopos} +\index{PiW-pretopos@$\Pi\mathsf{W}$-pretopos}% +\indexsee{pretopos}{$\Pi\mathsf{W}$-pretopos} +--- that is, a locally cartesian closed category +\index{locally cartesian closed category}% +\index{category!locally cartesian closed}% +with disjoint finite coproducts, effective equivalence relations, and initial algebras for polynomial endofunctors --- is intended as a ``predicative'' +\index{mathematics!predicative}% +notion of topos, i.e.\ a category of ``predicative sets'', which can serve the purpose for constructive mathematics +\index{mathematics!constructive}% +that the usual category of sets does for classical +\index{mathematics!classical}% +mathematics. + +Typically, in constructive type theory, one resorts to an external construction of ``setoids'' --- an exact completion --- to obtain a category with such closure properties. +\index{setoid}\index{completion!exact}% + In particular, the well-behaved quotients are required for many constructions in mathematics that usually involve (non-constructive) power sets. It is noteworthy that univalent foundations provides these constructions \emph{internally} (via higher inductive types), without requiring such external constructions. This represents a powerful advantage of our approach, as we shall see in subsequent examples. + +\begin{thm} + \index{PiW-pretopos@$\Pi\mathsf{W}$-pretopos} + The category $\uset$ is a $\Pi\mathsf{W}$-pretopos. +\end{thm} +\begin{proof} + We have an initial object + \index{initial!set}% + $\emptyt$ and finite, disjoint sums $A+B$. These are stable under pullback, simply because pullback has a right adjoint\index{adjoint!functor}. Indeed, $\uset$ is locally cartesian closed, since for any map $f:A\to B$ between sets, the ``fibrant replacement'' \index{fibrant replacement} $\sm{a:A}f(a)=b$ is equivalent to $A$ (over $B$), and we have dependent function types for the replacement. +We've just shown that $\uset$ is regular (\cref{thm:set_regular}) and that quotients are effective (\cref{lem:sets_exact}). We thus have a locally cartesian closed pretopos. Finally, since the $n$-types are closed under the formation of $W$-types by \cref{ex:ntypes-closed-under-wtypes}, and by \cref{thm:w-hinit} $W$-types are initial algebras for polynomial endofunctors, we see that $\uset$ is a $\Pi\mathsf{W}$-pretopos. +\end{proof} + + +\index{topos|(} +One naturally wonders what, if anything, prevents $\uset$ from being an (elementary) topos? +In addition to the structure already mentioned, a topos has a +\emph{subobject classifier}: +\indexdef{subobject classifier}% +\index{classifier!subobject}% +\index{power set}% +a pointed object classifying (equivalence classes of) monomorphisms\index{monomorphism}. (In fact, in the presence of a subobject +classifier, things become somewhat simpler: one merely needs cartesian closure in order to get the colimits.) +In homotopy type theory, univalence implies that the type $\prop \defeq \sm{X:\UU}\isprop(X)$ does classify monomorphisms (by an argument similar to \cref{sec:object-classification}), but in general it is as large as the ambient universe $\UU$. +Thus, it is a ``set'' in the sense of being a $0$-type, but it is not ``small'' in the sense of being an object of $\UU$, hence not an object of the category \uset. +However, if we assume an appropriate form of propositional resizing (see \cref{subsec:prop-subsets}), then we can find a small version of $\prop$, so that \uset becomes an elementary topos. + +\begin{thm}\label{thm:settopos} + \index{propositional!resizing}% + If there is a type $\Omega:\UU$ of all mere propositions, then the category $\uset_\UU$ is an elementary topos. +\end{thm} +\index{topos|)} + +A sufficient condition for this is the law of excluded middle, in the ``mere-propositional'' form that we have called \LEM{}; for then we have $\prop = \bool$, which \emph{is} small, and which then also classifies all mere propositions. +Moreover, in topos theory a well-known sufficient condition for \LEM{} is the axiom of choice, which is of course often assumed as an axiom in classical\index{mathematics!classical} set theory. +In the next section, we briefly investigate the relation between these conditions in our setting. + +\index{structural!set theory|)}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{The axiom of choice implies excluded middle} +\label{subsec:emacinsets} + +% In this section we prove a classic result that the axiom of choice implies excluded +% middle. + +We begin with the following lemma. + +\begin{lem}\label{prop:trunc_of_prop_is_set} +If $A$ is a mere proposition then its suspension $\susp(A)$ is a set, +and $A$ is equivalent to $\id[\susp(A)]{\north}{\south}$. +\end{lem} + +\begin{proof} +To show that $\susp(A)$ is a set, we define a +family $P:\susp(A)\to\susp(A)\to\type$ with the +property that $P(x,y)$ is a mere proposition for each $x,y:\susp(A)$, +and which is equivalent to its identity type $\idtypevar{\susp(A)}$. +% +We make the following definitions: +\begin{align*} +P(\north,\north) & \defeq \unit & +P(\south,\north) & \defeq A\\ +P(\north,\south) & \defeq A & +P(\south,\south) & \defeq \unit. +\end{align*} +We have to check that the definition preserves paths. +Given any $a : A$, there is a meridian $\merid(a) : \north = \south$, +so we should also have +% +\begin{equation*} + P(\north, \north) = P(\north, \south) = P(\south, \north) = P(\south, \south). +\end{equation*} +% +But since $A$ is inhabited by $a$, it is equivalent to $\unit$, so we have +% +\begin{equation*} + P(\north, \north) \eqvsym P(\north, \south) \eqvsym P(\south, \north) \eqvsym P(\south, \south). +\end{equation*} +% +The univalence axiom turns these into the desired equalities. Also, $P(x,y)$ is a mere +proposition for all $x, y : \susp(A)$, which is proved by induction on $x$ and $y$, and +using the fact that being a mere proposition is a mere proposition. + +Note that $P$ is a reflexive relation. +Therefore we may apply \cref{thm:h-set-refrel-in-paths-sets}, so it suffices to +construct $\tau : \prd{x,y:\susp(A)}P(x,y)\to(x=y)$. We do this by a double induction. +When $x$ is $\north$, we define $\tau(\north)$ by +% +\begin{equation*} + \tau(\north,\north,u) \defeq \refl{\north} + \qquad\text{and}\qquad + \tau(\north,\south,a) \defeq \merid(a). +\end{equation*} +% +If $A$ is inhabited by $a$ then $\merid(a) : \north = \south$ so we also need +\narrowequation{ + \trans{\merid(a)}{\tau(\north, \north)} = \tau(\north, \south). +} +This we get by function extensionality using the fact that, for all $x : A$, +% +\begin{multline*} + \trans{\merid(a)}{\tau(\north,\north,x)} = + \tau(\north,\north,x) \ct \opp{\merid(a)} \jdeq \\ + \refl{\north} \ct \merid(a) = + \merid(a) = + \merid(x) \jdeq + \tau(\north, \south, x). +\end{multline*} +In a symmetric fashion we may define $\tau(\south)$ by +% +\begin{equation*} + \tau(\south,\north, a) \defeq \opp{\merid(a)} + \qquad\text{and}\qquad + \tau(\south,\south, u) \defeq \refl{\south}. +\end{equation*} +% +To complete the construction of $\tau$, we need to check $\trans{\merid(a)}{\tau(\north)} = \tau(\south)$, +given any $a : A$. The verification proceeds much along the same lines by induction on the +second argument of $\tau$. + +Thus, by \cref{thm:h-set-refrel-in-paths-sets} we have that $\susp(A)$ is a set and that $P(x,y) \eqvsym (\id{x}{y})$ for all $x,y:\susp(A)$. +Taking $x\defeq \north$ and $y\defeq \south$ yields $\eqv{A}{(\id[\susp(A)]\north\south)}$ as desired. +\end{proof} + +\begin{thm}[Diaconescu]\label{thm:1surj_to_surj_to_pem} + \index{axiom!of choice}% + \index{excluded middle}% + \index{Diaconescu's theorem}\index{theorem!Diaconescu's}% + The axiom of choice implies the law of excluded middle. +\end{thm} + +\begin{proof} +We use the equivalent form of choice given in \cref{thm:ac-epis-split}. +Consider a mere proposition $A$. +The function $f:\bool\to\susp(A)$ defined by +$f(\bfalse) \defeq \north$ and $f(\btrue) \defeq \south$ +is surjective. +Indeed, we have +$\pairr{\bfalse,\refl{\north}} : \hfiber{f}{\north}$ +and $\pairr{\btrue,\refl{\south}} :\hfiber{f}{\south}$. +Since $\bbrck{\hfiber{f}{x}}$ is a mere proposition, by induction the claimed surjectivity follows. + +By \cref{prop:trunc_of_prop_is_set} the suspension $\susp(A)$ +is a set, so by the axiom of choice there merely exists a +section $g: \susp(A) \to \bool$ of $f$. +As equality on $\bool$ is decidable we get +\begin{equation*} + (g(f(\bfalse))= g(f(\btrue))) + + \lnot (g(f(\bfalse))= g(f(\btrue))), +\end{equation*} +and, since $g$ is a section of $f$, hence injective, +\begin{equation*} +(f(\bfalse) = f(\btrue)) + +\lnot (f(\bfalse) = f(\btrue)). +\end{equation*} +Finally, since $(f(\bfalse)=f(\btrue)) = (\north=\south) = A$ by \cref{prop:trunc_of_prop_is_set}, we have $A+\neg A$. +\end{proof} + +% This conclusion needs only \LEM{}, see \cref{ex:lemnm}. + +% \begin{cor}\label{cor:ACtoLEM0} +% If the axiom of choice \choice{} holds then $\brck{A + \neg A}$ for every set $A$. +% \end{cor} + +% \begin{proof} +% There is a surjection +% \[ +% A + \neg A \epi \brck{A} + \brck{\neg A} \epi +% \brck{(\brck{A} + \brck{\neg A})} = \brck{A} \vee \brck{\neg A} = \brck{A} \vee \neg \brck{A} = \unit, +% \] +% % +% where in the last step excluded middle is available as a consequence of the axiom of choice. +% Again by the axiom of choice there merely exists a section of the surjection, but this +% is none other than an inhabitant of $A + \neg A$. Therefore $\brck{A+\neg A}$. +% \end{proof} + +\index{denial} +\begin{thm}\label{thm:ETCS} + \index{Elementary Theory of the Category of Sets}% + \index{category!well-pointed}% + If the axiom of choice holds then the category $\uset$ is a well-pointed boolean\index{topos!boolean}\index{boolean!topos} elementary topos\index{topos} with choice. +\end{thm} + +\begin{proof} + Since \choice{} implies \LEM{}, we have a boolean elementary topos with choice by \cref{thm:settopos} and the remark following it. We leave the proof of well-pointedness as +an exercise for the reader (\cref{ex:well-pointed}). +\end{proof} + +\begin{rmk} + The conditions on a category mentioned in the theorem are known as Lawvere's\index{Lawvere} + axioms for the \emph{Elementary Theory of the Category of Sets}~\cite{lawvere:etcs-long}. +\end{rmk} + +\section{Cardinal numbers} +\label{sec:cardinals} + +\begin{defn}\label{defn:card} + The \define{type of cardinal numbers} + \indexdef{type!of cardinal numbers}% + \indexdef{cardinal number}% + \indexsee{number!cardinal}{cardinal number}% + is the 0-truncation of the type \set of sets: + \[ \card \defeq \pizero{\set} \] + Thus, a \define{cardinal number}, or \define{cardinal}, is an inhabitant of $\card\jdeq \pizero\set$. + Technically, of course, there is a separate type $\card_\UU$ associated to each universe \type. +\end{defn} + +%\begin{rmk} + + % , but with these conventions we can state theorems beginning with ``for all cardinal numbers\dots''\ and give them exactly the same sort of meaning as those beginning ``for all types\dots''. +%\end{rmk} + +As usual for truncations, if $A$ is a set, then $\cd{A}$ denotes its image under the canonical projection $\set \to \trunc0\set \jdeq \card$; we call $\cd{A}$ the \define{cardinality}\indexdef{cardinality} of $A$. +By definition, \card is a set. +It also inherits the structure of a semiring from \set. + +\begin{defn} + The operation of \define{cardinal addition} + \indexdef{addition!of cardinal numbers}% + \index{cardinal number!addition of}% + \[ (\blank+\blank) : \card \to \card \to \card \] + is defined by induction on truncation: + \[ \cd{A} + \cd{B} \defeq \cd{A+B}.\] +\end{defn} +\begin{proof} + Since $\card\to\card$ is a set, to define $(\alpha+\blank):\card\to\card$ for all $\alpha:\card$, by induction it suffices to assume that $\alpha$ is $\cd{A}$ for some $A:\set$. + Now we want to define $(\cd{A}+\blank) :\card\to\card$, i.e.\ we want to define $\cd{A}+\beta :\card$ for all $\beta:\card$. + However, since $\card$ is a set, by induction it suffices to assume that $\beta$ is $\cd{B}$ for some $B:\set$. + But now we can define $\cd{A}+\cd{B}$ to be $\cd{A+B}$. +\end{proof} + +\begin{defn} + Similarly, the operation of \define{cardinal multiplication} + \indexdef{multiplication!of cardinal numbers}% + \index{cardinal number!multiplication of}% + \[ (\blank\cdot\blank) : \card \to \card \to \card \] + is defined by induction on truncation: + \[ \cd{A} \cdot \cd{B} \defeq \cd{A\times B} \] +\end{defn} + +\begin{lem}\label{card:semiring} + \card is a commutative semiring\index{semiring}, i.e.\ for $\alpha,\beta,\gamma:\card$ we have the following. + \begin{align*} + (\alpha+\beta)+\gamma &= \alpha+(\beta+\gamma)\\ + \alpha+0 &= \alpha\\ + \alpha + \beta &= \beta + \alpha\\ + (\alpha \cdot \beta) \cdot \gamma &= \alpha \cdot (\beta\cdot\gamma)\\ + \alpha \cdot 1 &= \alpha\\ + \alpha\cdot\beta &= \beta\cdot\alpha\\ + \alpha\cdot(\beta+\gamma) &= \alpha\cdot\beta + \alpha\cdot\gamma + \end{align*} + where $0 \defeq \cd{\emptyt}$ and $1\defeq\cd{\unit}$. +\end{lem} +\begin{proof} + We prove the commutativity of multiplication, $\alpha\cdot\beta = \beta\cdot\alpha$; the others are exactly analogous. + Since \card is a set, the type $\alpha\cdot\beta = \beta\cdot\alpha$ is a mere proposition, and in particular a set. + Thus, by induction it suffices to assume $\alpha$ and $\beta$ are of the form $\cd{A}$ and $\cd{B}$ respectively, for some $A,B:\set$. + Now $\cd{A}\cdot \cd{B} \jdeq \cd{A\times B}$ and $\cd{B}\cdot\cd{A} \jdeq \cd{B\times A}$, so it suffices to show $A\times B = B\times A$. + Finally, by univalence, it suffices to give an equivalence $A\times B \eqvsym B\times A$. + But this is easy: take $(a,b) \mapsto (b,a)$ and its obvious inverse. +\end{proof} + +\begin{defn} + The operation of \define{cardinal exponentiation} is also defined by induction on truncation: + \indexdef{exponentiation, of cardinal numbers}% + \index{cardinal number!exponentiation of}% + \[ \cd{A}^{\cd{B}} \defeq \cd{B\to A}. \] +\end{defn} + +\begin{lem}\label{card:exp} + For $\alpha,\beta,\gamma:\card$ we have + \begin{align*} + \alpha^0 &= 1\\ + 1^\alpha &= 1\\ + \alpha^1 &= \alpha\\ + \alpha^{\beta+\gamma} &= \alpha^\beta \cdot \alpha^\gamma\\ + \alpha^{\beta\cdot \gamma} &= (\alpha^{\beta})^\gamma\\ + (\alpha\cdot\beta)^\gamma &= \alpha^\gamma \cdot \beta^\gamma + \end{align*} +\end{lem} +\begin{proof} + Exactly like \cref{card:semiring}. +\end{proof} + +\begin{defn} + The relation of \define{cardinal inequality} + \index{order!non-strict}% + \index{cardinal number!inequality of}% + \[ (\blank\le\blank) : \card\to\card\to\prop \] + is defined by induction on truncation: + \symlabel{inj} + \[ \cd{A} \le \cd{B} \defeq \brck{\inj(A,B)} \] + where $\inj(A,B)$ is the type of injections from $A$ to $B$. + \index{function!injective}% + In other words, $\cd{A} \le \cd{B}$ means that there merely exists an injection from $A$ to $B$. +\end{defn} + +\begin{lem} + Cardinal inequality is a preorder, i.e.\ for $\alpha,\beta:\card$ we have + \index{preorder!of cardinal numbers}% + \begin{gather*} + \alpha \le \alpha\\ + (\alpha \le \beta) \to (\beta\le\gamma) \to (\alpha\le\gamma) + \end{gather*} +\end{lem} +\begin{proof} + As before, by induction on truncation. + For instance, since $(\alpha \le \beta) \to (\beta\le\gamma) \to (\alpha\le\gamma)$ is a mere proposition, by induction on 0-truncation we may assume $\alpha$, $\beta$, and $\gamma$ are $\cd{A}$, $\cd{B}$, and $\cd{C}$ respectively. + Now since $\cd{A} \le \cd{C}$ is a mere proposition, by induction on $(-1)$-truncation we may assume given injections $f:A\to B$ and $g:B\to C$. + But then $g\circ f$ is an injection from $A$ to $C$, so $\cd{A} \le \cd{C}$ holds. + Reflexivity is even easier. +\end{proof} + +We may likewise show that cardinal inequality is compatible with the semiring operations. + +\begin{lem}\label{thm:injsurj} + \index{function!injective}% + \index{function!surjective}% + Consider the following statements: + \begin{enumerate} + \item There is an injection $A\to B$.\label{item:cle-inj} + \item There is a surjection $B\to A$.\label{item:cle-surj} + \end{enumerate} + Then, assuming excluded middle: + \index{excluded middle}% + \index{axiom!of choice}% + \begin{itemize} + \item Given $a_0:A$, we have~\ref{item:cle-inj}$\to$\ref{item:cle-surj}. + \item Therefore, if $A$ is merely inhabited, we have~\ref{item:cle-inj} $\to$ merely \ref{item:cle-surj}. + \item Assuming the axiom of choice, we have~\ref{item:cle-surj} $\to$ merely \ref{item:cle-inj}. + \end{itemize} +\end{lem} +\begin{proof} + If $f:A\to B$ is an injection, define $g:B\to A$ at $b:B$ as follows. + Since $f$ is injective, the fiber of $f$ at $b$ is a mere proposition. + Therefore, by excluded middle, either there is an $a:A$ with $f(a)=b$, or not. + In the first case, define $g(b)\defeq a$; otherwise set $g(b)\defeq a_0$. + Then for any $a:A$, we have $a = g(f(a))$, so $g$ is surjective. + + The second statement follows from this by induction on truncation. + For the third, if $g:B\to A$ is surjective, then by the axiom of choice, there merely exists a function $f:A\to B$ with $g(f(a)) = a$ for all $a$. + But then $f$ must be injective. +\end{proof} + +\begin{thm}[Schroeder--Bernstein] + \index{theorem!Schroeder--Bernstein}% + \index{Schroeder--Bernstein theorem}% + Assuming excluded middle, for sets $A$ and $B$ we have + \[ \inj(A,B) \to \inj(B,A) \to (A\cong B) \] +\end{thm} +\begin{proof} + The usual ``back-and-forth'' argument applies without significant changes. + Note that it actually constructs an isomorphism $A\cong B$ (assuming excluded middle so that we can decide whether a given element belongs to a cycle, an infinite chain, a chain beginning in $A$, or a chain beginning in $B$). +\end{proof} + +\begin{cor} + Assuming excluded middle, cardinal inequality is a partial order, i.e.\ for $\alpha,\beta:\card$ we have + \[ (\alpha\le\beta) \to (\beta\le\alpha) \to (\alpha=\beta). \] +\end{cor} +\begin{proof} + Since $\alpha=\beta$ is a mere proposition, by induction on truncation we may assume $\alpha$ and $\beta$ are $\cd{A}$ and $\cd{B}$, respectively, and that we have injections $f:A\to B$ and $g:B\to A$. + But then the Schroeder--Bernstein theorem gives an isomorphism $A\cong B$, hence an equality $\cd{A}=\cd{B}$. +\end{proof} + +Finally, we can reproduce Cantor's theorem, showing that for every cardinal there is a greater one. + +\begin{thm}[Cantor] + \index{Cantor's theorem}% + \index{theorem!Cantor's}% + For $A:\set$, there is no surjection $A \to (A\to \bool)$. +\end{thm} +\begin{proof} + Suppose $f:A \to (A\to \bool)$ is any function, and define $g:A\to \bool$ by $g(a) \defeq \neg f(a)(a)$. + If $g = f(a_0)$, then $g(a_0) = f(a_0)(a_0)$ but $g(a_0) = \neg f(a_0)(a_0)$, a contradiction. + Thus, $f$ is not surjective. +\end{proof} + +\begin{cor} + Assuming excluded middle, for any $\alpha:\card$, there is a cardinal $\beta$ such that $\alpha\le\beta$ and $\alpha\neq\beta$. +\end{cor} +\begin{proof} + Let $\beta = 2^\alpha$. + Now we want to show a mere proposition, so by induction we may assume $\alpha$ is $\cd{A}$, so that $\beta\jdeq \cd{A\to \bool}$. + Using excluded middle, we have a function $f:A\to (A\to \bool)$ defined by + \[f(a)(a') \defeq + \begin{cases} + \btrue &\quad a=a'\\ + \bfalse &\quad a\neq a'. + \end{cases} + \] + And if $f(a)=f(a')$, then $f(a')(a) = f(a)(a) = \btrue$, so $a=a'$; hence $f$ is injective. + Thus, $\alpha \jdeq \cd{A} \le \cd{A\to \bool} \jdeq 2^\alpha$. + + On the other hand, if $2^\alpha \le \alpha$, then we would have an injection $(A\to\bool)\to A$. + By \cref{thm:injsurj}, since we have $(\lam{x} \bfalse):A\to \bool$ and excluded middle, there would then be a surjection $A \to (A\to \bool)$, contradicting Cantor's theorem. +\end{proof} + +\section{Ordinal numbers} +\label{sec:ordinals} + +\index{ordinal|(}% + +\begin{defn}\label{defn:accessibility} + Let $A$ be a set and + \[(\blank<\blank):A\to A\to \prop\] + a binary relation on $A$. + We define by induction what it means for an element $a:A$ to be \define{accessible} + \indexdef{accessibility}% + \indexsee{accessible}{accessibility}% + by $<$: + \begin{itemize} + \item If $b$ is accessible for every $ba$. + Thus, $A'$ is itself an ordinal. + + Finally, since \ord is an ordinal, we can take $A\defeq\ord$. + Let $X'$ be the image of $g_\ord':\ord' \to X$; then the inverse of $g_\ord'$ yields an injection $H:X'\to \ord$. + By \cref{thm:ordunion}, there is an ordinal $C$ such that $Hx\le C$ for all $x:X'$. + Then by \cref{thm:ordsucc}, there is a further ordinal $D$ such that $C