<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Dependent Types, Read Through Pie on Massimo Nocentini</title><link>https://massimo-nocentini.github.io/book/dependent-types/</link><description>Recent content in Dependent Types, Read Through Pie on Massimo Nocentini</description><generator>Hugo</generator><language>en-US</language><atom:link href="https://massimo-nocentini.github.io/book/dependent-types/index.xml" rel="self" type="application/rss+xml"/><item><title>Preface</title><link>https://massimo-nocentini.github.io/book/dependent-types/preface/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/preface/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Pie is the small dependently typed language&lt;/span&gt; of Friedman and Christiansen’s &lt;em&gt;The Little Typer&lt;/em&gt;, implemented in about 6,700 lines of Racket, Typed Racket and Scribble. This tutorial teaches dependent type theory by reading that implementation alongside programs that have been run. It is written for a reader who knows Scheme and miniKanren but has not met dependent types.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Part I&lt;/strong&gt; (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-1/"&gt;Part&amp;nbsp;I&lt;/a&gt;) uses Pie: types that mention values, the fixed menu of types, when Pie needs an annotation, and the eliminators with their motives.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Part II&lt;/strong&gt; (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-2/"&gt;Part&amp;nbsp;II&lt;/a&gt;) proves things: definitional and propositional equality, induction, the constructor &lt;code&gt;same&lt;/code&gt; and the eliminators &lt;code&gt;cong&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, &lt;code&gt;symm&lt;/code&gt;, &lt;code&gt;trans&lt;/code&gt; and &lt;code&gt;ind-=&lt;/code&gt;, propositions as types, the empty and unit types, the universe, and proofs developed hole by hole with &lt;code&gt;TODO&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Part III&lt;/strong&gt; (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/"&gt;Part&amp;nbsp;III&lt;/a&gt;) opens the implementation: syntax, values and neutral terms, evaluation and read-back (normalization by evaluation), and the bidirectional checker that translates programs into a core language.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Every claim about the code cites file and line in the Pie repository, and every example is quoted with the output it actually produced. The last chapter (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/10-context/"&gt;Chapter&amp;nbsp;10&lt;/a&gt;) compares Pie with Agda, Rocq, Lean and Idris, lists what Pie leaves out and the defects found while running the examples, gives a recipe for building a checker of this kind, and describes a port of Pie to CHICKEN Scheme that prints what Pie prints, except where it fixes the defect of &lt;code&gt;cong&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>List of Figures</title><link>https://massimo-nocentini.github.io/book/dependent-types/list-of-figures/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/list-of-figures/</guid></item><item><title>List of Tables</title><link>https://massimo-nocentini.github.io/book/dependent-types/list-of-tables/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/list-of-tables/</guid></item><item><title>Types that mention values</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-1/01-intro/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-1/01-intro/</guid><description>&lt;p&gt;Pie is the small dependently typed language that accompanies &lt;em&gt;The Little Typer&lt;/em&gt;&lt;label for="sn-4c30c8-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-4c30c8-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="littletyper"&gt;Daniel P. Friedman and David Thrane Christiansen. &lt;cite&gt;The Little Typer&lt;/cite&gt;. MIT Press, Cambridge, MA, 2018&lt;/span&gt;&lt;/span&gt;. In the terms of type theory it is a small intensional Martin-Löf type theory&lt;label for="sn-4c30c8-2" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-4c30c8-2" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="martinlof1975"&gt;Per Martin-Löf. An Intuitionistic Theory of Types: Predicative Part. In H. E. Rose and J. C. Shepherdson, editors, &lt;cite&gt;Logic Colloquium ’73&lt;/cite&gt;, volume 80 of &lt;cite&gt;Studies in Logic and the Foundations of Mathematics&lt;/cite&gt;, pages 73–118. North-Holland, Amsterdam, 1975&lt;/span&gt;; and &lt;span class="bib-entry" data-cite="martinlof1984"&gt;Per Martin-Löf. &lt;cite&gt;Intuitionistic Type Theory&lt;/cite&gt;. Bibliopolis, Naples, 1984. Notes by Giovanni Sambin&lt;/span&gt;&lt;/span&gt;: dependent functions and pairs, natural numbers, atoms, lists, vectors, sums, an identity type, the empty and unit types and a single universe, all built in, with no way to declare more (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/10-context/"&gt;Chapter&amp;nbsp;10&lt;/a&gt; lists what it leaves out). Its implementation is a Racket package of about 6700 lines, counting the top-level &lt;code&gt;.rkt&lt;/code&gt; files and the language reference &lt;code&gt;pie.scrbl&lt;/code&gt; (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-1/01-intro/#tab-files"&gt;Table&amp;nbsp;1.1&lt;/a&gt;). We read it side by side with Pie programs that we run, assuming that the reader knows Scheme (closures, environments, an eval/apply interpreter) and miniKanren (relations, modes, unification) but not dependent types.&lt;/p&gt;</description></item><item><title>Programming with a fixed menu of types</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-1/02-programs/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-1/02-programs/</guid><description>&lt;p&gt;Pie has no way to declare a new datatype. It offers a fixed menu of types, collected in &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-1/02-programs/#tab-types"&gt;Table&amp;nbsp;2.1&lt;/a&gt;. Here we use the menu as a programmer would, building values, taking them apart and reading what Pie prints. Two facts met here shape everything else. An expression can get &lt;em&gt;stuck&lt;/em&gt; on a variable that has no value, and a definition cannot call itself.&lt;/p&gt;&#10;&lt;figure class="fullwidth tufte-table"&gt;&lt;div class="table-wrapper fullwidth"&gt;&#10;&lt;table class="fullwidth"&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th style="text-align: left"&gt;Type&lt;/th&gt;&#10;&lt;th style="text-align: left"&gt;Formation&lt;/th&gt;&#10;&lt;th style="text-align: left"&gt;Constructors&lt;/th&gt;&#10;&lt;th style="text-align: left"&gt;Eliminators&lt;/th&gt;&#10;&lt;th style="text-align: left"&gt;ι-rules&lt;/th&gt;&#10;&lt;th style="text-align: left"&gt;η&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;U&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;is-type 96; not in &lt;code&gt;U&lt;/code&gt; (synth 206–208)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;the types below (synth, in &lt;code&gt;U&lt;/code&gt;)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;none&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;—&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;—&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Nat&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;97 / 205&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;zero&lt;/code&gt; 246, &lt;code&gt;add1&lt;/code&gt; 247–249, numerals 639–647 (all synth)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;which-Nat&lt;/code&gt; 250–261, &lt;code&gt;iter-Nat&lt;/code&gt; 262–274, &lt;code&gt;rec-Nat&lt;/code&gt; 275–289, &lt;code&gt;ind-Nat&lt;/code&gt; 290–303&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;120–181&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;no&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Atom&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;132–133 / 304&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;'a&lt;/code&gt; 352–355 (synth)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;none&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;—&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;no&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Π&lt;/code&gt;, &lt;code&gt;→&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;98–131 / 209–245&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;λ&lt;/code&gt; 663–684 (check)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;application 599–629&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;110–118&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;yes&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Σ&lt;/code&gt;, &lt;code&gt;Pair&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;134–159 / 305–333&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;cons&lt;/code&gt; 685–697 (check)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;car&lt;/code&gt;, &lt;code&gt;cdr&lt;/code&gt; 334–351&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;183–197&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;yes&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;List&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;161–163 / 408–410&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;nil&lt;/code&gt; 698–705 (check), &lt;code&gt;::&lt;/code&gt; 411–414 (synth)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;ind-List&lt;/code&gt; 360–386, &lt;code&gt;rec-List&lt;/code&gt; 387–407&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;199–236&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;no&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Vec&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;171–174 / 502–505&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;vecnil&lt;/code&gt; 718–732, &lt;code&gt;vec::&lt;/code&gt; 733–747 (check)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;head&lt;/code&gt; 506–521, &lt;code&gt;tail&lt;/code&gt; 522–538, &lt;code&gt;ind-Vec&lt;/code&gt; 539–572&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;308–359&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;length &lt;code&gt;zero&lt;/code&gt; only&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Either&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;175–178 / 573–576&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;left&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt; 748–767 (check)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;ind-Either&lt;/code&gt; 577–590&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;361–378&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;no&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;=&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;165–170 / 421–426&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;same&lt;/code&gt; 706–717 (check)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;replace&lt;/code&gt; 427–444, &lt;code&gt;trans&lt;/code&gt; 445–458, &lt;code&gt;cong&lt;/code&gt; 459–475, &lt;code&gt;symm&lt;/code&gt; 476–484, &lt;code&gt;ind-=&lt;/code&gt; 485–501&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;245–306&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;no&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Trivial&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;160 / 356–357&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;sole&lt;/code&gt; 358–359 (synth)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;none&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;—&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;yes&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;Absurd&lt;/code&gt;&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;164 / 415–416&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;none&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;&lt;code&gt;ind-Absurd&lt;/code&gt; 417–420&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;never reduces (238–243)&lt;/td&gt;&#10;&lt;td style="text-align: left"&gt;yes&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&lt;figcaption class="caption-margin"&gt;&lt;span class="caption-label"&gt;Table&amp;nbsp;&lt;span class="tufte-num" data-kind="table" data-key="tab-types" data-labeled="1"&gt;2.1&lt;/span&gt;:&lt;/span&gt; &lt;span class="caption-text"&gt;Pie&amp;rsquo;s fixed menu of types. Line numbers in the Formation, Constructors and Eliminators columns are in &lt;code&gt;typechecker.rkt&lt;/code&gt;; in a pair of ranges separated by a slash, the first is the clause of &lt;code&gt;is-type&lt;/code&gt; (the type is a type) and the second the clause of &lt;code&gt;synth&lt;/code&gt; (the type is an element of &lt;code&gt;U&lt;/code&gt;). “check” and “synth” say whether a constructor only checks against a given type or also synthesizes its own. The ι-rules column gives the &lt;code&gt;do-*&lt;/code&gt; functions in &lt;code&gt;normalize.rkt&lt;/code&gt;. The η column says whether read-back has an η-rule for the type; &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/08-nbe/#tab-eta"&gt;Table&amp;nbsp;8.2&lt;/a&gt; in &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/08-nbe/"&gt;Chapter&amp;nbsp;8&lt;/a&gt; lists them. On a first reading the Type, Constructors and Eliminators columns are enough: &lt;code&gt;is-type&lt;/code&gt; and &lt;code&gt;synth&lt;/code&gt; are explained in &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/09-checking/"&gt;Chapter&amp;nbsp;9&lt;/a&gt;, the ι- and η-rules in &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/08-nbe/"&gt;Chapter&amp;nbsp;8&lt;/a&gt;.&lt;/span&gt;&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;p&gt;An atom is a quoted name, of type &lt;code&gt;Atom&lt;/code&gt;. A natural number is &lt;code&gt;zero&lt;/code&gt; or &lt;code&gt;(add1 n)&lt;/code&gt;, of type &lt;code&gt;Nat&lt;/code&gt;. Each top-level expression is printed as &lt;code&gt;(the T e)&lt;/code&gt;, its type and its normal form (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-1/01-intro/#sub:intro-running"&gt;Section&amp;nbsp;1.2&lt;/a&gt;). The program &lt;code&gt;atoms.pie&lt;/code&gt; and its output:&lt;/p&gt;</description></item><item><title>Motives, induction and indexed families</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-1/03-motives/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-1/03-motives/</guid><description>&lt;p&gt;The eliminators of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-1/02-programs/#sub:programs-nat-elims"&gt;Section&amp;nbsp;2.3&lt;/a&gt; have one fixed result type. In &lt;code&gt;(iter-Nat t b s)&lt;/code&gt; the checker synthesizes a type &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;B&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;B&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; for the base &lt;code&gt;b&lt;/code&gt;, and &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;B&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;B&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; is then the type of the whole expression, for every target. A dependent eliminator lifts this restriction: the type of the result may depend on the value of the target. The eliminator gets this type from an extra argument, the &lt;em&gt;motive&lt;/em&gt;. This section shows how the motive determines the types of the base and the step, where Pie allows a type to be computed by recursion, and how &lt;code&gt;Vec&lt;/code&gt; uses a natural number as an index that the checker computes while checking. In the rule below, typewriter letters such as &lt;code&gt;t&lt;/code&gt;, &lt;code&gt;mot&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt; stand for expressions, as in the appendix of &lt;em&gt;The Little Typer&lt;/em&gt;&lt;label for="sn-5ef64d-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-5ef64d-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="littletyper"&gt;Daniel P. Friedman and David Thrane Christiansen. &lt;cite&gt;The Little Typer&lt;/cite&gt;. MIT Press, Cambridge, MA, 2018&lt;/span&gt;&lt;/span&gt;, and the elaborated Core output (&lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mo&gt;⇝&lt;/mo&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\rightsquigarrow c&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt; of the judgment is left out.&lt;/p&gt;</description></item><item><title>Equality: definitional and propositional</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-2/04-equality/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-2/04-equality/</guid><description>&lt;p&gt;Pie has two notions of sameness, and most of the difficulty of writing proofs comes from keeping them apart.&#10;&lt;em&gt;Definitional equality&lt;/em&gt;, written &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;≡&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;a \equiv b&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; is a judgment: the checker decides it by computing both sides to normal form and comparing the results (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/08-nbe/"&gt;Chapter&amp;nbsp;8&lt;/a&gt;).&lt;label for="sn-ce87c1-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-ce87c1-1" class="margin-toggle"/&gt;&lt;span class="sidenote"&gt;The literature also calls it &lt;em&gt;judgmental&lt;/em&gt; equality. The two words mean the same thing; we use “definitional” throughout.&lt;/span&gt;&#10;Nobody writes a proof of &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;≡&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;a \equiv b&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;;&lt;/span&gt; either the machine sees it or it does not.&#10;&lt;em&gt;Propositional equality&lt;/em&gt; is the type &lt;code&gt;(= A from to)&lt;/code&gt;. Its inhabitants are proofs, ordinary values that other programs take as arguments, return and compute with.&#10;This section shows how &lt;code&gt;same&lt;/code&gt; turns definitional equality into a proof, what the machine can and cannot see, and how the eliminators &lt;code&gt;cong&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, &lt;code&gt;symm&lt;/code&gt;, &lt;code&gt;trans&lt;/code&gt; and &lt;code&gt;ind-=&lt;/code&gt; are checked and computed.&#10;Several programs use addition, defined as in &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-1/02-programs/#sub:programs-nat-elims"&gt;Section&amp;nbsp;2.3&lt;/a&gt;; we show it once and omit it afterwards, together with lemmas proved earlier in the section:&lt;/p&gt;</description></item><item><title>Propositions as types, Absurd, Trivial and the universe</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-2/05-logic/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-2/05-logic/</guid><description>&lt;p&gt;&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-2/04-equality/"&gt;Chapter&amp;nbsp;4&lt;/a&gt; treated &lt;code&gt;=&lt;/code&gt; as a type whose elements are proofs.&#10;This section extends that reading to all of Pie&amp;rsquo;s types, which is the&#10;Curry–Howard correspondence.&#10;It then looks at &lt;code&gt;Absurd&lt;/code&gt;, which has no elements, and &lt;code&gt;Trivial&lt;/code&gt;, which&#10;has exactly one, and at their unusual equality rules.&#10;It ends with the universe &lt;code&gt;U&lt;/code&gt; and with what Pie does to keep &lt;code&gt;U&lt;/code&gt; out of&#10;itself.&lt;/p&gt;&#10;&lt;p&gt;A type can be read as a proposition, and an element of the type as a proof of&#10;it&lt;label for="sn-15b2e1-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-15b2e1-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="howard1980"&gt;W. A. Howard. The Formulae-as-Types Notion of Construction. In J. P. Seldin and J. R. Hindley, editors, &lt;cite&gt;To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism&lt;/cite&gt;, pages 479–490. Academic Press, London, 1980&lt;/span&gt;&lt;/span&gt;.&lt;/p&gt;</description></item><item><title>TODO-driven development</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-2/06-todo/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-2/06-todo/</guid><description>&lt;p&gt;The Little Typer builds programs and proofs by leaving empty boxes and&#10;filling them in one at a time&lt;label for="sn-59b81b-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-59b81b-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="littletyper"&gt;Daniel P. Friedman and David Thrane Christiansen. &lt;cite&gt;The Little Typer&lt;/cite&gt;. MIT Press, Cambridge, MA, 2018&lt;/span&gt;&lt;/span&gt;. In Pie the empty box&#10;is the expression &lt;code&gt;TODO&lt;/code&gt;. A &lt;code&gt;TODO&lt;/code&gt; checks against any type, so a&#10;program with holes can still be checked, run and printed, and for each hole&#10;Pie reports the type it must have and the variables in scope. This section uses those reports to develop&#10;a proof (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-2/06-todo/#sub:todo-workflow"&gt;Section&amp;nbsp;6.1&lt;/a&gt;), then shows how holes are implemented&#10;(&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-2/06-todo/#sub:todo-impl"&gt;Section&amp;nbsp;6.2&lt;/a&gt;), how they behave during computation&#10;(&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-2/06-todo/#sub:todo-neutral"&gt;Section&amp;nbsp;6.3&lt;/a&gt;), and how they compare with the holes of Agda&#10;(&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-2/06-todo/#sub:todo-compare"&gt;Section&amp;nbsp;6.4&lt;/a&gt;).&lt;/p&gt;</description></item><item><title>Inside Pie: syntax, values and contexts</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-3/07-representation/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-3/07-representation/</guid><description>&lt;p&gt;From here on we read the implementation. &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/08-nbe/"&gt;Chapter&amp;nbsp;8&lt;/a&gt; explains how Pie computes and decides equality, and &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/09-checking/"&gt;Chapter&amp;nbsp;9&lt;/a&gt; how it checks programs. Both manipulate the data structures that this section describes, most of them defined in &lt;code&gt;basics.rkt&lt;/code&gt;. The Racket idioms of the excerpts were explained in the paragraph “Reading the Racket” of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-1/01-intro/#sub:intro-map"&gt;Section&amp;nbsp;1.3&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Besides Pie programs, we show the output of two Racket scripts, &lt;code&gt;repr.rkt&lt;/code&gt; and &lt;code&gt;elaborate.rkt&lt;/code&gt;, which call Pie’s modules directly.&lt;label for="mn-761ff9-1" class="margin-toggle"&gt;&amp;#8853;&lt;/label&gt;&lt;input type="checkbox" id="mn-761ff9-1" class="margin-toggle"/&gt;&lt;span class="marginnote"&gt;The scripts call the modules of an unmodified copy of Pie. Racket prints a struct as &lt;code&gt;#(struct:NAME field ...)&lt;/code&gt; and a box as &lt;code&gt;#&amp;amp;&lt;/code&gt;. For long values, &lt;code&gt;repr.rkt&lt;/code&gt; uses a compact printer of its own, which forces nothing: a struct prints as &lt;code&gt;(NAME field ...)&lt;/code&gt;, a delayed value not yet computed as &lt;code&gt;(later e)&lt;/code&gt;, one already computed as &lt;code&gt;(! v)&lt;/code&gt;.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Normalization by evaluation</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-3/08-nbe/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-3/08-nbe/</guid><description>&lt;p&gt;The checker keeps asking one question: are two expressions the same? The &lt;span class="sc"&gt;Same&lt;/span&gt; rule asks it about the endpoints of an equality type (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-2/04-equality/#sub:equality-same"&gt;Section&amp;nbsp;4.1&lt;/a&gt;), the mode switch asks it about two types (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/dependent-types/part-3/09-checking/#sub:checking-modes"&gt;Section&amp;nbsp;9.2&lt;/a&gt;), and &lt;code&gt;check-same&lt;/code&gt; asks it directly. It is the judgment &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi mathvariant="normal"&gt;Γ&lt;/mi&gt;&lt;mo&gt;⊢&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;≡&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mo&gt;:&lt;/mo&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\Gamma \vdash a \equiv b : A&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; or &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi mathvariant="normal"&gt;Γ&lt;/mi&gt;&lt;mo&gt;⊢&lt;/mo&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mo&gt;≡&lt;/mo&gt;&lt;mi&gt;B&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mrow&gt;&lt;mi&gt;𝗍&lt;/mi&gt;&lt;mi&gt;𝗒&lt;/mi&gt;&lt;mi&gt;𝗉&lt;/mi&gt;&lt;mi&gt;𝖾&lt;/mi&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\Gamma \vdash A \equiv B\ \mathsf{type}&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; for types. Pie answers it with &lt;em&gt;normalization by evaluation&lt;/em&gt; (NbE): evaluate both expressions to values, read the values back into syntax guided by the type, and compare the results up to the names of bound variables. This section follows that procedure through &lt;code&gt;normalize.rkt&lt;/code&gt; and &lt;code&gt;alpha.rkt&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Bidirectional checking as elaboration</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-3/09-checking/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-3/09-checking/</guid><description>&lt;p&gt;The last two sections described the data the checker works on and the test it uses for equality. This section describes the checker itself, &lt;code&gt;typechecker.rkt:1–897&lt;/code&gt;. It does two jobs in one pass. It decides whether a Src term is well typed, and it translates the term into Core. A checker that produces a translated term as a side product of checking is called an &lt;em&gt;elaborator&lt;/em&gt;. Each form of judgment in the appendix of &lt;em&gt;The Little Typer&lt;/em&gt;&lt;label for="sn-0a6d45-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-0a6d45-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="littletyper"&gt;Daniel P. Friedman and David Thrane Christiansen. &lt;cite&gt;The Little Typer&lt;/cite&gt;. MIT Press, Cambridge, MA, 2018&lt;/span&gt;&lt;/span&gt; becomes one Racket function, and the output of each function is the term written after &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mo&gt;⇝&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\rightsquigarrow&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; in the judgment.&lt;/p&gt;</description></item><item><title>Pie among type theories, and building your own</title><link>https://massimo-nocentini.github.io/book/dependent-types/part-3/10-context/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/part-3/10-context/</guid><description>&lt;p&gt;Pie is small on purpose. This last section lists what it leaves out and what it takes for granted, compares it with four larger systems, and ends with a recipe for a checker of the same kind, exercises that change Pie itself, and further reading.&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="run-in"&gt;User-defined datatypes.&lt;/span&gt; A Pie file contains only &lt;code&gt;claim&lt;/code&gt;, &lt;code&gt;define&lt;/code&gt;, &lt;code&gt;check-same&lt;/code&gt; and expressions: the declaration parser &lt;code&gt;parse-pie-decl&lt;/code&gt; has exactly these four cases (&lt;code&gt;parser.rkt:395–423&lt;/code&gt;), and the type formers are a fixed list of keywords (&lt;code&gt;basics.rkt:39–51&lt;/code&gt;). A would-be declaration is read as an expression, an application of an unknown variable:&lt;/p&gt;</description></item><item><title>Bibliography</title><link>https://massimo-nocentini.github.io/book/dependent-types/bibliography/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/dependent-types/bibliography/</guid></item></channel></rss>