csci8980-f21/versions/19.08/DeBruijn/index.html

1565 lines
386 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DeBruijn: Intrinsically-typed de Bruijn representation | Programming Language Foundations in Agda
</title><!-- Begin Jekyll SEO tag v2.6.1 -->
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="DeBruijn: Intrinsically-typed de Bruijn representation" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Programming Language Foundations in Agda" />
<meta property="og:description" content="Programming Language Foundations in Agda" />
<link rel="canonical" href="https://plfa.github.io/19.08/DeBruijn/" />
<meta property="og:url" content="https://plfa.github.io/19.08/DeBruijn/" />
<meta property="og:site_name" content="Programming Language Foundations in Agda" />
<script type="application/ld+json">
{"url":"https://plfa.github.io/19.08/DeBruijn/","headline":"DeBruijn: Intrinsically-typed de Bruijn representation","description":"Programming Language Foundations in Agda","@type":"WebPage","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/19.08/assets/main.css"></head>
<body><header class="site-header" role="banner">
<div class="wrapper">
<a class="site-title" href="/19.08/">Programming Language Foundations in Agda
</a>
<nav class="site-nav">
<span class="menu-icon">
<svg viewBox="0 0 18 15" width="18px" height="15px">
<path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
<path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
<path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
</svg>
</span>
<div class="trigger">
<a class="page-link" href="/19.08/">The Book</a>
<a class="page-link" href="/19.08/Announcements/">Announcements</a>
<a class="page-link" href="/19.08/GettingStarted/">Getting Started</a>
<a class="page-link" href="/19.08/Citing/">Citing</a>
<a class="page-link" href="https://agda-zh.github.io/PLFA-zh/">中文</a>
</div>
</nav>
</div>
</header>
<main class="page-content" aria-label="Content">
<div class="wrapper">
<article class="post">
<header class="post-header">
<h1 class="post-title">DeBruijn: Intrinsically-typed de Bruijn representation</h1>
</header>
<p style="text-align:center;">
<a alt="Previous chapter" href="/19.08/Properties/">Prev</a>
&bullet;
<a alt="Source code" href="https://github.com/plfa/plfa.github.io/blob/dev-19.08/src/plfa/part2/DeBruijn.lagda.md">Source</a>
&bullet;
<a alt="Next chapter" href="/19.08/More/">Next</a>
</p>
<div class="post-content">
<pre class="Agda"><a id="167" class="Keyword">module</a> <a id="174" href="/19.08/DeBruijn/" class="Module">plfa.part2.DeBruijn</a> <a id="194" class="Keyword">where</a>
</pre>
<p>The previous two chapters introduced lambda calculus, with a
formalisation based on named variables, and terms defined
separately from types. We began with that approach because it
is traditional, but it is not the one we recommend. This
chapter presents an alternative approach, where named
variables are replaced by de Bruijn indices and terms are
indexed by their types. Our new presentation is more compact, using
substantially fewer lines of code to cover the same ground.</p>
<p>There are two fundamental approaches to typed lambda calculi.
One approach, followed in the last two chapters,
is to first define terms and then define types.
Terms exist independent of types, and may have types assigned to them
by separate typing rules.
Another approach, followed in this chapter,
is to first define types and then define terms.
Terms and type rules are intertwined, and it makes no sense to talk
of a term without a type.
The two approaches are sometimes called <em>Curry style</em> and <em>Church style</em>.
Following Reynolds, we will refer to them as <em>extrinsic</em> and <em>intrinsic</em>.</p>
<p>The particular representation described here
was first proposed by
Thorsten Altenkirch and Bernhard Reus.
The formalisation of renaming and substitution
we use is due to Conor McBride.
Related work has been carried out by
James Chapman, James McKinna, and many others.</p>
<h2 id="imports">Imports</h2>
<pre class="Agda"><a id="1564" class="Keyword">import</a> <a id="1571" href="https://agda.github.io/agda-stdlib/v1.1/Relation.Binary.PropositionalEquality.html" class="Module">Relation.Binary.PropositionalEquality</a> <a id="1609" class="Symbol">as</a> <a id="1612" class="Module">Eq</a>
<a id="1615" class="Keyword">open</a> <a id="1620" href="https://agda.github.io/agda-stdlib/v1.1/Relation.Binary.PropositionalEquality.html" class="Module">Eq</a> <a id="1623" class="Keyword">using</a> <a id="1629" class="Symbol">(</a><a id="1630" href="Agda.Builtin.Equality.html#125" class="Datatype Operator">_≡_</a><a id="1633" class="Symbol">;</a> <a id="1635" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a><a id="1639" class="Symbol">)</a>
<a id="1641" class="Keyword">open</a> <a id="1646" class="Keyword">import</a> <a id="1653" href="https://agda.github.io/agda-stdlib/v1.1/Data.Empty.html" class="Module">Data.Empty</a> <a id="1664" class="Keyword">using</a> <a id="1670" class="Symbol">(</a><a id="1671" href="https://agda.github.io/agda-stdlib/v1.1/Data.Empty.html#279" class="Datatype"></a><a id="1672" class="Symbol">;</a> <a id="1674" href="https://agda.github.io/agda-stdlib/v1.1/Data.Empty.html#294" class="Function">⊥-elim</a><a id="1680" class="Symbol">)</a>
<a id="1682" class="Keyword">open</a> <a id="1687" class="Keyword">import</a> <a id="1694" href="https://agda.github.io/agda-stdlib/v1.1/Data.Nat.html" class="Module">Data.Nat</a> <a id="1703" class="Keyword">using</a> <a id="1709" class="Symbol">(</a><a id="1710" href="Agda.Builtin.Nat.html#165" class="Datatype"></a><a id="1711" class="Symbol">;</a> <a id="1713" href="Agda.Builtin.Nat.html#183" class="InductiveConstructor">zero</a><a id="1717" class="Symbol">;</a> <a id="1719" href="Agda.Builtin.Nat.html#196" class="InductiveConstructor">suc</a><a id="1722" class="Symbol">)</a>
<a id="1724" class="Keyword">open</a> <a id="1729" class="Keyword">import</a> <a id="1736" href="https://agda.github.io/agda-stdlib/v1.1/Relation.Nullary.html" class="Module">Relation.Nullary</a> <a id="1753" class="Keyword">using</a> <a id="1759" class="Symbol">(</a><a id="1760" href="https://agda.github.io/agda-stdlib/v1.1/Relation.Nullary.html#535" class="Function Operator">¬_</a><a id="1762" class="Symbol">)</a>
</pre>
<h2 id="introduction">Introduction</h2>
<p>There is a close correspondence between the structure of a
term and the structure of the derivation showing that it is
well typed. For example, here is the term for the Church
numeral two:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>twoᶜ : Term
twoᶜ = ƛ "s" ⇒ ƛ "z" ⇒ ` "s" · (` "s" · ` "z")
</code></pre></div></div>
<p>And here is its corresponding type derivation:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>⊢twoᶜ : ∀ {A} → ∅ ⊢ twoᶜ ⦂ Ch A
⊢twoᶜ = ⊢ƛ (⊢ƛ (⊢` ∋s · (⊢` ∋s · ⊢` ∋z)))
where
∋s = S ("s" ≠ "z") Z
∋z = Z
</code></pre></div></div>
<p>(These are both taken from Chapter
<a href="/19.08/Lambda/">Lambda</a>
and you can see the corresponding derivation tree written out
in full
<a href="/19.08/Lambda/#derivation">here</a>.)
The two definitions are in close correspondence, where:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">`_</code> corresponds to <code class="language-plaintext highlighter-rouge">⊢`</code></li>
<li><code class="language-plaintext highlighter-rouge">ƛ_⇒_</code> corresponds to <code class="language-plaintext highlighter-rouge">⊢ƛ</code></li>
<li><code class="language-plaintext highlighter-rouge">_·_</code> corresponds to <code class="language-plaintext highlighter-rouge">_·_</code></li>
</ul>
<p>Further, if we think of <code class="language-plaintext highlighter-rouge">Z</code> as zero and <code class="language-plaintext highlighter-rouge">S</code> as successor, then
the lookup derivation for each variable corresponds to a
number which tells us how many enclosing binding terms to
count to find the binding of that variable. Here <code class="language-plaintext highlighter-rouge">"z"</code>
corresponds to <code class="language-plaintext highlighter-rouge">Z</code> or zero and <code class="language-plaintext highlighter-rouge">"s"</code> corresponds to <code class="language-plaintext highlighter-rouge">S Z</code> or
one. And, indeed, <code class="language-plaintext highlighter-rouge">"z"</code> is bound by the inner abstraction
(count outward past zero abstractions) and <code class="language-plaintext highlighter-rouge">"s"</code> is bound by the
outer abstraction (count outward past one abstraction).</p>
<p>In this chapter, we are going to exploit this correspondence,
and introduce a new notation for terms that simultaneously
represents the term and its type derivation. Now we will
write the following:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>twoᶜ : ∅ ⊢ Ch `
twoᶜ = ƛ ƛ (# 1 · (# 1 · # 0))
</code></pre></div></div>
<p>A variable is represented by a natural number (written with
<code class="language-plaintext highlighter-rouge">Z</code> and <code class="language-plaintext highlighter-rouge">S</code>, and abbreviated in the usual way), and tells us
how many enclosing binding terms to count to find the binding
of that variable. Thus, <code class="language-plaintext highlighter-rouge"># 0</code> is bound at the inner <code class="language-plaintext highlighter-rouge">ƛ</code>, and
<code class="language-plaintext highlighter-rouge"># 1</code> at the outer <code class="language-plaintext highlighter-rouge">ƛ</code>.</p>
<p>Replacing variables by numbers in this way is called <em>de
Bruijn representation</em>, and the numbers themselves are called
<em>de Bruijn indices</em>, after the Dutch mathematician Nicolaas
Govert (Dick) de Bruijn (1918—2012), a pioneer in the creation
of proof assistants. One advantage of replacing named
variables with de Bruijn indices is that each term now has a
unique representation, rather than being represented by the
equivalence class of terms under alpha renaming.</p>
<p>The other important feature of our chosen representation is
that it is <em>intrinsically typed</em>. In the previous two chapters,
the definition of terms and the definition of types are
completely separate. All terms have type <code class="language-plaintext highlighter-rouge">Term</code>, and nothing
in Agda prevents one from writing a nonsense term such as
<code class="language-plaintext highlighter-rouge">`zero · `suc `zero</code> which has no type. Such terms that
exist independent of types are sometimes called <em>preterms</em> or
<em>raw terms</em>. Here we are going to replace the type <code class="language-plaintext highlighter-rouge">Term</code> of
raw terms by the type <code class="language-plaintext highlighter-rouge">Γ ⊢ A</code> of intrinsically-typed terms
which in context <code class="language-plaintext highlighter-rouge">Γ</code> have type <code class="language-plaintext highlighter-rouge">A</code>.</p>
<p>While these two choices fit well, they are independent. One
can use de Bruijn indices in raw terms, or
have intrinsically-typed terms with names. In
Chapter <a href="/19.08/Untyped/">Untyped</a>,
we will introduce terms with de Bruijn indices that
are intrinsically scoped but not typed.</p>
<h2 id="a-second-example">A second example</h2>
<p>De Bruijn indices can be tricky to get the hang of, so before
proceeding further lets consider a second example. Here is
the term that adds two naturals:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>plus : Term
plus = μ "+" ⇒ ƛ "m" ⇒ ƛ "n" ⇒
case ` "m"
[zero⇒ ` "n"
|suc "m" ⇒ `suc (` "+" · ` "m" · ` "n") ]
</code></pre></div></div>
<p>Note variable <code class="language-plaintext highlighter-rouge">"m"</code> is bound twice, once in a lambda abstraction
and once in the successor branch of the case. Any appearance
of <code class="language-plaintext highlighter-rouge">"m"</code> in the successor branch must refer to the latter
binding, due to shadowing.</p>
<p>Here is its corresponding type derivation:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>⊢plus : ∅ ⊢ plus ⦂ ` ⇒ ` ⇒ `
⊢plus = ⊢μ (⊢ƛ (⊢ƛ (⊢case (⊢` ∋m) (⊢` ∋n)
(⊢suc (⊢` ∋+ · ⊢` ∋m · ⊢` ∋n)))))
where
∋+ = (S ("+" ≠ "m") (S ("+" ≠ "n") (S ("+" ≠ "m") Z)))
∋m = (S ("m" ≠ "n") Z)
∋n = Z
∋m = Z
∋n = (S ("n" ≠ "m") Z)
</code></pre></div></div>
<p>The two definitions are in close correspondence, where in
addition to the previous correspondences we have:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">`zero</code> corresponds to <code class="language-plaintext highlighter-rouge">⊢zero</code></li>
<li><code class="language-plaintext highlighter-rouge">`suc_</code> corresponds to <code class="language-plaintext highlighter-rouge">⊢suc</code></li>
<li><code class="language-plaintext highlighter-rouge">case_[zero⇒_|suc_⇒_]</code> corresponds to <code class="language-plaintext highlighter-rouge">⊢case</code></li>
<li><code class="language-plaintext highlighter-rouge">μ_⇒_</code> corresponds to <code class="language-plaintext highlighter-rouge">⊢μ</code></li>
</ul>
<p>Note the two lookup judgments <code class="language-plaintext highlighter-rouge">∋m</code> and <code class="language-plaintext highlighter-rouge">∋m</code> refer to two
different bindings of variables named <code class="language-plaintext highlighter-rouge">"m"</code>. In contrast, the
two judgments <code class="language-plaintext highlighter-rouge">∋n</code> and <code class="language-plaintext highlighter-rouge">∋n</code> both refer to the same binding
of <code class="language-plaintext highlighter-rouge">"n"</code> but accessed in different contexts, the first where
<code class="language-plaintext highlighter-rouge">"n"</code> is the last binding in the context, and the second after
<code class="language-plaintext highlighter-rouge">"m"</code> is bound in the successor branch of the case.</p>
<p>Here is the term and its type derivation in the notation of this chapter:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>plus : ∀ {Γ} → Γ ⊢ ` ⇒ ` ⇒ `
plus = μ ƛ ƛ case (# 1) (# 0) (`suc (# 3 · # 0 · # 1))
</code></pre></div></div>
<p>Reading from left to right, each de Bruijn index corresponds
to a lookup derivation:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge"># 1</code> corresponds to <code class="language-plaintext highlighter-rouge">∋m</code></li>
<li><code class="language-plaintext highlighter-rouge"># 0</code> corresponds to <code class="language-plaintext highlighter-rouge">∋n</code></li>
<li><code class="language-plaintext highlighter-rouge"># 3</code> corresponds to <code class="language-plaintext highlighter-rouge">∋+</code></li>
<li><code class="language-plaintext highlighter-rouge"># 0</code> corresponds to <code class="language-plaintext highlighter-rouge">∋m</code></li>
<li><code class="language-plaintext highlighter-rouge"># 1</code> corresponds to <code class="language-plaintext highlighter-rouge">∋n</code></li>
</ul>
<p>The de Bruijn index counts the number of <code class="language-plaintext highlighter-rouge">S</code> constructs in the
corresponding lookup derivation. Variable <code class="language-plaintext highlighter-rouge">"n"</code> bound in the
inner abstraction is referred to as <code class="language-plaintext highlighter-rouge"># 0</code> in the zero branch
of the case but as <code class="language-plaintext highlighter-rouge"># 1</code> in the successor branch of the case,
because of the intervening binding. Variable <code class="language-plaintext highlighter-rouge">"m"</code> bound in the
lambda abstraction is referred to by the first <code class="language-plaintext highlighter-rouge"># 1</code> in the
code, while variable <code class="language-plaintext highlighter-rouge">"m"</code> bound in the successor branch of the
case is referred to by the second <code class="language-plaintext highlighter-rouge"># 0</code>. There is no
shadowing: with variable names, there is no way to refer to
the former binding in the scope of the latter, but with de
Bruijn indices it could be referred to as <code class="language-plaintext highlighter-rouge"># 2</code>.</p>
<h2 id="order-of-presentation">Order of presentation</h2>
<p>In the current chapter, the use of intrinsically-typed terms
necessitates that we cannot introduce operations such as
substitution or reduction without also showing that they
preserve types. Hence, the order of presentation must change.</p>
<p>The syntax of terms now incorporates their typing rules, and the
definition of values now incorporates the Canonical Forms lemma. The
definition of substitution is somewhat more involved, but incorporates
the trickiest part of the previous proof, the lemma establishing that
substitution preserves types. The definition of reduction
incorporates preservation, which no longer requires a separate proof.</p>
<h2 id="syntax">Syntax</h2>
<p>We now begin our formal development.</p>
<p>First, we get all our infix declarations out of the way.
We list separately operators for judgments, types, and terms:</p>
<pre class="Agda"><a id="8363" class="Keyword">infix</a> <a id="8370" class="Number">4</a> <a id="8372" href="/19.08/DeBruijn/#11094" class="Datatype Operator">_⊢_</a>
<a id="8376" class="Keyword">infix</a> <a id="8383" class="Number">4</a> <a id="8385" href="/19.08/DeBruijn/#9823" class="Datatype Operator">_∋_</a>
<a id="8389" class="Keyword">infixl</a> <a id="8396" class="Number">5</a> <a id="8398" href="/19.08/DeBruijn/#8917" class="InductiveConstructor Operator">_,_</a>
<a id="8403" class="Keyword">infixr</a> <a id="8410" class="Number">7</a> <a id="8412" href="/19.08/DeBruijn/#8730" class="InductiveConstructor Operator">_⇒_</a>
<a id="8417" class="Keyword">infix</a> <a id="8424" class="Number">5</a> <a id="8426" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ_</a>
<a id="8429" class="Keyword">infix</a> <a id="8436" class="Number">5</a> <a id="8438" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ_</a>
<a id="8441" class="Keyword">infixl</a> <a id="8448" class="Number">7</a> <a id="8450" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">_·_</a>
<a id="8454" class="Keyword">infix</a> <a id="8461" class="Number">8</a> <a id="8463" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc_</a>
<a id="8469" class="Keyword">infix</a> <a id="8476" class="Number">9</a> <a id="8478" href="/19.08/DeBruijn/#11130" class="InductiveConstructor Operator">`_</a>
<a id="8481" class="Keyword">infix</a> <a id="8488" class="Number">9</a> <a id="8490" href="/19.08/DeBruijn/#9906" class="InductiveConstructor Operator">S_</a>
<a id="8493" class="Keyword">infix</a> <a id="8500" class="Number">9</a> <a id="8502" href="/19.08/DeBruijn/#13527" class="Function Operator">#_</a>
</pre>
<p>Since terms are intrinsically typed, we must define types and
contexts before terms.</p>
<h3 id="types">Types</h3>
<p>As before, we have just two types, functions and naturals.
The formal definition is unchanged:</p>
<pre class="Agda"><a id="8706" class="Keyword">data</a> <a id="Type"></a><a id="8711" href="/19.08/DeBruijn/#8711" class="Datatype">Type</a> <a id="8716" class="Symbol">:</a> <a id="8718" class="PrimitiveType">Set</a> <a id="8722" class="Keyword">where</a>
<a id="Type._⇒_"></a><a id="8730" href="/19.08/DeBruijn/#8730" class="InductiveConstructor Operator">_⇒_</a> <a id="8734" class="Symbol">:</a> <a id="8736" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a> <a id="8741" class="Symbol"></a> <a id="8743" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a> <a id="8748" class="Symbol"></a> <a id="8750" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a>
<a id="Type.`"></a><a id="8757" href="/19.08/DeBruijn/#8757" class="InductiveConstructor">`</a> <a id="8761" class="Symbol">:</a> <a id="8763" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a>
</pre>
<h3 id="contexts">Contexts</h3>
<p>Contexts are as before, but we drop the names.
Contexts are formalised as follows:</p>
<pre class="Agda"><a id="8874" class="Keyword">data</a> <a id="Context"></a><a id="8879" href="/19.08/DeBruijn/#8879" class="Datatype">Context</a> <a id="8887" class="Symbol">:</a> <a id="8889" class="PrimitiveType">Set</a> <a id="8893" class="Keyword">where</a>
<a id="Context.∅"></a><a id="8901" href="/19.08/DeBruijn/#8901" class="InductiveConstructor"></a> <a id="8905" class="Symbol">:</a> <a id="8907" href="plfa.part2.DeBruijn.html#8879" class="Datatype">Context</a>
<a id="Context._,_"></a><a id="8917" href="/19.08/DeBruijn/#8917" class="InductiveConstructor Operator">_,_</a> <a id="8921" class="Symbol">:</a> <a id="8923" href="plfa.part2.DeBruijn.html#8879" class="Datatype">Context</a> <a id="8931" class="Symbol"></a> <a id="8933" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a> <a id="8938" class="Symbol"></a> <a id="8940" href="plfa.part2.DeBruijn.html#8879" class="Datatype">Context</a>
</pre>
<p>A context is just a list of types, with the type of the most
recently bound variable on the right. As before, we let <code class="language-plaintext highlighter-rouge">Γ</code>
and <code class="language-plaintext highlighter-rouge">Δ</code> range over contexts. We write <code class="language-plaintext highlighter-rouge"></code> for the empty
context, and <code class="language-plaintext highlighter-rouge">Γ , A</code> for the context <code class="language-plaintext highlighter-rouge">Γ</code> extended by type <code class="language-plaintext highlighter-rouge">A</code>.
For example</p>
<pre class="Agda"><a id="9210" href="/19.08/DeBruijn/#9210" class="Function">_</a> <a id="9212" class="Symbol">:</a> <a id="9214" href="plfa.part2.DeBruijn.html#8879" class="Datatype">Context</a>
<a id="9222" class="Symbol">_</a> <a id="9224" class="Symbol">=</a> <a id="9226" href="/19.08/DeBruijn/#8901" class="InductiveConstructor"></a> <a id="9228" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="9230" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="9233" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="9235" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="9238" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="9240" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
</pre>
<p>is a context with two variables in scope, where the outer
bound one has type <code class="language-plaintext highlighter-rouge">` ⇒ `</code>, and the inner bound one has
type <code class="language-plaintext highlighter-rouge">`</code>.</p>
<h3 id="variables-and-the-lookup-judgment">Variables and the lookup judgment</h3>
<p>Intrinsically-typed variables correspond to the lookup judgment.
They are represented by de Bruijn indices, and hence also
correspond to natural numbers. We write</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Γ ∋ A
</code></pre></div></div>
<p>for variables which in context <code class="language-plaintext highlighter-rouge">Γ</code> have type <code class="language-plaintext highlighter-rouge">A</code>.
The lookup judgement is formalised by a datatype indexed
by a context and a type.
It looks exactly like the old lookup judgment, but
with all variable names dropped:</p>
<pre class="Agda"><a id="9818" class="Keyword">data</a> <a id="_∋_"></a><a id="9823" href="/19.08/DeBruijn/#9823" class="Datatype Operator">_∋_</a> <a id="9827" class="Symbol">:</a> <a id="9829" href="plfa.part2.DeBruijn.html#8879" class="Datatype">Context</a> <a id="9837" class="Symbol"></a> <a id="9839" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a> <a id="9844" class="Symbol"></a> <a id="9846" class="PrimitiveType">Set</a> <a id="9850" class="Keyword">where</a>
<a id="_∋_.Z"></a><a id="9859" href="/19.08/DeBruijn/#9859" class="InductiveConstructor">Z</a> <a id="9861" class="Symbol">:</a> <a id="9863" class="Symbol"></a> <a id="9865" class="Symbol">{</a><a id="9866" href="plfa.part2.DeBruijn.html#9866" class="Bound">Γ</a> <a id="9868" href="plfa.part2.DeBruijn.html#9868" class="Bound">A</a><a id="9869" class="Symbol">}</a>
<a id="9877" class="Comment">---------</a>
<a id="9891" class="Symbol"></a> <a id="9893" href="/19.08/DeBruijn/#9866" class="Bound">Γ</a> <a id="9895" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="9897" href="plfa.part2.DeBruijn.html#9868" class="Bound">A</a> <a id="9899" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="9901" href="plfa.part2.DeBruijn.html#9868" class="Bound">A</a>
<a id="_∋_.S_"></a><a id="9906" href="/19.08/DeBruijn/#9906" class="InductiveConstructor Operator">S_</a> <a id="9909" class="Symbol">:</a> <a id="9911" class="Symbol"></a> <a id="9913" class="Symbol">{</a><a id="9914" href="plfa.part2.DeBruijn.html#9914" class="Bound">Γ</a> <a id="9916" href="plfa.part2.DeBruijn.html#9916" class="Bound">A</a> <a id="9918" href="plfa.part2.DeBruijn.html#9918" class="Bound">B</a><a id="9919" class="Symbol">}</a>
<a id="9925" class="Symbol"></a> <a id="9927" href="/19.08/DeBruijn/#9914" class="Bound">Γ</a> <a id="9929" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="9931" href="plfa.part2.DeBruijn.html#9916" class="Bound">A</a>
<a id="9939" class="Comment">---------</a>
<a id="9953" class="Symbol"></a> <a id="9955" href="/19.08/DeBruijn/#9914" class="Bound">Γ</a> <a id="9957" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="9959" href="plfa.part2.DeBruijn.html#9918" class="Bound">B</a> <a id="9961" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="9963" href="plfa.part2.DeBruijn.html#9916" class="Bound">A</a>
</pre>
<p>Constructor <code class="language-plaintext highlighter-rouge">S</code> no longer requires an additional parameter,
since without names shadowing is no longer an issue. Now
constructors <code class="language-plaintext highlighter-rouge">Z</code> and <code class="language-plaintext highlighter-rouge">S</code> correspond even more closely to the
constructors <code class="language-plaintext highlighter-rouge">here</code> and <code class="language-plaintext highlighter-rouge">there</code> for the element-of relation
<code class="language-plaintext highlighter-rouge">_∈_</code> on lists, as well as to constructors <code class="language-plaintext highlighter-rouge">zero</code> and <code class="language-plaintext highlighter-rouge">suc</code>
for natural numbers.</p>
<p>For example, consider the following old-style lookup
judgments:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">∅ , "s" ⦂ ` ⇒ ` , "z" ⦂ ` ∋ "z" ⦂ `</code></li>
<li><code class="language-plaintext highlighter-rouge">∅ , "s" ⦂ ` ⇒ ` , "z" ⦂ ` ∋ "s" ⦂ ` ⇒ `</code></li>
</ul>
<p>They correspond to the following intrinsically-typed variables:</p>
<pre class="Agda"><a id="10525" href="/19.08/DeBruijn/#10525" class="Function">_</a> <a id="10527" class="Symbol">:</a> <a id="10529" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="10531" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="10533" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="10536" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="10538" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="10541" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="10543" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="10546" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="10548" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="10551" class="Symbol">_</a> <a id="10553" class="Symbol">=</a> <a id="10555" href="/19.08/DeBruijn/#9859" class="InductiveConstructor">Z</a>
<a id="10558" href="/19.08/DeBruijn/#10558" class="Function">_</a> <a id="10560" class="Symbol">:</a> <a id="10562" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="10564" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="10566" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="10569" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="10571" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="10574" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="10576" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="10579" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="10581" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="10584" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="10586" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="10589" class="Symbol">_</a> <a id="10591" class="Symbol">=</a> <a id="10593" href="/19.08/DeBruijn/#9906" class="InductiveConstructor Operator">S</a> <a id="10595" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
</pre>
<p>In the given context, <code class="language-plaintext highlighter-rouge">"z"</code> is represented by <code class="language-plaintext highlighter-rouge">Z</code>
(as the most recently bound variable),
and <code class="language-plaintext highlighter-rouge">"s"</code> by <code class="language-plaintext highlighter-rouge">S Z</code>
(as the next most recently bound variable).</p>
<h3 id="terms-and-the-typing-judgment">Terms and the typing judgment</h3>
<p>Intrinsically-typed terms correspond to the typing judgment.
We write</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Γ ⊢ A
</code></pre></div></div>
<p>for terms which in context <code class="language-plaintext highlighter-rouge">Γ</code> has type <code class="language-plaintext highlighter-rouge">A</code>.
The judgement is formalised by a datatype indexed
by a context and a type.
It looks exactly like the old typing judgment, but
with all terms and variable names dropped:</p>
<pre class="Agda"><a id="11089" class="Keyword">data</a> <a id="_⊢_"></a><a id="11094" href="/19.08/DeBruijn/#11094" class="Datatype Operator">_⊢_</a> <a id="11098" class="Symbol">:</a> <a id="11100" href="plfa.part2.DeBruijn.html#8879" class="Datatype">Context</a> <a id="11108" class="Symbol"></a> <a id="11110" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a> <a id="11115" class="Symbol"></a> <a id="11117" class="PrimitiveType">Set</a> <a id="11121" class="Keyword">where</a>
<a id="_⊢_.`_"></a><a id="11130" href="/19.08/DeBruijn/#11130" class="InductiveConstructor Operator">`_</a> <a id="11133" class="Symbol">:</a> <a id="11135" class="Symbol"></a> <a id="11137" class="Symbol">{</a><a id="11138" href="plfa.part2.DeBruijn.html#11138" class="Bound">Γ</a> <a id="11140" href="plfa.part2.DeBruijn.html#11140" class="Bound">A</a><a id="11141" class="Symbol">}</a>
<a id="11147" class="Symbol"></a> <a id="11149" href="/19.08/DeBruijn/#11138" class="Bound">Γ</a> <a id="11151" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="11153" href="plfa.part2.DeBruijn.html#11140" class="Bound">A</a>
<a id="11161" class="Comment">-----</a>
<a id="11171" class="Symbol"></a> <a id="11173" href="/19.08/DeBruijn/#11138" class="Bound">Γ</a> <a id="11175" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11177" href="plfa.part2.DeBruijn.html#11140" class="Bound">A</a>
<a id="_⊢_.ƛ_"></a><a id="11182" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ_</a> <a id="11186" class="Symbol">:</a> <a id="11188" class="Symbol"></a> <a id="11190" class="Symbol">{</a><a id="11191" href="plfa.part2.DeBruijn.html#11191" class="Bound">Γ</a> <a id="11193" href="plfa.part2.DeBruijn.html#11193" class="Bound">A</a> <a id="11195" href="plfa.part2.DeBruijn.html#11195" class="Bound">B</a><a id="11196" class="Symbol">}</a>
<a id="11202" class="Symbol"></a> <a id="11204" href="/19.08/DeBruijn/#11191" class="Bound">Γ</a> <a id="11206" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="11208" href="plfa.part2.DeBruijn.html#11193" class="Bound">A</a> <a id="11210" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11212" href="plfa.part2.DeBruijn.html#11195" class="Bound">B</a>
<a id="11220" class="Comment">---------</a>
<a id="11234" class="Symbol"></a> <a id="11236" href="/19.08/DeBruijn/#11191" class="Bound">Γ</a> <a id="11238" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11240" href="plfa.part2.DeBruijn.html#11193" class="Bound">A</a> <a id="11242" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="11244" href="plfa.part2.DeBruijn.html#11195" class="Bound">B</a>
<a id="_⊢_._·_"></a><a id="11249" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">_·_</a> <a id="11253" class="Symbol">:</a> <a id="11255" class="Symbol"></a> <a id="11257" class="Symbol">{</a><a id="11258" href="plfa.part2.DeBruijn.html#11258" class="Bound">Γ</a> <a id="11260" href="plfa.part2.DeBruijn.html#11260" class="Bound">A</a> <a id="11262" href="plfa.part2.DeBruijn.html#11262" class="Bound">B</a><a id="11263" class="Symbol">}</a>
<a id="11269" class="Symbol"></a> <a id="11271" href="/19.08/DeBruijn/#11258" class="Bound">Γ</a> <a id="11273" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11275" href="plfa.part2.DeBruijn.html#11260" class="Bound">A</a> <a id="11277" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="11279" href="plfa.part2.DeBruijn.html#11262" class="Bound">B</a>
<a id="11285" class="Symbol"></a> <a id="11287" href="/19.08/DeBruijn/#11258" class="Bound">Γ</a> <a id="11289" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11291" href="plfa.part2.DeBruijn.html#11260" class="Bound">A</a>
<a id="11299" class="Comment">---------</a>
<a id="11313" class="Symbol"></a> <a id="11315" href="/19.08/DeBruijn/#11258" class="Bound">Γ</a> <a id="11317" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11319" href="plfa.part2.DeBruijn.html#11262" class="Bound">B</a>
<a id="_⊢_.`zero"></a><a id="11324" href="/19.08/DeBruijn/#11324" class="InductiveConstructor">`zero</a> <a id="11330" class="Symbol">:</a> <a id="11332" class="Symbol"></a> <a id="11334" class="Symbol">{</a><a id="11335" href="plfa.part2.DeBruijn.html#11335" class="Bound">Γ</a><a id="11336" class="Symbol">}</a>
<a id="11344" class="Comment">---------</a>
<a id="11358" class="Symbol"></a> <a id="11360" href="/19.08/DeBruijn/#11335" class="Bound">Γ</a> <a id="11362" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11364" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="_⊢_.`suc_"></a><a id="11370" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc_</a> <a id="11376" class="Symbol">:</a> <a id="11378" class="Symbol"></a> <a id="11380" class="Symbol">{</a><a id="11381" href="plfa.part2.DeBruijn.html#11381" class="Bound">Γ</a><a id="11382" class="Symbol">}</a>
<a id="11388" class="Symbol"></a> <a id="11390" href="/19.08/DeBruijn/#11381" class="Bound">Γ</a> <a id="11392" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11394" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="11403" class="Comment">------</a>
<a id="11414" class="Symbol"></a> <a id="11416" href="/19.08/DeBruijn/#11381" class="Bound">Γ</a> <a id="11418" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11420" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="_⊢_.case"></a><a id="11426" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="11431" class="Symbol">:</a> <a id="11433" class="Symbol"></a> <a id="11435" class="Symbol">{</a><a id="11436" href="plfa.part2.DeBruijn.html#11436" class="Bound">Γ</a> <a id="11438" href="plfa.part2.DeBruijn.html#11438" class="Bound">A</a><a id="11439" class="Symbol">}</a>
<a id="11445" class="Symbol"></a> <a id="11447" href="/19.08/DeBruijn/#11436" class="Bound">Γ</a> <a id="11449" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11451" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="11458" class="Symbol"></a> <a id="11460" href="/19.08/DeBruijn/#11436" class="Bound">Γ</a> <a id="11462" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11464" href="plfa.part2.DeBruijn.html#11438" class="Bound">A</a>
<a id="11470" class="Symbol"></a> <a id="11472" href="/19.08/DeBruijn/#11436" class="Bound">Γ</a> <a id="11474" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="11476" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="11479" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11481" href="plfa.part2.DeBruijn.html#11438" class="Bound">A</a>
<a id="11489" class="Comment">----------</a>
<a id="11504" class="Symbol"></a> <a id="11506" href="/19.08/DeBruijn/#11436" class="Bound">Γ</a> <a id="11508" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11510" href="plfa.part2.DeBruijn.html#11438" class="Bound">A</a>
<a id="_⊢_.μ_"></a><a id="11515" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ_</a> <a id="11518" class="Symbol">:</a> <a id="11520" class="Symbol"></a> <a id="11522" class="Symbol">{</a><a id="11523" href="plfa.part2.DeBruijn.html#11523" class="Bound">Γ</a> <a id="11525" href="plfa.part2.DeBruijn.html#11525" class="Bound">A</a><a id="11526" class="Symbol">}</a>
<a id="11532" class="Symbol"></a> <a id="11534" href="/19.08/DeBruijn/#11523" class="Bound">Γ</a> <a id="11536" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="11538" href="plfa.part2.DeBruijn.html#11525" class="Bound">A</a> <a id="11540" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11542" href="plfa.part2.DeBruijn.html#11525" class="Bound">A</a>
<a id="11550" class="Comment">---------</a>
<a id="11564" class="Symbol"></a> <a id="11566" href="/19.08/DeBruijn/#11523" class="Bound">Γ</a> <a id="11568" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="11570" href="plfa.part2.DeBruijn.html#11525" class="Bound">A</a>
</pre>
<p>The definition exploits the close correspondence between the
structure of terms and the structure of a derivation showing
that it is well typed: now we use the derivation <em>as</em> the
term.</p>
<p>For example, consider the following old-style typing judgments:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">∅ , "s" ⦂ ` ⇒ ` , "z" ⦂ ` ⊢ ` "z" ⦂ `</code></li>
<li><code class="language-plaintext highlighter-rouge">∅ , "s" ⦂ ` ⇒ ` , "z" ⦂ ` ⊢ ` "s" ⦂ ` ⇒ `</code></li>
<li><code class="language-plaintext highlighter-rouge">∅ , "s" ⦂ ` ⇒ ` , "z" ⦂ ` ⊢ ` "s" · ` "z" ⦂ `</code></li>
<li><code class="language-plaintext highlighter-rouge">∅ , "s" ⦂ ` ⇒ ` , "z" ⦂ ` ⊢ ` "s" · (` "s" · ` "z") ⦂ `</code></li>
<li><code class="language-plaintext highlighter-rouge">∅ , "s" ⦂ ` ⇒ ` ⊢ (ƛ "z" ⇒ ` "s" · (` "s" · ` "z")) ⦂ ` ⇒ `</code></li>
<li><code class="language-plaintext highlighter-rouge">∅ ⊢ ƛ "s" ⇒ ƛ "z" ⇒ ` "s" · (` "s" · ` "z")) ⦂ (` ⇒ `) ⇒ ` ⇒ `</code></li>
</ul>
<p>They correspond to the following intrinsically-typed terms:</p>
<pre class="Agda"><a id="12275" href="/19.08/DeBruijn/#12275" class="Function">_</a> <a id="12277" class="Symbol">:</a> <a id="12279" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="12281" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12283" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12286" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12288" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12291" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12293" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12296" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="12298" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="12301" class="Symbol">_</a> <a id="12303" class="Symbol">=</a> <a id="12305" href="/19.08/DeBruijn/#11130" class="InductiveConstructor Operator">`</a> <a id="12307" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="12310" href="/19.08/DeBruijn/#12310" class="Function">_</a> <a id="12312" class="Symbol">:</a> <a id="12314" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="12316" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12318" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12321" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12323" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12326" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12328" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12331" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="12333" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12336" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12338" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="12341" class="Symbol">_</a> <a id="12343" class="Symbol">=</a> <a id="12345" href="/19.08/DeBruijn/#11130" class="InductiveConstructor Operator">`</a> <a id="12347" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12349" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="12352" href="/19.08/DeBruijn/#12352" class="Function">_</a> <a id="12354" class="Symbol">:</a> <a id="12356" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="12358" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12360" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12363" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12365" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12368" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12370" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12373" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="12375" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="12378" class="Symbol">_</a> <a id="12380" class="Symbol">=</a> <a id="12382" href="/19.08/DeBruijn/#11130" class="InductiveConstructor Operator">`</a> <a id="12384" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12386" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="12388" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="12390" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12392" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="12395" href="/19.08/DeBruijn/#12395" class="Function">_</a> <a id="12397" class="Symbol">:</a> <a id="12399" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="12401" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12403" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12406" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12408" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12411" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12413" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12416" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="12418" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="12421" class="Symbol">_</a> <a id="12423" class="Symbol">=</a> <a id="12425" href="/19.08/DeBruijn/#11130" class="InductiveConstructor Operator">`</a> <a id="12427" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12429" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="12431" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="12433" class="Symbol">(</a><a id="12434" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12436" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12438" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="12440" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="12442" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12444" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="12445" class="Symbol">)</a>
<a id="12448" href="/19.08/DeBruijn/#12448" class="Function">_</a> <a id="12450" class="Symbol">:</a> <a id="12452" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="12454" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12456" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12459" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12461" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12464" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="12466" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12469" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12471" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="12474" class="Symbol">_</a> <a id="12476" class="Symbol">=</a> <a id="12478" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="12480" class="Symbol">(</a><a id="12481" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12483" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12485" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="12487" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="12489" class="Symbol">(</a><a id="12490" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12492" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12494" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="12496" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="12498" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12500" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="12501" class="Symbol">))</a>
<a id="12505" href="/19.08/DeBruijn/#12505" class="Function">_</a> <a id="12507" class="Symbol">:</a> <a id="12509" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="12511" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="12513" class="Symbol">(</a><a id="12514" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12517" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12519" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="12521" class="Symbol">)</a> <a id="12523" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12525" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="12528" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="12530" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="12533" class="Symbol">_</a> <a id="12535" class="Symbol">=</a> <a id="12537" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="12539" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="12541" class="Symbol">(</a><a id="12542" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12544" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12546" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="12548" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="12550" class="Symbol">(</a><a id="12551" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12553" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="12555" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="12557" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="12559" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="12561" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="12562" class="Symbol">))</a>
</pre>
<p>The final term represents the Church numeral two.</p>
<h3 id="abbreviating-de-bruijn-indices">Abbreviating de Bruijn indices</h3>
<p>We can use a natural number to select a type from a context:</p>
<pre class="Agda"><a id="lookup"></a><a id="12721" href="/19.08/DeBruijn/#12721" class="Function">lookup</a> <a id="12728" class="Symbol">:</a> <a id="12730" href="plfa.part2.DeBruijn.html#8879" class="Datatype">Context</a> <a id="12738" class="Symbol"></a> <a id="12740" href="Agda.Builtin.Nat.html#165" class="Datatype"></a> <a id="12742" class="Symbol"></a> <a id="12744" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a>
<a id="12749" href="/19.08/DeBruijn/#12721" class="Function">lookup</a> <a id="12756" class="Symbol">(</a><a id="12757" href="plfa.part2.DeBruijn.html#12757" class="Bound">Γ</a> <a id="12759" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12761" href="plfa.part2.DeBruijn.html#12761" class="Bound">A</a><a id="12762" class="Symbol">)</a> <a id="12764" href="Agda.Builtin.Nat.html#183" class="InductiveConstructor">zero</a> <a id="12773" class="Symbol">=</a> <a id="12776" href="plfa.part2.DeBruijn.html#12761" class="Bound">A</a>
<a id="12778" href="/19.08/DeBruijn/#12721" class="Function">lookup</a> <a id="12785" class="Symbol">(</a><a id="12786" href="plfa.part2.DeBruijn.html#12786" class="Bound">Γ</a> <a id="12788" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="12790" class="Symbol">_)</a> <a id="12793" class="Symbol">(</a><a id="12794" href="Agda.Builtin.Nat.html#196" class="InductiveConstructor">suc</a> <a id="12798" href="plfa.part2.DeBruijn.html#12798" class="Bound">n</a><a id="12799" class="Symbol">)</a> <a id="12802" class="Symbol">=</a> <a id="12805" href="plfa.part2.DeBruijn.html#12721" class="Function">lookup</a> <a id="12812" href="plfa.part2.DeBruijn.html#12786" class="Bound">Γ</a> <a id="12814" href="plfa.part2.DeBruijn.html#12798" class="Bound">n</a>
<a id="12816" href="/19.08/DeBruijn/#12721" class="Function">lookup</a> <a id="12823" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="12831" class="Symbol">_</a> <a id="12840" class="Symbol">=</a> <a id="12843" href="https://agda.github.io/agda-stdlib/v1.1/Data.Empty.html#294" class="Function">⊥-elim</a> <a id="12850" href="plfa.part2.DeBruijn.html#12879" class="Postulate">impossible</a>
<a id="12863" class="Keyword">where</a> <a id="12869" class="Keyword">postulate</a> <a id="12879" href="/19.08/DeBruijn/#12879" class="Postulate">impossible</a> <a id="12890" class="Symbol">:</a> <a id="12892" href="https://agda.github.io/agda-stdlib/v1.1/Data.Empty.html#279" class="Datatype"></a>
</pre>
<p>We intend to apply the function only when the natural is
shorter than the length of the context, which we indicate by
postulating an <code class="language-plaintext highlighter-rouge">impossible</code> term, just as we did
<a href="/19.08/Lambda/#impossible">here</a>.</p>
<p>Given the above, we can convert a natural to a corresponding
de Bruijn index, looking up its type in the context:</p>
<pre class="Agda"><a id="count"></a><a id="13231" href="/19.08/DeBruijn/#13231" class="Function">count</a> <a id="13237" class="Symbol">:</a> <a id="13239" class="Symbol"></a> <a id="13241" class="Symbol">{</a><a id="13242" href="plfa.part2.DeBruijn.html#13242" class="Bound">Γ</a><a id="13243" class="Symbol">}</a> <a id="13245" class="Symbol"></a> <a id="13247" class="Symbol">(</a><a id="13248" href="plfa.part2.DeBruijn.html#13248" class="Bound">n</a> <a id="13250" class="Symbol">:</a> <a id="13252" href="Agda.Builtin.Nat.html#165" class="Datatype"></a><a id="13253" class="Symbol">)</a> <a id="13255" class="Symbol"></a> <a id="13257" href="plfa.part2.DeBruijn.html#13242" class="Bound">Γ</a> <a id="13259" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="13261" href="plfa.part2.DeBruijn.html#12721" class="Function">lookup</a> <a id="13268" href="plfa.part2.DeBruijn.html#13242" class="Bound">Γ</a> <a id="13270" href="plfa.part2.DeBruijn.html#13248" class="Bound">n</a>
<a id="13272" href="/19.08/DeBruijn/#13231" class="Function">count</a> <a id="13278" class="Symbol">{</a><a id="13279" href="plfa.part2.DeBruijn.html#13279" class="Bound">Γ</a> <a id="13281" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="13283" class="Symbol">_}</a> <a id="13286" href="Agda.Builtin.Nat.html#183" class="InductiveConstructor">zero</a> <a id="13295" class="Symbol">=</a> <a id="13298" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="13300" href="/19.08/DeBruijn/#13231" class="Function">count</a> <a id="13306" class="Symbol">{</a><a id="13307" href="plfa.part2.DeBruijn.html#13307" class="Bound">Γ</a> <a id="13309" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="13311" class="Symbol">_}</a> <a id="13314" class="Symbol">(</a><a id="13315" href="Agda.Builtin.Nat.html#196" class="InductiveConstructor">suc</a> <a id="13319" href="plfa.part2.DeBruijn.html#13319" class="Bound">n</a><a id="13320" class="Symbol">)</a> <a id="13323" class="Symbol">=</a> <a id="13326" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="13328" class="Symbol">(</a><a id="13329" href="plfa.part2.DeBruijn.html#13231" class="Function">count</a> <a id="13335" href="plfa.part2.DeBruijn.html#13319" class="Bound">n</a><a id="13336" class="Symbol">)</a>
<a id="13338" href="/19.08/DeBruijn/#13231" class="Function">count</a> <a id="13344" class="Symbol">{</a><a id="13345" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a><a id="13346" class="Symbol">}</a> <a id="13352" class="Symbol">_</a> <a id="13361" class="Symbol">=</a> <a id="13364" href="https://agda.github.io/agda-stdlib/v1.1/Data.Empty.html#294" class="Function">⊥-elim</a> <a id="13371" href="plfa.part2.DeBruijn.html#13400" class="Postulate">impossible</a>
<a id="13384" class="Keyword">where</a> <a id="13390" class="Keyword">postulate</a> <a id="13400" href="/19.08/DeBruijn/#13400" class="Postulate">impossible</a> <a id="13411" class="Symbol">:</a> <a id="13413" href="https://agda.github.io/agda-stdlib/v1.1/Data.Empty.html#279" class="Datatype"></a>
</pre>
<p>This requires the same trick as before.</p>
<p>We can then introduce a convenient abbreviation for variables:</p>
<pre class="Agda"><a id="#_"></a><a id="13527" href="/19.08/DeBruijn/#13527" class="Function Operator">#_</a> <a id="13530" class="Symbol">:</a> <a id="13532" class="Symbol"></a> <a id="13534" class="Symbol">{</a><a id="13535" href="plfa.part2.DeBruijn.html#13535" class="Bound">Γ</a><a id="13536" class="Symbol">}</a> <a id="13538" class="Symbol"></a> <a id="13540" class="Symbol">(</a><a id="13541" href="plfa.part2.DeBruijn.html#13541" class="Bound">n</a> <a id="13543" class="Symbol">:</a> <a id="13545" href="Agda.Builtin.Nat.html#165" class="Datatype"></a><a id="13546" class="Symbol">)</a> <a id="13548" class="Symbol"></a> <a id="13550" href="plfa.part2.DeBruijn.html#13535" class="Bound">Γ</a> <a id="13552" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="13554" href="plfa.part2.DeBruijn.html#12721" class="Function">lookup</a> <a id="13561" href="plfa.part2.DeBruijn.html#13535" class="Bound">Γ</a> <a id="13563" href="plfa.part2.DeBruijn.html#13541" class="Bound">n</a>
<a id="13565" href="/19.08/DeBruijn/#13527" class="Function Operator">#</a> <a id="13567" href="plfa.part2.DeBruijn.html#13567" class="Bound">n</a> <a id="13570" class="Symbol">=</a> <a id="13573" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="13575" href="plfa.part2.DeBruijn.html#13231" class="Function">count</a> <a id="13581" href="plfa.part2.DeBruijn.html#13567" class="Bound">n</a>
</pre>
<p>With this abbreviation, we can rewrite the Church numeral two more compactly:</p>
<pre class="Agda"><a id="13670" href="/19.08/DeBruijn/#13670" class="Function">_</a> <a id="13672" class="Symbol">:</a> <a id="13674" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="13676" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="13678" class="Symbol">(</a><a id="13679" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="13682" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="13684" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="13686" class="Symbol">)</a> <a id="13688" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="13690" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="13693" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="13695" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="13698" class="Symbol">_</a> <a id="13700" class="Symbol">=</a> <a id="13702" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="13704" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="13706" class="Symbol">(</a><a id="13707" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="13709" class="Number">1</a> <a id="13711" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="13713" class="Symbol">(</a><a id="13714" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="13716" class="Number">1</a> <a id="13718" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="13720" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="13722" class="Number">0</a><a id="13723" class="Symbol">))</a>
</pre>
<h3 id="test-examples">Test examples</h3>
<p>We repeat the test examples from
Chapter <a href="/19.08/Lambda/">Lambda</a>.
You can find them
<a href="/19.08/Lambda/#derivation">here</a>
for comparison.</p>
<p>First, computing two plus two on naturals:</p>
<pre class="Agda"><a id="two"></a><a id="13958" href="/19.08/DeBruijn/#13958" class="Function">two</a> <a id="13962" class="Symbol">:</a> <a id="13964" class="Symbol"></a> <a id="13966" class="Symbol">{</a><a id="13967" href="plfa.part2.DeBruijn.html#13967" class="Bound">Γ</a><a id="13968" class="Symbol">}</a> <a id="13970" class="Symbol"></a> <a id="13972" href="plfa.part2.DeBruijn.html#13967" class="Bound">Γ</a> <a id="13974" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="13976" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="13979" href="/19.08/DeBruijn/#13958" class="Function">two</a> <a id="13983" class="Symbol">=</a> <a id="13985" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="13990" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="13995" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="plus"></a><a id="14002" href="/19.08/DeBruijn/#14002" class="Function">plus</a> <a id="14007" class="Symbol">:</a> <a id="14009" class="Symbol"></a> <a id="14011" class="Symbol">{</a><a id="14012" href="plfa.part2.DeBruijn.html#14012" class="Bound">Γ</a><a id="14013" class="Symbol">}</a> <a id="14015" class="Symbol"></a> <a id="14017" href="plfa.part2.DeBruijn.html#14012" class="Bound">Γ</a> <a id="14019" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="14021" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="14024" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14026" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="14029" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14031" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="14034" href="/19.08/DeBruijn/#14002" class="Function">plus</a> <a id="14039" class="Symbol">=</a> <a id="14041" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="14043" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14045" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14047" class="Symbol">(</a><a id="14048" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="14053" class="Symbol">(</a><a id="14054" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14056" class="Number">1</a><a id="14057" class="Symbol">)</a> <a id="14059" class="Symbol">(</a><a id="14060" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14062" class="Number">0</a><a id="14063" class="Symbol">)</a> <a id="14065" class="Symbol">(</a><a id="14066" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="14071" class="Symbol">(</a><a id="14072" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14074" class="Number">3</a> <a id="14076" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14078" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14080" class="Number">0</a> <a id="14082" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14084" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14086" class="Number">1</a><a id="14087" class="Symbol">)))</a>
<a id="2+2"></a><a id="14092" href="/19.08/DeBruijn/#14092" class="Function">2+2</a> <a id="14096" class="Symbol">:</a> <a id="14098" class="Symbol"></a> <a id="14100" class="Symbol">{</a><a id="14101" href="plfa.part2.DeBruijn.html#14101" class="Bound">Γ</a><a id="14102" class="Symbol">}</a> <a id="14104" class="Symbol"></a> <a id="14106" href="plfa.part2.DeBruijn.html#14101" class="Bound">Γ</a> <a id="14108" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="14110" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="14113" href="/19.08/DeBruijn/#14092" class="Function">2+2</a> <a id="14117" class="Symbol">=</a> <a id="14119" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="14124" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14126" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="14130" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14132" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a>
</pre>
<p>We generalise to arbitrary contexts because later we will give examples
where <code class="language-plaintext highlighter-rouge">two</code> appears nested inside binders.</p>
<p>Next, computing two plus two on Church numerals:</p>
<pre class="Agda"><a id="Ch"></a><a id="14309" href="/19.08/DeBruijn/#14309" class="Function">Ch</a> <a id="14312" class="Symbol">:</a> <a id="14314" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a> <a id="14319" class="Symbol"></a> <a id="14321" href="plfa.part2.DeBruijn.html#8711" class="Datatype">Type</a>
<a id="14326" href="/19.08/DeBruijn/#14309" class="Function">Ch</a> <a id="14329" href="plfa.part2.DeBruijn.html#14329" class="Bound">A</a> <a id="14332" class="Symbol">=</a> <a id="14335" class="Symbol">(</a><a id="14336" href="plfa.part2.DeBruijn.html#14329" class="Bound">A</a> <a id="14338" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14340" href="plfa.part2.DeBruijn.html#14329" class="Bound">A</a><a id="14341" class="Symbol">)</a> <a id="14343" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14345" href="plfa.part2.DeBruijn.html#14329" class="Bound">A</a> <a id="14347" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14349" href="plfa.part2.DeBruijn.html#14329" class="Bound">A</a>
<a id="twoᶜ"></a><a id="14352" href="/19.08/DeBruijn/#14352" class="Function">twoᶜ</a> <a id="14357" class="Symbol">:</a> <a id="14359" class="Symbol"></a> <a id="14361" class="Symbol">{</a><a id="14362" href="plfa.part2.DeBruijn.html#14362" class="Bound">Γ</a> <a id="14364" href="plfa.part2.DeBruijn.html#14364" class="Bound">A</a><a id="14365" class="Symbol">}</a> <a id="14367" class="Symbol"></a> <a id="14369" href="plfa.part2.DeBruijn.html#14362" class="Bound">Γ</a> <a id="14371" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="14373" href="plfa.part2.DeBruijn.html#14309" class="Function">Ch</a> <a id="14376" href="plfa.part2.DeBruijn.html#14364" class="Bound">A</a>
<a id="14378" href="/19.08/DeBruijn/#14352" class="Function">twoᶜ</a> <a id="14383" class="Symbol">=</a> <a id="14385" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14387" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14389" class="Symbol">(</a><a id="14390" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14392" class="Number">1</a> <a id="14394" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14396" class="Symbol">(</a><a id="14397" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14399" class="Number">1</a> <a id="14401" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14403" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14405" class="Number">0</a><a id="14406" class="Symbol">))</a>
<a id="plusᶜ"></a><a id="14410" href="/19.08/DeBruijn/#14410" class="Function">plusᶜ</a> <a id="14416" class="Symbol">:</a> <a id="14418" class="Symbol"></a> <a id="14420" class="Symbol">{</a><a id="14421" href="plfa.part2.DeBruijn.html#14421" class="Bound">Γ</a> <a id="14423" href="plfa.part2.DeBruijn.html#14423" class="Bound">A</a><a id="14424" class="Symbol">}</a> <a id="14426" class="Symbol"></a> <a id="14428" href="plfa.part2.DeBruijn.html#14421" class="Bound">Γ</a> <a id="14430" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="14432" href="plfa.part2.DeBruijn.html#14309" class="Function">Ch</a> <a id="14435" href="plfa.part2.DeBruijn.html#14423" class="Bound">A</a> <a id="14437" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14439" href="plfa.part2.DeBruijn.html#14309" class="Function">Ch</a> <a id="14442" href="plfa.part2.DeBruijn.html#14423" class="Bound">A</a> <a id="14444" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14446" href="plfa.part2.DeBruijn.html#14309" class="Function">Ch</a> <a id="14449" href="plfa.part2.DeBruijn.html#14423" class="Bound">A</a>
<a id="14451" href="/19.08/DeBruijn/#14410" class="Function">plusᶜ</a> <a id="14457" class="Symbol">=</a> <a id="14459" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14461" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14463" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14465" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14467" class="Symbol">(</a><a id="14468" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14470" class="Number">3</a> <a id="14472" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14474" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14476" class="Number">1</a> <a id="14478" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14480" class="Symbol">(</a><a id="14481" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14483" class="Number">2</a> <a id="14485" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14487" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14489" class="Number">1</a> <a id="14491" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14493" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14495" class="Number">0</a><a id="14496" class="Symbol">))</a>
<a id="sucᶜ"></a><a id="14500" href="/19.08/DeBruijn/#14500" class="Function">sucᶜ</a> <a id="14505" class="Symbol">:</a> <a id="14507" class="Symbol"></a> <a id="14509" class="Symbol">{</a><a id="14510" href="plfa.part2.DeBruijn.html#14510" class="Bound">Γ</a><a id="14511" class="Symbol">}</a> <a id="14513" class="Symbol"></a> <a id="14515" href="plfa.part2.DeBruijn.html#14510" class="Bound">Γ</a> <a id="14517" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="14519" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="14522" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="14524" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="14527" href="/19.08/DeBruijn/#14500" class="Function">sucᶜ</a> <a id="14532" class="Symbol">=</a> <a id="14534" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="14536" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="14541" class="Symbol">(</a><a id="14542" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="14544" class="Number">0</a><a id="14545" class="Symbol">)</a>
<a id="2+2ᶜ"></a><a id="14548" href="/19.08/DeBruijn/#14548" class="Function">2+2ᶜ</a> <a id="14553" class="Symbol">:</a> <a id="14555" class="Symbol"></a> <a id="14557" class="Symbol">{</a><a id="14558" href="plfa.part2.DeBruijn.html#14558" class="Bound">Γ</a><a id="14559" class="Symbol">}</a> <a id="14561" class="Symbol"></a> <a id="14563" href="plfa.part2.DeBruijn.html#14558" class="Bound">Γ</a> <a id="14565" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="14567" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="14570" href="/19.08/DeBruijn/#14548" class="Function">2+2ᶜ</a> <a id="14575" class="Symbol">=</a> <a id="14577" href="plfa.part2.DeBruijn.html#14410" class="Function">plusᶜ</a> <a id="14583" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14585" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="14590" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14592" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="14597" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14599" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="14604" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="14606" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
</pre>
<p>As before we generalise everything to arbitrary
contexts. While we are at it, we also generalise <code class="language-plaintext highlighter-rouge">twoᶜ</code> and
<code class="language-plaintext highlighter-rouge">plusᶜ</code> to Church numerals over arbitrary types.</p>
<h4 id="exercise-mul-recommended">Exercise <code class="language-plaintext highlighter-rouge">mul</code> (recommended)</h4>
<p>Write out the definition of a lambda term that multiplies
two natural numbers, now adapted to the intrinsically-typed
DeBruijn representation.</p>
<pre class="Agda"><a id="14960" class="Comment">-- Your code goes here</a>
</pre>
<h2 id="renaming">Renaming</h2>
<p>Renaming is a necessary prelude to substitution, enabling us
to “rebase” a term from one context to another. It
corresponds directly to the renaming result from the previous
chapter, but here the theorem that ensures renaming preserves
typing also acts as code that performs renaming.</p>
<p>As before, we first need an extension lemma that allows us to
extend the context when we encounter a binder. Given a map
from variables in one context to variables in another,
extension yields a map from the first context extended to the
second context similarly extended. It looks exactly like the
old extension lemma, but with all names and terms dropped:</p>
<pre class="Agda"><a id="ext"></a><a id="15652" href="/19.08/DeBruijn/#15652" class="Function">ext</a> <a id="15656" class="Symbol">:</a> <a id="15658" class="Symbol"></a> <a id="15660" class="Symbol">{</a><a id="15661" href="plfa.part2.DeBruijn.html#15661" class="Bound">Γ</a> <a id="15663" href="plfa.part2.DeBruijn.html#15663" class="Bound">Δ</a><a id="15664" class="Symbol">}</a>
<a id="15668" class="Symbol"></a> <a id="15670" class="Symbol">(∀</a> <a id="15673" class="Symbol">{</a><a id="15674" href="/19.08/DeBruijn/#15674" class="Bound">A</a><a id="15675" class="Symbol">}</a> <a id="15677" class="Symbol"></a> <a id="15685" href="plfa.part2.DeBruijn.html#15661" class="Bound">Γ</a> <a id="15687" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="15689" href="plfa.part2.DeBruijn.html#15674" class="Bound">A</a> <a id="15691" class="Symbol"></a> <a id="15697" href="plfa.part2.DeBruijn.html#15663" class="Bound">Δ</a> <a id="15699" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="15701" href="plfa.part2.DeBruijn.html#15674" class="Bound">A</a><a id="15702" class="Symbol">)</a>
<a id="15708" class="Comment">---------------------------------</a>
<a id="15744" class="Symbol"></a> <a id="15746" class="Symbol">(∀</a> <a id="15749" class="Symbol">{</a><a id="15750" href="/19.08/DeBruijn/#15750" class="Bound">A</a> <a id="15752" href="plfa.part2.DeBruijn.html#15752" class="Bound">B</a><a id="15753" class="Symbol">}</a> <a id="15755" class="Symbol"></a> <a id="15757" href="plfa.part2.DeBruijn.html#15661" class="Bound">Γ</a> <a id="15759" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="15761" href="plfa.part2.DeBruijn.html#15752" class="Bound">B</a> <a id="15763" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="15765" href="plfa.part2.DeBruijn.html#15750" class="Bound">A</a> <a id="15767" class="Symbol"></a> <a id="15769" href="plfa.part2.DeBruijn.html#15663" class="Bound">Δ</a> <a id="15771" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="15773" href="plfa.part2.DeBruijn.html#15752" class="Bound">B</a> <a id="15775" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="15777" href="plfa.part2.DeBruijn.html#15750" class="Bound">A</a><a id="15778" class="Symbol">)</a>
<a id="15780" href="/19.08/DeBruijn/#15652" class="Function">ext</a> <a id="15784" href="plfa.part2.DeBruijn.html#15784" class="Bound">ρ</a> <a id="15786" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="15793" class="Symbol">=</a> <a id="15796" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="15798" href="/19.08/DeBruijn/#15652" class="Function">ext</a> <a id="15802" href="plfa.part2.DeBruijn.html#15802" class="Bound">ρ</a> <a id="15804" class="Symbol">(</a><a id="15805" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="15807" href="plfa.part2.DeBruijn.html#15807" class="Bound">x</a><a id="15808" class="Symbol">)</a> <a id="15811" class="Symbol">=</a> <a id="15814" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="15816" class="Symbol">(</a><a id="15817" href="plfa.part2.DeBruijn.html#15802" class="Bound">ρ</a> <a id="15819" href="plfa.part2.DeBruijn.html#15807" class="Bound">x</a><a id="15820" class="Symbol">)</a>
</pre>
<p>Let <code class="language-plaintext highlighter-rouge">ρ</code> be the name of the map that takes variables in <code class="language-plaintext highlighter-rouge">Γ</code>
to variables in <code class="language-plaintext highlighter-rouge">Δ</code>. Consider the de Bruijn index of the
variable in <code class="language-plaintext highlighter-rouge">Γ , B</code>:</p>
<ul>
<li>
<p>If it is <code class="language-plaintext highlighter-rouge">Z</code>, which has type <code class="language-plaintext highlighter-rouge">B</code> in <code class="language-plaintext highlighter-rouge">Γ , B</code>,
then we return <code class="language-plaintext highlighter-rouge">Z</code>, which also has type <code class="language-plaintext highlighter-rouge">B</code> in <code class="language-plaintext highlighter-rouge">Δ , B</code>.</p>
</li>
<li>
<p>If it is <code class="language-plaintext highlighter-rouge">S x</code>, for some variable <code class="language-plaintext highlighter-rouge">x</code> in <code class="language-plaintext highlighter-rouge">Γ</code>, then <code class="language-plaintext highlighter-rouge">ρ x</code>
is a variable in <code class="language-plaintext highlighter-rouge">Δ</code>, and hence <code class="language-plaintext highlighter-rouge">S (ρ x)</code> is a variable in
<code class="language-plaintext highlighter-rouge">Δ , B</code>.</p>
</li>
</ul>
<p>With extension under our belts, it is straightforward
to define renaming. If variables in one context map to
variables in another, then terms in the first context map to
terms in the second:</p>
<pre class="Agda"><a id="rename"></a><a id="16399" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16406" class="Symbol">:</a> <a id="16408" class="Symbol"></a> <a id="16410" class="Symbol">{</a><a id="16411" href="plfa.part2.DeBruijn.html#16411" class="Bound">Γ</a> <a id="16413" href="plfa.part2.DeBruijn.html#16413" class="Bound">Δ</a><a id="16414" class="Symbol">}</a>
<a id="16418" class="Symbol"></a> <a id="16420" class="Symbol">(∀</a> <a id="16423" class="Symbol">{</a><a id="16424" href="/19.08/DeBruijn/#16424" class="Bound">A</a><a id="16425" class="Symbol">}</a> <a id="16427" class="Symbol"></a> <a id="16429" href="plfa.part2.DeBruijn.html#16411" class="Bound">Γ</a> <a id="16431" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="16433" href="plfa.part2.DeBruijn.html#16424" class="Bound">A</a> <a id="16435" class="Symbol"></a> <a id="16437" href="plfa.part2.DeBruijn.html#16413" class="Bound">Δ</a> <a id="16439" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="16441" href="plfa.part2.DeBruijn.html#16424" class="Bound">A</a><a id="16442" class="Symbol">)</a>
<a id="16448" class="Comment">-----------------------</a>
<a id="16474" class="Symbol"></a> <a id="16476" class="Symbol">(∀</a> <a id="16479" class="Symbol">{</a><a id="16480" href="/19.08/DeBruijn/#16480" class="Bound">A</a><a id="16481" class="Symbol">}</a> <a id="16483" class="Symbol"></a> <a id="16485" href="plfa.part2.DeBruijn.html#16411" class="Bound">Γ</a> <a id="16487" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="16489" href="plfa.part2.DeBruijn.html#16480" class="Bound">A</a> <a id="16491" class="Symbol"></a> <a id="16493" href="plfa.part2.DeBruijn.html#16413" class="Bound">Δ</a> <a id="16495" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="16497" href="plfa.part2.DeBruijn.html#16480" class="Bound">A</a><a id="16498" class="Symbol">)</a>
<a id="16500" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16507" href="plfa.part2.DeBruijn.html#16507" class="Bound">ρ</a> <a id="16509" class="Symbol">(</a><a id="16510" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="16512" href="plfa.part2.DeBruijn.html#16512" class="Bound">x</a><a id="16513" class="Symbol">)</a> <a id="16524" class="Symbol">=</a> <a id="16527" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="16529" class="Symbol">(</a><a id="16530" href="plfa.part2.DeBruijn.html#16507" class="Bound">ρ</a> <a id="16532" href="plfa.part2.DeBruijn.html#16512" class="Bound">x</a><a id="16533" class="Symbol">)</a>
<a id="16535" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16542" href="plfa.part2.DeBruijn.html#16542" class="Bound">ρ</a> <a id="16544" class="Symbol">(</a><a id="16545" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="16547" href="plfa.part2.DeBruijn.html#16547" class="Bound">N</a><a id="16548" class="Symbol">)</a> <a id="16559" class="Symbol">=</a> <a id="16562" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="16564" class="Symbol">(</a><a id="16565" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16572" class="Symbol">(</a><a id="16573" href="plfa.part2.DeBruijn.html#15652" class="Function">ext</a> <a id="16577" href="plfa.part2.DeBruijn.html#16542" class="Bound">ρ</a><a id="16578" class="Symbol">)</a> <a id="16580" href="plfa.part2.DeBruijn.html#16547" class="Bound">N</a><a id="16581" class="Symbol">)</a>
<a id="16583" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16590" href="plfa.part2.DeBruijn.html#16590" class="Bound">ρ</a> <a id="16592" class="Symbol">(</a><a id="16593" href="plfa.part2.DeBruijn.html#16593" class="Bound">L</a> <a id="16595" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="16597" href="plfa.part2.DeBruijn.html#16597" class="Bound">M</a><a id="16598" class="Symbol">)</a> <a id="16607" class="Symbol">=</a> <a id="16610" class="Symbol">(</a><a id="16611" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16618" href="plfa.part2.DeBruijn.html#16590" class="Bound">ρ</a> <a id="16620" href="plfa.part2.DeBruijn.html#16593" class="Bound">L</a><a id="16621" class="Symbol">)</a> <a id="16623" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="16625" class="Symbol">(</a><a id="16626" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16633" href="plfa.part2.DeBruijn.html#16590" class="Bound">ρ</a> <a id="16635" href="plfa.part2.DeBruijn.html#16597" class="Bound">M</a><a id="16636" class="Symbol">)</a>
<a id="16638" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16645" href="plfa.part2.DeBruijn.html#16645" class="Bound">ρ</a> <a id="16647" class="Symbol">(</a><a id="16648" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="16653" class="Symbol">)</a> <a id="16662" class="Symbol">=</a> <a id="16665" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="16671" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16678" href="plfa.part2.DeBruijn.html#16678" class="Bound">ρ</a> <a id="16680" class="Symbol">(</a><a id="16681" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="16686" href="plfa.part2.DeBruijn.html#16686" class="Bound">M</a><a id="16687" class="Symbol">)</a> <a id="16695" class="Symbol">=</a> <a id="16698" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="16703" class="Symbol">(</a><a id="16704" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16711" href="plfa.part2.DeBruijn.html#16678" class="Bound">ρ</a> <a id="16713" href="plfa.part2.DeBruijn.html#16686" class="Bound">M</a><a id="16714" class="Symbol">)</a>
<a id="16716" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16723" href="plfa.part2.DeBruijn.html#16723" class="Bound">ρ</a> <a id="16725" class="Symbol">(</a><a id="16726" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="16731" href="plfa.part2.DeBruijn.html#16731" class="Bound">L</a> <a id="16733" href="plfa.part2.DeBruijn.html#16733" class="Bound">M</a> <a id="16735" href="plfa.part2.DeBruijn.html#16735" class="Bound">N</a><a id="16736" class="Symbol">)</a> <a id="16740" class="Symbol">=</a> <a id="16743" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="16748" class="Symbol">(</a><a id="16749" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16756" href="plfa.part2.DeBruijn.html#16723" class="Bound">ρ</a> <a id="16758" href="plfa.part2.DeBruijn.html#16731" class="Bound">L</a><a id="16759" class="Symbol">)</a> <a id="16761" class="Symbol">(</a><a id="16762" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16769" href="plfa.part2.DeBruijn.html#16723" class="Bound">ρ</a> <a id="16771" href="plfa.part2.DeBruijn.html#16733" class="Bound">M</a><a id="16772" class="Symbol">)</a> <a id="16774" class="Symbol">(</a><a id="16775" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16782" class="Symbol">(</a><a id="16783" href="plfa.part2.DeBruijn.html#15652" class="Function">ext</a> <a id="16787" href="plfa.part2.DeBruijn.html#16723" class="Bound">ρ</a><a id="16788" class="Symbol">)</a> <a id="16790" href="plfa.part2.DeBruijn.html#16735" class="Bound">N</a><a id="16791" class="Symbol">)</a>
<a id="16793" href="/19.08/DeBruijn/#16399" class="Function">rename</a> <a id="16800" href="plfa.part2.DeBruijn.html#16800" class="Bound">ρ</a> <a id="16802" class="Symbol">(</a><a id="16803" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="16805" href="plfa.part2.DeBruijn.html#16805" class="Bound">N</a><a id="16806" class="Symbol">)</a> <a id="16817" class="Symbol">=</a> <a id="16820" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="16822" class="Symbol">(</a><a id="16823" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="16830" class="Symbol">(</a><a id="16831" href="plfa.part2.DeBruijn.html#15652" class="Function">ext</a> <a id="16835" href="plfa.part2.DeBruijn.html#16800" class="Bound">ρ</a><a id="16836" class="Symbol">)</a> <a id="16838" href="plfa.part2.DeBruijn.html#16805" class="Bound">N</a><a id="16839" class="Symbol">)</a>
</pre>
<p>Let <code class="language-plaintext highlighter-rouge">ρ</code> be the name of the map that takes variables in <code class="language-plaintext highlighter-rouge">Γ</code>
to variables in <code class="language-plaintext highlighter-rouge">Δ</code>. Lets unpack the first three cases:</p>
<ul>
<li>
<p>If the term is a variable, simply apply <code class="language-plaintext highlighter-rouge">ρ</code>.</p>
</li>
<li>
<p>If the term is an abstraction, use the previous result
to extend the map <code class="language-plaintext highlighter-rouge">ρ</code> suitably and recursively rename
the body of the abstraction.</p>
</li>
<li>
<p>If the term is an application, recursively rename both
the function and the argument.</p>
</li>
</ul>
<p>The remaining cases are similar, recursing on each subterm,
and extending the map whenever the construct introduces a
bound variable.</p>
<p>Whereas before renaming was a result that carried evidence
that a term is well typed in one context to evidence that it
is well typed in another context, now it actually transforms
the term, suitably altering the bound variables. Typechecking
the code in Agda ensures that it is only passed and returns
terms that are well typed by the rules of simply-typed lambda
calculus.</p>
<p>Here is an example of renaming a term with one free
and one bound variable:</p>
<pre class="Agda"><a id="M₀"></a><a id="17838" href="/19.08/DeBruijn/#17838" class="Function">M₀</a> <a id="17841" class="Symbol">:</a> <a id="17843" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="17845" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="17847" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="17850" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="17852" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="17855" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="17857" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="17860" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="17862" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="17865" href="/19.08/DeBruijn/#17838" class="Function">M₀</a> <a id="17868" class="Symbol">=</a> <a id="17870" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="17872" class="Symbol">(</a><a id="17873" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="17875" class="Number">1</a> <a id="17877" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="17879" class="Symbol">(</a><a id="17880" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="17882" class="Number">1</a> <a id="17884" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="17886" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="17888" class="Number">0</a><a id="17889" class="Symbol">))</a>
<a id="M₁"></a><a id="17893" href="/19.08/DeBruijn/#17893" class="Function">M₁</a> <a id="17896" class="Symbol">:</a> <a id="17898" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="17900" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="17902" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="17905" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="17907" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="17910" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="17912" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="17915" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="17917" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="17920" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="17922" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="17925" href="/19.08/DeBruijn/#17893" class="Function">M₁</a> <a id="17928" class="Symbol">=</a> <a id="17930" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="17932" class="Symbol">(</a><a id="17933" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="17935" class="Number">2</a> <a id="17937" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="17939" class="Symbol">(</a><a id="17940" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="17942" class="Number">2</a> <a id="17944" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="17946" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="17948" class="Number">0</a><a id="17949" class="Symbol">))</a>
<a id="17953" href="/19.08/DeBruijn/#17953" class="Function">_</a> <a id="17955" class="Symbol">:</a> <a id="17957" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="17964" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S_</a> <a id="17967" href="plfa.part2.DeBruijn.html#17838" class="Function">M₀</a> <a id="17970" href="Agda.Builtin.Equality.html#125" class="Datatype Operator"></a> <a id="17972" href="plfa.part2.DeBruijn.html#17893" class="Function">M₁</a>
<a id="17975" class="Symbol">_</a> <a id="17977" class="Symbol">=</a> <a id="17979" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a>
</pre>
<p>In general, <code class="language-plaintext highlighter-rouge">rename S_</code> will increment the de Bruijn index for
each free variable by one, while leaving the index for each
bound variable unchanged. The code achieves this naturally:
the map originally increments each variable by one, and is
extended for each bound variable by a map that leaves it
unchanged.</p>
<p>We will see below that renaming by <code class="language-plaintext highlighter-rouge">S_</code> plays a key role in
substitution. For traditional uses of de Bruijn indices
without intrinsic typing, this is a little tricky. The code
keeps count of a number where all greater indexes are free and
all smaller indexes bound, and increment only indexes greater
than the number. Its easy to have off-by-one errors. But
its hard to imagine an off-by-one error that preserves
typing, and hence the Agda code for intrinsically-typed de Bruijn
terms is intrinsically reliable.</p>
<h2 id="simultaneous-substitution">Simultaneous Substitution</h2>
<p>Because de Bruijn indices free us of concerns with renaming,
it becomes easy to provide a definition of substitution that
is more general than the one considered previously. Instead
of substituting a closed term for a single variable, it
provides a map that takes each free variable of the original
term to another term. Further, the substituted terms are over
an arbitrary context, and need not be closed.</p>
<p>The structure of the definition and the proof is remarkably
close to that for renaming. Again, we first need an extension
lemma that allows us to extend the context when we encounter a
binder. Whereas renaming concerned a map from variables
in one context to variables in another, substitution takes a
map from variables in one context to <em>terms</em> in another.
Given a map from variables in one context to terms over
another, extension yields a map from the first context
extended to the second context similarly extended:</p>
<pre class="Agda"><a id="exts"></a><a id="19784" href="/19.08/DeBruijn/#19784" class="Function">exts</a> <a id="19789" class="Symbol">:</a> <a id="19791" class="Symbol"></a> <a id="19793" class="Symbol">{</a><a id="19794" href="plfa.part2.DeBruijn.html#19794" class="Bound">Γ</a> <a id="19796" href="plfa.part2.DeBruijn.html#19796" class="Bound">Δ</a><a id="19797" class="Symbol">}</a>
<a id="19801" class="Symbol"></a> <a id="19803" class="Symbol">(∀</a> <a id="19806" class="Symbol">{</a><a id="19807" href="/19.08/DeBruijn/#19807" class="Bound">A</a><a id="19808" class="Symbol">}</a> <a id="19810" class="Symbol"></a> <a id="19818" href="plfa.part2.DeBruijn.html#19794" class="Bound">Γ</a> <a id="19820" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="19822" href="plfa.part2.DeBruijn.html#19807" class="Bound">A</a> <a id="19824" class="Symbol"></a> <a id="19830" href="plfa.part2.DeBruijn.html#19796" class="Bound">Δ</a> <a id="19832" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="19834" href="plfa.part2.DeBruijn.html#19807" class="Bound">A</a><a id="19835" class="Symbol">)</a>
<a id="19841" class="Comment">---------------------------------</a>
<a id="19877" class="Symbol"></a> <a id="19879" class="Symbol">(∀</a> <a id="19882" class="Symbol">{</a><a id="19883" href="/19.08/DeBruijn/#19883" class="Bound">A</a> <a id="19885" href="plfa.part2.DeBruijn.html#19885" class="Bound">B</a><a id="19886" class="Symbol">}</a> <a id="19888" class="Symbol"></a> <a id="19890" href="plfa.part2.DeBruijn.html#19794" class="Bound">Γ</a> <a id="19892" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="19894" href="plfa.part2.DeBruijn.html#19885" class="Bound">B</a> <a id="19896" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="19898" href="plfa.part2.DeBruijn.html#19883" class="Bound">A</a> <a id="19900" class="Symbol"></a> <a id="19902" href="plfa.part2.DeBruijn.html#19796" class="Bound">Δ</a> <a id="19904" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="19906" href="plfa.part2.DeBruijn.html#19885" class="Bound">B</a> <a id="19908" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="19910" href="plfa.part2.DeBruijn.html#19883" class="Bound">A</a><a id="19911" class="Symbol">)</a>
<a id="19913" href="/19.08/DeBruijn/#19784" class="Function">exts</a> <a id="19918" href="plfa.part2.DeBruijn.html#19918" class="Bound">σ</a> <a id="19920" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="19927" class="Symbol">=</a> <a id="19930" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="19932" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="19934" href="/19.08/DeBruijn/#19784" class="Function">exts</a> <a id="19939" href="plfa.part2.DeBruijn.html#19939" class="Bound">σ</a> <a id="19941" class="Symbol">(</a><a id="19942" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="19944" href="plfa.part2.DeBruijn.html#19944" class="Bound">x</a><a id="19945" class="Symbol">)</a> <a id="19948" class="Symbol">=</a> <a id="19951" href="plfa.part2.DeBruijn.html#16399" class="Function">rename</a> <a id="19958" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S_</a> <a id="19961" class="Symbol">(</a><a id="19962" href="plfa.part2.DeBruijn.html#19939" class="Bound">σ</a> <a id="19964" href="plfa.part2.DeBruijn.html#19944" class="Bound">x</a><a id="19965" class="Symbol">)</a>
</pre>
<p>Let <code class="language-plaintext highlighter-rouge">σ</code> be the name of the map that takes variables in <code class="language-plaintext highlighter-rouge">Γ</code>
to terms over <code class="language-plaintext highlighter-rouge">Δ</code>. Consider the de Bruijn index of the
variable in <code class="language-plaintext highlighter-rouge">Γ , B</code>:</p>
<ul>
<li>
<p>If it is <code class="language-plaintext highlighter-rouge">Z</code>, which has type <code class="language-plaintext highlighter-rouge">B</code> in <code class="language-plaintext highlighter-rouge">Γ , B</code>,
then we return the term <code class="language-plaintext highlighter-rouge">` Z</code>, which also has
type <code class="language-plaintext highlighter-rouge">B</code> in <code class="language-plaintext highlighter-rouge">Δ , B</code>.</p>
</li>
<li>
<p>If it is <code class="language-plaintext highlighter-rouge">S x</code>, for some variable <code class="language-plaintext highlighter-rouge">x</code> in <code class="language-plaintext highlighter-rouge">Γ</code>, then
<code class="language-plaintext highlighter-rouge">σ x</code> is a term in <code class="language-plaintext highlighter-rouge">Δ</code>, and hence <code class="language-plaintext highlighter-rouge">rename S_ (σ x)</code>
is a term in <code class="language-plaintext highlighter-rouge">Δ , B</code>.</p>
</li>
</ul>
<p>This is why we had to define renaming first, since
we require it to convert a term over context <code class="language-plaintext highlighter-rouge">Δ</code>
to a term over the extended context <code class="language-plaintext highlighter-rouge">Δ , B</code>.</p>
<p>With extension under our belts, it is straightforward
to define substitution. If variables in one context map
to terms over another, then terms in the first context
map to terms in the second:</p>
<pre class="Agda"><a id="subst"></a><a id="20706" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="20712" class="Symbol">:</a> <a id="20714" class="Symbol"></a> <a id="20716" class="Symbol">{</a><a id="20717" href="plfa.part2.DeBruijn.html#20717" class="Bound">Γ</a> <a id="20719" href="plfa.part2.DeBruijn.html#20719" class="Bound">Δ</a><a id="20720" class="Symbol">}</a>
<a id="20724" class="Symbol"></a> <a id="20726" class="Symbol">(∀</a> <a id="20729" class="Symbol">{</a><a id="20730" href="/19.08/DeBruijn/#20730" class="Bound">A</a><a id="20731" class="Symbol">}</a> <a id="20733" class="Symbol"></a> <a id="20735" href="plfa.part2.DeBruijn.html#20717" class="Bound">Γ</a> <a id="20737" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="20739" href="plfa.part2.DeBruijn.html#20730" class="Bound">A</a> <a id="20741" class="Symbol"></a> <a id="20743" href="plfa.part2.DeBruijn.html#20719" class="Bound">Δ</a> <a id="20745" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="20747" href="plfa.part2.DeBruijn.html#20730" class="Bound">A</a><a id="20748" class="Symbol">)</a>
<a id="20754" class="Comment">-----------------------</a>
<a id="20780" class="Symbol"></a> <a id="20782" class="Symbol">(∀</a> <a id="20785" class="Symbol">{</a><a id="20786" href="/19.08/DeBruijn/#20786" class="Bound">A</a><a id="20787" class="Symbol">}</a> <a id="20789" class="Symbol"></a> <a id="20791" href="plfa.part2.DeBruijn.html#20717" class="Bound">Γ</a> <a id="20793" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="20795" href="plfa.part2.DeBruijn.html#20786" class="Bound">A</a> <a id="20797" class="Symbol"></a> <a id="20799" href="plfa.part2.DeBruijn.html#20719" class="Bound">Δ</a> <a id="20801" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="20803" href="plfa.part2.DeBruijn.html#20786" class="Bound">A</a><a id="20804" class="Symbol">)</a>
<a id="20806" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="20812" href="plfa.part2.DeBruijn.html#20812" class="Bound">σ</a> <a id="20814" class="Symbol">(</a><a id="20815" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="20817" href="plfa.part2.DeBruijn.html#20817" class="Bound">k</a><a id="20818" class="Symbol">)</a> <a id="20829" class="Symbol">=</a> <a id="20832" href="plfa.part2.DeBruijn.html#20812" class="Bound">σ</a> <a id="20834" href="plfa.part2.DeBruijn.html#20817" class="Bound">k</a>
<a id="20836" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="20842" href="plfa.part2.DeBruijn.html#20842" class="Bound">σ</a> <a id="20844" class="Symbol">(</a><a id="20845" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="20847" href="plfa.part2.DeBruijn.html#20847" class="Bound">N</a><a id="20848" class="Symbol">)</a> <a id="20859" class="Symbol">=</a> <a id="20862" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="20864" class="Symbol">(</a><a id="20865" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="20871" class="Symbol">(</a><a id="20872" href="plfa.part2.DeBruijn.html#19784" class="Function">exts</a> <a id="20877" href="plfa.part2.DeBruijn.html#20842" class="Bound">σ</a><a id="20878" class="Symbol">)</a> <a id="20880" href="plfa.part2.DeBruijn.html#20847" class="Bound">N</a><a id="20881" class="Symbol">)</a>
<a id="20883" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="20889" href="plfa.part2.DeBruijn.html#20889" class="Bound">σ</a> <a id="20891" class="Symbol">(</a><a id="20892" href="plfa.part2.DeBruijn.html#20892" class="Bound">L</a> <a id="20894" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="20896" href="plfa.part2.DeBruijn.html#20896" class="Bound">M</a><a id="20897" class="Symbol">)</a> <a id="20906" class="Symbol">=</a> <a id="20909" class="Symbol">(</a><a id="20910" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="20916" href="plfa.part2.DeBruijn.html#20889" class="Bound">σ</a> <a id="20918" href="plfa.part2.DeBruijn.html#20892" class="Bound">L</a><a id="20919" class="Symbol">)</a> <a id="20921" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="20923" class="Symbol">(</a><a id="20924" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="20930" href="plfa.part2.DeBruijn.html#20889" class="Bound">σ</a> <a id="20932" href="plfa.part2.DeBruijn.html#20896" class="Bound">M</a><a id="20933" class="Symbol">)</a>
<a id="20935" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="20941" href="plfa.part2.DeBruijn.html#20941" class="Bound">σ</a> <a id="20943" class="Symbol">(</a><a id="20944" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="20949" class="Symbol">)</a> <a id="20958" class="Symbol">=</a> <a id="20961" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="20967" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="20973" href="plfa.part2.DeBruijn.html#20973" class="Bound">σ</a> <a id="20975" class="Symbol">(</a><a id="20976" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="20981" href="plfa.part2.DeBruijn.html#20981" class="Bound">M</a><a id="20982" class="Symbol">)</a> <a id="20990" class="Symbol">=</a> <a id="20993" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="20998" class="Symbol">(</a><a id="20999" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="21005" href="plfa.part2.DeBruijn.html#20973" class="Bound">σ</a> <a id="21007" href="plfa.part2.DeBruijn.html#20981" class="Bound">M</a><a id="21008" class="Symbol">)</a>
<a id="21010" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="21016" href="plfa.part2.DeBruijn.html#21016" class="Bound">σ</a> <a id="21018" class="Symbol">(</a><a id="21019" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="21024" href="plfa.part2.DeBruijn.html#21024" class="Bound">L</a> <a id="21026" href="plfa.part2.DeBruijn.html#21026" class="Bound">M</a> <a id="21028" href="plfa.part2.DeBruijn.html#21028" class="Bound">N</a><a id="21029" class="Symbol">)</a> <a id="21033" class="Symbol">=</a> <a id="21036" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="21041" class="Symbol">(</a><a id="21042" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="21048" href="plfa.part2.DeBruijn.html#21016" class="Bound">σ</a> <a id="21050" href="plfa.part2.DeBruijn.html#21024" class="Bound">L</a><a id="21051" class="Symbol">)</a> <a id="21053" class="Symbol">(</a><a id="21054" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="21060" href="plfa.part2.DeBruijn.html#21016" class="Bound">σ</a> <a id="21062" href="plfa.part2.DeBruijn.html#21026" class="Bound">M</a><a id="21063" class="Symbol">)</a> <a id="21065" class="Symbol">(</a><a id="21066" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="21072" class="Symbol">(</a><a id="21073" href="plfa.part2.DeBruijn.html#19784" class="Function">exts</a> <a id="21078" href="plfa.part2.DeBruijn.html#21016" class="Bound">σ</a><a id="21079" class="Symbol">)</a> <a id="21081" href="plfa.part2.DeBruijn.html#21028" class="Bound">N</a><a id="21082" class="Symbol">)</a>
<a id="21084" href="/19.08/DeBruijn/#20706" class="Function">subst</a> <a id="21090" href="plfa.part2.DeBruijn.html#21090" class="Bound">σ</a> <a id="21092" class="Symbol">(</a><a id="21093" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="21095" href="plfa.part2.DeBruijn.html#21095" class="Bound">N</a><a id="21096" class="Symbol">)</a> <a id="21107" class="Symbol">=</a> <a id="21110" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="21112" class="Symbol">(</a><a id="21113" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="21119" class="Symbol">(</a><a id="21120" href="plfa.part2.DeBruijn.html#19784" class="Function">exts</a> <a id="21125" href="plfa.part2.DeBruijn.html#21090" class="Bound">σ</a><a id="21126" class="Symbol">)</a> <a id="21128" href="plfa.part2.DeBruijn.html#21095" class="Bound">N</a><a id="21129" class="Symbol">)</a>
</pre>
<p>Let <code class="language-plaintext highlighter-rouge">σ</code> be the name of the map that takes variables in <code class="language-plaintext highlighter-rouge">Γ</code>
to terms over <code class="language-plaintext highlighter-rouge">Δ</code>. Lets unpack the first three cases:</p>
<ul>
<li>
<p>If the term is a variable, simply apply <code class="language-plaintext highlighter-rouge">σ</code>.</p>
</li>
<li>
<p>If the term is an abstraction, use the previous result
to extend the map <code class="language-plaintext highlighter-rouge">σ</code> suitably and recursively substitute
over the body of the abstraction.</p>
</li>
<li>
<p>If the term is an application, recursively substitute over
both the function and the argument.</p>
</li>
</ul>
<p>The remaining cases are similar, recursing on each subterm,
and extending the map whenever the construct introduces a
bound variable.</p>
<h2 id="single-substitution">Single substitution</h2>
<p>From the general case of substitution for multiple free
variables it is easy to define the special case of
substitution for one free variable:</p>
<pre class="Agda"><a id="_[_]"></a><a id="21859" href="/19.08/DeBruijn/#21859" class="Function Operator">_[_]</a> <a id="21864" class="Symbol">:</a> <a id="21866" class="Symbol"></a> <a id="21868" class="Symbol">{</a><a id="21869" href="plfa.part2.DeBruijn.html#21869" class="Bound">Γ</a> <a id="21871" href="plfa.part2.DeBruijn.html#21871" class="Bound">A</a> <a id="21873" href="plfa.part2.DeBruijn.html#21873" class="Bound">B</a><a id="21874" class="Symbol">}</a>
<a id="21884" class="Symbol"></a> <a id="21886" href="/19.08/DeBruijn/#21869" class="Bound">Γ</a> <a id="21888" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="21890" href="plfa.part2.DeBruijn.html#21873" class="Bound">B</a> <a id="21892" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="21894" href="plfa.part2.DeBruijn.html#21871" class="Bound">A</a>
<a id="21904" class="Symbol"></a> <a id="21906" href="/19.08/DeBruijn/#21869" class="Bound">Γ</a> <a id="21908" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="21910" href="plfa.part2.DeBruijn.html#21873" class="Bound">B</a>
<a id="21922" class="Comment">---------</a>
<a id="21940" class="Symbol"></a> <a id="21942" href="/19.08/DeBruijn/#21869" class="Bound">Γ</a> <a id="21944" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="21946" href="plfa.part2.DeBruijn.html#21871" class="Bound">A</a>
<a id="21948" href="/19.08/DeBruijn/#21859" class="Function Operator">_[_]</a> <a id="21953" class="Symbol">{</a><a id="21954" href="plfa.part2.DeBruijn.html#21954" class="Bound">Γ</a><a id="21955" class="Symbol">}</a> <a id="21957" class="Symbol">{</a><a id="21958" href="plfa.part2.DeBruijn.html#21958" class="Bound">A</a><a id="21959" class="Symbol">}</a> <a id="21961" class="Symbol">{</a><a id="21962" href="plfa.part2.DeBruijn.html#21962" class="Bound">B</a><a id="21963" class="Symbol">}</a> <a id="21965" href="plfa.part2.DeBruijn.html#21965" class="Bound">N</a> <a id="21967" href="plfa.part2.DeBruijn.html#21967" class="Bound">M</a> <a id="21969" class="Symbol">=</a> <a id="21972" href="plfa.part2.DeBruijn.html#20706" class="Function">subst</a> <a id="21978" class="Symbol">{</a><a id="21979" href="plfa.part2.DeBruijn.html#21954" class="Bound">Γ</a> <a id="21981" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="21983" href="plfa.part2.DeBruijn.html#21962" class="Bound">B</a><a id="21984" class="Symbol">}</a> <a id="21986" class="Symbol">{</a><a id="21987" href="plfa.part2.DeBruijn.html#21954" class="Bound">Γ</a><a id="21988" class="Symbol">}</a> <a id="21990" href="plfa.part2.DeBruijn.html#22008" class="Function">σ</a> <a id="21992" class="Symbol">{</a><a id="21993" href="plfa.part2.DeBruijn.html#21958" class="Bound">A</a><a id="21994" class="Symbol">}</a> <a id="21996" href="plfa.part2.DeBruijn.html#21965" class="Bound">N</a>
<a id="22000" class="Keyword">where</a>
<a id="22008" href="/19.08/DeBruijn/#22008" class="Function">σ</a> <a id="22010" class="Symbol">:</a> <a id="22012" class="Symbol"></a> <a id="22014" class="Symbol">{</a><a id="22015" href="plfa.part2.DeBruijn.html#22015" class="Bound">A</a><a id="22016" class="Symbol">}</a> <a id="22018" class="Symbol"></a> <a id="22020" href="plfa.part2.DeBruijn.html#21954" class="Bound">Γ</a> <a id="22022" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="22024" href="plfa.part2.DeBruijn.html#21962" class="Bound">B</a> <a id="22026" href="plfa.part2.DeBruijn.html#9823" class="Datatype Operator"></a> <a id="22028" href="plfa.part2.DeBruijn.html#22015" class="Bound">A</a> <a id="22030" class="Symbol"></a> <a id="22032" href="plfa.part2.DeBruijn.html#21954" class="Bound">Γ</a> <a id="22034" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="22036" href="plfa.part2.DeBruijn.html#22015" class="Bound">A</a>
<a id="22040" href="/19.08/DeBruijn/#22008" class="Function">σ</a> <a id="22042" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="22049" class="Symbol">=</a> <a id="22052" href="plfa.part2.DeBruijn.html#21967" class="Bound">M</a>
<a id="22056" href="/19.08/DeBruijn/#22008" class="Function">σ</a> <a id="22058" class="Symbol">(</a><a id="22059" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="22061" href="plfa.part2.DeBruijn.html#22061" class="Bound">x</a><a id="22062" class="Symbol">)</a> <a id="22065" class="Symbol">=</a> <a id="22068" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="22070" href="plfa.part2.DeBruijn.html#22061" class="Bound">x</a>
</pre>
<p>In a term of type <code class="language-plaintext highlighter-rouge">A</code> over context <code class="language-plaintext highlighter-rouge">Γ , B</code>, we replace the
variable of type <code class="language-plaintext highlighter-rouge">B</code> by a term of type <code class="language-plaintext highlighter-rouge">B</code> over context <code class="language-plaintext highlighter-rouge">Γ</code>.
To do so, we use a map from the context <code class="language-plaintext highlighter-rouge">Γ , B</code> to the context
<code class="language-plaintext highlighter-rouge">Γ</code>, that maps the last variable in the context to the term of
type <code class="language-plaintext highlighter-rouge">B</code> and every other free variable to itself.</p>
<p>Consider the previous example:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">(ƛ "z" ⇒ ` "s" · (` "s" · ` "z")) [ "s" := sucᶜ ]</code> yields
<code class="language-plaintext highlighter-rouge">ƛ "z" ⇒ sucᶜ · (sucᶜ · ` "z")</code></li>
</ul>
<p>Here is the example formalised:</p>
<pre class="Agda"><a id="M₂"></a><a id="22545" href="/19.08/DeBruijn/#22545" class="Function">M₂</a> <a id="22548" class="Symbol">:</a> <a id="22550" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="22552" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="22554" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="22557" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="22559" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="22562" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="22564" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="22567" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="22569" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="22572" href="/19.08/DeBruijn/#22545" class="Function">M₂</a> <a id="22575" class="Symbol">=</a> <a id="22577" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="22579" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="22581" class="Number">1</a> <a id="22583" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="22585" class="Symbol">(</a><a id="22586" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="22588" class="Number">1</a> <a id="22590" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="22592" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="22594" class="Number">0</a><a id="22595" class="Symbol">)</a>
<a id="M₃"></a><a id="22598" href="/19.08/DeBruijn/#22598" class="Function">M₃</a> <a id="22601" class="Symbol">:</a> <a id="22603" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="22605" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="22607" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="22610" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="22612" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="22615" href="/19.08/DeBruijn/#22598" class="Function">M₃</a> <a id="22618" class="Symbol">=</a> <a id="22620" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="22622" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="22627" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="22629" class="Number">0</a>
<a id="M₄"></a><a id="22632" href="/19.08/DeBruijn/#22632" class="Function">M₄</a> <a id="22635" class="Symbol">:</a> <a id="22637" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="22639" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="22641" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="22644" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="22646" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="22649" href="/19.08/DeBruijn/#22632" class="Function">M₄</a> <a id="22652" class="Symbol">=</a> <a id="22654" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="22656" class="Symbol">(</a><a id="22657" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="22659" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="22664" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="22666" class="Number">0</a><a id="22667" class="Symbol">)</a> <a id="22669" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="22671" class="Symbol">((</a><a id="22673" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="22675" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="22680" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="22682" class="Number">0</a><a id="22683" class="Symbol">)</a> <a id="22685" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="22687" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="22689" class="Number">0</a><a id="22690" class="Symbol">)</a>
<a id="22693" href="/19.08/DeBruijn/#22693" class="Function">_</a> <a id="22695" class="Symbol">:</a> <a id="22697" href="plfa.part2.DeBruijn.html#22545" class="Function">M₂</a> <a id="22700" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">[</a> <a id="22702" href="plfa.part2.DeBruijn.html#22598" class="Function">M₃</a> <a id="22705" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">]</a> <a id="22707" href="Agda.Builtin.Equality.html#125" class="Datatype Operator"></a> <a id="22709" href="plfa.part2.DeBruijn.html#22632" class="Function">M₄</a>
<a id="22712" class="Symbol">_</a> <a id="22714" class="Symbol">=</a> <a id="22716" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a>
</pre>
<p>Previously, we presented an example of substitution that we
did not implement, since it needed to rename the bound
variable to avoid capture:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">(ƛ "x" ⇒ ` "x" · ` "y") [ "y" := ` "x" · `zero ]</code> should yield
<code class="language-plaintext highlighter-rouge">ƛ "z" ⇒ ` "z" · (` "x" · `zero)</code></li>
</ul>
<p>Say the bound <code class="language-plaintext highlighter-rouge">"x"</code> has type <code class="language-plaintext highlighter-rouge">` ⇒ `</code>, the substituted
<code class="language-plaintext highlighter-rouge">"y"</code> has type <code class="language-plaintext highlighter-rouge">`</code>, and the free <code class="language-plaintext highlighter-rouge">"x"</code> also has type <code class="language-plaintext highlighter-rouge">
` ⇒ `</code>. Here is the example formalised:</p>
<pre class="Agda"><a id="M₅"></a><a id="23150" href="/19.08/DeBruijn/#23150" class="Function">M₅</a> <a id="23153" class="Symbol">:</a> <a id="23155" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="23157" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="23159" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23162" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="23164" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23167" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="23169" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23172" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="23174" class="Symbol">(</a><a id="23175" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23178" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="23180" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="23182" class="Symbol">)</a> <a id="23184" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="23186" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="23189" href="/19.08/DeBruijn/#23150" class="Function">M₅</a> <a id="23192" class="Symbol">=</a> <a id="23194" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="23196" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="23198" class="Number">0</a> <a id="23200" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="23202" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="23204" class="Number">1</a>
<a id="M₆"></a><a id="23207" href="/19.08/DeBruijn/#23207" class="Function">M₆</a> <a id="23210" class="Symbol">:</a> <a id="23212" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="23214" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="23216" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23219" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="23221" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23224" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="23226" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="23229" href="/19.08/DeBruijn/#23207" class="Function">M₆</a> <a id="23232" class="Symbol">=</a> <a id="23234" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="23236" class="Number">0</a> <a id="23238" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="23240" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="M₇"></a><a id="23247" href="/19.08/DeBruijn/#23247" class="Function">M₇</a> <a id="23250" class="Symbol">:</a> <a id="23252" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="23254" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="23256" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23259" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="23261" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23264" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="23266" class="Symbol">(</a><a id="23267" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="23270" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="23272" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="23274" class="Symbol">)</a> <a id="23276" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="23278" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="23281" href="/19.08/DeBruijn/#23247" class="Function">M₇</a> <a id="23284" class="Symbol">=</a> <a id="23286" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="23288" class="Symbol">(</a><a id="23289" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="23291" class="Number">0</a> <a id="23293" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="23295" class="Symbol">(</a><a id="23296" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="23298" class="Number">1</a> <a id="23300" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="23302" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="23307" class="Symbol">))</a>
<a id="23311" href="/19.08/DeBruijn/#23311" class="Function">_</a> <a id="23313" class="Symbol">:</a> <a id="23315" href="plfa.part2.DeBruijn.html#23150" class="Function">M₅</a> <a id="23318" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">[</a> <a id="23320" href="plfa.part2.DeBruijn.html#23207" class="Function">M₆</a> <a id="23323" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">]</a> <a id="23325" href="Agda.Builtin.Equality.html#125" class="Datatype Operator"></a> <a id="23327" href="plfa.part2.DeBruijn.html#23247" class="Function">M₇</a>
<a id="23330" class="Symbol">_</a> <a id="23332" class="Symbol">=</a> <a id="23334" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a>
</pre>
<p>The logician Haskell Curry observed that getting the
definition of substitution right can be a tricky business. It
can be even trickier when using de Bruijn indices, which can
often be hard to decipher. Under the current approach, any
definition of substitution must, of necessity, preserves
types. While this makes the definition more involved, it
means that once it is done the hardest work is out of the way.
And combining definition with proof makes it harder for errors
to sneak in.</p>
<h2 id="values">Values</h2>
<p>The definition of value is much as before, save that the
added types incorporate the same information found in the
Canonical Forms lemma:</p>
<pre class="Agda"><a id="23990" class="Keyword">data</a> <a id="Value"></a><a id="23995" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="24001" class="Symbol">:</a> <a id="24003" class="Symbol"></a> <a id="24005" class="Symbol">{</a><a id="24006" href="plfa.part2.DeBruijn.html#24006" class="Bound">Γ</a> <a id="24008" href="plfa.part2.DeBruijn.html#24008" class="Bound">A</a><a id="24009" class="Symbol">}</a> <a id="24011" class="Symbol"></a> <a id="24013" href="plfa.part2.DeBruijn.html#24006" class="Bound">Γ</a> <a id="24015" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24017" href="plfa.part2.DeBruijn.html#24008" class="Bound">A</a> <a id="24019" class="Symbol"></a> <a id="24021" class="PrimitiveType">Set</a> <a id="24025" class="Keyword">where</a>
<a id="Value.V-ƛ"></a><a id="24034" href="/19.08/DeBruijn/#24034" class="InductiveConstructor">V-ƛ</a> <a id="24038" class="Symbol">:</a> <a id="24040" class="Symbol"></a> <a id="24042" class="Symbol">{</a><a id="24043" href="plfa.part2.DeBruijn.html#24043" class="Bound">Γ</a> <a id="24045" href="plfa.part2.DeBruijn.html#24045" class="Bound">A</a> <a id="24047" href="plfa.part2.DeBruijn.html#24047" class="Bound">B</a><a id="24048" class="Symbol">}</a> <a id="24050" class="Symbol">{</a><a id="24051" href="plfa.part2.DeBruijn.html#24051" class="Bound">N</a> <a id="24053" class="Symbol">:</a> <a id="24055" href="plfa.part2.DeBruijn.html#24043" class="Bound">Γ</a> <a id="24057" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="24059" href="plfa.part2.DeBruijn.html#24045" class="Bound">A</a> <a id="24061" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24063" href="plfa.part2.DeBruijn.html#24047" class="Bound">B</a><a id="24064" class="Symbol">}</a>
<a id="24072" class="Comment">---------------------------</a>
<a id="24104" class="Symbol"></a> <a id="24106" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="24112" class="Symbol">(</a><a id="24113" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="24115" href="plfa.part2.DeBruijn.html#24051" class="Bound">N</a><a id="24116" class="Symbol">)</a>
<a id="Value.V-zero"></a><a id="24121" href="/19.08/DeBruijn/#24121" class="InductiveConstructor">V-zero</a> <a id="24128" class="Symbol">:</a> <a id="24130" class="Symbol"></a> <a id="24132" class="Symbol">{</a><a id="24133" href="plfa.part2.DeBruijn.html#24133" class="Bound">Γ</a><a id="24134" class="Symbol">}</a>
<a id="24142" class="Comment">-----------------</a>
<a id="24164" class="Symbol"></a> <a id="24166" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="24172" class="Symbol">(</a><a id="24173" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="24179" class="Symbol">{</a><a id="24180" href="plfa.part2.DeBruijn.html#24133" class="Bound">Γ</a><a id="24181" class="Symbol">})</a>
<a id="Value.V-suc"></a><a id="24187" href="/19.08/DeBruijn/#24187" class="InductiveConstructor">V-suc</a> <a id="24193" class="Symbol">:</a> <a id="24195" class="Symbol"></a> <a id="24197" class="Symbol">{</a><a id="24198" href="plfa.part2.DeBruijn.html#24198" class="Bound">Γ</a><a id="24199" class="Symbol">}</a> <a id="24201" class="Symbol">{</a><a id="24202" href="plfa.part2.DeBruijn.html#24202" class="Bound">V</a> <a id="24204" class="Symbol">:</a> <a id="24206" href="plfa.part2.DeBruijn.html#24198" class="Bound">Γ</a> <a id="24208" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24210" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="24212" class="Symbol">}</a>
<a id="24218" class="Symbol"></a> <a id="24220" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="24226" href="plfa.part2.DeBruijn.html#24202" class="Bound">V</a>
<a id="24234" class="Comment">--------------</a>
<a id="24253" class="Symbol"></a> <a id="24255" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="24261" class="Symbol">(</a><a id="24262" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="24267" href="plfa.part2.DeBruijn.html#24202" class="Bound">V</a><a id="24268" class="Symbol">)</a>
</pre>
<p>Here <code class="language-plaintext highlighter-rouge">zero</code> requires an implicit parameter to aid inference,
much in the same way that <code class="language-plaintext highlighter-rouge">[]</code> did in
<a href="/19.08/Lists/">Lists</a>.</p>
<h2 id="reduction">Reduction</h2>
<p>The reduction rules are the same as those given earlier, save
that for each term we must specify its types. As before, we
have compatibility rules that reduce a part of a term,
labelled with <code class="language-plaintext highlighter-rouge">ξ</code>, and rules that simplify a constructor
combined with a destructor, labelled with <code class="language-plaintext highlighter-rouge">β</code>:</p>
<pre class="Agda"><a id="24713" class="Keyword">infix</a> <a id="24719" class="Number">2</a> <a id="24721" href="/19.08/DeBruijn/#24732" class="Datatype Operator">_—→_</a>
<a id="24727" class="Keyword">data</a> <a id="_—→_"></a><a id="24732" href="/19.08/DeBruijn/#24732" class="Datatype Operator">_—→_</a> <a id="24737" class="Symbol">:</a> <a id="24739" class="Symbol"></a> <a id="24741" class="Symbol">{</a><a id="24742" href="plfa.part2.DeBruijn.html#24742" class="Bound">Γ</a> <a id="24744" href="plfa.part2.DeBruijn.html#24744" class="Bound">A</a><a id="24745" class="Symbol">}</a> <a id="24747" class="Symbol"></a> <a id="24749" class="Symbol">(</a><a id="24750" href="plfa.part2.DeBruijn.html#24742" class="Bound">Γ</a> <a id="24752" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24754" href="plfa.part2.DeBruijn.html#24744" class="Bound">A</a><a id="24755" class="Symbol">)</a> <a id="24757" class="Symbol"></a> <a id="24759" class="Symbol">(</a><a id="24760" href="plfa.part2.DeBruijn.html#24742" class="Bound">Γ</a> <a id="24762" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24764" href="plfa.part2.DeBruijn.html#24744" class="Bound">A</a><a id="24765" class="Symbol">)</a> <a id="24767" class="Symbol"></a> <a id="24769" class="PrimitiveType">Set</a> <a id="24773" class="Keyword">where</a>
<a id="_—→_.ξ-·₁"></a><a id="24782" href="/19.08/DeBruijn/#24782" class="InductiveConstructor">ξ-·₁</a> <a id="24787" class="Symbol">:</a> <a id="24789" class="Symbol"></a> <a id="24791" class="Symbol">{</a><a id="24792" href="plfa.part2.DeBruijn.html#24792" class="Bound">Γ</a> <a id="24794" href="plfa.part2.DeBruijn.html#24794" class="Bound">A</a> <a id="24796" href="plfa.part2.DeBruijn.html#24796" class="Bound">B</a><a id="24797" class="Symbol">}</a> <a id="24799" class="Symbol">{</a><a id="24800" href="plfa.part2.DeBruijn.html#24800" class="Bound">L</a> <a id="24802" href="plfa.part2.DeBruijn.html#24802" class="Bound">L</a> <a id="24805" class="Symbol">:</a> <a id="24807" href="plfa.part2.DeBruijn.html#24792" class="Bound">Γ</a> <a id="24809" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24811" href="plfa.part2.DeBruijn.html#24794" class="Bound">A</a> <a id="24813" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="24815" href="plfa.part2.DeBruijn.html#24796" class="Bound">B</a><a id="24816" class="Symbol">}</a> <a id="24818" class="Symbol">{</a><a id="24819" href="plfa.part2.DeBruijn.html#24819" class="Bound">M</a> <a id="24821" class="Symbol">:</a> <a id="24823" href="plfa.part2.DeBruijn.html#24792" class="Bound">Γ</a> <a id="24825" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24827" href="plfa.part2.DeBruijn.html#24794" class="Bound">A</a><a id="24828" class="Symbol">}</a>
<a id="24834" class="Symbol"></a> <a id="24836" href="/19.08/DeBruijn/#24800" class="Bound">L</a> <a id="24838" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="24841" href="plfa.part2.DeBruijn.html#24802" class="Bound">L</a>
<a id="24850" class="Comment">---------------</a>
<a id="24870" class="Symbol"></a> <a id="24872" href="/19.08/DeBruijn/#24800" class="Bound">L</a> <a id="24874" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="24876" href="plfa.part2.DeBruijn.html#24819" class="Bound">M</a> <a id="24878" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="24881" href="plfa.part2.DeBruijn.html#24802" class="Bound">L</a> <a id="24884" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="24886" href="plfa.part2.DeBruijn.html#24819" class="Bound">M</a>
<a id="_—→_.ξ-·₂"></a><a id="24891" href="/19.08/DeBruijn/#24891" class="InductiveConstructor">ξ-·₂</a> <a id="24896" class="Symbol">:</a> <a id="24898" class="Symbol"></a> <a id="24900" class="Symbol">{</a><a id="24901" href="plfa.part2.DeBruijn.html#24901" class="Bound">Γ</a> <a id="24903" href="plfa.part2.DeBruijn.html#24903" class="Bound">A</a> <a id="24905" href="plfa.part2.DeBruijn.html#24905" class="Bound">B</a><a id="24906" class="Symbol">}</a> <a id="24908" class="Symbol">{</a><a id="24909" href="plfa.part2.DeBruijn.html#24909" class="Bound">V</a> <a id="24911" class="Symbol">:</a> <a id="24913" href="plfa.part2.DeBruijn.html#24901" class="Bound">Γ</a> <a id="24915" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24917" href="plfa.part2.DeBruijn.html#24903" class="Bound">A</a> <a id="24919" href="plfa.part2.DeBruijn.html#8730" class="InductiveConstructor Operator"></a> <a id="24921" href="plfa.part2.DeBruijn.html#24905" class="Bound">B</a><a id="24922" class="Symbol">}</a> <a id="24924" class="Symbol">{</a><a id="24925" href="plfa.part2.DeBruijn.html#24925" class="Bound">M</a> <a id="24927" href="plfa.part2.DeBruijn.html#24927" class="Bound">M</a> <a id="24930" class="Symbol">:</a> <a id="24932" href="plfa.part2.DeBruijn.html#24901" class="Bound">Γ</a> <a id="24934" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="24936" href="plfa.part2.DeBruijn.html#24903" class="Bound">A</a><a id="24937" class="Symbol">}</a>
<a id="24943" class="Symbol"></a> <a id="24945" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="24951" href="plfa.part2.DeBruijn.html#24909" class="Bound">V</a>
<a id="24957" class="Symbol"></a> <a id="24959" href="/19.08/DeBruijn/#24925" class="Bound">M</a> <a id="24961" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="24964" href="plfa.part2.DeBruijn.html#24927" class="Bound">M</a>
<a id="24973" class="Comment">---------------</a>
<a id="24993" class="Symbol"></a> <a id="24995" href="/19.08/DeBruijn/#24909" class="Bound">V</a> <a id="24997" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="24999" href="plfa.part2.DeBruijn.html#24925" class="Bound">M</a> <a id="25001" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25004" href="plfa.part2.DeBruijn.html#24909" class="Bound">V</a> <a id="25006" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="25008" href="plfa.part2.DeBruijn.html#24927" class="Bound">M</a>
<a id="_—→_.β-ƛ"></a><a id="25014" href="/19.08/DeBruijn/#25014" class="InductiveConstructor">β-ƛ</a> <a id="25018" class="Symbol">:</a> <a id="25020" class="Symbol"></a> <a id="25022" class="Symbol">{</a><a id="25023" href="plfa.part2.DeBruijn.html#25023" class="Bound">Γ</a> <a id="25025" href="plfa.part2.DeBruijn.html#25025" class="Bound">A</a> <a id="25027" href="plfa.part2.DeBruijn.html#25027" class="Bound">B</a><a id="25028" class="Symbol">}</a> <a id="25030" class="Symbol">{</a><a id="25031" href="plfa.part2.DeBruijn.html#25031" class="Bound">N</a> <a id="25033" class="Symbol">:</a> <a id="25035" href="plfa.part2.DeBruijn.html#25023" class="Bound">Γ</a> <a id="25037" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="25039" href="plfa.part2.DeBruijn.html#25025" class="Bound">A</a> <a id="25041" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25043" href="plfa.part2.DeBruijn.html#25027" class="Bound">B</a><a id="25044" class="Symbol">}</a> <a id="25046" class="Symbol">{</a><a id="25047" href="plfa.part2.DeBruijn.html#25047" class="Bound">W</a> <a id="25049" class="Symbol">:</a> <a id="25051" href="plfa.part2.DeBruijn.html#25023" class="Bound">Γ</a> <a id="25053" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25055" href="plfa.part2.DeBruijn.html#25025" class="Bound">A</a><a id="25056" class="Symbol">}</a>
<a id="25062" class="Symbol"></a> <a id="25064" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="25070" href="plfa.part2.DeBruijn.html#25047" class="Bound">W</a>
<a id="25078" class="Comment">--------------------</a>
<a id="25103" class="Symbol"></a> <a id="25105" class="Symbol">(</a><a id="25106" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="25108" href="plfa.part2.DeBruijn.html#25031" class="Bound">N</a><a id="25109" class="Symbol">)</a> <a id="25111" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="25113" href="plfa.part2.DeBruijn.html#25047" class="Bound">W</a> <a id="25115" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25118" href="plfa.part2.DeBruijn.html#25031" class="Bound">N</a> <a id="25120" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">[</a> <a id="25122" href="plfa.part2.DeBruijn.html#25047" class="Bound">W</a> <a id="25124" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">]</a>
<a id="_—→_.ξ-suc"></a><a id="25129" href="/19.08/DeBruijn/#25129" class="InductiveConstructor">ξ-suc</a> <a id="25135" class="Symbol">:</a> <a id="25137" class="Symbol"></a> <a id="25139" class="Symbol">{</a><a id="25140" href="plfa.part2.DeBruijn.html#25140" class="Bound">Γ</a><a id="25141" class="Symbol">}</a> <a id="25143" class="Symbol">{</a><a id="25144" href="plfa.part2.DeBruijn.html#25144" class="Bound">M</a> <a id="25146" href="plfa.part2.DeBruijn.html#25146" class="Bound">M</a> <a id="25149" class="Symbol">:</a> <a id="25151" href="plfa.part2.DeBruijn.html#25140" class="Bound">Γ</a> <a id="25153" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25155" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="25157" class="Symbol">}</a>
<a id="25163" class="Symbol"></a> <a id="25165" href="/19.08/DeBruijn/#25144" class="Bound">M</a> <a id="25167" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25170" href="plfa.part2.DeBruijn.html#25146" class="Bound">M</a>
<a id="25179" class="Comment">-----------------</a>
<a id="25201" class="Symbol"></a> <a id="25203" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="25208" href="plfa.part2.DeBruijn.html#25144" class="Bound">M</a> <a id="25210" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25213" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="25218" href="plfa.part2.DeBruijn.html#25146" class="Bound">M</a>
<a id="_—→_.ξ-case"></a><a id="25224" href="/19.08/DeBruijn/#25224" class="InductiveConstructor">ξ-case</a> <a id="25231" class="Symbol">:</a> <a id="25233" class="Symbol"></a> <a id="25235" class="Symbol">{</a><a id="25236" href="plfa.part2.DeBruijn.html#25236" class="Bound">Γ</a> <a id="25238" href="plfa.part2.DeBruijn.html#25238" class="Bound">A</a><a id="25239" class="Symbol">}</a> <a id="25241" class="Symbol">{</a><a id="25242" href="plfa.part2.DeBruijn.html#25242" class="Bound">L</a> <a id="25244" href="plfa.part2.DeBruijn.html#25244" class="Bound">L</a> <a id="25247" class="Symbol">:</a> <a id="25249" href="plfa.part2.DeBruijn.html#25236" class="Bound">Γ</a> <a id="25251" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25253" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="25255" class="Symbol">}</a> <a id="25257" class="Symbol">{</a><a id="25258" href="plfa.part2.DeBruijn.html#25258" class="Bound">M</a> <a id="25260" class="Symbol">:</a> <a id="25262" href="plfa.part2.DeBruijn.html#25236" class="Bound">Γ</a> <a id="25264" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25266" href="plfa.part2.DeBruijn.html#25238" class="Bound">A</a><a id="25267" class="Symbol">}</a> <a id="25269" class="Symbol">{</a><a id="25270" href="plfa.part2.DeBruijn.html#25270" class="Bound">N</a> <a id="25272" class="Symbol">:</a> <a id="25274" href="plfa.part2.DeBruijn.html#25236" class="Bound">Γ</a> <a id="25276" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="25278" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="25281" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25283" href="plfa.part2.DeBruijn.html#25238" class="Bound">A</a><a id="25284" class="Symbol">}</a>
<a id="25290" class="Symbol"></a> <a id="25292" href="/19.08/DeBruijn/#25242" class="Bound">L</a> <a id="25294" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25297" href="plfa.part2.DeBruijn.html#25244" class="Bound">L</a>
<a id="25306" class="Comment">-------------------------</a>
<a id="25336" class="Symbol"></a> <a id="25338" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="25343" href="plfa.part2.DeBruijn.html#25242" class="Bound">L</a> <a id="25345" href="plfa.part2.DeBruijn.html#25258" class="Bound">M</a> <a id="25347" href="plfa.part2.DeBruijn.html#25270" class="Bound">N</a> <a id="25349" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25352" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="25357" href="plfa.part2.DeBruijn.html#25244" class="Bound">L</a> <a id="25360" href="plfa.part2.DeBruijn.html#25258" class="Bound">M</a> <a id="25362" href="plfa.part2.DeBruijn.html#25270" class="Bound">N</a>
<a id="_—→_.β-zero"></a><a id="25367" href="/19.08/DeBruijn/#25367" class="InductiveConstructor">β-zero</a> <a id="25374" class="Symbol">:</a> <a id="25377" class="Symbol"></a> <a id="25379" class="Symbol">{</a><a id="25380" href="plfa.part2.DeBruijn.html#25380" class="Bound">Γ</a> <a id="25382" href="plfa.part2.DeBruijn.html#25382" class="Bound">A</a><a id="25383" class="Symbol">}</a> <a id="25385" class="Symbol">{</a><a id="25386" href="plfa.part2.DeBruijn.html#25386" class="Bound">M</a> <a id="25388" class="Symbol">:</a> <a id="25390" href="plfa.part2.DeBruijn.html#25380" class="Bound">Γ</a> <a id="25392" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25394" href="plfa.part2.DeBruijn.html#25382" class="Bound">A</a><a id="25395" class="Symbol">}</a> <a id="25397" class="Symbol">{</a><a id="25398" href="plfa.part2.DeBruijn.html#25398" class="Bound">N</a> <a id="25400" class="Symbol">:</a> <a id="25402" href="plfa.part2.DeBruijn.html#25380" class="Bound">Γ</a> <a id="25404" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="25406" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="25409" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25411" href="plfa.part2.DeBruijn.html#25382" class="Bound">A</a><a id="25412" class="Symbol">}</a>
<a id="25420" class="Comment">-------------------</a>
<a id="25444" class="Symbol"></a> <a id="25446" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="25451" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="25457" href="plfa.part2.DeBruijn.html#25386" class="Bound">M</a> <a id="25459" href="plfa.part2.DeBruijn.html#25398" class="Bound">N</a> <a id="25461" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25464" href="plfa.part2.DeBruijn.html#25386" class="Bound">M</a>
<a id="_—→_.β-suc"></a><a id="25469" href="/19.08/DeBruijn/#25469" class="InductiveConstructor">β-suc</a> <a id="25475" class="Symbol">:</a> <a id="25477" class="Symbol"></a> <a id="25479" class="Symbol">{</a><a id="25480" href="plfa.part2.DeBruijn.html#25480" class="Bound">Γ</a> <a id="25482" href="plfa.part2.DeBruijn.html#25482" class="Bound">A</a><a id="25483" class="Symbol">}</a> <a id="25485" class="Symbol">{</a><a id="25486" href="plfa.part2.DeBruijn.html#25486" class="Bound">V</a> <a id="25488" class="Symbol">:</a> <a id="25490" href="plfa.part2.DeBruijn.html#25480" class="Bound">Γ</a> <a id="25492" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25494" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a><a id="25496" class="Symbol">}</a> <a id="25498" class="Symbol">{</a><a id="25499" href="plfa.part2.DeBruijn.html#25499" class="Bound">M</a> <a id="25501" class="Symbol">:</a> <a id="25503" href="plfa.part2.DeBruijn.html#25480" class="Bound">Γ</a> <a id="25505" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25507" href="plfa.part2.DeBruijn.html#25482" class="Bound">A</a><a id="25508" class="Symbol">}</a> <a id="25510" class="Symbol">{</a><a id="25511" href="plfa.part2.DeBruijn.html#25511" class="Bound">N</a> <a id="25513" class="Symbol">:</a> <a id="25515" href="plfa.part2.DeBruijn.html#25480" class="Bound">Γ</a> <a id="25517" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="25519" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a> <a id="25522" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25524" href="plfa.part2.DeBruijn.html#25482" class="Bound">A</a><a id="25525" class="Symbol">}</a>
<a id="25531" class="Symbol"></a> <a id="25533" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="25539" href="plfa.part2.DeBruijn.html#25486" class="Bound">V</a>
<a id="25547" class="Comment">----------------------------</a>
<a id="25580" class="Symbol"></a> <a id="25582" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="25587" class="Symbol">(</a><a id="25588" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="25593" href="plfa.part2.DeBruijn.html#25486" class="Bound">V</a><a id="25594" class="Symbol">)</a> <a id="25596" href="plfa.part2.DeBruijn.html#25499" class="Bound">M</a> <a id="25598" href="plfa.part2.DeBruijn.html#25511" class="Bound">N</a> <a id="25600" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25603" href="plfa.part2.DeBruijn.html#25511" class="Bound">N</a> <a id="25605" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">[</a> <a id="25607" href="plfa.part2.DeBruijn.html#25486" class="Bound">V</a> <a id="25609" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">]</a>
<a id="_—→_.β-μ"></a><a id="25614" href="/19.08/DeBruijn/#25614" class="InductiveConstructor">β-μ</a> <a id="25618" class="Symbol">:</a> <a id="25620" class="Symbol"></a> <a id="25622" class="Symbol">{</a><a id="25623" href="plfa.part2.DeBruijn.html#25623" class="Bound">Γ</a> <a id="25625" href="plfa.part2.DeBruijn.html#25625" class="Bound">A</a><a id="25626" class="Symbol">}</a> <a id="25628" class="Symbol">{</a><a id="25629" href="plfa.part2.DeBruijn.html#25629" class="Bound">N</a> <a id="25631" class="Symbol">:</a> <a id="25633" href="plfa.part2.DeBruijn.html#25623" class="Bound">Γ</a> <a id="25635" href="plfa.part2.DeBruijn.html#8917" class="InductiveConstructor Operator">,</a> <a id="25637" href="plfa.part2.DeBruijn.html#25625" class="Bound">A</a> <a id="25639" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="25641" href="plfa.part2.DeBruijn.html#25625" class="Bound">A</a><a id="25642" class="Symbol">}</a>
<a id="25650" class="Comment">----------------</a>
<a id="25671" class="Symbol"></a> <a id="25673" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a> <a id="25675" href="plfa.part2.DeBruijn.html#25629" class="Bound">N</a> <a id="25677" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="25680" href="plfa.part2.DeBruijn.html#25629" class="Bound">N</a> <a id="25682" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">[</a> <a id="25684" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="25686" href="plfa.part2.DeBruijn.html#25629" class="Bound">N</a> <a id="25688" href="plfa.part2.DeBruijn.html#21859" class="Function Operator">]</a>
</pre>
<p>The definition states that <code class="language-plaintext highlighter-rouge">M —→ N</code> can only hold of terms <code class="language-plaintext highlighter-rouge">M</code>
and <code class="language-plaintext highlighter-rouge">N</code> which <em>both</em> have type <code class="language-plaintext highlighter-rouge">Γ ⊢ A</code> for some context <code class="language-plaintext highlighter-rouge">Γ</code>
and type <code class="language-plaintext highlighter-rouge">A</code>. In other words, it is <em>built-in</em> to our
definition that reduction preserves types. There is no
separate Preservation theorem to prove. The Agda type-checker
validates that each term preserves types. In the case of <code class="language-plaintext highlighter-rouge">β</code>
rules, preservation depends on the fact that substitution
preserves types, which is built-in to our
definition of substitution.</p>
<h2 id="reflexive-and-transitive-closure">Reflexive and transitive closure</h2>
<p>The reflexive and transitive closure is exactly as before.
We simply cut-and-paste the previous definition:</p>
<pre class="Agda"><a id="26332" class="Keyword">infix</a> <a id="26339" class="Number">2</a> <a id="26341" href="/19.08/DeBruijn/#26397" class="Datatype Operator">_—↠_</a>
<a id="26346" class="Keyword">infix</a> <a id="26353" class="Number">1</a> <a id="26355" href="/19.08/DeBruijn/#26598" class="Function Operator">begin_</a>
<a id="26362" class="Keyword">infixr</a> <a id="26369" class="Number">2</a> <a id="26371" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">_—→⟨_⟩_</a>
<a id="26379" class="Keyword">infix</a> <a id="26386" class="Number">3</a> <a id="26388" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator">_∎</a>
<a id="26392" class="Keyword">data</a> <a id="_—↠_"></a><a id="26397" href="/19.08/DeBruijn/#26397" class="Datatype Operator">_—↠_</a> <a id="26402" class="Symbol">:</a> <a id="26404" class="Symbol"></a> <a id="26406" class="Symbol">{</a><a id="26407" href="plfa.part2.DeBruijn.html#26407" class="Bound">Γ</a> <a id="26409" href="plfa.part2.DeBruijn.html#26409" class="Bound">A</a><a id="26410" class="Symbol">}</a> <a id="26412" class="Symbol"></a> <a id="26414" class="Symbol">(</a><a id="26415" href="plfa.part2.DeBruijn.html#26407" class="Bound">Γ</a> <a id="26417" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="26419" href="plfa.part2.DeBruijn.html#26409" class="Bound">A</a><a id="26420" class="Symbol">)</a> <a id="26422" class="Symbol"></a> <a id="26424" class="Symbol">(</a><a id="26425" href="plfa.part2.DeBruijn.html#26407" class="Bound">Γ</a> <a id="26427" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="26429" href="plfa.part2.DeBruijn.html#26409" class="Bound">A</a><a id="26430" class="Symbol">)</a> <a id="26432" class="Symbol"></a> <a id="26434" class="PrimitiveType">Set</a> <a id="26438" class="Keyword">where</a>
<a id="_—↠_._∎"></a><a id="26447" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator">_∎</a> <a id="26450" class="Symbol">:</a> <a id="26452" class="Symbol"></a> <a id="26454" class="Symbol">{</a><a id="26455" href="plfa.part2.DeBruijn.html#26455" class="Bound">Γ</a> <a id="26457" href="plfa.part2.DeBruijn.html#26457" class="Bound">A</a><a id="26458" class="Symbol">}</a> <a id="26460" class="Symbol">(</a><a id="26461" href="plfa.part2.DeBruijn.html#26461" class="Bound">M</a> <a id="26463" class="Symbol">:</a> <a id="26465" href="plfa.part2.DeBruijn.html#26455" class="Bound">Γ</a> <a id="26467" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="26469" href="plfa.part2.DeBruijn.html#26457" class="Bound">A</a><a id="26470" class="Symbol">)</a>
<a id="26478" class="Comment">------</a>
<a id="26489" class="Symbol"></a> <a id="26491" href="/19.08/DeBruijn/#26461" class="Bound">M</a> <a id="26493" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="26496" href="plfa.part2.DeBruijn.html#26461" class="Bound">M</a>
<a id="_—↠_._—→⟨_⟩_"></a><a id="26501" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">_—→⟨_⟩_</a> <a id="26509" class="Symbol">:</a> <a id="26511" class="Symbol"></a> <a id="26513" class="Symbol">{</a><a id="26514" href="plfa.part2.DeBruijn.html#26514" class="Bound">Γ</a> <a id="26516" href="plfa.part2.DeBruijn.html#26516" class="Bound">A</a><a id="26517" class="Symbol">}</a> <a id="26519" class="Symbol">(</a><a id="26520" href="plfa.part2.DeBruijn.html#26520" class="Bound">L</a> <a id="26522" class="Symbol">:</a> <a id="26524" href="plfa.part2.DeBruijn.html#26514" class="Bound">Γ</a> <a id="26526" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="26528" href="plfa.part2.DeBruijn.html#26516" class="Bound">A</a><a id="26529" class="Symbol">)</a> <a id="26531" class="Symbol">{</a><a id="26532" href="plfa.part2.DeBruijn.html#26532" class="Bound">M</a> <a id="26534" href="plfa.part2.DeBruijn.html#26534" class="Bound">N</a> <a id="26536" class="Symbol">:</a> <a id="26538" href="plfa.part2.DeBruijn.html#26514" class="Bound">Γ</a> <a id="26540" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="26542" href="plfa.part2.DeBruijn.html#26516" class="Bound">A</a><a id="26543" class="Symbol">}</a>
<a id="26549" class="Symbol"></a> <a id="26551" href="/19.08/DeBruijn/#26520" class="Bound">L</a> <a id="26553" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="26556" href="plfa.part2.DeBruijn.html#26532" class="Bound">M</a>
<a id="26562" class="Symbol"></a> <a id="26564" href="/19.08/DeBruijn/#26532" class="Bound">M</a> <a id="26566" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="26569" href="plfa.part2.DeBruijn.html#26534" class="Bound">N</a>
<a id="26577" class="Comment">------</a>
<a id="26588" class="Symbol"></a> <a id="26590" href="/19.08/DeBruijn/#26520" class="Bound">L</a> <a id="26592" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="26595" href="plfa.part2.DeBruijn.html#26534" class="Bound">N</a>
<a id="begin_"></a><a id="26598" href="/19.08/DeBruijn/#26598" class="Function Operator">begin_</a> <a id="26605" class="Symbol">:</a> <a id="26607" class="Symbol"></a> <a id="26609" class="Symbol">{</a><a id="26610" href="plfa.part2.DeBruijn.html#26610" class="Bound">Γ</a> <a id="26612" href="plfa.part2.DeBruijn.html#26612" class="Bound">A</a><a id="26613" class="Symbol">}</a> <a id="26615" class="Symbol">{</a><a id="26616" href="plfa.part2.DeBruijn.html#26616" class="Bound">M</a> <a id="26618" href="plfa.part2.DeBruijn.html#26618" class="Bound">N</a> <a id="26620" class="Symbol">:</a> <a id="26622" href="plfa.part2.DeBruijn.html#26610" class="Bound">Γ</a> <a id="26624" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="26626" href="plfa.part2.DeBruijn.html#26612" class="Bound">A</a><a id="26627" class="Symbol">}</a>
<a id="26631" class="Symbol"></a> <a id="26633" href="/19.08/DeBruijn/#26616" class="Bound">M</a> <a id="26635" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="26638" href="plfa.part2.DeBruijn.html#26618" class="Bound">N</a>
<a id="26644" class="Comment">------</a>
<a id="26653" class="Symbol"></a> <a id="26655" href="/19.08/DeBruijn/#26616" class="Bound">M</a> <a id="26657" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="26660" href="plfa.part2.DeBruijn.html#26618" class="Bound">N</a>
<a id="26662" href="/19.08/DeBruijn/#26598" class="Function Operator">begin</a> <a id="26668" href="plfa.part2.DeBruijn.html#26668" class="Bound">M—↠N</a> <a id="26673" class="Symbol">=</a> <a id="26675" href="plfa.part2.DeBruijn.html#26668" class="Bound">M—↠N</a>
</pre>
<h2 id="examples">Examples</h2>
<p>We reiterate each of our previous examples. First, the Church
numeral two applied to the successor function and zero yields
the natural number two:</p>
<pre class="Agda"><a id="26852" href="/19.08/DeBruijn/#26852" class="Function">_</a> <a id="26854" class="Symbol">:</a> <a id="26856" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="26861" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="26863" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="26868" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="26870" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="26876" class="Symbol">{</a><a id="26877" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a><a id="26878" class="Symbol">}</a> <a id="26880" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="26883" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="26888" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="26893" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="26899" class="Symbol">_</a> <a id="26901" class="Symbol">=</a>
<a id="26905" href="/19.08/DeBruijn/#26598" class="Function Operator">begin</a>
<a id="26915" href="/19.08/DeBruijn/#14352" class="Function">twoᶜ</a> <a id="26920" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="26922" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="26927" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="26929" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="26937" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="26941" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="26946" class="Symbol">(</a><a id="26947" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="26951" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="26954" class="Symbol">)</a> <a id="26956" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="26962" class="Symbol">(</a><a id="26963" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="26965" class="Symbol">(</a><a id="26966" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="26971" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="26973" class="Symbol">(</a><a id="26974" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="26979" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="26981" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="26983" class="Number">0</a><a id="26984" class="Symbol">)))</a> <a id="26988" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="26990" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="26998" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27002" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="27006" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a> <a id="27013" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27019" href="/19.08/DeBruijn/#14500" class="Function">sucᶜ</a> <a id="27024" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27026" class="Symbol">(</a><a id="27027" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="27032" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27034" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="27039" class="Symbol">)</a>
<a id="27043" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27047" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="27052" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="27056" class="Symbol">(</a><a id="27057" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="27061" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="27067" class="Symbol">)</a> <a id="27069" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27075" href="/19.08/DeBruijn/#14500" class="Function">sucᶜ</a> <a id="27080" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27082" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27087" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="27095" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27099" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="27103" class="Symbol">(</a><a id="27104" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27110" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="27116" class="Symbol">)</a> <a id="27118" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27123" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="27128" class="Symbol">(</a><a id="27129" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27134" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="27139" class="Symbol">)</a>
<a id="27143" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator"></a>
</pre>
<p>As before, we need to supply an explicit context to <code class="language-plaintext highlighter-rouge">`zero</code>.</p>
<p>Next, a sample reduction demonstrating that two plus two is four:</p>
<pre class="Agda"><a id="27285" href="/19.08/DeBruijn/#27285" class="Function">_</a> <a id="27287" class="Symbol">:</a> <a id="27289" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="27294" class="Symbol">{</a><a id="27295" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a><a id="27296" class="Symbol">}</a> <a id="27298" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27300" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="27304" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27306" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="27310" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="27313" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27318" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27323" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27328" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27333" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="27339" class="Symbol">_</a> <a id="27341" class="Symbol">=</a>
<a id="27347" href="/19.08/DeBruijn/#14002" class="Function">plus</a> <a id="27352" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27354" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="27358" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27360" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a>
<a id="27366" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27370" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="27375" class="Symbol">(</a><a id="27376" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="27381" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="27384" class="Symbol">)</a> <a id="27386" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27392" class="Symbol">(</a><a id="27393" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="27395" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="27397" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="27402" class="Symbol">(</a><a id="27403" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27405" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="27407" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27408" class="Symbol">)</a> <a id="27410" class="Symbol">(</a><a id="27411" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27413" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27414" class="Symbol">)</a> <a id="27416" class="Symbol">(</a><a id="27417" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27422" class="Symbol">(</a><a id="27423" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="27428" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27430" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27432" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="27434" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27436" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27438" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="27440" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27441" class="Symbol">)))</a> <a id="27445" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27447" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="27451" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27453" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a>
<a id="27459" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27463" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="27468" class="Symbol">(</a><a id="27469" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="27473" class="Symbol">(</a><a id="27474" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27480" class="Symbol">(</a><a id="27481" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27487" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="27493" class="Symbol">)))</a> <a id="27497" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27503" class="Symbol">(</a><a id="27504" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="27506" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="27511" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="27515" class="Symbol">(</a><a id="27516" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27518" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27519" class="Symbol">)</a> <a id="27521" class="Symbol">(</a><a id="27522" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27527" class="Symbol">(</a><a id="27528" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="27533" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27535" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27537" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="27539" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27541" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27543" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="27545" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27546" class="Symbol">)))</a> <a id="27550" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27552" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a>
<a id="27558" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27562" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="27566" class="Symbol">(</a><a id="27567" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27573" class="Symbol">(</a><a id="27574" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27580" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="27586" class="Symbol">))</a> <a id="27589" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27595" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="27600" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="27604" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="27608" class="Symbol">(</a><a id="27609" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27614" class="Symbol">(</a><a id="27615" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="27620" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27622" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27624" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="27626" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27628" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="27631" class="Symbol">))</a>
<a id="27636" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27640" href="plfa.part2.DeBruijn.html#25469" class="InductiveConstructor">β-suc</a> <a id="27646" class="Symbol">(</a><a id="27647" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27653" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="27659" class="Symbol">)</a> <a id="27661" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27667" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="27672" class="Symbol">(</a><a id="27673" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="27678" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27680" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27685" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="27691" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27693" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="27696" class="Symbol">)</a>
<a id="27700" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27704" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="27710" class="Symbol">(</a><a id="27711" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="27716" class="Symbol">(</a><a id="27717" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="27722" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="27725" class="Symbol">))</a> <a id="27728" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27734" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="27739" class="Symbol">((</a><a id="27741" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="27743" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="27745" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="27750" class="Symbol">(</a><a id="27751" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27753" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="27755" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27756" class="Symbol">)</a> <a id="27758" class="Symbol">(</a><a id="27759" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27761" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27762" class="Symbol">)</a> <a id="27764" class="Symbol">(</a><a id="27765" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27770" class="Symbol">(</a><a id="27771" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="27776" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27778" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27780" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="27782" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27784" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27786" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="27788" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27789" class="Symbol">)))</a>
<a id="27799" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="27801" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27806" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="27812" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27814" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="27817" class="Symbol">)</a>
<a id="27821" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27825" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="27831" class="Symbol">(</a><a id="27832" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="27837" class="Symbol">(</a><a id="27838" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="27842" class="Symbol">(</a><a id="27843" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27849" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="27855" class="Symbol">)))</a> <a id="27859" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27865" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="27870" class="Symbol">((</a><a id="27872" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="27874" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="27879" class="Symbol">(</a><a id="27880" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27885" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="27890" class="Symbol">)</a> <a id="27892" class="Symbol">(</a><a id="27893" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27895" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27896" class="Symbol">)</a> <a id="27898" class="Symbol">(</a><a id="27899" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27904" class="Symbol">(</a><a id="27905" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="27910" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27912" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27914" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="27916" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27918" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="27920" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="27922" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="27923" class="Symbol">)))</a> <a id="27927" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="27929" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="27932" class="Symbol">)</a>
<a id="27936" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="27940" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="27946" class="Symbol">(</a><a id="27947" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="27951" class="Symbol">(</a><a id="27952" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27958" class="Symbol">(</a><a id="27959" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="27965" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="27971" class="Symbol">)))</a> <a id="27975" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="27981" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="27986" class="Symbol">(</a><a id="27987" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="27992" class="Symbol">(</a><a id="27993" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="27998" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="28003" class="Symbol">)</a> <a id="28005" class="Symbol">(</a><a id="28006" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="28009" class="Symbol">)</a> <a id="28011" class="Symbol">(</a><a id="28012" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28017" class="Symbol">(</a><a id="28018" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="28023" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28025" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28027" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28029" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28031" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="28034" class="Symbol">)))</a>
<a id="28040" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28044" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28050" class="Symbol">(</a><a id="28051" href="plfa.part2.DeBruijn.html#25469" class="InductiveConstructor">β-suc</a> <a id="28057" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="28063" class="Symbol">)</a> <a id="28065" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28071" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="28076" class="Symbol">(</a><a id="28077" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28082" class="Symbol">(</a><a id="28083" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="28088" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28090" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="28096" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28098" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="28101" class="Symbol">))</a>
<a id="28106" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28110" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28116" class="Symbol">(</a><a id="28117" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28123" class="Symbol">(</a><a id="28124" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28129" class="Symbol">(</a><a id="28130" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28135" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="28138" class="Symbol">)))</a> <a id="28142" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28148" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="28153" class="Symbol">(</a><a id="28154" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28159" class="Symbol">((</a><a id="28161" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28163" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28165" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="28170" class="Symbol">(</a><a id="28171" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28173" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28175" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28176" class="Symbol">)</a> <a id="28178" class="Symbol">(</a><a id="28179" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28181" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28182" class="Symbol">)</a> <a id="28184" class="Symbol">(</a><a id="28185" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28190" class="Symbol">(</a><a id="28191" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="28196" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28198" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28200" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28202" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28204" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28206" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28208" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28209" class="Symbol">)))</a>
<a id="28219" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="28221" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="28227" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28229" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="28232" class="Symbol">))</a>
<a id="28237" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28241" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28247" class="Symbol">(</a><a id="28248" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28254" class="Symbol">(</a><a id="28255" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28260" class="Symbol">(</a><a id="28261" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="28265" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="28271" class="Symbol">)))</a> <a id="28275" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28281" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="28286" class="Symbol">(</a><a id="28287" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28292" class="Symbol">((</a><a id="28294" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28296" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="28301" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="28307" class="Symbol">(</a><a id="28308" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28310" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28311" class="Symbol">)</a> <a id="28313" class="Symbol">(</a><a id="28314" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28319" class="Symbol">(</a><a id="28320" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="28325" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28327" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28329" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28331" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28333" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28335" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28337" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28338" class="Symbol">)))</a> <a id="28342" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28344" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="28347" class="Symbol">))</a>
<a id="28352" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28356" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28362" class="Symbol">(</a><a id="28363" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28369" class="Symbol">(</a><a id="28370" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="28374" class="Symbol">(</a><a id="28375" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="28381" class="Symbol">(</a><a id="28382" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="28388" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="28394" class="Symbol">))))</a> <a id="28399" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28405" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="28410" class="Symbol">(</a><a id="28411" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28416" class="Symbol">(</a><a id="28417" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="28422" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="28428" class="Symbol">(</a><a id="28429" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="28432" class="Symbol">)</a> <a id="28434" class="Symbol">(</a><a id="28435" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28440" class="Symbol">(</a><a id="28441" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="28446" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28448" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28450" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28452" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28454" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="28457" class="Symbol">))))</a>
<a id="28464" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28468" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28474" class="Symbol">(</a><a id="28475" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="28481" href="plfa.part2.DeBruijn.html#25367" class="InductiveConstructor">β-zero</a><a id="28487" class="Symbol">)</a> <a id="28489" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28494" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="28499" class="Symbol">(</a><a id="28500" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28505" class="Symbol">(</a><a id="28506" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28511" class="Symbol">(</a><a id="28512" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28517" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="28522" class="Symbol">)))</a>
<a id="28528" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator"></a>
</pre>
<p>And finally, a similar sample reduction for Church numerals:</p>
<pre class="Agda"><a id="28600" href="/19.08/DeBruijn/#28600" class="Function">_</a> <a id="28602" class="Symbol">:</a> <a id="28604" href="plfa.part2.DeBruijn.html#14410" class="Function">plusᶜ</a> <a id="28610" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28612" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28617" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28619" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28624" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28626" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="28631" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28633" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="28639" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="28642" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28647" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28652" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28657" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="28662" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="28668" class="Symbol">{</a><a id="28669" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a><a id="28670" class="Symbol">}</a>
<a id="28672" class="Symbol">_</a> <a id="28674" class="Symbol">=</a>
<a id="28678" href="/19.08/DeBruijn/#26598" class="Function Operator">begin</a>
<a id="28688" href="/19.08/DeBruijn/#14410" class="Function">plusᶜ</a> <a id="28694" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28696" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28701" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28703" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28708" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28710" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="28715" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28717" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="28725" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28729" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28734" class="Symbol">(</a><a id="28735" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28740" class="Symbol">(</a><a id="28741" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28746" class="Symbol">(</a><a id="28747" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="28751" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="28754" class="Symbol">)))</a> <a id="28758" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28764" class="Symbol">(</a><a id="28765" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28767" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28769" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28771" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28776" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28778" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28780" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28782" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28784" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28786" class="Symbol">(</a><a id="28787" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28789" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28791" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28793" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28795" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28797" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28799" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28801" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28803" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28805" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28807" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28808" class="Symbol">))</a> <a id="28811" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28813" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28818" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28820" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="28825" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28827" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="28835" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28839" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28844" class="Symbol">(</a><a id="28845" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28850" class="Symbol">(</a><a id="28851" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="28855" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="28858" class="Symbol">))</a> <a id="28861" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28867" class="Symbol">(</a><a id="28868" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28870" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28872" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28877" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28879" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28881" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28883" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28885" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28887" class="Symbol">(</a><a id="28888" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28893" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28895" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28897" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="28899" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="28901" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28903" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28905" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28906" class="Symbol">))</a> <a id="28909" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28911" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="28916" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28918" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="28926" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="28930" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="28935" class="Symbol">(</a><a id="28936" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="28940" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="28943" class="Symbol">)</a> <a id="28945" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="28951" class="Symbol">(</a><a id="28952" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="28954" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28959" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28961" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="28966" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28968" class="Symbol">(</a><a id="28969" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="28974" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28976" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="28981" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28983" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="28985" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="28986" class="Symbol">))</a> <a id="28989" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="28991" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="28999" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29003" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29007" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a> <a id="29014" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29020" href="/19.08/DeBruijn/#14352" class="Function">twoᶜ</a> <a id="29025" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29027" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29032" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29034" class="Symbol">(</a><a id="29035" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="29040" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29042" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29047" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29049" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29054" class="Symbol">)</a>
<a id="29058" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29062" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="29067" class="Symbol">(</a><a id="29068" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29072" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="29075" class="Symbol">)</a> <a id="29077" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29083" class="Symbol">(</a><a id="29084" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="29086" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29091" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29093" class="Symbol">(</a><a id="29094" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29099" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29101" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="29103" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="29104" class="Symbol">))</a> <a id="29107" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29109" class="Symbol">(</a><a id="29110" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="29115" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29117" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29122" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29124" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29129" class="Symbol">)</a>
<a id="29133" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29137" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="29142" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="29146" class="Symbol">(</a><a id="29147" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="29152" class="Symbol">(</a><a id="29153" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29157" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="29160" class="Symbol">))</a> <a id="29163" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29169" class="Symbol">(</a><a id="29170" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="29172" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29177" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29179" class="Symbol">(</a><a id="29180" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29185" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29187" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="29189" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="29190" class="Symbol">))</a> <a id="29193" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29195" class="Symbol">((</a><a id="29197" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="29199" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29204" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29206" class="Symbol">(</a><a id="29207" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29212" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29214" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="29216" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="29217" class="Symbol">))</a> <a id="29220" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29222" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29227" class="Symbol">)</a>
<a id="29231" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29235" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="29240" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="29244" class="Symbol">(</a><a id="29245" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29249" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="29255" class="Symbol">)</a> <a id="29257" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29263" class="Symbol">(</a><a id="29264" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="29266" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29271" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29273" class="Symbol">(</a><a id="29274" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29279" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29281" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="29283" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="29284" class="Symbol">))</a> <a id="29287" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29289" class="Symbol">(</a><a id="29290" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29295" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29297" class="Symbol">(</a><a id="29298" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29303" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29305" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29310" class="Symbol">))</a>
<a id="29315" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29319" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="29324" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="29328" class="Symbol">(</a><a id="29329" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="29334" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="29338" class="Symbol">(</a><a id="29339" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29343" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="29349" class="Symbol">))</a> <a id="29352" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29358" class="Symbol">(</a><a id="29359" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="29361" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29366" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29368" class="Symbol">(</a><a id="29369" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29374" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29376" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="29378" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="29379" class="Symbol">))</a> <a id="29382" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29384" class="Symbol">(</a><a id="29385" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29390" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29392" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29397" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29402" class="Symbol">)</a>
<a id="29406" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29410" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="29415" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="29419" class="Symbol">(</a><a id="29420" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29424" class="Symbol">(</a><a id="29425" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29431" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="29437" class="Symbol">))</a> <a id="29440" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29446" class="Symbol">(</a><a id="29447" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="29449" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29454" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29456" class="Symbol">(</a><a id="29457" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29462" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29464" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="29466" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="29467" class="Symbol">))</a> <a id="29470" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29472" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29477" class="Symbol">(</a><a id="29478" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29483" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29488" class="Symbol">)</a>
<a id="29492" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29496" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29500" class="Symbol">(</a><a id="29501" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29507" class="Symbol">(</a><a id="29508" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29514" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="29520" class="Symbol">))</a> <a id="29523" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29529" href="/19.08/DeBruijn/#14500" class="Function">sucᶜ</a> <a id="29534" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29536" class="Symbol">(</a><a id="29537" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="29542" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29544" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29549" class="Symbol">(</a><a id="29550" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29555" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29560" class="Symbol">))</a>
<a id="29565" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29569" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="29574" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="29578" class="Symbol">(</a><a id="29579" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29583" class="Symbol">(</a><a id="29584" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29590" class="Symbol">(</a><a id="29591" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29597" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="29603" class="Symbol">)))</a> <a id="29607" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29613" href="/19.08/DeBruijn/#14500" class="Function">sucᶜ</a> <a id="29618" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="29620" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29625" class="Symbol">(</a><a id="29626" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29631" class="Symbol">(</a><a id="29632" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29637" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29642" class="Symbol">))</a>
<a id="29647" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="29651" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="29655" class="Symbol">(</a><a id="29656" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29662" class="Symbol">(</a><a id="29663" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29669" class="Symbol">(</a><a id="29670" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="29676" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="29682" class="Symbol">)))</a> <a id="29686" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="29692" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="29697" class="Symbol">(</a><a id="29698" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29703" class="Symbol">(</a><a id="29704" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29709" class="Symbol">(</a><a id="29710" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="29715" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="29720" class="Symbol">)))</a>
<a id="29726" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator"></a>
</pre>
<h2 id="values-do-not-reduce">Values do not reduce</h2>
<p>We have now completed all the definitions, which of
necessity subsumed some of the propositions from the
earlier development: Canonical Forms,
Substitution preserves types, and Preservation.
We now turn to proving the remaining results from the
previous development.</p>
<h4 id="exercise-v-practice">Exercise <code class="language-plaintext highlighter-rouge">V¬—→</code> (practice)</h4>
<p>Following the previous development, show values do
not reduce, and its corollary, terms that reduce are not
values.</p>
<pre class="Agda"><a id="30180" class="Comment">-- Your code goes here</a>
</pre>
<h2 id="progress">Progress</h2>
<p>As before, every term that is well typed and closed is either
a value or takes a reduction step. The formulation of progress
is just as before, but annotated with types:</p>
<pre class="Agda"><a id="30396" class="Keyword">data</a> <a id="Progress"></a><a id="30401" href="/19.08/DeBruijn/#30401" class="Datatype">Progress</a> <a id="30410" class="Symbol">{</a><a id="30411" href="plfa.part2.DeBruijn.html#30411" class="Bound">A</a><a id="30412" class="Symbol">}</a> <a id="30414" class="Symbol">(</a><a id="30415" href="plfa.part2.DeBruijn.html#30415" class="Bound">M</a> <a id="30417" class="Symbol">:</a> <a id="30419" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="30421" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="30423" href="plfa.part2.DeBruijn.html#30411" class="Bound">A</a><a id="30424" class="Symbol">)</a> <a id="30426" class="Symbol">:</a> <a id="30428" class="PrimitiveType">Set</a> <a id="30432" class="Keyword">where</a>
<a id="Progress.step"></a><a id="30441" href="/19.08/DeBruijn/#30441" class="InductiveConstructor">step</a> <a id="30446" class="Symbol">:</a> <a id="30448" class="Symbol"></a> <a id="30450" class="Symbol">{</a><a id="30451" href="plfa.part2.DeBruijn.html#30451" class="Bound">N</a> <a id="30453" class="Symbol">:</a> <a id="30455" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="30457" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="30459" href="plfa.part2.DeBruijn.html#30411" class="Bound">A</a><a id="30460" class="Symbol">}</a>
<a id="30466" class="Symbol"></a> <a id="30468" href="/19.08/DeBruijn/#30415" class="Bound">M</a> <a id="30470" href="plfa.part2.DeBruijn.html#24732" class="Datatype Operator">—→</a> <a id="30473" href="plfa.part2.DeBruijn.html#30451" class="Bound">N</a>
<a id="30481" class="Comment">----------</a>
<a id="30496" class="Symbol"></a> <a id="30498" href="/19.08/DeBruijn/#30401" class="Datatype">Progress</a> <a id="30507" href="plfa.part2.DeBruijn.html#30415" class="Bound">M</a>
<a id="Progress.done"></a><a id="30512" href="/19.08/DeBruijn/#30512" class="InductiveConstructor">done</a> <a id="30517" class="Symbol">:</a>
<a id="30525" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="30531" href="plfa.part2.DeBruijn.html#30415" class="Bound">M</a>
<a id="30539" class="Comment">----------</a>
<a id="30554" class="Symbol"></a> <a id="30556" href="/19.08/DeBruijn/#30401" class="Datatype">Progress</a> <a id="30565" href="plfa.part2.DeBruijn.html#30415" class="Bound">M</a>
</pre>
<p>The statement and proof of progress is much as before,
appropriately annotated. We no longer need
to explicitly refer to the Canonical Forms lemma, since it
is built-in to the definition of value:</p>
<pre class="Agda"><a id="progress"></a><a id="30774" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="30783" class="Symbol">:</a> <a id="30785" class="Symbol"></a> <a id="30787" class="Symbol">{</a><a id="30788" href="plfa.part2.DeBruijn.html#30788" class="Bound">A</a><a id="30789" class="Symbol">}</a> <a id="30791" class="Symbol"></a> <a id="30793" class="Symbol">(</a><a id="30794" href="plfa.part2.DeBruijn.html#30794" class="Bound">M</a> <a id="30796" class="Symbol">:</a> <a id="30798" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="30800" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="30802" href="plfa.part2.DeBruijn.html#30788" class="Bound">A</a><a id="30803" class="Symbol">)</a> <a id="30805" class="Symbol"></a> <a id="30807" href="plfa.part2.DeBruijn.html#30401" class="Datatype">Progress</a> <a id="30816" href="plfa.part2.DeBruijn.html#30794" class="Bound">M</a>
<a id="30818" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="30827" class="Symbol">(</a><a id="30828" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="30830" class="Symbol">())</a>
<a id="30834" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="30843" class="Symbol">(</a><a id="30844" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="30846" href="plfa.part2.DeBruijn.html#30846" class="Bound">N</a><a id="30847" class="Symbol">)</a> <a id="30874" class="Symbol">=</a> <a id="30877" href="plfa.part2.DeBruijn.html#30512" class="InductiveConstructor">done</a> <a id="30882" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a>
<a id="30886" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="30895" class="Symbol">(</a><a id="30896" href="plfa.part2.DeBruijn.html#30896" class="Bound">L</a> <a id="30898" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="30900" href="plfa.part2.DeBruijn.html#30900" class="Bound">M</a><a id="30901" class="Symbol">)</a> <a id="30903" class="Keyword">with</a> <a id="30908" href="plfa.part2.DeBruijn.html#30774" class="Function">progress</a> <a id="30917" href="plfa.part2.DeBruijn.html#30896" class="Bound">L</a>
<a id="30919" class="Symbol">...</a> <a id="30926" class="Symbol">|</a> <a id="30928" href="/19.08/DeBruijn/#30441" class="InductiveConstructor">step</a> <a id="30933" href="plfa.part2.DeBruijn.html#30933" class="Bound">L—→L</a> <a id="30959" class="Symbol">=</a> <a id="30962" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="30967" class="Symbol">(</a><a id="30968" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="30973" href="plfa.part2.DeBruijn.html#30933" class="Bound">L—→L</a><a id="30978" class="Symbol">)</a>
<a id="30980" class="Symbol">...</a> <a id="30987" class="Symbol">|</a> <a id="30989" href="/19.08/DeBruijn/#30512" class="InductiveConstructor">done</a> <a id="30994" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="30998" class="Keyword">with</a> <a id="31003" href="plfa.part2.DeBruijn.html#30774" class="Function">progress</a> <a id="31012" class="Bound">M</a>
<a id="31014" class="Symbol">...</a> <a id="31025" class="Symbol">|</a> <a id="31027" href="/19.08/DeBruijn/#30441" class="InductiveConstructor">step</a> <a id="31032" href="plfa.part2.DeBruijn.html#31032" class="Bound">M—→M</a> <a id="31054" class="Symbol">=</a> <a id="31057" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="31062" class="Symbol">(</a><a id="31063" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="31068" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="31072" href="plfa.part2.DeBruijn.html#31032" class="Bound">M—→M</a><a id="31077" class="Symbol">)</a>
<a id="31079" class="Symbol">...</a> <a id="31090" class="Symbol">|</a> <a id="31092" href="/19.08/DeBruijn/#30512" class="InductiveConstructor">done</a> <a id="31097" href="plfa.part2.DeBruijn.html#31097" class="Bound">VM</a> <a id="31119" class="Symbol">=</a> <a id="31122" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="31127" class="Symbol">(</a><a id="31128" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="31132" href="plfa.part2.DeBruijn.html#31097" class="Bound">VM</a><a id="31134" class="Symbol">)</a>
<a id="31136" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="31145" class="Symbol">(</a><a id="31146" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="31151" class="Symbol">)</a> <a id="31176" class="Symbol">=</a> <a id="31179" href="plfa.part2.DeBruijn.html#30512" class="InductiveConstructor">done</a> <a id="31184" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a>
<a id="31191" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="31200" class="Symbol">(</a><a id="31201" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="31206" href="plfa.part2.DeBruijn.html#31206" class="Bound">M</a><a id="31207" class="Symbol">)</a> <a id="31209" class="Keyword">with</a> <a id="31214" href="plfa.part2.DeBruijn.html#30774" class="Function">progress</a> <a id="31223" href="plfa.part2.DeBruijn.html#31206" class="Bound">M</a>
<a id="31225" class="Symbol">...</a> <a id="31232" class="Symbol">|</a> <a id="31234" href="/19.08/DeBruijn/#30441" class="InductiveConstructor">step</a> <a id="31239" href="plfa.part2.DeBruijn.html#31239" class="Bound">M—→M</a> <a id="31265" class="Symbol">=</a> <a id="31268" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="31273" class="Symbol">(</a><a id="31274" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="31280" href="plfa.part2.DeBruijn.html#31239" class="Bound">M—→M</a><a id="31285" class="Symbol">)</a>
<a id="31287" class="Symbol">...</a> <a id="31294" class="Symbol">|</a> <a id="31296" href="/19.08/DeBruijn/#30512" class="InductiveConstructor">done</a> <a id="31301" href="plfa.part2.DeBruijn.html#31301" class="Bound">VM</a> <a id="31327" class="Symbol">=</a> <a id="31330" href="plfa.part2.DeBruijn.html#30512" class="InductiveConstructor">done</a> <a id="31335" class="Symbol">(</a><a id="31336" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="31342" href="plfa.part2.DeBruijn.html#31301" class="Bound">VM</a><a id="31344" class="Symbol">)</a>
<a id="31346" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="31355" class="Symbol">(</a><a id="31356" href="plfa.part2.DeBruijn.html#11426" class="InductiveConstructor">case</a> <a id="31361" href="plfa.part2.DeBruijn.html#31361" class="Bound">L</a> <a id="31363" href="plfa.part2.DeBruijn.html#31363" class="Bound">M</a> <a id="31365" href="plfa.part2.DeBruijn.html#31365" class="Bound">N</a><a id="31366" class="Symbol">)</a> <a id="31368" class="Keyword">with</a> <a id="31373" href="plfa.part2.DeBruijn.html#30774" class="Function">progress</a> <a id="31382" href="plfa.part2.DeBruijn.html#31361" class="Bound">L</a>
<a id="31384" class="Symbol">...</a> <a id="31391" class="Symbol">|</a> <a id="31393" href="/19.08/DeBruijn/#30441" class="InductiveConstructor">step</a> <a id="31398" href="plfa.part2.DeBruijn.html#31398" class="Bound">L—→L</a> <a id="31424" class="Symbol">=</a> <a id="31427" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="31432" class="Symbol">(</a><a id="31433" href="plfa.part2.DeBruijn.html#25224" class="InductiveConstructor">ξ-case</a> <a id="31440" href="plfa.part2.DeBruijn.html#31398" class="Bound">L—→L</a><a id="31445" class="Symbol">)</a>
<a id="31447" class="Symbol">...</a> <a id="31454" class="Symbol">|</a> <a id="31456" href="/19.08/DeBruijn/#30512" class="InductiveConstructor">done</a> <a id="31461" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a> <a id="31487" class="Symbol">=</a> <a id="31490" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="31495" class="Symbol">(</a><a id="31496" href="plfa.part2.DeBruijn.html#25367" class="InductiveConstructor">β-zero</a><a id="31502" class="Symbol">)</a>
<a id="31504" class="Symbol">...</a> <a id="31511" class="Symbol">|</a> <a id="31513" href="/19.08/DeBruijn/#30512" class="InductiveConstructor">done</a> <a id="31518" class="Symbol">(</a><a id="31519" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="31525" href="plfa.part2.DeBruijn.html#31525" class="Bound">VL</a><a id="31527" class="Symbol">)</a> <a id="31544" class="Symbol">=</a> <a id="31547" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="31552" class="Symbol">(</a><a id="31553" href="plfa.part2.DeBruijn.html#25469" class="InductiveConstructor">β-suc</a> <a id="31559" href="plfa.part2.DeBruijn.html#31525" class="Bound">VL</a><a id="31561" class="Symbol">)</a>
<a id="31563" href="/19.08/DeBruijn/#30774" class="Function">progress</a> <a id="31572" class="Symbol">(</a><a id="31573" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="31575" href="plfa.part2.DeBruijn.html#31575" class="Bound">N</a><a id="31576" class="Symbol">)</a> <a id="31603" class="Symbol">=</a> <a id="31606" href="plfa.part2.DeBruijn.html#30441" class="InductiveConstructor">step</a> <a id="31611" class="Symbol">(</a><a id="31612" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="31615" class="Symbol">)</a>
</pre>
<h2 id="evaluation">Evaluation</h2>
<p>Before, we combined progress and preservation to evaluate a term.
We can do much the same here, but we no longer need to explicitly
refer to preservation, since it is built-in to the definition of reduction.</p>
<p>As previously, gas is specified by a natural number:</p>
<pre class="Agda"><a id="31904" class="Keyword">data</a> <a id="Gas"></a><a id="31909" href="/19.08/DeBruijn/#31909" class="Datatype">Gas</a> <a id="31913" class="Symbol">:</a> <a id="31915" class="PrimitiveType">Set</a> <a id="31919" class="Keyword">where</a>
<a id="Gas.gas"></a><a id="31927" href="/19.08/DeBruijn/#31927" class="InductiveConstructor">gas</a> <a id="31931" class="Symbol">:</a> <a id="31933" href="Agda.Builtin.Nat.html#165" class="Datatype"></a> <a id="31935" class="Symbol"></a> <a id="31937" href="plfa.part2.DeBruijn.html#31909" class="Datatype">Gas</a>
</pre>
<p>When our evaluator returns a term <code class="language-plaintext highlighter-rouge">N</code>, it will either give evidence that
<code class="language-plaintext highlighter-rouge">N</code> is a value or indicate that it ran out of gas:</p>
<pre class="Agda"><a id="32073" class="Keyword">data</a> <a id="Finished"></a><a id="32078" href="/19.08/DeBruijn/#32078" class="Datatype">Finished</a> <a id="32087" class="Symbol">{</a><a id="32088" href="plfa.part2.DeBruijn.html#32088" class="Bound">Γ</a> <a id="32090" href="plfa.part2.DeBruijn.html#32090" class="Bound">A</a><a id="32091" class="Symbol">}</a> <a id="32093" class="Symbol">(</a><a id="32094" href="plfa.part2.DeBruijn.html#32094" class="Bound">N</a> <a id="32096" class="Symbol">:</a> <a id="32098" href="plfa.part2.DeBruijn.html#32088" class="Bound">Γ</a> <a id="32100" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="32102" href="plfa.part2.DeBruijn.html#32090" class="Bound">A</a><a id="32103" class="Symbol">)</a> <a id="32105" class="Symbol">:</a> <a id="32107" class="PrimitiveType">Set</a> <a id="32111" class="Keyword">where</a>
<a id="Finished.done"></a><a id="32121" href="/19.08/DeBruijn/#32121" class="InductiveConstructor">done</a> <a id="32126" class="Symbol">:</a>
<a id="32135" href="/19.08/DeBruijn/#23995" class="Datatype">Value</a> <a id="32141" href="plfa.part2.DeBruijn.html#32094" class="Bound">N</a>
<a id="32150" class="Comment">----------</a>
<a id="32166" class="Symbol"></a> <a id="32168" href="/19.08/DeBruijn/#32078" class="Datatype">Finished</a> <a id="32177" href="plfa.part2.DeBruijn.html#32094" class="Bound">N</a>
<a id="Finished.out-of-gas"></a><a id="32183" href="/19.08/DeBruijn/#32183" class="InductiveConstructor">out-of-gas</a> <a id="32194" class="Symbol">:</a>
<a id="32203" class="Comment">----------</a>
<a id="32221" href="/19.08/DeBruijn/#32078" class="Datatype">Finished</a> <a id="32230" href="plfa.part2.DeBruijn.html#32094" class="Bound">N</a>
</pre>
<p>Given a term <code class="language-plaintext highlighter-rouge">L</code> of type <code class="language-plaintext highlighter-rouge">A</code>, the evaluator will, for some <code class="language-plaintext highlighter-rouge">N</code>, return
a reduction sequence from <code class="language-plaintext highlighter-rouge">L</code> to <code class="language-plaintext highlighter-rouge">N</code> and an indication of whether
reduction finished:</p>
<pre class="Agda"><a id="32397" class="Keyword">data</a> <a id="Steps"></a><a id="32402" href="/19.08/DeBruijn/#32402" class="Datatype">Steps</a> <a id="32408" class="Symbol">:</a> <a id="32410" class="Symbol"></a> <a id="32412" class="Symbol">{</a><a id="32413" href="plfa.part2.DeBruijn.html#32413" class="Bound">A</a><a id="32414" class="Symbol">}</a> <a id="32416" class="Symbol"></a> <a id="32418" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="32420" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="32422" href="plfa.part2.DeBruijn.html#32413" class="Bound">A</a> <a id="32424" class="Symbol"></a> <a id="32426" class="PrimitiveType">Set</a> <a id="32430" class="Keyword">where</a>
<a id="Steps.steps"></a><a id="32439" href="/19.08/DeBruijn/#32439" class="InductiveConstructor">steps</a> <a id="32445" class="Symbol">:</a> <a id="32447" class="Symbol"></a> <a id="32449" class="Symbol">{</a><a id="32450" href="plfa.part2.DeBruijn.html#32450" class="Bound">A</a><a id="32451" class="Symbol">}</a> <a id="32453" class="Symbol">{</a><a id="32454" href="plfa.part2.DeBruijn.html#32454" class="Bound">L</a> <a id="32456" href="plfa.part2.DeBruijn.html#32456" class="Bound">N</a> <a id="32458" class="Symbol">:</a> <a id="32460" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="32462" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="32464" href="plfa.part2.DeBruijn.html#32450" class="Bound">A</a><a id="32465" class="Symbol">}</a>
<a id="32471" class="Symbol"></a> <a id="32473" href="/19.08/DeBruijn/#32454" class="Bound">L</a> <a id="32475" href="plfa.part2.DeBruijn.html#26397" class="Datatype Operator">—↠</a> <a id="32478" href="plfa.part2.DeBruijn.html#32456" class="Bound">N</a>
<a id="32484" class="Symbol"></a> <a id="32486" href="/19.08/DeBruijn/#32078" class="Datatype">Finished</a> <a id="32495" href="plfa.part2.DeBruijn.html#32456" class="Bound">N</a>
<a id="32503" class="Comment">----------</a>
<a id="32518" class="Symbol"></a> <a id="32520" href="/19.08/DeBruijn/#32402" class="Datatype">Steps</a> <a id="32526" href="plfa.part2.DeBruijn.html#32454" class="Bound">L</a>
</pre>
<p>The evaluator takes gas and a term and returns the corresponding steps:</p>
<pre class="Agda"><a id="eval"></a><a id="32608" href="/19.08/DeBruijn/#32608" class="Function">eval</a> <a id="32613" class="Symbol">:</a> <a id="32615" class="Symbol"></a> <a id="32617" class="Symbol">{</a><a id="32618" href="plfa.part2.DeBruijn.html#32618" class="Bound">A</a><a id="32619" class="Symbol">}</a>
<a id="32623" class="Symbol"></a> <a id="32625" href="/19.08/DeBruijn/#31909" class="Datatype">Gas</a>
<a id="32631" class="Symbol"></a> <a id="32633" class="Symbol">(</a><a id="32634" href="/19.08/DeBruijn/#32634" class="Bound">L</a> <a id="32636" class="Symbol">:</a> <a id="32638" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="32640" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="32642" href="plfa.part2.DeBruijn.html#32618" class="Bound">A</a><a id="32643" class="Symbol">)</a>
<a id="32649" class="Comment">-----------</a>
<a id="32663" class="Symbol"></a> <a id="32665" href="/19.08/DeBruijn/#32402" class="Datatype">Steps</a> <a id="32671" href="plfa.part2.DeBruijn.html#32634" class="Bound">L</a>
<a id="32673" href="/19.08/DeBruijn/#32608" class="Function">eval</a> <a id="32678" class="Symbol">(</a><a id="32679" href="plfa.part2.DeBruijn.html#31927" class="InductiveConstructor">gas</a> <a id="32683" href="Agda.Builtin.Nat.html#183" class="InductiveConstructor">zero</a><a id="32687" class="Symbol">)</a> <a id="32692" href="plfa.part2.DeBruijn.html#32692" class="Bound">L</a> <a id="32714" class="Symbol">=</a> <a id="32717" href="plfa.part2.DeBruijn.html#32439" class="InductiveConstructor">steps</a> <a id="32723" class="Symbol">(</a><a id="32724" href="plfa.part2.DeBruijn.html#32692" class="Bound">L</a> <a id="32726" href="plfa.part2.DeBruijn.html#26447" class="InductiveConstructor Operator"></a><a id="32727" class="Symbol">)</a> <a id="32729" href="plfa.part2.DeBruijn.html#32183" class="InductiveConstructor">out-of-gas</a>
<a id="32740" href="/19.08/DeBruijn/#32608" class="Function">eval</a> <a id="32745" class="Symbol">(</a><a id="32746" href="plfa.part2.DeBruijn.html#31927" class="InductiveConstructor">gas</a> <a id="32750" class="Symbol">(</a><a id="32751" href="Agda.Builtin.Nat.html#196" class="InductiveConstructor">suc</a> <a id="32755" href="plfa.part2.DeBruijn.html#32755" class="Bound">m</a><a id="32756" class="Symbol">))</a> <a id="32759" href="plfa.part2.DeBruijn.html#32759" class="Bound">L</a> <a id="32761" class="Keyword">with</a> <a id="32766" href="plfa.part2.DeBruijn.html#30774" class="Function">progress</a> <a id="32775" href="plfa.part2.DeBruijn.html#32759" class="Bound">L</a>
<a id="32777" class="Symbol">...</a> <a id="32781" class="Symbol">|</a> <a id="32783" href="/19.08/DeBruijn/#30512" class="InductiveConstructor">done</a> <a id="32788" href="plfa.part2.DeBruijn.html#32788" class="Bound">VL</a> <a id="32818" class="Symbol">=</a> <a id="32821" href="plfa.part2.DeBruijn.html#32439" class="InductiveConstructor">steps</a> <a id="32827" class="Symbol">(</a><a id="32828" class="Bound">L</a> <a id="32830" href="plfa.part2.DeBruijn.html#26447" class="InductiveConstructor Operator"></a><a id="32831" class="Symbol">)</a> <a id="32833" class="Symbol">(</a><a id="32834" href="plfa.part2.DeBruijn.html#32121" class="InductiveConstructor">done</a> <a id="32839" href="plfa.part2.DeBruijn.html#32788" class="Bound">VL</a><a id="32841" class="Symbol">)</a>
<a id="32843" class="Symbol">...</a> <a id="32847" class="Symbol">|</a> <a id="32849" href="/19.08/DeBruijn/#30441" class="InductiveConstructor">step</a> <a id="32854" class="Symbol">{</a><a id="32855" href="plfa.part2.DeBruijn.html#32855" class="Bound">M</a><a id="32856" class="Symbol">}</a> <a id="32858" href="plfa.part2.DeBruijn.html#32858" class="Bound">L—→M</a> <a id="32863" class="Keyword">with</a> <a id="32868" href="plfa.part2.DeBruijn.html#32608" class="Function">eval</a> <a id="32873" class="Symbol">(</a><a id="32874" href="plfa.part2.DeBruijn.html#31927" class="InductiveConstructor">gas</a> <a id="32878" class="Bound">m</a><a id="32879" class="Symbol">)</a> <a id="32881" href="plfa.part2.DeBruijn.html#32855" class="Bound">M</a>
<a id="32883" class="Symbol">...</a> <a id="32890" class="Symbol">|</a> <a id="32892" href="/19.08/DeBruijn/#32439" class="InductiveConstructor">steps</a> <a id="32898" href="plfa.part2.DeBruijn.html#32898" class="Bound">M—↠N</a> <a id="32903" href="plfa.part2.DeBruijn.html#32903" class="Bound">fin</a> <a id="32924" class="Symbol">=</a> <a id="32927" href="plfa.part2.DeBruijn.html#32439" class="InductiveConstructor">steps</a> <a id="32933" class="Symbol">(</a><a id="32934" class="Bound">L</a> <a id="32936" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="32940" class="Bound">L—→M</a> <a id="32945" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a> <a id="32947" href="plfa.part2.DeBruijn.html#32898" class="Bound">M—↠N</a><a id="32951" class="Symbol">)</a> <a id="32953" href="plfa.part2.DeBruijn.html#32903" class="Bound">fin</a>
</pre>
<p>The definition is a little simpler than previously, as we no longer need
to invoke preservation.</p>
<h2 id="examples-1">Examples</h2>
<p>We reiterate each of our previous examples. We re-define the term
<code class="language-plaintext highlighter-rouge">sucμ</code> that loops forever:</p>
<pre class="Agda"><a id="sucμ"></a><a id="33170" href="/19.08/DeBruijn/#33170" class="Function">sucμ</a> <a id="33175" class="Symbol">:</a> <a id="33177" href="plfa.part2.DeBruijn.html#8901" class="InductiveConstructor"></a> <a id="33179" href="plfa.part2.DeBruijn.html#11094" class="Datatype Operator"></a> <a id="33181" href="plfa.part2.DeBruijn.html#8757" class="InductiveConstructor">`</a>
<a id="33184" href="/19.08/DeBruijn/#33170" class="Function">sucμ</a> <a id="33189" class="Symbol">=</a> <a id="33191" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="33193" class="Symbol">(</a><a id="33194" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33199" class="Symbol">(</a><a id="33200" href="plfa.part2.DeBruijn.html#13527" class="Function Operator">#</a> <a id="33202" class="Number">0</a><a id="33203" class="Symbol">))</a>
</pre>
<p>To compute the first three steps of the infinite reduction sequence,
we evaluate with three steps worth of gas:</p>
<pre class="Agda"><a id="33326" href="/19.08/DeBruijn/#33326" class="Function">_</a> <a id="33328" class="Symbol">:</a> <a id="33330" href="plfa.part2.DeBruijn.html#32608" class="Function">eval</a> <a id="33335" class="Symbol">(</a><a id="33336" href="plfa.part2.DeBruijn.html#31927" class="InductiveConstructor">gas</a> <a id="33340" class="Number">3</a><a id="33341" class="Symbol">)</a> <a id="33343" href="plfa.part2.DeBruijn.html#33170" class="Function">sucμ</a> <a id="33348" href="Agda.Builtin.Equality.html#125" class="Datatype Operator"></a>
<a id="33352" href="/19.08/DeBruijn/#32439" class="InductiveConstructor">steps</a>
<a id="33361" class="Symbol">(</a><a id="33362" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a> <a id="33364" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33369" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33371" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="33376" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="33380" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a> <a id="33384" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="33390" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="33395" class="Symbol">(</a><a id="33396" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="33398" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33403" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33405" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33406" class="Symbol">)</a>
<a id="33411" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="33415" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="33421" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a> <a id="33425" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="33431" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="33436" class="Symbol">(</a><a id="33437" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33442" class="Symbol">(</a><a id="33443" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="33445" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33450" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33452" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33453" class="Symbol">))</a>
<a id="33459" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="33463" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="33469" class="Symbol">(</a><a id="33470" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="33476" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="33479" class="Symbol">)</a> <a id="33481" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="33487" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="33492" class="Symbol">(</a><a id="33493" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33498" class="Symbol">(</a><a id="33499" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33504" class="Symbol">(</a><a id="33505" href="plfa.part2.DeBruijn.html#11515" class="InductiveConstructor Operator">μ</a> <a id="33507" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33512" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33514" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33515" class="Symbol">)))</a>
<a id="33522" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator"></a><a id="33523" class="Symbol">)</a>
<a id="33528" href="/19.08/DeBruijn/#32183" class="InductiveConstructor">out-of-gas</a>
<a id="33539" class="Symbol">_</a> <a id="33541" class="Symbol">=</a> <a id="33543" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a>
</pre>
<p>The Church numeral two applied to successor and zero:</p>
<pre class="Agda"><a id="33611" href="/19.08/DeBruijn/#33611" class="Function">_</a> <a id="33613" class="Symbol">:</a> <a id="33615" href="plfa.part2.DeBruijn.html#32608" class="Function">eval</a> <a id="33620" class="Symbol">(</a><a id="33621" href="plfa.part2.DeBruijn.html#31927" class="InductiveConstructor">gas</a> <a id="33625" class="Number">100</a><a id="33628" class="Symbol">)</a> <a id="33630" class="Symbol">(</a><a id="33631" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="33636" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33638" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="33643" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33645" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="33650" class="Symbol">)</a> <a id="33652" href="Agda.Builtin.Equality.html#125" class="Datatype Operator"></a>
<a id="33656" href="/19.08/DeBruijn/#32439" class="InductiveConstructor">steps</a>
<a id="33665" class="Symbol">((</a><a id="33667" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33669" class="Symbol">(</a><a id="33670" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33672" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33674" class="Symbol">(</a><a id="33675" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="33677" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33678" class="Symbol">)</a> <a id="33680" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33682" class="Symbol">(</a><a id="33683" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33685" class="Symbol">(</a><a id="33686" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="33688" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33689" class="Symbol">)</a> <a id="33691" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33693" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33695" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33696" class="Symbol">)))</a> <a id="33700" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33702" class="Symbol">(</a><a id="33703" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33705" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33710" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33712" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33713" class="Symbol">)</a> <a id="33715" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33717" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="33726" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="33730" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="33735" class="Symbol">(</a><a id="33736" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="33740" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="33743" class="Symbol">)</a> <a id="33745" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="33751" class="Symbol">(</a><a id="33752" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33754" class="Symbol">(</a><a id="33755" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33757" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33762" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33764" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33765" class="Symbol">)</a> <a id="33767" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33769" class="Symbol">((</a><a id="33771" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33773" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33778" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33780" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33781" class="Symbol">)</a> <a id="33783" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33785" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33787" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33788" class="Symbol">))</a> <a id="33791" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33793" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="33802" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="33806" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="33810" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a> <a id="33817" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="33823" class="Symbol">(</a><a id="33824" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33826" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33831" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33833" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33834" class="Symbol">)</a> <a id="33836" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33838" class="Symbol">((</a><a id="33840" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33842" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33847" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33849" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33850" class="Symbol">)</a> <a id="33852" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33854" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="33859" class="Symbol">)</a>
<a id="33864" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="33868" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="33873" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="33877" class="Symbol">(</a><a id="33878" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="33882" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="33888" class="Symbol">)</a> <a id="33890" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="33896" class="Symbol">(</a><a id="33897" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="33899" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33904" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="33906" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="33907" class="Symbol">)</a> <a id="33909" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="33911" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33916" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="33925" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="33929" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="33933" class="Symbol">(</a><a id="33934" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="33940" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="33946" class="Symbol">)</a> <a id="33948" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="33954" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="33959" class="Symbol">(</a><a id="33960" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="33965" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="33970" class="Symbol">)</a>
<a id="33975" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator"></a><a id="33976" class="Symbol">)</a>
<a id="33981" class="Symbol">(</a><a id="33982" href="/19.08/DeBruijn/#32121" class="InductiveConstructor">done</a> <a id="33987" class="Symbol">(</a><a id="33988" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="33994" class="Symbol">(</a><a id="33995" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="34001" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="34007" class="Symbol">)))</a>
<a id="34011" class="Symbol">_</a> <a id="34013" class="Symbol">=</a> <a id="34015" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a>
</pre>
<p>Two plus two is four:</p>
<pre class="Agda"><a id="34051" href="/19.08/DeBruijn/#34051" class="Function">_</a> <a id="34053" class="Symbol">:</a> <a id="34055" href="plfa.part2.DeBruijn.html#32608" class="Function">eval</a> <a id="34060" class="Symbol">(</a><a id="34061" href="plfa.part2.DeBruijn.html#31927" class="InductiveConstructor">gas</a> <a id="34065" class="Number">100</a><a id="34068" class="Symbol">)</a> <a id="34070" class="Symbol">(</a><a id="34071" href="plfa.part2.DeBruijn.html#14002" class="Function">plus</a> <a id="34076" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34078" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a> <a id="34082" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34084" href="plfa.part2.DeBruijn.html#13958" class="Function">two</a><a id="34087" class="Symbol">)</a> <a id="34089" href="Agda.Builtin.Equality.html#125" class="Datatype Operator"></a>
<a id="34093" href="/19.08/DeBruijn/#32439" class="InductiveConstructor">steps</a>
<a id="34102" class="Symbol">((</a><a id="34104" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="34111" class="Symbol">(</a><a id="34112" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34120" class="Symbol">(</a><a id="34121" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34130" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="34135" class="Symbol">(</a><a id="34136" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34138" class="Symbol">(</a><a id="34139" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34141" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34142" class="Symbol">))</a> <a id="34145" class="Symbol">(</a><a id="34146" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34148" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34149" class="Symbol">)</a> <a id="34151" class="Symbol">(</a><a id="34152" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34157" class="Symbol">(</a><a id="34158" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34160" class="Symbol">(</a><a id="34161" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34163" class="Symbol">(</a><a id="34164" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34166" class="Symbol">(</a><a id="34167" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34169" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34170" class="Symbol">)))</a> <a id="34174" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34176" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34178" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="34180" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34182" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34184" class="Symbol">(</a><a id="34185" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34187" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34188" class="Symbol">))))))</a>
<a id="34199" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34201" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34206" class="Symbol">(</a><a id="34207" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34212" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34217" class="Symbol">)</a>
<a id="34223" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34225" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34230" class="Symbol">(</a><a id="34231" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34236" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34241" class="Symbol">)</a>
<a id="34246" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="34250" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="34255" class="Symbol">(</a><a id="34256" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="34261" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="34264" class="Symbol">)</a> <a id="34266" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="34272" class="Symbol">(</a><a id="34273" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34280" class="Symbol">(</a><a id="34281" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34289" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="34294" class="Symbol">(</a><a id="34295" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34297" class="Symbol">(</a><a id="34298" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34300" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34301" class="Symbol">))</a> <a id="34304" class="Symbol">(</a><a id="34305" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34307" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34308" class="Symbol">)</a>
<a id="34316" class="Symbol">(</a><a id="34317" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="34329" class="Symbol">((</a><a id="34331" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="34342" class="Symbol">(</a><a id="34343" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34355" class="Symbol">(</a><a id="34356" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34369" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="34374" class="Symbol">(</a><a id="34375" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34377" class="Symbol">(</a><a id="34378" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34380" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34381" class="Symbol">))</a> <a id="34384" class="Symbol">(</a><a id="34385" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34387" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34388" class="Symbol">)</a> <a id="34390" class="Symbol">(</a><a id="34391" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34396" class="Symbol">(</a><a id="34397" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34399" class="Symbol">(</a><a id="34400" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34402" class="Symbol">(</a><a id="34403" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34405" class="Symbol">(</a><a id="34406" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34408" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34409" class="Symbol">)))</a> <a id="34413" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34415" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34417" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="34419" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34421" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34423" class="Symbol">(</a><a id="34424" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34426" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34427" class="Symbol">))))))</a>
<a id="34442" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34444" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34446" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="34456" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34458" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34460" class="Symbol">(</a><a id="34461" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34463" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34464" class="Symbol">)))))</a>
<a id="34474" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34476" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34481" class="Symbol">(</a><a id="34482" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34487" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34492" class="Symbol">)</a>
<a id="34498" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34500" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34505" class="Symbol">(</a><a id="34506" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34511" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34516" class="Symbol">)</a>
<a id="34521" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="34525" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="34530" class="Symbol">(</a><a id="34531" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="34535" class="Symbol">(</a><a id="34536" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="34542" class="Symbol">(</a><a id="34543" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="34549" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="34555" class="Symbol">)))</a> <a id="34559" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="34565" class="Symbol">(</a><a id="34566" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34573" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="34578" class="Symbol">(</a><a id="34579" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34584" class="Symbol">(</a><a id="34585" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34590" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34595" class="Symbol">))</a> <a id="34598" class="Symbol">(</a><a id="34599" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34601" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34602" class="Symbol">)</a>
<a id="34609" class="Symbol">(</a><a id="34610" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="34621" class="Symbol">((</a><a id="34623" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="34633" class="Symbol">(</a><a id="34634" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34645" class="Symbol">(</a><a id="34646" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34658" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="34663" class="Symbol">(</a><a id="34664" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34666" class="Symbol">(</a><a id="34667" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34669" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34670" class="Symbol">))</a> <a id="34673" class="Symbol">(</a><a id="34674" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34676" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34677" class="Symbol">)</a> <a id="34679" class="Symbol">(</a><a id="34680" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34685" class="Symbol">(</a><a id="34686" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34688" class="Symbol">(</a><a id="34689" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34691" class="Symbol">(</a><a id="34692" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34694" class="Symbol">(</a><a id="34695" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34697" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34698" class="Symbol">)))</a> <a id="34702" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34704" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34706" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="34708" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34710" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34712" class="Symbol">(</a><a id="34713" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34715" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34716" class="Symbol">))))))</a>
<a id="34730" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34732" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34734" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="34743" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34745" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34747" class="Symbol">(</a><a id="34748" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34750" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34751" class="Symbol">))))</a>
<a id="34760" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34762" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34767" class="Symbol">(</a><a id="34768" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34773" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34778" class="Symbol">)</a>
<a id="34783" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="34787" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="34791" class="Symbol">(</a><a id="34792" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="34798" class="Symbol">(</a><a id="34799" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="34805" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="34811" class="Symbol">))</a> <a id="34814" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="34820" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="34825" class="Symbol">(</a><a id="34826" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34831" class="Symbol">(</a><a id="34832" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34837" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34842" class="Symbol">))</a> <a id="34845" class="Symbol">(</a><a id="34846" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34851" class="Symbol">(</a><a id="34852" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34857" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="34862" class="Symbol">))</a>
<a id="34869" class="Symbol">(</a><a id="34870" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="34880" class="Symbol">((</a><a id="34882" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="34891" class="Symbol">(</a><a id="34892" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34902" class="Symbol">(</a><a id="34903" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="34914" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="34919" class="Symbol">(</a><a id="34920" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34922" class="Symbol">(</a><a id="34923" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34925" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34926" class="Symbol">))</a> <a id="34929" class="Symbol">(</a><a id="34930" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34932" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34933" class="Symbol">)</a> <a id="34935" class="Symbol">(</a><a id="34936" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="34941" class="Symbol">(</a><a id="34942" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34944" class="Symbol">(</a><a id="34945" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34947" class="Symbol">(</a><a id="34948" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34950" class="Symbol">(</a><a id="34951" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34953" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34954" class="Symbol">)))</a> <a id="34958" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34960" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34962" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="34964" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="34966" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34968" class="Symbol">(</a><a id="34969" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="34971" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="34972" class="Symbol">))))))</a>
<a id="34985" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34987" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="34989" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="34997" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="34999" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35004" class="Symbol">(</a><a id="35005" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35010" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="35015" class="Symbol">)))</a>
<a id="35022" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="35026" href="plfa.part2.DeBruijn.html#25469" class="InductiveConstructor">β-suc</a> <a id="35032" class="Symbol">(</a><a id="35033" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="35039" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="35045" class="Symbol">)</a> <a id="35047" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="35053" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="35062" class="Symbol">((</a><a id="35064" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="35072" class="Symbol">(</a><a id="35073" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35082" class="Symbol">(</a><a id="35083" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35093" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="35098" class="Symbol">(</a><a id="35099" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35101" class="Symbol">(</a><a id="35102" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35104" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35105" class="Symbol">))</a> <a id="35108" class="Symbol">(</a><a id="35109" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35111" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35112" class="Symbol">)</a> <a id="35114" class="Symbol">(</a><a id="35115" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35120" class="Symbol">(</a><a id="35121" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35123" class="Symbol">(</a><a id="35124" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35126" class="Symbol">(</a><a id="35127" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35129" class="Symbol">(</a><a id="35130" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35132" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35133" class="Symbol">)))</a> <a id="35137" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35139" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35141" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="35143" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35145" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35147" class="Symbol">(</a><a id="35148" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35150" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35151" class="Symbol">))))))</a>
<a id="35163" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35165" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35170" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="35181" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35183" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35188" class="Symbol">(</a><a id="35189" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35194" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="35199" class="Symbol">))</a>
<a id="35205" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="35209" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="35215" class="Symbol">(</a><a id="35216" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="35221" class="Symbol">(</a><a id="35222" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="35227" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="35230" class="Symbol">))</a> <a id="35233" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="35239" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="35248" class="Symbol">((</a><a id="35250" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35258" class="Symbol">(</a><a id="35259" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35268" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="35273" class="Symbol">(</a><a id="35274" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35276" class="Symbol">(</a><a id="35277" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35279" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35280" class="Symbol">))</a> <a id="35283" class="Symbol">(</a><a id="35284" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35286" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35287" class="Symbol">)</a>
<a id="35296" class="Symbol">(</a><a id="35297" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="35310" class="Symbol">((</a><a id="35312" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="35324" class="Symbol">(</a><a id="35325" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35338" class="Symbol">(</a><a id="35339" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35353" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="35358" class="Symbol">(</a><a id="35359" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35361" class="Symbol">(</a><a id="35362" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35364" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35365" class="Symbol">))</a> <a id="35368" class="Symbol">(</a><a id="35369" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35371" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35372" class="Symbol">)</a> <a id="35374" class="Symbol">(</a><a id="35375" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35380" class="Symbol">(</a><a id="35381" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35383" class="Symbol">(</a><a id="35384" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35386" class="Symbol">(</a><a id="35387" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35389" class="Symbol">(</a><a id="35390" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35392" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35393" class="Symbol">)))</a> <a id="35397" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35399" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35401" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="35403" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35405" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35407" class="Symbol">(</a><a id="35408" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35410" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35411" class="Symbol">))))))</a>
<a id="35427" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35429" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35431" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="35442" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35444" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35446" class="Symbol">(</a><a id="35447" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35449" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35450" class="Symbol">)))))</a>
<a id="35461" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35463" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35468" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="35479" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35481" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35486" class="Symbol">(</a><a id="35487" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35492" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="35497" class="Symbol">))</a>
<a id="35503" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="35507" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="35513" class="Symbol">(</a><a id="35514" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="35519" class="Symbol">(</a><a id="35520" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="35524" class="Symbol">(</a><a id="35525" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="35531" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="35537" class="Symbol">)))</a> <a id="35541" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="35547" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="35556" class="Symbol">((</a><a id="35558" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35566" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="35571" class="Symbol">(</a><a id="35572" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35577" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="35582" class="Symbol">)</a> <a id="35584" class="Symbol">(</a><a id="35585" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35587" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35588" class="Symbol">)</a>
<a id="35596" class="Symbol">(</a><a id="35597" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="35609" class="Symbol">((</a><a id="35611" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="35622" class="Symbol">(</a><a id="35623" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35635" class="Symbol">(</a><a id="35636" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35649" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="35654" class="Symbol">(</a><a id="35655" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35657" class="Symbol">(</a><a id="35658" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35660" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35661" class="Symbol">))</a> <a id="35664" class="Symbol">(</a><a id="35665" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35667" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35668" class="Symbol">)</a> <a id="35670" class="Symbol">(</a><a id="35671" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35676" class="Symbol">(</a><a id="35677" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35679" class="Symbol">(</a><a id="35680" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35682" class="Symbol">(</a><a id="35683" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35685" class="Symbol">(</a><a id="35686" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35688" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35689" class="Symbol">)))</a> <a id="35693" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35695" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35697" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="35699" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35701" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35703" class="Symbol">(</a><a id="35704" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35706" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35707" class="Symbol">))))))</a>
<a id="35722" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35724" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35726" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="35736" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35738" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35740" class="Symbol">(</a><a id="35741" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35743" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35744" class="Symbol">))))</a>
<a id="35754" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35756" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35761" class="Symbol">(</a><a id="35762" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35767" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="35772" class="Symbol">))</a>
<a id="35778" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="35782" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="35788" class="Symbol">(</a><a id="35789" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="35793" class="Symbol">(</a><a id="35794" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="35800" class="Symbol">(</a><a id="35801" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="35807" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="35813" class="Symbol">)))</a> <a id="35817" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="35823" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="35832" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="35837" class="Symbol">(</a><a id="35838" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35843" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="35848" class="Symbol">)</a> <a id="35850" class="Symbol">(</a><a id="35851" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35856" class="Symbol">(</a><a id="35857" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35862" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="35867" class="Symbol">))</a>
<a id="35874" class="Symbol">(</a><a id="35875" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="35885" class="Symbol">((</a><a id="35887" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="35896" class="Symbol">(</a><a id="35897" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35907" class="Symbol">(</a><a id="35908" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="35919" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="35924" class="Symbol">(</a><a id="35925" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35927" class="Symbol">(</a><a id="35928" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35930" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35931" class="Symbol">))</a> <a id="35934" class="Symbol">(</a><a id="35935" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35937" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35938" class="Symbol">)</a> <a id="35940" class="Symbol">(</a><a id="35941" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="35946" class="Symbol">(</a><a id="35947" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35949" class="Symbol">(</a><a id="35950" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35952" class="Symbol">(</a><a id="35953" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35955" class="Symbol">(</a><a id="35956" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35958" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35959" class="Symbol">)))</a> <a id="35963" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35965" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35967" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="35969" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="35971" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35973" class="Symbol">(</a><a id="35974" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="35976" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="35977" class="Symbol">))))))</a>
<a id="35990" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="35992" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="35994" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="36002" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36004" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36009" class="Symbol">(</a><a id="36010" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36015" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="36020" class="Symbol">)))</a>
<a id="36027" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="36031" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="36037" class="Symbol">(</a><a id="36038" href="plfa.part2.DeBruijn.html#25469" class="InductiveConstructor">β-suc</a> <a id="36044" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="36050" class="Symbol">)</a> <a id="36052" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="36058" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36067" class="Symbol">(</a><a id="36068" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36078" class="Symbol">((</a><a id="36080" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="36089" class="Symbol">(</a><a id="36090" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36100" class="Symbol">(</a><a id="36101" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36112" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="36117" class="Symbol">(</a><a id="36118" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36120" class="Symbol">(</a><a id="36121" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36123" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36124" class="Symbol">))</a> <a id="36127" class="Symbol">(</a><a id="36128" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36130" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36131" class="Symbol">)</a> <a id="36133" class="Symbol">(</a><a id="36134" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36139" class="Symbol">(</a><a id="36140" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36142" class="Symbol">(</a><a id="36143" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36145" class="Symbol">(</a><a id="36146" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36148" class="Symbol">(</a><a id="36149" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36151" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36152" class="Symbol">)))</a> <a id="36156" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="36158" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36160" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="36162" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="36164" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36166" class="Symbol">(</a><a id="36167" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36169" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36170" class="Symbol">))))))</a>
<a id="36183" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36185" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="36197" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36199" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36204" class="Symbol">(</a><a id="36205" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36210" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="36215" class="Symbol">)))</a>
<a id="36222" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="36226" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="36232" class="Symbol">(</a><a id="36233" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="36239" class="Symbol">(</a><a id="36240" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="36245" class="Symbol">(</a><a id="36246" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="36251" href="plfa.part2.DeBruijn.html#25614" class="InductiveConstructor">β-μ</a><a id="36254" class="Symbol">)))</a> <a id="36258" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="36264" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36273" class="Symbol">(</a><a id="36274" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36284" class="Symbol">((</a><a id="36286" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36295" class="Symbol">(</a><a id="36296" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36306" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="36311" class="Symbol">(</a><a id="36312" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36314" class="Symbol">(</a><a id="36315" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36317" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36318" class="Symbol">))</a> <a id="36321" class="Symbol">(</a><a id="36322" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36324" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36325" class="Symbol">)</a>
<a id="36335" class="Symbol">(</a><a id="36336" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36350" class="Symbol">((</a><a id="36352" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="36365" class="Symbol">(</a><a id="36366" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36380" class="Symbol">(</a><a id="36381" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36396" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="36401" class="Symbol">(</a><a id="36402" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36404" class="Symbol">(</a><a id="36405" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36407" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36408" class="Symbol">))</a> <a id="36411" class="Symbol">(</a><a id="36412" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36414" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36415" class="Symbol">)</a> <a id="36417" class="Symbol">(</a><a id="36418" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36423" class="Symbol">(</a><a id="36424" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36426" class="Symbol">(</a><a id="36427" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36429" class="Symbol">(</a><a id="36430" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36432" class="Symbol">(</a><a id="36433" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36435" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36436" class="Symbol">)))</a> <a id="36440" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="36442" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36444" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="36446" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="36448" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36450" class="Symbol">(</a><a id="36451" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36453" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36454" class="Symbol">))))))</a>
<a id="36471" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36473" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36475" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="36487" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36489" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36491" class="Symbol">(</a><a id="36492" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36494" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36495" class="Symbol">)))))</a>
<a id="36507" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36509" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="36521" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36523" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36528" class="Symbol">(</a><a id="36529" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36534" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="36539" class="Symbol">)))</a>
<a id="36546" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="36550" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="36556" class="Symbol">(</a><a id="36557" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="36563" class="Symbol">(</a><a id="36564" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="36569" class="Symbol">(</a><a id="36570" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="36574" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="36580" class="Symbol">)))</a> <a id="36584" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="36590" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36599" class="Symbol">(</a><a id="36600" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36610" class="Symbol">((</a><a id="36612" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36621" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="36626" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="36632" class="Symbol">(</a><a id="36633" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36635" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36636" class="Symbol">)</a>
<a id="36645" class="Symbol">(</a><a id="36646" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36659" class="Symbol">((</a><a id="36661" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="36673" class="Symbol">(</a><a id="36674" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36687" class="Symbol">(</a><a id="36688" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36702" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="36707" class="Symbol">(</a><a id="36708" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36710" class="Symbol">(</a><a id="36711" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36713" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36714" class="Symbol">))</a> <a id="36717" class="Symbol">(</a><a id="36718" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36720" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36721" class="Symbol">)</a> <a id="36723" class="Symbol">(</a><a id="36724" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36729" class="Symbol">(</a><a id="36730" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36732" class="Symbol">(</a><a id="36733" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36735" class="Symbol">(</a><a id="36736" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36738" class="Symbol">(</a><a id="36739" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36741" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36742" class="Symbol">)))</a> <a id="36746" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="36748" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36750" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="36752" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="36754" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36756" class="Symbol">(</a><a id="36757" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36759" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36760" class="Symbol">))))))</a>
<a id="36776" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36778" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36780" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="36791" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36793" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="36795" class="Symbol">(</a><a id="36796" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="36798" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="36799" class="Symbol">))))</a>
<a id="36810" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="36812" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36817" class="Symbol">(</a><a id="36818" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36823" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="36828" class="Symbol">)))</a>
<a id="36835" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="36839" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="36845" class="Symbol">(</a><a id="36846" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="36852" class="Symbol">(</a><a id="36853" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="36857" class="Symbol">(</a><a id="36858" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="36864" class="Symbol">(</a><a id="36865" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="36871" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="36877" class="Symbol">))))</a> <a id="36882" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="36888" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36897" class="Symbol">(</a><a id="36898" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36908" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="36913" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a> <a id="36919" class="Symbol">(</a><a id="36920" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36925" class="Symbol">(</a><a id="36926" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="36931" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="36936" class="Symbol">))</a>
<a id="36944" class="Symbol">(</a><a id="36945" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a>
<a id="36956" class="Symbol">((</a><a id="36958" href="/19.08/DeBruijn/#11515" class="InductiveConstructor Operator">μ</a>
<a id="36968" class="Symbol">(</a><a id="36969" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36980" class="Symbol">(</a><a id="36981" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="36993" href="/19.08/DeBruijn/#11426" class="InductiveConstructor">case</a> <a id="36998" class="Symbol">(</a><a id="36999" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37001" class="Symbol">(</a><a id="37002" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37004" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37005" class="Symbol">))</a> <a id="37008" class="Symbol">(</a><a id="37009" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37011" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37012" class="Symbol">)</a> <a id="37014" class="Symbol">(</a><a id="37015" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37020" class="Symbol">(</a><a id="37021" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37023" class="Symbol">(</a><a id="37024" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37026" class="Symbol">(</a><a id="37027" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37029" class="Symbol">(</a><a id="37030" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37032" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37033" class="Symbol">)))</a> <a id="37037" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37039" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37041" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a> <a id="37043" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37045" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37047" class="Symbol">(</a><a id="37048" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37050" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37051" class="Symbol">))))))</a>
<a id="37065" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37067" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37069" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a>
<a id="37078" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37080" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37085" class="Symbol">(</a><a id="37086" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37091" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="37096" class="Symbol">))))</a>
<a id="37104" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="37108" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="37114" class="Symbol">(</a><a id="37115" href="plfa.part2.DeBruijn.html#25129" class="InductiveConstructor">ξ-suc</a> <a id="37121" href="plfa.part2.DeBruijn.html#25367" class="InductiveConstructor">β-zero</a><a id="37127" class="Symbol">)</a> <a id="37129" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="37135" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="37140" class="Symbol">(</a><a id="37141" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37146" class="Symbol">(</a><a id="37147" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37152" class="Symbol">(</a><a id="37153" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37158" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="37163" class="Symbol">)))</a>
<a id="37170" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator"></a><a id="37171" class="Symbol">)</a>
<a id="37176" class="Symbol">(</a><a id="37177" href="/19.08/DeBruijn/#32121" class="InductiveConstructor">done</a> <a id="37182" class="Symbol">(</a><a id="37183" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="37189" class="Symbol">(</a><a id="37190" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="37196" class="Symbol">(</a><a id="37197" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="37203" class="Symbol">(</a><a id="37204" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="37210" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="37216" class="Symbol">)))))</a>
<a id="37222" class="Symbol">_</a> <a id="37224" class="Symbol">=</a> <a id="37226" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a>
</pre>
<p>And the corresponding term for Church numerals:</p>
<pre class="Agda"><a id="37288" href="/19.08/DeBruijn/#37288" class="Function">_</a> <a id="37290" class="Symbol">:</a> <a id="37292" href="plfa.part2.DeBruijn.html#32608" class="Function">eval</a> <a id="37297" class="Symbol">(</a><a id="37298" href="plfa.part2.DeBruijn.html#31927" class="InductiveConstructor">gas</a> <a id="37302" class="Number">100</a><a id="37305" class="Symbol">)</a> <a id="37307" class="Symbol">(</a><a id="37308" href="plfa.part2.DeBruijn.html#14410" class="Function">plusᶜ</a> <a id="37314" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37316" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="37321" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37323" href="plfa.part2.DeBruijn.html#14352" class="Function">twoᶜ</a> <a id="37328" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37330" href="plfa.part2.DeBruijn.html#14500" class="Function">sucᶜ</a> <a id="37335" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37337" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="37342" class="Symbol">)</a> <a id="37344" href="Agda.Builtin.Equality.html#125" class="Datatype Operator"></a>
<a id="37348" href="/19.08/DeBruijn/#32439" class="InductiveConstructor">steps</a>
<a id="37357" class="Symbol">((</a><a id="37359" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="37366" class="Symbol">(</a><a id="37367" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="37375" class="Symbol">(</a><a id="37376" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37378" class="Symbol">(</a><a id="37379" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37381" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37383" class="Symbol">(</a><a id="37384" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37386" class="Symbol">(</a><a id="37387" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37389" class="Symbol">(</a><a id="37390" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37392" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37393" class="Symbol">)))</a> <a id="37397" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37399" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37401" class="Symbol">(</a><a id="37402" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37404" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37405" class="Symbol">)</a> <a id="37407" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37409" class="Symbol">(</a><a id="37410" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37412" class="Symbol">(</a><a id="37413" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37415" class="Symbol">(</a><a id="37416" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37418" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37419" class="Symbol">))</a> <a id="37422" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37424" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37426" class="Symbol">(</a><a id="37427" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37429" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37430" class="Symbol">)</a> <a id="37432" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37434" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37436" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37437" class="Symbol">)))))</a>
<a id="37447" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37449" class="Symbol">(</a><a id="37450" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37452" class="Symbol">(</a><a id="37453" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37455" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37457" class="Symbol">(</a><a id="37458" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37460" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37461" class="Symbol">)</a> <a id="37463" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37465" class="Symbol">(</a><a id="37466" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37468" class="Symbol">(</a><a id="37469" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37471" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37472" class="Symbol">)</a> <a id="37474" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37476" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37478" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37479" class="Symbol">)))</a>
<a id="37487" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37489" class="Symbol">(</a><a id="37490" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37492" class="Symbol">(</a><a id="37493" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37495" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37497" class="Symbol">(</a><a id="37498" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37500" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37501" class="Symbol">)</a> <a id="37503" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37505" class="Symbol">(</a><a id="37506" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37508" class="Symbol">(</a><a id="37509" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37511" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37512" class="Symbol">)</a> <a id="37514" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37516" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37518" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37519" class="Symbol">)))</a>
<a id="37527" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37529" class="Symbol">(</a><a id="37530" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37532" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37537" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37539" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37540" class="Symbol">)</a>
<a id="37546" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37548" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="37557" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="37561" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="37566" class="Symbol">(</a><a id="37567" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="37572" class="Symbol">(</a><a id="37573" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="37578" class="Symbol">(</a><a id="37579" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="37583" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="37586" class="Symbol">)))</a> <a id="37590" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="37596" class="Symbol">(</a><a id="37597" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="37604" class="Symbol">(</a><a id="37605" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="37613" class="Symbol">(</a><a id="37614" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="37623" class="Symbol">(</a><a id="37624" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37626" class="Symbol">(</a><a id="37627" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37629" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37631" class="Symbol">(</a><a id="37632" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37634" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37635" class="Symbol">)</a> <a id="37637" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37639" class="Symbol">(</a><a id="37640" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37642" class="Symbol">(</a><a id="37643" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37645" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37646" class="Symbol">)</a> <a id="37648" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37650" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37652" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37653" class="Symbol">)))</a> <a id="37657" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37659" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37661" class="Symbol">(</a><a id="37662" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37664" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37665" class="Symbol">)</a> <a id="37667" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="37676" class="Symbol">(</a><a id="37677" href="/19.08/DeBruijn/#11130" class="InductiveConstructor Operator">`</a> <a id="37679" class="Symbol">(</a><a id="37680" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37682" class="Symbol">(</a><a id="37683" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37685" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37686" class="Symbol">))</a> <a id="37689" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37691" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37693" class="Symbol">(</a><a id="37694" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37696" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37697" class="Symbol">)</a> <a id="37699" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37701" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37703" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37704" class="Symbol">))))</a>
<a id="37713" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37715" class="Symbol">(</a><a id="37716" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37718" class="Symbol">(</a><a id="37719" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37721" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37723" class="Symbol">(</a><a id="37724" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37726" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37727" class="Symbol">)</a> <a id="37729" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37731" class="Symbol">(</a><a id="37732" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37734" class="Symbol">(</a><a id="37735" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37737" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37738" class="Symbol">)</a> <a id="37740" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37742" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37744" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37745" class="Symbol">)))</a>
<a id="37753" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37755" class="Symbol">(</a><a id="37756" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37758" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37763" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37765" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37766" class="Symbol">)</a>
<a id="37772" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37774" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="37783" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="37787" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="37792" class="Symbol">(</a><a id="37793" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="37798" class="Symbol">(</a><a id="37799" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="37803" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="37806" class="Symbol">))</a> <a id="37809" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="37815" class="Symbol">(</a><a id="37816" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="37823" class="Symbol">(</a><a id="37824" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="37832" class="Symbol">(</a><a id="37833" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37835" class="Symbol">(</a><a id="37836" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37838" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37840" class="Symbol">(</a><a id="37841" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37843" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37844" class="Symbol">)</a> <a id="37846" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37848" class="Symbol">(</a><a id="37849" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37851" class="Symbol">(</a><a id="37852" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37854" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37855" class="Symbol">)</a> <a id="37857" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37859" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37861" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37862" class="Symbol">)))</a> <a id="37866" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37868" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37870" class="Symbol">(</a><a id="37871" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37873" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37874" class="Symbol">)</a> <a id="37876" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="37884" class="Symbol">((</a><a id="37886" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37888" class="Symbol">(</a><a id="37889" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37891" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37893" class="Symbol">(</a><a id="37894" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37896" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37897" class="Symbol">)</a> <a id="37899" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37901" class="Symbol">(</a><a id="37902" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37904" class="Symbol">(</a><a id="37905" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37907" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37908" class="Symbol">)</a> <a id="37910" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37912" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37914" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37915" class="Symbol">)))</a> <a id="37919" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37921" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37923" class="Symbol">(</a><a id="37924" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="37926" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37927" class="Symbol">)</a> <a id="37929" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="37931" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37933" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37934" class="Symbol">)))</a>
<a id="37942" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37944" class="Symbol">(</a><a id="37945" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="37947" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="37952" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="37954" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="37955" class="Symbol">)</a>
<a id="37961" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="37963" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="37972" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="37976" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="37981" class="Symbol">(</a><a id="37982" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="37986" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="37989" class="Symbol">)</a> <a id="37991" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="37997" class="Symbol">(</a><a id="37998" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a>
<a id="38005" class="Symbol">(</a><a id="38006" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38008" class="Symbol">(</a><a id="38009" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38011" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38013" class="Symbol">(</a><a id="38014" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38016" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38017" class="Symbol">)</a> <a id="38019" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38021" class="Symbol">(</a><a id="38022" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38024" class="Symbol">(</a><a id="38025" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38027" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38028" class="Symbol">)</a> <a id="38030" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38032" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38034" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38035" class="Symbol">)))</a> <a id="38039" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38041" class="Symbol">(</a><a id="38042" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38044" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38049" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38051" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38052" class="Symbol">)</a> <a id="38054" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="38061" class="Symbol">((</a><a id="38063" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38065" class="Symbol">(</a><a id="38066" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38068" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38070" class="Symbol">(</a><a id="38071" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38073" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38074" class="Symbol">)</a> <a id="38076" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38078" class="Symbol">(</a><a id="38079" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38081" class="Symbol">(</a><a id="38082" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38084" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38085" class="Symbol">)</a> <a id="38087" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38089" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38091" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38092" class="Symbol">)))</a> <a id="38096" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38098" class="Symbol">(</a><a id="38099" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38101" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38106" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38108" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38109" class="Symbol">)</a> <a id="38111" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38113" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38115" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38116" class="Symbol">))</a>
<a id="38123" href="/19.08/DeBruijn/#11249" class="InductiveConstructor Operator">·</a> <a id="38125" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a>
<a id="38134" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38138" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38142" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a> <a id="38149" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="38155" class="Symbol">(</a><a id="38156" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38158" class="Symbol">(</a><a id="38159" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38161" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38163" class="Symbol">(</a><a id="38164" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38166" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38167" class="Symbol">)</a> <a id="38169" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38171" class="Symbol">(</a><a id="38172" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38174" class="Symbol">(</a><a id="38175" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38177" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38178" class="Symbol">)</a> <a id="38180" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38182" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38184" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38185" class="Symbol">)))</a> <a id="38189" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38191" class="Symbol">(</a><a id="38192" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38194" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38199" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38201" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38202" class="Symbol">)</a> <a id="38204" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="38210" class="Symbol">((</a><a id="38212" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38214" class="Symbol">(</a><a id="38215" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38217" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38219" class="Symbol">(</a><a id="38220" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38222" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38223" class="Symbol">)</a> <a id="38225" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38227" class="Symbol">(</a><a id="38228" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38230" class="Symbol">(</a><a id="38231" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38233" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38234" class="Symbol">)</a> <a id="38236" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38238" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38240" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38241" class="Symbol">)))</a> <a id="38245" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38247" class="Symbol">(</a><a id="38248" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38250" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38255" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38257" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38258" class="Symbol">)</a> <a id="38260" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38262" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="38267" class="Symbol">)</a>
<a id="38272" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38276" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="38281" class="Symbol">(</a><a id="38282" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38286" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="38289" class="Symbol">)</a> <a id="38291" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="38297" class="Symbol">(</a><a id="38298" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38300" class="Symbol">(</a><a id="38301" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38303" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38308" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38310" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38311" class="Symbol">)</a> <a id="38313" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38315" class="Symbol">((</a><a id="38317" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38319" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38324" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38326" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38327" class="Symbol">)</a> <a id="38329" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38331" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38333" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38334" class="Symbol">))</a> <a id="38337" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="38343" class="Symbol">((</a><a id="38345" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38347" class="Symbol">(</a><a id="38348" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38350" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38352" class="Symbol">(</a><a id="38353" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38355" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38356" class="Symbol">)</a> <a id="38358" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38360" class="Symbol">(</a><a id="38361" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38363" class="Symbol">(</a><a id="38364" href="plfa.part2.DeBruijn.html#9906" class="InductiveConstructor Operator">S</a> <a id="38366" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38367" class="Symbol">)</a> <a id="38369" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38371" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38373" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38374" class="Symbol">)))</a> <a id="38378" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38380" class="Symbol">(</a><a id="38381" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38383" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38388" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38390" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38391" class="Symbol">)</a> <a id="38393" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38395" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="38400" class="Symbol">)</a>
<a id="38405" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38409" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="38414" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="38418" class="Symbol">(</a><a id="38419" href="plfa.part2.DeBruijn.html#24782" class="InductiveConstructor">ξ-·₁</a> <a id="38424" class="Symbol">(</a><a id="38425" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38429" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a><a id="38432" class="Symbol">))</a> <a id="38435" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="38441" class="Symbol">(</a><a id="38442" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38444" class="Symbol">(</a><a id="38445" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38447" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38452" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38454" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38455" class="Symbol">)</a> <a id="38457" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38459" class="Symbol">((</a><a id="38461" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38463" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38468" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38470" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38471" class="Symbol">)</a> <a id="38473" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38475" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38477" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38478" class="Symbol">))</a> <a id="38481" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="38487" class="Symbol">((</a><a id="38489" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38491" class="Symbol">(</a><a id="38492" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38494" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38499" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38501" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38502" class="Symbol">)</a> <a id="38504" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38506" class="Symbol">((</a><a id="38508" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38510" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38515" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38517" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38518" class="Symbol">)</a> <a id="38520" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38522" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38524" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38525" class="Symbol">))</a> <a id="38528" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38530" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="38535" class="Symbol">)</a>
<a id="38540" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38544" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="38549" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="38553" class="Symbol">(</a><a id="38554" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38558" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="38564" class="Symbol">)</a> <a id="38566" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="38572" class="Symbol">(</a><a id="38573" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38575" class="Symbol">(</a><a id="38576" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38578" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38583" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38585" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38586" class="Symbol">)</a> <a id="38588" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38590" class="Symbol">((</a><a id="38592" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38594" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38599" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38601" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38602" class="Symbol">)</a> <a id="38604" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38606" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38608" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38609" class="Symbol">))</a> <a id="38612" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="38618" class="Symbol">((</a><a id="38620" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38622" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38627" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38629" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38630" class="Symbol">)</a> <a id="38632" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38634" class="Symbol">((</a><a id="38636" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38638" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38643" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38645" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38646" class="Symbol">)</a> <a id="38648" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38650" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="38655" class="Symbol">))</a>
<a id="38661" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38665" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="38670" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="38674" class="Symbol">(</a><a id="38675" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="38680" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="38684" class="Symbol">(</a><a id="38685" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38689" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="38695" class="Symbol">))</a> <a id="38698" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="38704" class="Symbol">(</a><a id="38705" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38707" class="Symbol">(</a><a id="38708" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38710" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38715" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38717" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38718" class="Symbol">)</a> <a id="38720" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38722" class="Symbol">((</a><a id="38724" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38726" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38731" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38733" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38734" class="Symbol">)</a> <a id="38736" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38738" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38740" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38741" class="Symbol">))</a> <a id="38744" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a>
<a id="38750" class="Symbol">((</a><a id="38752" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38754" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38759" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38761" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38762" class="Symbol">)</a> <a id="38764" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38766" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38771" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="38776" class="Symbol">)</a>
<a id="38781" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38785" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="38790" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="38794" class="Symbol">(</a><a id="38795" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38799" class="Symbol">(</a><a id="38800" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="38806" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="38812" class="Symbol">))</a> <a id="38815" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="38821" class="Symbol">(</a><a id="38822" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38824" class="Symbol">(</a><a id="38825" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38827" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38832" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38834" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38835" class="Symbol">)</a> <a id="38837" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38839" class="Symbol">((</a><a id="38841" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38843" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38848" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38850" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38851" class="Symbol">)</a> <a id="38853" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38855" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38857" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38858" class="Symbol">))</a> <a id="38861" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38863" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38868" class="Symbol">(</a><a id="38869" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38874" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="38879" class="Symbol">)</a>
<a id="38884" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38888" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38892" class="Symbol">(</a><a id="38893" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="38899" class="Symbol">(</a><a id="38900" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="38906" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="38912" class="Symbol">))</a> <a id="38915" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="38921" class="Symbol">(</a><a id="38922" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38924" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38929" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38931" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38932" class="Symbol">)</a> <a id="38934" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38936" class="Symbol">((</a><a id="38938" href="plfa.part2.DeBruijn.html#11182" class="InductiveConstructor Operator">ƛ</a> <a id="38940" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38945" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="38947" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="38948" class="Symbol">)</a> <a id="38950" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="38952" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38957" class="Symbol">(</a><a id="38958" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="38963" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="38968" class="Symbol">))</a>
<a id="38974" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="38978" href="plfa.part2.DeBruijn.html#24891" class="InductiveConstructor">ξ-·₂</a> <a id="38983" href="plfa.part2.DeBruijn.html#24034" class="InductiveConstructor">V-ƛ</a> <a id="38987" class="Symbol">(</a><a id="38988" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="38992" class="Symbol">(</a><a id="38993" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="38999" class="Symbol">(</a><a id="39000" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39006" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="39012" class="Symbol">)))</a> <a id="39016" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="39022" class="Symbol">(</a><a id="39023" href="/19.08/DeBruijn/#11182" class="InductiveConstructor Operator">ƛ</a> <a id="39025" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="39030" href="plfa.part2.DeBruijn.html#11130" class="InductiveConstructor Operator">`</a> <a id="39032" href="plfa.part2.DeBruijn.html#9859" class="InductiveConstructor">Z</a><a id="39033" class="Symbol">)</a> <a id="39035" href="plfa.part2.DeBruijn.html#11249" class="InductiveConstructor Operator">·</a> <a id="39037" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="39042" class="Symbol">(</a><a id="39043" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="39048" class="Symbol">(</a><a id="39049" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="39054" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="39059" class="Symbol">))</a>
<a id="39065" href="/19.08/DeBruijn/#26501" class="InductiveConstructor Operator">—→⟨</a> <a id="39069" href="plfa.part2.DeBruijn.html#25014" class="InductiveConstructor">β-ƛ</a> <a id="39073" class="Symbol">(</a><a id="39074" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39080" class="Symbol">(</a><a id="39081" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39087" class="Symbol">(</a><a id="39088" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39094" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="39100" class="Symbol">)))</a> <a id="39104" href="plfa.part2.DeBruijn.html#26501" class="InductiveConstructor Operator"></a>
<a id="39110" href="/19.08/DeBruijn/#11370" class="InductiveConstructor Operator">`suc</a> <a id="39115" class="Symbol">(</a><a id="39116" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="39121" class="Symbol">(</a><a id="39122" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="39127" class="Symbol">(</a><a id="39128" href="plfa.part2.DeBruijn.html#11370" class="InductiveConstructor Operator">`suc</a> <a id="39133" href="plfa.part2.DeBruijn.html#11324" class="InductiveConstructor">`zero</a><a id="39138" class="Symbol">)))</a>
<a id="39145" href="/19.08/DeBruijn/#26447" class="InductiveConstructor Operator"></a><a id="39146" class="Symbol">)</a>
<a id="39151" class="Symbol">(</a><a id="39152" href="/19.08/DeBruijn/#32121" class="InductiveConstructor">done</a> <a id="39157" class="Symbol">(</a><a id="39158" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39164" class="Symbol">(</a><a id="39165" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39171" class="Symbol">(</a><a id="39172" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39178" class="Symbol">(</a><a id="39179" href="plfa.part2.DeBruijn.html#24187" class="InductiveConstructor">V-suc</a> <a id="39185" href="plfa.part2.DeBruijn.html#24121" class="InductiveConstructor">V-zero</a><a id="39191" class="Symbol">)))))</a>
<a id="39197" class="Symbol">_</a> <a id="39199" class="Symbol">=</a> <a id="39201" href="Agda.Builtin.Equality.html#182" class="InductiveConstructor">refl</a>
</pre>
<p>We omit the proof that reduction is deterministic, since it is
tedious and almost identical to the previous proof.</p>
<h4 id="exercise-mul-example-recommended">Exercise <code class="language-plaintext highlighter-rouge">mul-example</code> (recommended)</h4>
<p>Using the evaluator, confirm that two times two is four.</p>
<pre class="Agda"><a id="39433" class="Comment">-- Your code goes here</a>
</pre>
<h2 id="intrinsic-typing-is-golden">Intrinsic typing is golden</h2>
<p>Counting the lines of code is instructive. While this chapter
covers the same formal development as the previous two
chapters, it has much less code. Omitting all the examples,
and all proofs that appear in Properties but not DeBruijn
(such as the proof that reduction is deterministic), the
number of lines of code is as follows:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Lambda 216
Properties 235
DeBruijn 275
</code></pre></div></div>
<p>The relation between the two approaches approximates the
golden ratio: extrinsically-typed terms
require about 1.6 times as much code as intrinsicaly-typed.</p>
<h2 id="unicode">Unicode</h2>
<p>This chapter uses the following unicode:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>σ U+03C3 GREEK SMALL LETTER SIGMA (\Gs or \sigma)
₀ U+2080 SUBSCRIPT ZERO (\_0)
₃ U+20B3 SUBSCRIPT THREE (\_3)
₄ U+2084 SUBSCRIPT FOUR (\_4)
₅ U+2085 SUBSCRIPT FIVE (\_5)
₆ U+2086 SUBSCRIPT SIX (\_6)
₇ U+2087 SUBSCRIPT SEVEN (\_7)
≠ U+2260 NOT EQUAL TO (\=n)
</code></pre></div></div>
</div>
<p style="text-align:center;">
<a alt="Previous chapter" href="/19.08/Properties/">Prev</a>
&bullet;
<a alt="Source code" href="https://github.com/plfa/plfa.github.io/blob/dev-19.08/src/plfa/part2/DeBruijn.lagda.md">Source</a>
&bullet;
<a alt="Next chapter" href="/19.08/More/">Next</a>
</p>
</article>
</div>
</main><footer class="site-footer h-card">
<data class="u-url" href="/19.08/"></data>
<div class="wrapper">
<h2 class="footer-heading">Programming Language Foundations in Agda
</h2><div class="footer-col-wrapper">
<div class="footer-col footer-col-1">
<ul class="contact-list">
<li class="p-name">Philip Wadler</li>
<li><a class="u-email" href="mailto:wadler@inf.ed.ac.uk">wadler@inf.ed.ac.uk</a></li>
</ul>
</div>
<div class="footer-col footer-col-2"><ul class="social-media-list"><li><a href="https://github.com/wadler"><svg class="svg-icon"><use xlink:href="/19.08/assets/minima-social-icons.svg#github"></use></svg> <span class="username">wadler</span></a></li></ul>
</div>
<div class="footer-col footer-col-3"></div>
</div><div class="footer-col-wrapper">
<div class="footer-col footer-col-1">
<ul class="contact-list">
<li class="p-name">Wen Kokke</li>
<li><a class="u-email" href="mailto:wen.kokke@ed.ac.uk">wen.kokke@ed.ac.uk</a></li>
</ul>
</div>
<div class="footer-col footer-col-2"><ul class="social-media-list"><li><a href="https://github.com/wenkokke"><svg class="svg-icon"><use xlink:href="/19.08/assets/minima-social-icons.svg#github"></use></svg> <span class="username">wenkokke</span></a></li><li><a href="https://www.twitter.com/wenkokke"><svg class="svg-icon"><use xlink:href="/19.08/assets/minima-social-icons.svg#twitter"></use></svg> <span class="username">wenkokke</span></a></li></ul>
</div>
<div class="footer-col footer-col-3"></div>
</div><div class="footer-col-wrapper">
<div class="footer-col footer-col-1">
<ul class="contact-list">
<li class="p-name">Jeremy Siek</li>
<li><a class="u-email" href="mailto:jsiek@indiana.edu">jsiek@indiana.edu</a></li>
</ul>
</div>
<div class="footer-col footer-col-2"><ul class="social-media-list"><li><a href="https://github.com/jsiek"><svg class="svg-icon"><use xlink:href="/19.08/assets/minima-social-icons.svg#github"></use></svg> <span class="username">jsiek</span></a></li><li><a href="https://www.twitter.com/jeremysiek"><svg class="svg-icon"><use xlink:href="/19.08/assets/minima-social-icons.svg#twitter"></use></svg> <span class="username">jeremysiek</span></a></li></ul>
</div>
<div class="footer-col footer-col-3"></div>
</div>This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>
</div>
</footer>
<!-- Import jQuery -->
<script type="text/javascript" src="/19.08/assets/jquery.js"></script>
<script type="text/javascript">
// Makes sandwhich menu works
$('.menu-icon').click(function(){
$('.trigger').toggle();
});
// Script which allows for foldable code blocks
$('div.foldable pre').each(function(){
var autoHeight = $(this).height();
var lineHeight = parseFloat($(this).css('line-height'));
var plus = $("<div></div>");
var horLine = $("<div></div>");
var verLine = $("<div></div>");
$(this).prepend(plus);
plus.css({
'position' : 'relative',
'float' : 'right',
'right' : '-' + (0.5 * lineHeight - 1.5) + 'px',
'width' : lineHeight,
'height' : lineHeight});
verLine.css({
'position' : 'relative',
'height' : lineHeight,
'width' : '3px',
'background-color' : '#C1E0FF'});
horLine.css({
'position' : 'relative',
'top' : '-' + (0.5 * lineHeight + 1.5) + 'px',
'left' : '-' + (0.5 * lineHeight - 1.5) + 'px',
'height' : '3px',
'width' : lineHeight,
'background-color' : '#C1E0FF'});
plus.append(verLine);
plus.append(horLine);
$(this).height(2.0 * lineHeight);
$(this).css('overflow','hidden');
$(this).click(function(){
if ($(this).height() == autoHeight) {
$(this).height(2.0 * lineHeight);
plus.show();
}
else {
$(this).height('auto');
plus.hide();
}
});
});
</script>
<!-- Import KaTeX -->
<script type="text/javascript" src="/19.08/assets/katex.js"></script>
<!-- Script which renders TeX using KaTeX -->
<script type="text/javascript">
$("script[type='math/tex']").replaceWith(
function(){
var tex = $(this).text();
return "<span class=\"inline-equation\">" +
katex.renderToString(tex) +
"</span>";
});
$("script[type='math/tex; mode=display']").replaceWith(
function(){
var tex = $(this).text().replace(/%.*?(\n|$)/g,"");
return "<div class=\"equation\">" +
katex.renderToString("\\displaystyle "+tex) +
"</div>";
});
</script>
</body>
</html>