\documentclass[12pt,titlepage]{article} \usepackage{amsmath} \usepackage{mathrsfs} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{mathtools} \usepackage{graphicx} \usepackage{color} \usepackage{ucs} \usepackage[utf8x]{inputenc} \usepackage{xparse} \usepackage{hyperref} %----Macros---------- % % Unresolved issues: % % \righttoleftarrow % \lefttorightarrow % % \color{} with HTML colorspec % \bgcolor % \array with options (without options, it's equivalent to the matrix environment) % Of the standard HTML named colors, white, black, red, green, blue and yellow % are predefined in the color package. Here are the rest. \definecolor{aqua}{rgb}{0, 1.0, 1.0} \definecolor{fuschia}{rgb}{1.0, 0, 1.0} \definecolor{gray}{rgb}{0.502, 0.502, 0.502} \definecolor{lime}{rgb}{0, 1.0, 0} \definecolor{maroon}{rgb}{0.502, 0, 0} \definecolor{navy}{rgb}{0, 0, 0.502} \definecolor{olive}{rgb}{0.502, 0.502, 0} \definecolor{purple}{rgb}{0.502, 0, 0.502} \definecolor{silver}{rgb}{0.753, 0.753, 0.753} \definecolor{teal}{rgb}{0, 0.502, 0.502} % Because of conflicts, \space and \mathop are converted to % \itexspace and \operatorname during preprocessing. % itex: \space{ht}{dp}{wd} % % Height and baseline depth measurements are in units of tenths of an ex while % the width is measured in tenths of an em. \makeatletter \newdimen\itex@wd% \newdimen\itex@dp% \newdimen\itex@thd% \def\itexspace#1#2#3{\itex@wd=#3em% \itex@wd=0.1\itex@wd% \itex@dp=#2ex% \itex@dp=0.1\itex@dp% \itex@thd=#1ex% \itex@thd=0.1\itex@thd% \advance\itex@thd\the\itex@dp% \makebox[\the\itex@wd]{\rule[-\the\itex@dp]{0cm}{\the\itex@thd}}} \makeatother % \tensor and \multiscript \makeatletter \newif\if@sup \newtoks\@sups \def\append@sup#1{\edef\act{\noexpand\@sups={\the\@sups #1}}\act}% \def\reset@sup{\@supfalse\@sups={}}% \def\mk@scripts#1#2{\if #2/ \if@sup ^{\the\@sups}\fi \else% \ifx #1_ \if@sup ^{\the\@sups}\reset@sup \fi {}_{#2}% \else \append@sup#2 \@suptrue \fi% \expandafter\mk@scripts\fi} \def\tensor#1#2{\reset@sup#1\mk@scripts#2_/} \def\multiscripts#1#2#3{\reset@sup{}\mk@scripts#1_/#2% \reset@sup\mk@scripts#3_/} \makeatother % \slash \makeatletter \newbox\slashbox \setbox\slashbox=\hbox{$/$} \def\itex@pslash#1{\setbox\@tempboxa=\hbox{$#1$} \@tempdima=0.5\wd\slashbox \advance\@tempdima 0.5\wd\@tempboxa \copy\slashbox \kern-\@tempdima \box\@tempboxa} \def\slash{\protect\itex@pslash} \makeatother % math-mode versions of \rlap, etc % from Alexander Perlis, "A complement to \smash, \llap, and lap" % http://math.arizona.edu/~aprl/publications/mathclap/ \def\clap#1{\hbox to 0pt{\hss#1\hss}} \def\mathllap{\mathpalette\mathllapinternal} \def\mathrlap{\mathpalette\mathrlapinternal} \def\mathclap{\mathpalette\mathclapinternal} \def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}} \def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}} \def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}} % Renames \sqrt as \oldsqrt and redefine root to result in \sqrt[#1]{#2} \let\oldroot\root \def\root#1#2{\oldroot #1 \of{#2}} \renewcommand{\sqrt}[2][]{\oldroot #1 \of{#2}} % Manually declare the txfonts symbolsC font \DeclareSymbolFont{symbolsC}{U}{txsyc}{m}{n} \SetSymbolFont{symbolsC}{bold}{U}{txsyc}{bx}{n} \DeclareFontSubstitution{U}{txsyc}{m}{n} % Manually declare the stmaryrd font \DeclareSymbolFont{stmry}{U}{stmry}{m}{n} \SetSymbolFont{stmry}{bold}{U}{stmry}{b}{n} % Manually declare the MnSymbolE font \DeclareFontFamily{OMX}{MnSymbolE}{} \DeclareSymbolFont{mnomx}{OMX}{MnSymbolE}{m}{n} \SetSymbolFont{mnomx}{bold}{OMX}{MnSymbolE}{b}{n} \DeclareFontShape{OMX}{MnSymbolE}{m}{n}{ <-6> MnSymbolE5 <6-7> MnSymbolE6 <7-8> MnSymbolE7 <8-9> MnSymbolE8 <9-10> MnSymbolE9 <10-12> MnSymbolE10 <12-> MnSymbolE12}{} % Declare specific arrows from txfonts without loading the full package \makeatletter \def\re@DeclareMathSymbol#1#2#3#4{% \let#1=\undefined \DeclareMathSymbol{#1}{#2}{#3}{#4}} \re@DeclareMathSymbol{\neArrow}{\mathrel}{symbolsC}{116} \re@DeclareMathSymbol{\neArr}{\mathrel}{symbolsC}{116} \re@DeclareMathSymbol{\seArrow}{\mathrel}{symbolsC}{117} \re@DeclareMathSymbol{\seArr}{\mathrel}{symbolsC}{117} \re@DeclareMathSymbol{\nwArrow}{\mathrel}{symbolsC}{118} \re@DeclareMathSymbol{\nwArr}{\mathrel}{symbolsC}{118} \re@DeclareMathSymbol{\swArrow}{\mathrel}{symbolsC}{119} \re@DeclareMathSymbol{\swArr}{\mathrel}{symbolsC}{119} \re@DeclareMathSymbol{\nequiv}{\mathrel}{symbolsC}{46} \re@DeclareMathSymbol{\Perp}{\mathrel}{symbolsC}{121} \re@DeclareMathSymbol{\Vbar}{\mathrel}{symbolsC}{121} \re@DeclareMathSymbol{\sslash}{\mathrel}{stmry}{12} \re@DeclareMathSymbol{\bigsqcap}{\mathop}{stmry}{"64} \re@DeclareMathSymbol{\biginterleave}{\mathop}{stmry}{"6} \re@DeclareMathSymbol{\invamp}{\mathrel}{symbolsC}{77} \re@DeclareMathSymbol{\parr}{\mathrel}{symbolsC}{77} \makeatother % \llangle, \rrangle, \lmoustache and \rmoustache from MnSymbolE \makeatletter \def\Decl@Mn@Delim#1#2#3#4{% \if\relax\noexpand#1% \let#1\undefined \fi \DeclareMathDelimiter{#1}{#2}{#3}{#4}{#3}{#4}} \def\Decl@Mn@Open#1#2#3{\Decl@Mn@Delim{#1}{\mathopen}{#2}{#3}} \def\Decl@Mn@Close#1#2#3{\Decl@Mn@Delim{#1}{\mathclose}{#2}{#3}} \Decl@Mn@Open{\llangle}{mnomx}{'164} \Decl@Mn@Close{\rrangle}{mnomx}{'171} \Decl@Mn@Open{\lmoustache}{mnomx}{'245} \Decl@Mn@Close{\rmoustache}{mnomx}{'244} \makeatother % Widecheck \makeatletter \DeclareRobustCommand\widecheck[1]{{\mathpalette\@widecheck{#1}}} \def\@widecheck#1#2{% \setbox\z@\hbox{\m@th$#1#2$}% \setbox\tw@\hbox{\m@th$#1% \widehat{% \vrule\@width\z@\@height\ht\z@ \vrule\@height\z@\@width\wd\z@}$}% \dp\tw@-\ht\z@ \@tempdima\ht\z@ \advance\@tempdima2\ht\tw@ \divide\@tempdima\thr@@ \setbox\tw@\hbox{% \raise\@tempdima\hbox{\scalebox{1}[-1]{\lower\@tempdima\box \tw@}}}% {\ooalign{\box\tw@ \cr \box\z@}}} \makeatother % \mathraisebox{voffset}[height][depth]{something} \makeatletter \NewDocumentCommand\mathraisebox{moom}{% \IfNoValueTF{#2}{\def\@temp##1##2{\raisebox{#1}{$\m@th##1##2$}}}{% \IfNoValueTF{#3}{\def\@temp##1##2{\raisebox{#1}[#2]{$\m@th##1##2$}}% }{\def\@temp##1##2{\raisebox{#1}[#2][#3]{$\m@th##1##2$}}}}% \mathpalette\@temp{#4}} \makeatletter % udots (taken from yhmath) \makeatletter \def\udots{\mathinner{\mkern2mu\raise\p@\hbox{.} \mkern2mu\raise4\p@\hbox{.}\mkern1mu \raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}} \makeatother %% Fix array \newcommand{\itexarray}[1]{\begin{matrix}#1\end{matrix}} %% \itexnum is a noop \newcommand{\itexnum}[1]{#1} %% Renaming existing commands \newcommand{\underoverset}[3]{\underset{#1}{\overset{#2}{#3}}} \newcommand{\widevec}{\overrightarrow} \newcommand{\darr}{\downarrow} \newcommand{\nearr}{\nearrow} \newcommand{\nwarr}{\nwarrow} \newcommand{\searr}{\searrow} \newcommand{\swarr}{\swarrow} \newcommand{\curvearrowbotright}{\curvearrowright} \newcommand{\uparr}{\uparrow} \newcommand{\downuparrow}{\updownarrow} \newcommand{\duparr}{\updownarrow} \newcommand{\updarr}{\updownarrow} \newcommand{\gt}{>} \newcommand{\lt}{<} \newcommand{\map}{\mapsto} \newcommand{\embedsin}{\hookrightarrow} \newcommand{\Alpha}{A} \newcommand{\Beta}{B} \newcommand{\Zeta}{Z} \newcommand{\Eta}{H} \newcommand{\Iota}{I} \newcommand{\Kappa}{K} \newcommand{\Mu}{M} \newcommand{\Nu}{N} \newcommand{\Rho}{P} \newcommand{\Tau}{T} \newcommand{\Upsi}{\Upsilon} \newcommand{\omicron}{o} \newcommand{\lang}{\langle} \newcommand{\rang}{\rangle} \newcommand{\Union}{\bigcup} \newcommand{\Intersection}{\bigcap} \newcommand{\Oplus}{\bigoplus} \newcommand{\Otimes}{\bigotimes} \newcommand{\Wedge}{\bigwedge} \newcommand{\Vee}{\bigvee} \newcommand{\coproduct}{\coprod} \newcommand{\product}{\prod} \newcommand{\closure}{\overline} \newcommand{\integral}{\int} \newcommand{\doubleintegral}{\iint} \newcommand{\tripleintegral}{\iiint} \newcommand{\quadrupleintegral}{\iiiint} \newcommand{\conint}{\oint} \newcommand{\contourintegral}{\oint} \newcommand{\infinity}{\infty} \newcommand{\bottom}{\bot} \newcommand{\minusb}{\boxminus} \newcommand{\plusb}{\boxplus} \newcommand{\timesb}{\boxtimes} \newcommand{\intersection}{\cap} \newcommand{\union}{\cup} \newcommand{\Del}{\nabla} \newcommand{\odash}{\circleddash} \newcommand{\negspace}{\!} \newcommand{\widebar}{\overline} \newcommand{\textsize}{\normalsize} \renewcommand{\scriptsize}{\scriptstyle} \newcommand{\scriptscriptsize}{\scriptscriptstyle} \newcommand{\mathfr}{\mathfrak} \newcommand{\statusline}[2]{#2} \newcommand{\tooltip}[2]{#2} \newcommand{\toggle}[2]{#2} % Theorem Environments \theoremstyle{plain} \newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma} \newtheorem{prop}{Proposition} \newtheorem{cor}{Corollary} \newtheorem*{utheorem}{Theorem} \newtheorem*{ulemma}{Lemma} \newtheorem*{uprop}{Proposition} \newtheorem*{ucor}{Corollary} \theoremstyle{definition} \newtheorem{defn}{Definition} \newtheorem{example}{Example} \newtheorem*{udefn}{Definition} \newtheorem*{uexample}{Example} \theoremstyle{remark} \newtheorem{remark}{Remark} \newtheorem{note}{Note} \newtheorem*{uremark}{Remark} \newtheorem*{unote}{Note} %------------------------------------------------------------------- \begin{document} %------------------------------------------------------------------- \section*{inductive type} \hypertarget{context}{}\subsubsection*{{Context}}\label{context} \hypertarget{deduction_and_induction}{}\paragraph*{{Deduction and Induction}}\label{deduction_and_induction} [[!include deduction and induction - contents]] \hypertarget{type_theory}{}\paragraph*{{Type theory}}\label{type_theory} [[!include type theory - contents]] \hypertarget{induction}{}\paragraph*{{Induction}}\label{induction} [[!include induction - contents]] \hypertarget{contents}{}\section*{{Contents}}\label{contents} \noindent\hyperlink{idea}{Idea}\dotfill \pageref*{idea} \linebreak \noindent\hyperlink{definition}{Definition}\dotfill \pageref*{definition} \linebreak \noindent\hyperlink{InductionRules}{Induction: dependent elimination, computation}\dotfill \pageref*{InductionRules} \linebreak \noindent\hyperlink{RecursionRules}{Recursion: elimination, computation}\dotfill \pageref*{RecursionRules} \linebreak \noindent\hyperlink{categorical_semantics}{Categorical semantics}\dotfill \pageref*{categorical_semantics} \linebreak \noindent\hyperlink{properties}{Properties}\dotfill \pageref*{properties} \linebreak \noindent\hyperlink{homotopy_initiality}{Homotopy initiality}\dotfill \pageref*{homotopy_initiality} \linebreak \noindent\hyperlink{examples}{Examples}\dotfill \pageref*{examples} \linebreak \noindent\hyperlink{NaturalNumbers}{Natural numbers}\dotfill \pageref*{NaturalNumbers} \linebreak \noindent\hyperlink{introduction_elimination_computation}{Introduction, elimination, computation}\dotfill \pageref*{introduction_elimination_computation} \linebreak \noindent\hyperlink{induction_2}{Induction}\dotfill \pageref*{induction_2} \linebreak \noindent\hyperlink{recursion}{Recursion}\dotfill \pageref*{recursion} \linebreak \noindent\hyperlink{IdentityTypes}{Identity types}\dotfill \pageref*{IdentityTypes} \linebreak \noindent\hyperlink{categorical_semantics_2}{Categorical semantics}\dotfill \pageref*{categorical_semantics_2} \linebreak \noindent\hyperlink{PathInduction}{Path induction}\dotfill \pageref*{PathInduction} \linebreak \noindent\hyperlink{PathRecursion}{Path recursion}\dotfill \pageref*{PathRecursion} \linebreak \noindent\hyperlink{wtypes}{W-types}\dotfill \pageref*{wtypes} \linebreak \noindent\hyperlink{related_concepts}{Related concepts}\dotfill \pageref*{related_concepts} \linebreak \noindent\hyperlink{References}{References}\dotfill \pageref*{References} \linebreak \hypertarget{idea}{}\subsection*{{Idea}}\label{idea} An \emph{inductive type} is\ldots{} In terms of [[categorical semantics]], an \emph{inductive type} is a type whose interpretation is given by an [[initial algebra of an endofunctor]]. This has the usual meaning in ordinary [[category theory]]. In applications to [[(∞,1)-category theory]], the uniqueness clause in the notion of initial object is modified to allow for a [[contractible space]] of choices (as discussed at \emph{[[initial object in an (∞,1)-category]]}), and this difference is reflected accordingly in the type-theoretic set-up. The [[syntax]] will give back the traditional meaning whenever equality is interpreted [[extensional type theory|extensionally]]. \hypertarget{definition}{}\subsection*{{Definition}}\label{definition} There are two \emph{equivalent} ways of defining the [[judgement]] rules for inductive types. The first describes [[term elimination|elimination]] on [[dependent types]] over the given type. This is the formalization of the notion of [[induction]], and discussed below in \begin{itemize}% \item \hyperlink{InductionRules}{Induction: dependent elimination, computation}. \end{itemize} The second describes [[term elimination|elimination]] on absolute types. This is the formalization of the notion of [[recursion]], and discussed below \begin{itemize}% \item \hyperlink{RecursionRules}{Recursion: elimination, computation} \end{itemize} \hypertarget{InductionRules}{}\subsubsection*{{Induction: dependent elimination, computation}}\label{InductionRules} (\ldots{}) \hypertarget{RecursionRules}{}\subsubsection*{{Recursion: elimination, computation}}\label{RecursionRules} (\ldots{}) \hypertarget{categorical_semantics}{}\subsubsection*{{Categorical semantics}}\label{categorical_semantics} We discuss the [[categorical semantics]] of inductive types. \begin{defn} \label{InterpretationOfTheRules}\hypertarget{InterpretationOfTheRules}{} The categorical interpretation of [[induction]], hence of the \emph{dependent elimination} and computation rules from \hyperlink{InductionRules}{above} are the following. Let $\mathcal{C}$ be the [[ambient category]]. \begin{enumerate}% \item \textbf{[[term introduction rule]]} The interpretation of inductive term introduction is by an [[endofunctor]] $F : \mathcal{C} \to \mathcal{C}$ and an [[algebra over an endofunctor]], exhibited by a [[morphism]] in $\mathcal{C}$ of the form \begin{displaymath} F(W) \to W \,. \end{displaymath} \item \textbf{[[term elimination rule]]} The interpretation of the dependent elimination rule says that given a [[display map]] $B \to W$, where $B$ is given an $F$-[[algebra over an endofunctor|algebra structure]] and the display map is an $F$-algebra [[homomorphism]], the dependent eliminator is interpreted as a specified [[section]] $\sigma : W \to B \in \mathcal{C}_{/W}$, hence as a [[diagram]] \begin{displaymath} \itexarray{ W &&\stackrel{\sigma}{\to}&& B \\ & {}_{\mathllap{id}}\searrow && \swarrow_{\mathrlap{}} \\ && W } \end{displaymath} in $\mathcal{C}$. \item \textbf{[[computation rule]]} The interpretation of the dependent computation rules is that the section $\sigma$ from above is required to be an [[algebra for an endofunctor|algebra]] [[homomorphism]]. \end{enumerate} \end{defn} \begin{defn} \label{InterpretationOfTheSimpleRules}\hypertarget{InterpretationOfTheSimpleRules}{} The categorical interpretation of [[recursion]], hence of the absolute elimination rules from \hyperlink{RecursionRules}{above} in a suitable [[category]] $\mathcal{C}$ is the following \begin{enumerate}% \item \textbf{[[term introduction rule]]} The interpretation of inductive term introduction is by an [[endofunctor]] $F : \mathcal{C} \to \mathcal{C}$ and an [[algebra over an endofunctor]], exhibited by a [[morphism]] in $\mathcal{C}$ of the form \begin{displaymath} F(W) \to W \,. \end{displaymath} \item \textbf{[[term elimination rule]]} The interpretation of the absolute elimination rule is that for $A$ any other $F$-[[algebra of an endofunctor|algebra]], there is a morphism $W \to A$ in $\mathcal{C}$. \item \textbf{[[computation rule]]} The interpretation of the absolute computation rule says that the morphism $W \to A$ from above is an algebra [[homomorphism]] and is unique as such. \end{enumerate} In summary this says that the recursion rules are interpreted as an [[initial algebra of an endofunctor]]. \end{defn} \begin{prop} \label{BothFormulationsOfInitialityAreEquivalent}\hypertarget{BothFormulationsOfInitialityAreEquivalent}{} When interpreted in a category $\mathcal{C}$ of [[homotopy type|homotopy 0-types]] = sets, definition \ref{InterpretationOfTheRules} and definition \ref{InterpretationOfTheSimpleRules} are indeed equivalent. \end{prop} \begin{proof} First suppose that $W$ is an initial $F$-algebra as in def. \ref{InterpretationOfTheSimpleRules}. Then since [[initial object|initiality]] entails first of all the existence of a morphims to any other object it follows that with $B$ another $F$-algebra there is a homomorphism $W \to B$, and since secondly initiality entails uniqueness of this morphism, it follows that given a homomorphism $B \to W$ the composite $W \to B \to W$ has to equal the identity $id_W$, hence that $B \to W$ has a section, and uniquely so. Conversely, assume that $W$ satisfies definition \ref{InterpretationOfTheRules}. For $A$ any other $F$-algebra we can form the trivial display map $W \times A \to W$ by [[projection]] and a [[section]] of this is equivalently just a morphism $W \to A$, so we have a homomorphism from $W$ to any other $F$-algebra $A$. Therefore to show that $W$ is an initial $F$-algebra it remains to show that for $f, g : W \to A$ two algebra homomorphism, they are necessarily equal. To that end, notice that by the assumption of 0-truncation, the [[diagonal]] $\delta \colon A \to A \times A$ is a display map / fibration. Form its [[pullback]] $P$ \begin{displaymath} \itexarray{ P & \to & A \\ \downarrow & & \downarrow^\mathrlap{\delta} \\ W & \underset{\langle f, g \rangle}{\to} & A \times A, } \,, \end{displaymath} which is also an algebra homomorphism. Therefore by the interpretation of the elimination rule it has a (specified) [[section]] $\sigma : W \to P$. But $P \to W$ is the pullback of a [[monomorphism]] and therefore itself a monomorphism, and so the section forces it to be in fact an [[isomorphism]]. This in turn means that $f$ and $g$ are equal. \end{proof} \begin{remark} \label{}\hypertarget{}{} In [[intensional type theory]], where the diagonal is not a display map, we can perform the same argument using a [[path object]] $P A \to A \times A$ (represented in type theory by an [[identity type]]), showing thereby that $f$ and $g$ are homotopic. A fancier version of this argument enables us to show that the space of algebra maps $W\to A$ is actually contractible. In other words, the axioms for an inductive type still imply that algebra maps out of $W$ are essentially unique, even though the axioms do not state this explicitly. \end{remark} \hypertarget{properties}{}\subsection*{{Properties}}\label{properties} \hypertarget{homotopy_initiality}{}\subsubsection*{{Homotopy initiality}}\label{homotopy_initiality} Any inductive type $W$ is a homotopy initial F-[[algebra over an endofunctor|algebra]]: the space of $F$-[[algebra for an endofunctor|algebra]] maps $W \to X$ is [[contractible]]. (\hyperlink{AwodeyGambinoSojakova}{Awodey-Gambino-Sojakova}) \hypertarget{examples}{}\subsection*{{Examples}}\label{examples} \hypertarget{NaturalNumbers}{}\subsubsection*{{Natural numbers}}\label{NaturalNumbers} \hypertarget{introduction_elimination_computation}{}\paragraph*{{Introduction, elimination, computation}}\label{introduction_elimination_computation} \begin{defn} \label{InterpretationOfTheRules}\hypertarget{InterpretationOfTheRules}{} The [[type of natural numbers]] $\mathbb{N}$ is the inductive type defined as follows. \begin{enumerate}% \item \textbf{[[term introduction rule]]} \begin{displaymath} \frac{}{0 \in \mathbb{N}} \;\; \frac{n \in \mathbb{N}}{s(n) \in \mathbb{N}} \end{displaymath} \item \textbf{[[term elimination rule]]} \begin{displaymath} \frac{ \left( x \in \mathbb{N} \vdash P(x) : Type \;\; \vdash p_0 : P(0) \;\;\; x \in \mathbb{N}, p : P(x) \vdash q : P(s (x)) \right) \;\; \vdash n \in \mathbb{N} }{ p(n) : P(n) } \end{displaymath} (check, this probably still has syntax errors\ldots{}) \item \textbf{[[computation rule]]} (\ldots{}) \end{enumerate} \end{defn} See for instance (\hyperlink{Pfenning}{Pfenning, section 2}). In [[Coq]]-[[syntax]] the [[natural numbers]] are the inductive type defined by \begin{verbatim}Inductive nat : Type := | zero : nat | succ : nat -> nat.\end{verbatim} In the [[categorical semantics]] this is interpreted as the [[initial algebra for an endofunctor|initial algebra]] for the endofunctor $F$ that sends an object to its [[coproduct]] with the [[terminal object]] \begin{displaymath} F(X) = * \coprod X \,, \end{displaymath} or in different equivalent notation, which is very suggestive here: \begin{displaymath} F(X) = 1 + X \,. \end{displaymath} That [[initial algebra for an endofunctor|initial algebra]] is (as explained there) precisely a [[natural number object]] $\mathbb{N}$. The two components of the morphism $F(\mathbb{N}) \to \mathbb{N}$ that defines the algebra structure are the 0-[[generalized element|element]] $zero : * \to \mathbb{N}$ and the successor [[endomorphism]] $successor : \mathbb{N} \to \mathbb{N}$ \begin{displaymath} (zero,successor) : * \coprod \mathbb{N} \to \mathbb{N} \,. \end{displaymath} In the following we write of course for short $0 : * \to \mathbb{N}$ and $s : \mathbb{N} \to \mathbb{N}$. \hypertarget{induction_2}{}\paragraph*{{Induction}}\label{induction_2} \begin{example} \label{}\hypertarget{}{} We spell out in detail how the fact that $\mathbb{N}$ satisfied def. \ref{InterpretationOfTheRules} is the classical [[induction principle]]. That principle says informally that if a [[proposition]] $P$ depending on the natural numbers is true at $n = 0$ and such that if it is true for some $n$ then it is true for $n+1$, then it is true for all natural numbers. Here is how this is formalized in type theory and then [[categorical semantics|interpreted]] in some suitable ambient category $\mathcal{C}$. First of all, that $P$ is a proposition depending on the natural numbers means that it is a [[dependent type]] \begin{displaymath} n \in \mathbb{N} \vdash P(n) : Type \,. \end{displaymath} The categorical interpretation of this is by a [[display map]] \begin{displaymath} \itexarray{ P \\ \downarrow \\ \mathbb{N} } \end{displaymath} in the given category $\mathcal{C}$. Next, the fact that $P$ holds at 0 means that there is a ([[proof]]-)[[term]] \begin{displaymath} \vdash p_0 \in P(0) \,. \end{displaymath} In the categorical semantics the [[substitution]] of $n$ for 0 that gives $P(0)$ is given by the [[pullback]] of the above fibration \begin{displaymath} \itexarray{ 0^* P &\to& P \\ \downarrow && \downarrow \\ * &\stackrel{0}{\to}& \mathbb{N} } \end{displaymath} and the [[term]] $p_0$ is interpreted as a [[section]] of the resultig fibration over the terminal object \begin{displaymath} \itexarray{ * &\stackrel{p_0}{\to}& 0^* P &\to& P \\ &\searrow& \downarrow && \downarrow \\ && * &\stackrel{0}{\to}& \mathbb{N} } \,. \end{displaymath} But by the defining [[universal property]] of the pullback, this is equivalently just a [[commuting diagram]] \begin{displaymath} \itexarray{ * &\stackrel{p_0}{\to}& P \\ \downarrow && \downarrow \\ * &\stackrel{0}{\to}& \mathbb{N} } \,. \end{displaymath} Next the induction step. Formally it says that for all $n \in \mathbb{N}$ there is an [[implication]] $p_s(n) : P(n) \to P(n+1)$ \begin{displaymath} n \in \mathbb{N} \vdash p_s(n) : P(n) \to P(n+1) \end{displaymath} The categorical semantics of the [[substitution]] of $n+1$ for $n$ is now given by the [[pullback]] \begin{displaymath} \itexarray{ P((-)+1) \coloneqq & s^*P &\to& P \\ & \downarrow && \downarrow \\ & \mathbb{N} &\stackrel{s}{\to}& \mathbb{N} } \end{displaymath} and the interpretation of the implication term $p_s(n)$ is as a morphism $P \to s^* P$ in $\mathcal{C}_{/\mathbb{N}}$ \begin{displaymath} \itexarray{ P & \stackrel{p_s}{\to} & s^*P &\to& P \\ &\searrow & \downarrow && \downarrow \\ && \mathbb{N} &\stackrel{s}{\to}& \mathbb{N} } \,. \end{displaymath} Again by the [[universal property]] of the pullback this is the same as a [[commuting diagram]] \begin{displaymath} \itexarray{ P &\stackrel{p_s}{\to}& P \\ \downarrow && \downarrow \\ \mathbb{N} &\stackrel{s}{\to}& \mathbb{N} } \,. \end{displaymath} In summary this shows that the fact that $P$ is a proposition depending on natural numbers which holds at 0 and which holds at $n+1$ if it holds at $n$ is interpreted precisely as an $F$-[[algebra for an endofunctor|algebra homomorphism]] \begin{displaymath} \itexarray{ P \\ \downarrow \\ \mathbb{N} } \,. \end{displaymath} The [[induction principle]] is supposed to deduce from this that $P$ holds for every $n$, hence that there is a proof $p_n : P(n)$ for all $n$: \begin{displaymath} n \in \mathbb{N} \vdash p(n) : P(n) \,. \end{displaymath} The categorical interpretation of this is as a morphism $p : \mathbb{N} \to P$ in $\mathcal{C}_{/\mathbb{N}}$. The existence of this is indeed exactly what the interpretation of the elimination rule, def. \ref{InterpretationOfTheRules}, gives, or (equivalently by prop. \ref{BothFormulationsOfInitialityAreEquivalent}) exactly what the initiality of the $F$-algebra $\mathbb{N}$ gives. \end{example} \hypertarget{recursion}{}\paragraph*{{Recursion}}\label{recursion} \begin{example} \label{}\hypertarget{}{} We spell out how the fact that $\mathbb{N}$ satisfies def. \ref{InterpretationOfTheSimpleRules} is the classical [[recursion principle]]. So let $A$ be an $F$-algebra object, hence equipped with a morphism \begin{displaymath} a_0 : * \to A \end{displaymath} and a morphism \begin{displaymath} h : A \to A \,. \end{displaymath} By [[initial object|initiality]] of the $F$-algebra $\mathbb{N}$, there is then a (unique) morphism \begin{displaymath} f : \mathbb{N} \to A \end{displaymath} such that the diagram \begin{displaymath} \itexarray{ * &\stackrel{0}{\to}& \mathbb{N} &\stackrel{(-)+1}{\to}& \mathbb{N} \\ \downarrow && \downarrow^{\mathrlap{f}} && \downarrow^{\mathrlap{f}} \\ * &\stackrel{a_0}{\to}& A &\stackrel{h}{\to}& A } \end{displaymath} commutes. This means precisely that $f$ is the function defined recursively by \begin{enumerate}% \item $f(0) = a_0$; \item $f(n+1) = h(f(n))$. \end{enumerate} \end{example} \hypertarget{IdentityTypes}{}\subsubsection*{{Identity types}}\label{IdentityTypes} The introduction, elimination and computation rules for \emph{[[identity types]]} are discussed there. In [[Coq]]-[[syntax]] the [[identity types]] are the inductive types (or more precisely, the \emph{[[inductive family]]}) defined by \begin{verbatim}Inductive id {A} : A -> A -> Type := idpath : forall x, id x x.\end{verbatim} \hypertarget{categorical_semantics_2}{}\paragraph*{{Categorical semantics}}\label{categorical_semantics_2} We may [[categorical semantics|interpret]] identity types in suitable categories $\mathcal{C}$ such as a [[type-theoretic model category]]. \begin{example} \label{EndofunctorForIdentityTypes}\hypertarget{EndofunctorForIdentityTypes}{} The [[categorical semantics|categorical interpretation]] of identity types in a category $\mathcal{C}$ is as the [[initial algebra of an endofunctor|initial algebra]] for the [[endofunctor]] \begin{displaymath} F : \mathcal{C}_{/A \times A} \to \mathcal{C}_{/A \times A} \end{displaymath} of the [[slice category]] $\mathcal{C}_{/A \times A}$ over $A\times A$ which is constant at the [[diagonal]] $A\to A\times A$: \begin{displaymath} F (\langle E \to A \times A\rangle) = \langle A \stackrel{\Delta}{\to} A \times A\rangle \,. \end{displaymath} \end{example} So an [[algebra for an endofunctor|algebra]] for this endofunctor is a morphism \begin{displaymath} \itexarray{ A &&\to&& E \\ & {}_{\mathllap{\Delta}}\searrow && \swarrow \\ && A \times A } \end{displaymath} and the [[initial object|initial]] such is the [[path space object]] $A^I \to A \times A$. \hypertarget{PathInduction}{}\paragraph*{{Path induction}}\label{PathInduction} \begin{example} \label{}\hypertarget{}{} We spell out in detail how the the [[induction principle]] def. \ref{InterpretationOfTheRules} for identity types is the [[principle of substitution of equals for equals]]. To have an $F$-algebra $\langle E \to A\times A\rangle$ over $\langle A^I \to A \times A\rangle$ means precisely to have a diagram \begin{displaymath} \itexarray{ && E \\ & \nearrow& \downarrow \\ A &\to& A^I \\ &\searrow& \downarrow \\ && A \times A } \end{displaymath} in $\mathcal{C}$. This is the interpretation of the elimination rule: $E \to A^I$ is the interpretation of a type \begin{displaymath} a,b \in A , p : (a = b) \vdash E(a,b,p) \end{displaymath} and the lift $A \to E$ is a [[section]] of the [[pullback]] of $E$ to $A$, hence an interpretation of a [[term]] in the [[substitution]] \begin{displaymath} s : E(a,a,r_a) \,. \end{displaymath} The elimination rule then says that this extends to a section $A^I \to E$, hence a ``proof of $E$ over all identifications'' $a = b$. \end{example} \hypertarget{PathRecursion}{}\paragraph*{{Path recursion}}\label{PathRecursion} \begin{example} \label{}\hypertarget{}{} We spell out how the the [[recursion principle]] def. \ref{InterpretationOfTheSimpleRules} for [[identity types]] is related to the \emph{[[complete Segal space|Segal-completeness condition]]} and in particular to \emph{[[univalence]]}. Notice that an [[algebra for an endofunctor|algebra over the endofunctor]] that defines identity types, example \ref{EndofunctorForIdentityTypes}, \begin{displaymath} \itexarray{ X_0 &&\stackrel{\sigma_0}{\to}&& X_1 \\ & \searrow && \swarrow_{\mathrlap{\delta_0, \delta_1}} \\ && X_0 \times X_0 } \end{displaymath} constitutes the [[simplicial skeleton|1-skeleton]] of a [[simplicial object]] \begin{displaymath} \itexarray{ X_1 \\ {}^{\mathllap{\delta_0}}\downarrow \uparrow^{\mathrlap{\sigma_0}} \downarrow^{\mathrlap{\delta_1}} \\ X_0 } \,. \end{displaymath} The [[recursion principle]] says that the [[simplicial identities|degeneracy map]] $\sigma_0$ factors through the [[path space object]] of $X_0$ as a lift $\hat \sigma_0$ in the diagram \begin{displaymath} \itexarray{ X_0 &\stackrel{\sigma_0}{\to}& X_1 \\ \downarrow &\nearrow_{\hat \sigma_0}& \downarrow \\ X_0^I &\to& X_0 \times X_0 } \,. \end{displaymath} [[categorical semantics|Semantically]], this lift exists because $X_0 \to X_0^I$ is an [[acyclic cofibration]] by definition of [[path space object]], and $X_1 \to X_0 \times X_0$ is a [[fibration]] ([[display map]]) by the interpretation rule for [[dependent types]]. This morphism \begin{displaymath} \hat \sigma_0 : X_0^I \to X_1 \end{displaymath} lifts paths/[[morphisms]] that exist in $X_0$ to the morphisms exhibited by $X_1$, if we think of the above as the 1-skeleton of a simplicial object that represents an [[internal category in an (infinity,1)-category]]. Suppose this exists, then there will be a notion of \emph{equivalences} in $X_1$, those morphisms that are invertible with respect to the given composition operation. In good situations this will give the [[core]] inclusion \begin{displaymath} Core(X_1) \hookrightarrow X_1 \,. \end{displaymath} In this case the [[complete Segal space|Segal-completeness condition]] in degree 1 says that the path recursion $\hat \sigma_0$ exhibits this inclusion \begin{displaymath} \hat \sigma_0 : X_0^I \simeq Core(X_1) \to X_1 \,. \end{displaymath} In the case that $X_\bullet$ is the classifier of the [[codomain fibration]], then this is called the \emph{[[univalence]]-condition}. \end{example} \hypertarget{wtypes}{}\subsubsection*{{W-types}}\label{wtypes} \begin{itemize}% \item [[W-type]] \end{itemize} \hypertarget{related_concepts}{}\subsection*{{Related concepts}}\label{related_concepts} \begin{itemize}% \item \textbf{inductive type, [[initial algebra of an endofunctor]]} \item [[inductive-inductive type]] \item [[inductive family]] \item [[positive type]], [[negative type]] \item [[higher inductive type]], [[initial algebra of a presentable ∞-monad]] \item [[coinductive type]] \end{itemize} \hypertarget{References}{}\subsection*{{References}}\label{References} A very basic introduction to the concept, with an eye towards explaining [[identity types]] is in \begin{itemize}% \item [[Mike Shulman]], \emph{Induction on equality} (\href{http://home.sandiego.edu/~shulman/papers/induction.pdf}{pdf}) \end{itemize} A textbook account in the context of [[programming languages]] is in section 15 of \begin{itemize}% \item [[Robert Harper]], \emph{[[Practical Foundations for Programming Languages]]} \end{itemize} Discussion of inductive types in the context of [[Coq]]-programming is in chapter 3 of \begin{itemize}% \item [[Adam Chlipala]], \emph{\href{http://adam.chlipala.net/cpdt/}{Certified programming with dependent types}} \end{itemize} See also \begin{itemize}% \item Michael Abbott, [[Thorsten Altenkirch]], [[Neil Ghani]], \emph{Inductive Types for Free -- Representing nested inductive types using W-types} (\href{http://www.cs.nott.ac.uk/~txa/talks/icalp-slides.pdf}{pdf}) \end{itemize} Expositions with an eye towards [[higher inductive types]] include \begin{itemize}% \item [[Mike Shulman]], \emph{Homotopy type theory IV} (\href{http://golem.ph.utexas.edu/category/2011/04/homotopy_type_theory_vi.html}{web}) \item [[Peter LeFanu Lumsdaine]], \emph{Higher inductive types, a tour of the menageries} (\href{http://homotopytypetheory.org/2011/04/24/higher-inductive-types-a-tour-of-the-menagerie/}{blog post}) \item [[Mike Shulman]], \emph{Inductive and higher inductive types}, talk slides (2012) (\href{http://www.sandiego.edu/~shulman/hottminicourse2012/04induction.pdf}{pdf}) \end{itemize} Original references include \begin{itemize}% \item [[Per Martin-Löf]], \emph{Intuitionistic Type Theory}. Notes by G. Sambin of a series of lectures given in Padua, 1980. Bibliopolis, 1984. \end{itemize} The formalization in [[Coq]] is discussed in \begin{itemize}% \item Eduardo Gim\'e{}nez, Pierre Cast\'e{}ran, \emph{A Tutorial on Co-Inductive Types in Coq} (\href{http://flint.cs.yale.edu/cs428/coq/pdf/RecTutorial.pdf}{pdf}) \end{itemize} A study of the homotopy-initiality of inductive types in [[homotopy type theory]] is in \begin{itemize}% \item [[Steve Awodey]], [[Nicola Gambino]], [[Kristina Sojakova]], \emph{Inductive types in homotopy type theory} (\href{http://arxiv.org/abs/1201.3898}{arXiv:1201.3898}) \end{itemize} The corresponding [[Coq]]-code is at \begin{itemize}% \item \href{https://github.com/HoTT/HoTT/tree/master/Coq/IT}{https://github.com/HoTT/HoTT/tree/master/Coq/IT} \end{itemize} Exposition and discussion of that result is in \begin{itemize}% \item [[Steve Awodey]], \emph{Inductive types in Hott} (\href{http://homotopytypetheory.org/2012/01/19/inductive-types-in-hott/}{blog post}) \end{itemize} Discussion of the inductive type of [[natural numbers]] is in \begin{itemize}% \item Frank Pfenning, \emph{Lecture notes on natural numbers} (2009) (\href{http://www.cs.cmu.edu/~fp/courses/15317-f09/lectures/06-nat.pdf}{pdf}) \end{itemize} Discussion of inductive types in the context of [[linear type theory]] is in \begin{itemize}% \item St\'e{}phane Gimenez, \emph{Towards Generic Inductive Constructions in Systems of Nets} (\href{http://www.imn.htwk-leipzig.de/WST2013/papers/paper_16.pdf}{pdf}) \end{itemize} [[!redirects inductive type]] [[!redirects inductive types]] [[!redirects inducive type]] \end{document}