diff --git a/content/lambda-calculus/church-rosser/beta-eta-reduction.tex b/content/lambda-calculus/church-rosser/beta-eta-reduction.tex index b4015862..fc477c0a 100644 --- a/content/lambda-calculus/church-rosser/beta-eta-reduction.tex +++ b/content/lambda-calculus/church-rosser/beta-eta-reduction.tex @@ -11,17 +11,21 @@ \olsection{$\beta\eta$-reduction} The Church--Rosser property holds for -$\beta\eta$-reduction ($\bered$). +$\beta\eta$-reduction ($\bered$). Write $M\beredone N$ when either +$M\bredone N$ or $M\eredone N$; thus $\beredone$ is the union of the +two compatible one-step contraction relations. \begin{lem}\ollabel{lem:one-par} If $M \beredone M'$, then $M \beredpar M'$. \end{lem} \begin{proof} - By induction on the !!{derivation} of $M \beredone M'$. If $M \bredone - M'$ by $\eta$-conversion (i.e., \olref[syn][eta]{defn:beredone}), we - use \olref[pbe]{thm:refl}. The other cases are as in - \olref[b]{lem:one-par}. + Induct on the compatible one-step contraction derivation. For a + root $\eta$-contraction, $M=\lambd[x][Nx]$, $M'=N$, and + $x\notin\FV{N}$. Use $N\beredpar N$ from + \olref[pbe]{thm:refl}, followed by \olref[pbe]{defn:beredpar5}. + The root $\beta$ case and the abstraction and application contexts + are as in \olref[b]{lem:one-par}. \end{proof} @@ -49,7 +53,7 @@ \end{proof} \begin{thm}\ollabel{thm:cr} - $\bered$ satisfies Church--Rosser property. + $\bered$ satisfies the Church--Rosser property. \end{thm} \begin{proof} diff --git a/content/lambda-calculus/church-rosser/beta-reduction.tex b/content/lambda-calculus/church-rosser/beta-reduction.tex index 00b305a4..8c032824 100644 --- a/content/lambda-calculus/church-rosser/beta-reduction.tex +++ b/content/lambda-calculus/church-rosser/beta-reduction.tex @@ -13,11 +13,18 @@ \begin{lem}\ollabel{lem:one-par} If $M \bredone M'$, then $M \bredpar M'$. \end{lem} -\begin{proof} If $M \bredone M'$, then $M$ is +\begin{proof} +Induct on the compatible one-step contraction derivation. In the +root-redex case, $M$ is $(\lambd[x][N])Q$, $M'$ is $\Subst{N}{Q}{x}$, for some $x$, $N$, and~$Q$. Since $N \bredpar N$ and $Q \bredpar Q$ by \olref[pb]{thm:refl}, we immediately have $(\lambd[x][N])Q \bredpar \Subst{N}{Q}{x}$ by \olref[pb]{defn:bredpar}\olref[pb]{defn:bredpar4}. +For a contraction inside an abstraction, lift the induction +hypothesis by \olref[pb]{defn:bredpar2}. For a contraction in either +child of an application, combine the induction hypothesis with +\olref[pb]{thm:refl} on the unchanged child and use +\olref[pb]{defn:bredpar3}. \end{proof} \begin{lem}\ollabel{lem:par-red} @@ -40,7 +47,7 @@ by the reduction $Q \bred Q'$. \item The last rule is \olref[pb]{defn:bredpar4}: $M$ is $(\lambd[x][N])Q$ and $M'$ is $\Subst{N'}{Q'}{x}$ for some $x$, - $N$, $M'$, $Q$, $Q'$, where $N \bredpar N'$ and $Q \bredpar Q'$. + $N$, $N'$, $Q$, $Q'$, where $N \bredpar N'$ and $Q \bredpar Q'$. By induction hypothesis we get $Q \bred Q'$ and $N \bred N'$. So $(\lambd[x][N])Q \bred \Subst{N'}{Q'}{x}$ by $N \bred N'$ followed by $Q \bred Q'$ and finally contraction of $(\lambd[x][N'])Q'$ to @@ -58,7 +65,7 @@ $\bred \subseteq \xred$: Suppose $M \bred M'$, i.e., $M \ident M_1 \bredone \dots \bredone M_k \ident M'$. By \olref{lem:one-par}, $M - \ident M_1 \bredpar \dots \bredpar M_k \ident M'$. Since is $\xred$ + \ident M_1 \bredpar \dots \bredpar M_k \ident M'$. Since $\xred$ contains $\bredpar$ and is transitive, $M \xred M'$. $\xred \subseteq \bred$: Suppose $M \xred M'$, i.e., $M diff --git a/content/lambda-calculus/church-rosser/definitions-and-properties.tex b/content/lambda-calculus/church-rosser/definitions-and-properties.tex index 8e494072..3342ed7b 100644 --- a/content/lambda-calculus/church-rosser/definitions-and-properties.tex +++ b/content/lambda-calculus/church-rosser/definitions-and-properties.tex @@ -21,8 +21,8 @@ We can view the lambda calculus as a model of computation in which terms in normal form are ``values'' and a reducibility relation on -terms are the ``calculation rules.'' The Church--Rosser property states -is that when there is more than one way to proceed with a calculation, +terms supplies the ``calculation rules.'' The Church--Rosser property states +that when there is more than one way to proceed with a calculation, there is still only a single value of the expression. To take an example from elementary algebra, there's more than one way @@ -61,7 +61,7 @@ M & \xredone Q_1 \xredone \dots \xredone Q_n. \end{align*} We will prove the theorem by constructing a grid $N$ of terms of - height is $m + 1$ and width $n + 1$. We use $N_{i,j}$ to denote the + height $m + 1$ and width $n + 1$. We use $N_{i,j}$ to denote the term in the $i$-th row and $j$-th column. We construct $N$ in such a way that $N_{i,j} \xredone N_{i+1,j}$ and diff --git a/content/lambda-calculus/church-rosser/parallel-beta-eta-reduction.tex b/content/lambda-calculus/church-rosser/parallel-beta-eta-reduction.tex index 7d7f66f3..debb93a4 100644 --- a/content/lambda-calculus/church-rosser/parallel-beta-eta-reduction.tex +++ b/content/lambda-calculus/church-rosser/parallel-beta-eta-reduction.tex @@ -19,7 +19,7 @@ inductively defined as follows: \begin{enumerate} \item \ollabel{defn:beredpar1} $x \beredpar x$. - \item \ollabel{defn:beredpar2} If $N \xrightarrow{\beta} N'$ then $\lambd[x][N] \beredpar + \item \ollabel{defn:beredpar2} If $N \beredpar N'$ then $\lambd[x][N] \beredpar \lambd[x][N']$. \item \ollabel{defn:beredpar3} If $P \beredpar P'$ and $Q \beredpar Q'$ then $PQ \beredpar P'Q'$. @@ -47,7 +47,9 @@ as follows: \begin{align} \becd{x} &= x \ollabel{defn:becd1} \\ - \becd{(\lambd[x][N])} &= \lambd[x][\becd{N}] \ollabel{defn:becd2}\\ + \becd{(\lambd[x][N])} &= \lambd[x][\becd{N}] + &&\text{if $\lambd[x][N]$ is not an $\eta$-redex} + \ollabel{defn:becd2}\\ \becd{(PQ)} &= \becd{P}\becd{Q} && \text{if $P$ is not a $\lambd$-abstract} \ollabel{defn:becd3} \\ \becd{((\lambd[x][N])Q)} &= \Subst{\becd{N}}{\becd{Q}}{x} @@ -67,7 +69,7 @@ The first four cases are exactly like those in \olref[pb]{lem:comp}. If the last rule is \olref{defn:beredpar5}, then $M$ is - $\lambd[x][Nx]$, $M'$ is $N'$ for some $x$ and~$N'$ where $x \notin + $\lambd[x][Nx]$, $M'$ is $N'$ for some $x$, $N$, and~$N'$ where $x \notin FV(N)$, and $N \beredpar N'$. We want to show that $\Subst{(\lambd[x][Nx])}{R}{y} \beredpar \Subst{N'}{R'}{y}$, i.e., $\lambd[x][\Subst{N}{R}{y} x] \beredpar \Subst{N'}{R'}{y}$. It @@ -80,14 +82,52 @@ \end{lem} \begin{proof} - By induction on the !!{derivation} of $M \beredpar M'$. - - The first four cases are like those in \olref[pb]{lem:cont}. If the - last rule is \olref{defn:beredpar5}, then $M$ is $\lambd[x][Nx]$ and - $M'$ is $N'$ for some $x$, $N$, $N'$ where $x \notin FV(N)$ and $N - \beredpar N'$. We want to show that $N' \beredpar - \becd{(\lambd[x][Nx])}$, i.e., $N' \beredpar \becd{N}$, which is - immediate by induction hypothesis. +Use strong induction on the size of $M$, with representatives chosen +fresh whenever needed. Induction on parallel-reduction derivations +first gives $\FV{A'}\subseteq\FV{A}$ whenever $A\beredpar A'$. +Also $A\beredpar\becd{A}$ follows from the development clauses by +structural induction. These facts preserve every freshness +condition used below. + +The variable case is immediate. Suppose $M=\lambd[x][N]$ is not an +$\eta$-redex. Its parallel reduct is $\lambd[x][N']$, where +$N\beredpar N'$. The induction hypothesis and the abstraction rule +give $\lambd[x][N']\beredpar\lambd[x][\becd{N}]=\becd{M}$. + +Now suppose $M=\lambd[x][Px]$ with $x\notin\FV{P}$, so that +$\becd{M}=\becd{P}$. An outer $\eta$ step gives a reduct $P'$ of $P$, +and induction gives $P'\beredpar\becd{P}$. An abstraction step gives +$\lambd[x][N']$ where $Px\beredpar N'$. If this body step uses the +application rule, $N'=P'x$, and induction followed by the $\eta$ +rule gives $\lambd[x][P'x]\beredpar\becd{P}$. If it uses the +$\beta$ rule, write $P=\lambd[y][T]$ and +$N'=\Subst{T'}{x}{y}$, where $T\beredpar T'$. Since $x$ is fresh, +$\lambd[x][\Subst{T'}{x}{y}]\aeq\lambd[y][T']$. +The latter is a parallel reduct of the smaller term $P$, so induction +again gives a parallel reduction to $\becd{P}$. + +Suppose next that $M=PQ$ and $P$ is not an abstraction. Only the +application rule can be last, and induction gives +$P'Q'\beredpar\becd{P}\becd{Q}=\becd{M}$. + +Finally let $M=(\lambd[x][N])Q$. If the last rule is the $\beta$ +rule, induction and \olref{lem:comp} give +$\Subst{N'}{Q'}{x}\beredpar\Subst{\becd{N}}{\becd{Q}}{x} +=\becd{M}$. If the last rule is application, the reduct is $P'Q'$ +with $\lambd[x][N]\beredpar P'$ and $Q\beredpar Q'$. +When the function reduction uses abstraction, $P'=\lambd[x][N']$; +induction and the $\beta$ rule give the same target. + +The remaining function reduction uses $\eta$: then $N=Sx$, +$x\notin\FV{S}$, and $S\beredpar P'$. If $S$ is not an abstraction, +the target is $\becd{S}\becd{Q}$, reached from $P'Q'$ by induction +and application. If $S=\lambd[y][T]$, the target is +$\Subst{\becd{T}}{\becd{Q}}{y}$, by the capture-free substitution +identity and freshness of $x$. But $P'Q'$ is a parallel reduct of +$SQ$, a term strictly smaller than the original +$(\lambd[x][Sx])Q$. The strong induction hypothesis for $SQ$ gives +exactly that target. This covers both overlaps between $\beta$ and +$\eta$. \end{proof} \begin{thm}\ollabel{thm:cr} diff --git a/content/lambda-calculus/church-rosser/parallel-beta-reduction.tex b/content/lambda-calculus/church-rosser/parallel-beta-reduction.tex index 86c8f55d..d268e10f 100644 --- a/content/lambda-calculus/church-rosser/parallel-beta-reduction.tex +++ b/content/lambda-calculus/church-rosser/parallel-beta-reduction.tex @@ -11,13 +11,13 @@ \olsection{Parallel $\beta$-reduction} We introduce the notion of \emph{parallel $\beta$-reduction}, and -prove the it has the Church--Rosser property. +prove that it has the Church--Rosser property. \begin{defn}[parallel $\beta$-reduction, $\bredpar$] \ollabel{defn:bredpar} Parallel reduction ($\bredpar$) of terms is inductively defined as follows: \begin{enumerate} \item \ollabel{defn:bredpar1} $x \bredpar x$. - \item \ollabel{defn:bredpar2} If $N \xrightarrow{\beta} N'$ then $\lambd[x][N] \bredpar + \item \ollabel{defn:bredpar2} If $N \bredpar N'$ then $\lambd[x][N] \bredpar \lambd[x][N']$. \item \ollabel{defn:bredpar3} If $P \bredpar P'$ and $Q \bredpar Q'$ then $PQ \bredpar P'Q'$. @@ -86,7 +86,7 @@ $\Subst{(\lambd[x][N])}{R}{y} \bredpar \Subst{(\lambd[x][N'])}{R'}{y}$, i.e., $\lambd[x][\Subst{N}{R}{y}] \bredpar - \lambd[x][\Subst{N'}{R}{y}]$. This follows immediately by + \lambd[x][\Subst{N'}{R'}{y}]$. This follows immediately by \olref{defn:bredpar2} and the induction hypothesis. \item The last step is \olref{defn:bredpar3}: Exercise. \item The last step is \olref{defn:bredpar4}: $M$ is diff --git a/content/lambda-calculus/introduction/basic-pr-lambda.tex b/content/lambda-calculus/introduction/basic-pr-lambda.tex index c07ae88f..48038f36 100644 --- a/content/lambda-calculus/introduction/basic-pr-lambda.tex +++ b/content/lambda-calculus/introduction/basic-pr-lambda.tex @@ -14,10 +14,10 @@ \end{lem} \begin{proof} -$\Zero$ is just -$\lambd[x][\lambd[y][y]]$. +$\Zero$ is !!{lambda defined} by +$\lambd[z][\lambd[x][\lambd[y][y]]]$. -The successor function~$\Succ$, is +The successor function~$\Succ$ is defined by $\fn{Succ}(u) = \lambd[x][\lambd[y][x(uxy)]]$. You should think about why this works; for each numeral $\num{n}$, thought of as an iterator, and each function~$f$, $\fn{Succ}(\num{n},f)$ is a function that, diff --git a/content/lambda-calculus/introduction/composition.tex b/content/lambda-calculus/introduction/composition.tex index f150e14d..b5754bcc 100644 --- a/content/lambda-calculus/introduction/composition.tex +++ b/content/lambda-calculus/introduction/composition.tex @@ -14,6 +14,9 @@ \end{lem} \begin{proof} +We first prove this for total component functions. The general +partial case follows from the independent computability equivalence +completed in \olref[min]{sec}. Suppose $f$ is defined by composition from $h$, $g_0,$ \dots,~$g_{k-1}$. Assuming $h$, $g_0$, \dots,~$g_{k-1}$ are !!{lambda defined} by $H$, $G_0$, \dots,~$G_{k-1}$, @@ -24,7 +27,10 @@ \dots, G_{k-1}(x_0, \dots, x_{l-1})). \] In other words, the language of the lambda calculus is well suited to -represent composition. +represent composition for total components. For partial components +this term alone need not work: a constant-zero outer term can erase +a nonnormalizing inner term, although strict numeric composition is +then undefined. \end{proof} \end{document} diff --git a/content/lambda-calculus/introduction/computable-lambda.tex b/content/lambda-calculus/introduction/computable-lambda.tex index c99cdf1c..99818c1a 100644 --- a/content/lambda-calculus/introduction/computable-lambda.tex +++ b/content/lambda-calculus/introduction/computable-lambda.tex @@ -15,16 +15,25 @@ \end{thm} \begin{proof} -We need to show that every partial computable function~$f$ is -!!{lambda defined} by a lambda term~$F$. By Kleene's normal form -theorem, it suffices to show that every primitive recursive function -is !!{lambda defined} by a lambda term, and then that the functions -!!{lambda definable} are closed under suitable compositions and -unbounded search. To show that every primitive recursive function is -!!{lambda defined} by a lambda term, it suffices to show that the -initial functions are !!{lambda definable}, and that the partial -functions that are !!{lambda definable} are closed under -composition, primitive recursion, and unbounded search. +By Kleene's normal form theorem, for every partial computable +function~$f$ there are primitive recursive functions $r$ and $u$ such +that +\[ +f(\vec x)\simeq u(\umin{t}{r(\vec x,t)}). +\] +First we represent +the initial functions and prove closure under composition and +primitive recursion for \emph{total} functions. This supplies terms +for $r$ and $u$. We then implement a search that returns the decoded +value $u(t)$ only in its successful branch; the construction at the +end of \olref[min]{sec} also proves that an unsuccessful search has +no normal form. This proves the theorem without assuming that +ordinary lambda application preserves undefinedness. + +After this construction, the general partial closure results follow +from the computability of lambda-definable functions +(\olref[cmp]{thm:lambda-computable}) and the corresponding strict +closure operations on partial computable functions. \end{proof} We will use a more conventional notation to make the rest of the proof diff --git a/content/lambda-calculus/introduction/currying.tex b/content/lambda-calculus/introduction/currying.tex index 2c1422c0..ecf49b9c 100644 --- a/content/lambda-calculus/introduction/currying.tex +++ b/content/lambda-calculus/introduction/currying.tex @@ -10,7 +10,7 @@ \olsection{Currying} A $\lambd$-abstract $\lambd[x][M]$ represents a function of one -argument, which is quite a limitation when we want to define function +argument, which is quite a limitation when we want to define a function accepting multiple arguments. One way to do this would be by extending the $\lambd$-calculus to allow the formation of pairs, triples, etc., in which case, say, a three-place function @@ -41,7 +41,8 @@ accepts an argument~$x$ and returns the function~$\lambd[y][x]$. The function $\lambd[y][x]$ accepts another argument~$y$, but drops it, and always returns~$x$. Let's see what happens when we apply -$\lambd[x][\lambd[y][x]]$ to two arguments: +$\lambd[x][\lambd[y][x]]$ to two arguments, choosing $y$ not free +in $M$ by renaming the bound variable first if necessary: \begin{align*} (\lambd[x][\lambd[y][x]])MN \bredone & (\lambd[y][M])N \\ @@ -51,16 +52,17 @@ In general, to write a function with parameters $x_1$, \dots,~$x_n$ defined by some term~$N$, we can write $\lambd[x_1][\lambd[x_2][\ldots\lambd[x_n][N]]]$. If we apply $n$ arguments -to it we get: +to it, first choose the $x_i$ pairwise distinct and not free in any +$M_j$, renaming bound variables as necessary. Then we get: \begin{multline*} - (\lambd[x_1][\lambd[x_2][\ldots\lambd[x_n][N]]]) M_1 \dots M_n \bredone\\ + (\lambd[x_1][\lambd[x_2][\ldots\lambd[x_n][N]]]) M_1 \dots M_n\\ \begin{aligned} \bredone {} & (\Subst{(\lambd[x_2][\ldots\lambd[x_n][N]])}{M_1}{x_1}) M_2 \dots M_n\\ \eqs {} & (\lambd[x_2][\ldots\lambd[x_n][\Subst{N}{M_1}{x_1}]]) M_2 \dots M_n \\ \vdots & \\ - \bredone {} &\Subst{\Subst{P}{M_1}{x_1}\ldots}{M_n}{x_n} + \bredone {} &\Subst{\Subst{N}{M_1}{x_1}\ldots}{M_n}{x_n} \end{aligned} \end{multline*} The last line literally means substituting $M_i$ for $x_i$ in the body diff --git a/content/lambda-calculus/introduction/fixed-point-combinator.tex b/content/lambda-calculus/introduction/fixed-point-combinator.tex index dff80dcf..65f9ebfe 100644 --- a/content/lambda-calculus/introduction/fixed-point-combinator.tex +++ b/content/lambda-calculus/introduction/fixed-point-combinator.tex @@ -10,7 +10,8 @@ \olsection{Fixed-Point Combinators} Suppose you have a lambda term $g$, and you want another term $k$ with -the property that $k$ is $\beta$-equivalent to $gk$. Define terms +the property that $k$ is $\beta$-equivalent to $gk$. Choose $x$ not free in +$g$, and define terms \[ \fn{diag}(x) = xx \] diff --git a/content/lambda-calculus/introduction/lambda-computable.tex b/content/lambda-calculus/introduction/lambda-computable.tex index 30021023..6f654adf 100644 --- a/content/lambda-calculus/introduction/lambda-computable.tex +++ b/content/lambda-calculus/introduction/lambda-computable.tex @@ -18,8 +18,7 @@ \begin{proof} Suppose a function~$f$ is !!{lambda defined} by a lambda term~$X$. Let us describe an informal procedure to compute~$f$. On input $m_0$, -\dots,~$m_{n-1}$, write down the term $X \num m_0 \ldots \num -m_{n-1}$. Build a tree, first writing down all the one-step reductions +\dots,~$m_{n-1}$, write down the term $X \num{m_0} \ldots \num{m_{n-1}}$. Build a tree, first writing down all the one-step reductions of the original term; below that, write all the one-step reductions of those (i.e., the two-step reductions of the original term); and keep going. If you ever reach a numeral, return that as the answer; @@ -28,7 +27,7 @@ An appeal to Church's thesis tells us that this function is computable. A better way to prove the theorem would be to give a recursive description of this search procedure. For example, one -could define a sequence primitive recursive functions and relations, +could define a sequence of primitive recursive functions and relations, ``$\fn{IsASubterm}$,'' ``$\fn{Substitute}$,'' ``$\fn{ReducesToInOneStep}$,'' ``$\fn{ReductionSequence}$,'' ``$\fn{Numeral}$,'' etc. The partial recursive procedure for computing diff --git a/content/lambda-calculus/introduction/lambda-definability.tex b/content/lambda-calculus/introduction/lambda-definability.tex index da245a8d..10265fee 100644 --- a/content/lambda-calculus/introduction/lambda-definability.tex +++ b/content/lambda-calculus/introduction/lambda-definability.tex @@ -18,7 +18,7 @@ \begin{defn} For each natural number~$n$, define the \emph{Church numeral} $\num{n}$ to be the lambda term $\lambd[x][\lambd[y][(x(x(x(\dots -x(y)))))]]$, where there are $n$ $x$'s in all. +x(y)))))]]$, where the body contains $n$ occurrences of $x$. \end{defn} The terms $\num{n}$ are ``iterators'': on input $f$, $\num{n}$ returns @@ -27,14 +27,14 @@ a function on the natural numbers. \begin{defn} -Let $f(x_0, \dots, x_{k-1})$ be an $n$-ary partial function from $\Nat$ +Let $f(x_0, \dots, x_{k-1})$ be a $k$-ary partial function from $\Nat^k$ to $\Nat$. We say a $\lambd$-term~$F$ \emph{!!{lambda define}s}~$f$ iff for every sequence of natural numbers $n_0$, \dots,~$n_{k-1}$, \[ F\, \num{n_0}\, \num{n_1} \dots \num{n_{k-1}} \red \num{f(n_0, n_1, \dots, n_{k-1})} \] -if $f(n_0, \dots, n_{k-1})$ is defined, and $F, \num{n_0}\, \num{n_1} +if $f(n_0, \dots, n_{k-1})$ is defined, and $F\, \num{n_0}\, \num{n_1} \dots \num{n_{k-1}}$ has no normal form otherwise. \end{defn} diff --git a/content/lambda-calculus/introduction/minimization.tex b/content/lambda-calculus/introduction/minimization.tex index e3651e71..2a4b7601 100644 --- a/content/lambda-calculus/introduction/minimization.tex +++ b/content/lambda-calculus/introduction/minimization.tex @@ -18,6 +18,10 @@ \end{lem} \begin{proof} +First assume that $f$ is total; the arbitrary partial case is proved +at the end. Choose its representative closed, replacing any free +variables by closed terms; since every numeric input reduces to a +closed numeral, this preserves all required values. The idea is roughly as follows. Given $x$, we will use the fixed-point lambda term $Y$ to define a function $h_x(n)$ which searches for a~$y$ starting at~$n$; then $g(x)$ is just $h_x(0)$. The function~$h_x$ can @@ -30,18 +34,19 @@ \end{cases} \] -Here are the details. Since $f$ is primitive recursive, it is +Here are the details. By hypothesis, $f$ is !!{lambda defined} by some term $F$. Remember that we also have a lambda term~$D$, such that $D(M, N, \bar{0}) \red M$ and $D(M, N, \bar{1}) \red N$. Fixing $x$ for the moment, to !!{lambda define} $h_x$ we want to find a term~$H$ (depending on~$x$) satisfying \[ -H(\num{n}) \equiv D(\num{n}, H(S(\num{n})), F(x, \num{n})). +H(\num{n}) \equiv D(\num{n}, H(\fn{Succ}(\num{n})), F(x, \num{n})). \] -We can do this using the fixed-point term~$Y$. First, let $U$ be the +Use Turing's fixed-point term~$Y$ from \olref[fix]{sec}, so that +$YU\red U(YU)$. First, let $U$ be the term \[ -\lambd[h][\lambd[z][D(z,(h(Sz)),F(x,z))]], +\lambd[h][\lambd[z][D(z,(h(\fn{Succ}(z))),F(x,z))]], \] and then let $H$ be the term~$YU$. Notice that the only free variable in~$H$ is~$x$. Let us show that $H$ satisfies the equation above. @@ -53,17 +58,49 @@ In particular, for each natural number~$n$, we have \begin{align*} H(\num{n}) & \equiv U(H, \num{n}) \\ -& \red D(\num{n}, H(S(\num{n})), F(x, \num{n})), +& \red D(\num{n}, H(\fn{Succ}(\num{n})), F(x, \num{n})), \end{align*} as required. Notice that if you substitute a numeral $\num{m}$ for~$x$ in the last line, the expression reduces to $\num{n}$ if $F(\num{m}, -\num{n})$ reduces to $\num{0}$, and it reduces to $H(S(\num{n}))$ if +\num{n})$ reduces to $\num{0}$, and it reduces to $H(\fn{Succ}(\num{n}))$ if $F(\num{m}, \num{n})$ reduces to any other numeral. -To finish off the proof, let $G$ be $\lambd[x][H(\num 0)]$. Then $G$ -!!{lambda define}s~$g$; in other words, for every~$m$, $G(\num m)$ -reduces to~$\overline {g(m)}$, if $g(m)$ is defined, and has no normal -form otherwise. +To finish the total-input case, let $G$ be $\lambd[x][H(\num 0)]$. +If the search first succeeds at $n$, finitely many unfoldings give +$G(\num m)\red\num n$. If no candidate succeeds, leftmost-outermost +reduction continually evaluates the next test and returns to the +recursive call in head position. It never reaches a normal form. +Here we use the normalization theorem: leftmost-outermost reduction +reaches a $\beta$-normal form whenever one exists.\footnote{For a +proof, see Andrew D. Ker, \emph{Lambda Calculus and Types} (2009), +Theorem 3.2.3, pp.~35--36.} Thus an unsuccessful search has no normal +form. Merely exhibiting some infinite reduction sequence would not +suffice. + +We can now complete \olref[lrp]{thm:computable-lambda}, without using +closure under arbitrary partial composition. Let the total +primitive recursive $r$ and $u$ be as in its proof outline, and let +closed terms $R$ and $U_0$ represent them. With fresh variables, put +\[ + Q=\lambd[h][\lambd[n][\lambd[\vec x][ + D(U_0(n),h(\fn{Succ}(n),\vec x),R(\vec x,n))]]], + \qquad L=YQ. +\] +Then $\lambd[\vec x][L(\num 0,\vec x)]$ represents $f$. If the least +successful test is $n$, the search selects $U_0(\num n)$, which +reduces to the numeral for $u(n)$. If no test succeeds, the same +leftmost-outermost argument gives no normal form. The decoder is +inside the successful branch, so it cannot erase a failed search. + +Finally, for arbitrary partial lambda-definable component functions, +\olref[cmp]{thm:lambda-computable} makes them partial computable. +Strict composition computes every inner value before applying the +outer function; strict primitive recursion computes the base and +all earlier values; strict minimization tests candidates in order +and is undefined if a required test is undefined. These are partial +computable procedures, so the theorem just completed supplies +lambda representatives. This proves the general partial versions +of all three closure lemmas. \end{proof} \end{document} diff --git a/content/lambda-calculus/introduction/primitive-recursion.tex b/content/lambda-calculus/introduction/primitive-recursion.tex index 1aee7eca..e5aae62a 100644 --- a/content/lambda-calculus/introduction/primitive-recursion.tex +++ b/content/lambda-calculus/introduction/primitive-recursion.tex @@ -10,24 +10,24 @@ \olsection{\usetoken{S}{lambda definable} Functions are Closed under Primitive Recursion} When it comes to primitive recursion, we finally need to do some -work. We will have to proceed in stages. As before, on the assumption -that we already have terms $G$ and $H$ that !!{lambda define} functions -$g$ and~$h$, respectively, we want a term $H$ that !!{lambda define}s the +work. We first prove the direct construction for total component +functions; the general partial case follows at the end of +\olref[min]{sec}. We will proceed in stages. As before, on the assumption +that we already have terms $G'$ and $H'$ that !!{lambda define} functions +$g$ and~$h$, respectively, we want a term $F'$ that !!{lambda define}s the function~$f$ defined by \begin{align*} f(0, \vec z) & = g(\vec z) \\ -f(x+1, \vec z) & = h(z, f(x,\vec z), \vec z). +f(x+1, \vec z) & = h(x, f(x,\vec z), \vec z). \end{align*} -So, in general, given lambda terms $G'$ and~$H'$, it suffices to find -a term~$F$ such that +Given these lambda terms $G'$ and~$H'$, we seek a term~$F'$ such that \begin{align*} -F(\num{0}, \vec z) & \equiv G(\vec z) \\ -F(\overline{n+1}, \vec z) & \equiv H(\num{n}, F(\num{n}, \vec z), \vec z) +F'(\num{0}, \vec z) & \equiv G'(\vec z) \\ +F'(\overline{n+1}, \vec z) & \equiv H'(\num{n}, F'(\num{n}, \vec z), \vec z). \end{align*} -for every natural number~$n$; the fact that $G'$ and~$H'$ !!{lambda define} -$g$ and~$h$ means that whenever we plug in numerals $\num{\vec m}$ -for $\vec z$, $F(\num{n+1}, \num{\vec m})$ will normalize to the -right answer. +For total $g$ and $h$, induction on $n$ then shows that substituting +numerals $\num{\vec m}$ for $\vec z$ makes +$F'(\num{n},\num{\vec m})$ normalize to the right answer. But for this, it suffices to find a term~$F$ satisfying \begin{align*} @@ -35,9 +35,9 @@ F(\overline {n+1}) & \equiv H(\num{n},F(\num{n})) \intertext{for every natural number $n$, where} G & = \lambd[\vec z][G'(\vec z)] \text{ and}\\ -H(u,v) & = \lambd[\vec z][H'(u,v(u,\vec z),\vec z)]. +H(u,v) & = \lambd[\vec z][H'(u,v(\vec z),\vec z)]. \end{align*} -In other words, with lambda trickery, we can avoid having to worry +Set $F'(u,\vec z)=F(u)(\vec z)$. In other words, with lambda trickery, we can avoid having to worry about the extra parameters $\vec z$---they just get absorbed in the lambda notation. @@ -76,7 +76,11 @@ \end{lem} \begin{proof} -We need to show that given any terms, $G$ and $H$, we can find a term +For the total component functions under consideration, it suffices +to construct the following iterator. Its equations hold for any +terms $G$ and $H$, but by themselves do not enforce strict +undefinedness: a step that ignores its previous value can erase an +undefined base. We can find a term $F$ such that \begin{align*} F(\num{0}) & \equiv G \\ @@ -95,7 +99,7 @@ The details are as follows. Define $T(u)$ by \[ -T(u) = \tuple{S((u)_0), H((u)_0,(u)_1)}. +T(u) = \tuple{\fn{Succ}((u)_0), H((u)_0,(u)_1)}. \] Now it is easy to verify that for any number~$n$, \[ @@ -126,8 +130,8 @@ & \equiv (\tuple{\num{n+1}, H(\num{n}, F(\num{n}))})_1 \\ & \equiv H(\num{n}, F(\num{n})). \end{align*} -Here we have used the induction hypothesis on the second-to-last -line. For the first clause, we have +Here we have used the induction hypothesis in the transition to the +third line. For the first clause, we have \begin{align*} \num{n+1} (T, \tuple{\num 0, G}) & \equiv T(\num{n} (T, \tuple{\num 0, G})) \\ diff --git a/content/lambda-calculus/introduction/reduction.tex b/content/lambda-calculus/introduction/reduction.tex index b4dfd6d0..121ac6eb 100644 --- a/content/lambda-calculus/introduction/reduction.tex +++ b/content/lambda-calculus/introduction/reduction.tex @@ -58,11 +58,11 @@ \item Also, some terms can be reduced in more than one way; for example, \[ -(\lambd[x][(\lambd[y][yx]) z)] v \redone (\lambd[y][yv]) z +(\lambd[x][(\lambd[y][yx]) z]) v \redone (\lambd[y][yv]) z \] by contracting the outermost application; and \[ -(\lambd[x][(\lambd[y][yx]) z)] v \redone (\lambd[x][zx]) v +(\lambd[x][(\lambd[y][yx]) z]) v \redone (\lambd[x][zx]) v \] by contracting the innermost one. Note, in this case, however, that both terms further reduce to the same term, $zv$. diff --git a/content/lambda-calculus/introduction/syntax.tex b/content/lambda-calculus/introduction/syntax.tex index 0fbb2bcb..b1752ea6 100644 --- a/content/lambda-calculus/introduction/syntax.tex +++ b/content/lambda-calculus/introduction/syntax.tex @@ -36,7 +36,7 @@ to right. For example, if $M$, $N$, $P$, and $Q$ are terms, then $MNPQ$ abbreviates $(((MN)P)Q)$. \item Again, when parentheses are left out, lambda abstraction is to - be given the widest scope possible. From example, $\lambd[x][MNP]$ is + be given the widest scope possible. For example, $\lambd[x][MNP]$ is read $(\lambd[x][((MN)P)])$. \item A lambda can be used to abstract multiple variables. For example, $\lambd[xyz][M]$ is short for @@ -61,8 +61,8 @@ $\lambd[y][y]$. It will be convenient to think of these as being the ``same'' term; in other words, when we say that $M$ and $N$ are the same, we also mean ``up to renamings of the bound variables.'' -Variables that are in the scope of a $\lambd$ are called ``bound'', -while others are called ``free.'' There are no free variables in the +A variable occurrence is called ``bound'' when it is in the scope of +an abstraction binding that same variable, and ``free'' otherwise. There are no free variables in the previous example; but in \[ (\lambd[z][yz])x diff --git a/content/lambda-calculus/lambda-definability/arithmetical-functions.tex b/content/lambda-calculus/lambda-definability/arithmetical-functions.tex index c8e01618..e92acab5 100644 --- a/content/lambda-calculus/lambda-definability/arithmetical-functions.tex +++ b/content/lambda-calculus/lambda-definability/arithmetical-functions.tex @@ -1,5 +1,5 @@ % Part: lambda-calculus -% Chapter: lambda-definablity +% Chapter: lambda-definability % Section: arithmetical-functions \documentclass[../../../include/open-logic-section]{subfiles} @@ -26,8 +26,8 @@ if the argument $a$ is a Church numeral, it reduces to one. Consider:} (\lambd[a][\lambd[fx][f ({a} f x)]])\,\num{n} & \redone \lambd[fx][f ({\num{n}} f x)]. - \intertext{The embedded term $\num{n}fx$ is a redex, since - $\num{n}$ is $\lambd[fx][f^nx]$. So $\num{n}fx \redone f^nx$ and + \intertext{The embedded term $\num{n}fx$ contains a redex, since + $\num{n}$ is $\lambd[fx][f^nx]$. Thus $\num{n}fx \red f^nx$ and so, for the entire term we have} \fn{Succ}\, \num n & \red \lambd[fx][f(f^n(x))], \end{align*} @@ -65,19 +65,19 @@ \intertext{or, alternatively,} \fn{Add}' & \ident \lambd[{a}{b}][{a}\, \fn{Succ} \, {b}]. \intertext{The first addition works as follows: $\fn{Add}$ first - accept two numbers ${a}$ and ${b}$. The result is a function that + accepts two numbers ${a}$ and ${b}$. The result is a function that accepts $f$ and $x$ and returns $af(bfx)$. If $a$ and $b$ are Church numerals $\num{n}$ and $\num{m}$, this reduces to $f^{n+m}(x)$, which is identical to $f^{n}(f^{m}(x))$. Or, slowly:} - (\lambd[{a}{b}][\lambd[fx][{a} f ({b} f x)]])\num n\,\num m & \redone + (\lambd[{a}{b}][\lambd[fx][{a} f ({b} f x)]])\num n\,\num m & \red \lambd[fx][\num{n}\, f (\num {m}\, f x)] \\ - & \redone \lambd[fx][\num{n}\, f (f^m x)] \\ - & \redone \lambd[fx][f^n (f^m x)] \ident \num {n+m}. + & \red \lambd[fx][\num{n}\, f (f^m x)] \\ + & \red \lambd[fx][f^n (f^m x)] \ident \num {n+m}. \intertext{The second representation of addition $\fn{Add'}$ works differently: Applied to two Church numerals $\num{n}$ and $\num{m}$,} \fn{Add}' \num n \,\num m -& \redone \num{n}\, \fn{Succ}\, \num{m}. +& \red \num{n}\, \fn{Succ}\, \num{m}. \intertext{But $\num{n} f x$ always reduces to $f^n(x)$. So,} \num{n}\, \fn{Succ}\, \num{m} & \red \fn{Succ}^n(\num{m}). \end{align*} @@ -141,7 +141,7 @@ $\eta$-reduction, this does not work for exponent~$0$ however. \end{editorial} -Predecessor and subtraction on Church numeral are not as easy to +Predecessor and subtraction on Church numerals are not as easy to define as we might think: it requires encoding of pairs. \end{document} diff --git a/content/lambda-calculus/lambda-definability/fixpoints.tex b/content/lambda-calculus/lambda-definability/fixpoints.tex index da4852d1..c620a0c5 100644 --- a/content/lambda-calculus/lambda-definability/fixpoints.tex +++ b/content/lambda-calculus/lambda-definability/fixpoints.tex @@ -21,7 +21,7 @@ side. Such recursive definitions involving self-reference are not part of the lambda calculus. Defining a term, e.g., by \[ -\fn{Mult} \ident \lambd[ab][a (\fn{Add}\, b) 0] +\fn{Mult} \ident \lambd[ab][a (\fn{Add}\, b) \num{0}] \] only involves previously defined terms on the right-hand side, such as $\fn{Add}$. We can always remove $\fn{Add}$ by replacing it with its @@ -52,11 +52,13 @@ \] applied to the term $f$, i.e., $\fn{Fac}'\,f$, also represents the factorial function. That is, if we regard $\fn{Fac}'$ as a function -accepting a function and returning a function, the value of -$\fn{Fac'}\, f$ is just~$f$, provided $f$ is the factorial. A -function~$f$ with the property that $\fn{Fac}' \, f \equal[\beta] f$ is called -a \emph{fixpoint} of $\fn{Fac}'$. So, the factorial is a fixpoint of -$\fn{Fac}'$. +accepting a numerical-function representative and returning another +one, $\fn{Fac'}\,f$ agrees with $f$ on Church-numeral inputs whenever +$f$ represents factorial. This numerical agreement does not by itself +imply $\beta$-equivalence of the terms. A term~$f$ satisfying the +stronger equation $\fn{Fac}'\,f\equal[\beta]f$ is called a +\emph{fixpoint} of $\fn{Fac}'$. The construction below supplies such +a fixpoint and proves that it represents factorial. There are terms in the lambda calculus that compute the fixpoints of a given term, and these terms can then be used to turn a term like @@ -86,15 +88,15 @@ Yg$, so $Yg$ is a fixpoint of~$g$. \end{proof} -Of course, since $Yg$ is a redex, the reduction can continue indefinitely: +Of course, since $Yg$ contains a redex, the reduction can continue indefinitely: \begin{align*} Y g &\red g (Y g) \\ &\red g (g (Y g)) \\ &\red g(g (g (Y g)))\\ &\ldots \end{align*} -So we can think of $Yg$ as $g$ applied to itself infinitely many -times. If we apply~$g$ to it one additional time, we---so to +So we can think of $Yg$ as an indefinitely repeated nesting of +applications of~$g$. If we apply~$g$ to it one additional time, we---so to speak---aren't doing anything extra; $g$~applied to~$g$ applied infinitely many times to~$Yg$ is still $g$~applied to~$Yg$ infinitely many times. @@ -145,7 +147,7 @@ that} G\,x_1 \dots x_n & \equal[\beta] \Subst{N}{G}{g}. \intertext{For by the fixpoint theorem,} -G \ident (Y \lambd[g][\lambd[x_1\dots x_n][N]]) & \red \lambd[g][\lambd[x_1\dots x_n][N]](Y \lambd[g][\lambd[x_1\dots x_n][N]])\\ +G \ident (Y \lambd[g][\lambd[x_1\dots x_n][N]]) & \red (\lambd[g][\lambd[x_1\dots x_n][N]])(Y \lambd[g][\lambd[x_1\dots x_n][N]])\\ & \ident (\lambd[g][\lambd[x_1\dots x_n][N]])\,G \intertext{and consequently} G\,x_1 \dots x_n @@ -155,12 +157,12 @@ \end{align*} The $Y$ combinator of \olref{defn:Turing-Y} is due to Alan -Turing. Alonzo Church had proposed a different version which we'll +Turing. Curry's paradoxical combinator is a different version which we'll call~$Y_C$: \[ Y_C \ident \lambd[g][(\lambd[x][g(xx)])(\lambd[x][g(xx)])]. \] -Church's combinator is a bit weaker than Turing's in that $Y_C g +Curry's combinator is a bit weaker than Turing's in that $Y_C g \equal[\beta] g(Y_C g)$ but not $Y_C g \bred g(Y_C g)$. Let $V$ be the term $\lambd[x][g(xx)]$, so that $Y_C \ident \lambd[g][VV]$. Then \begin{align*} diff --git a/content/lambda-calculus/lambda-definability/introduction.tex b/content/lambda-calculus/lambda-definability/introduction.tex index 219b597a..e5e13c45 100644 --- a/content/lambda-calculus/lambda-definability/introduction.tex +++ b/content/lambda-calculus/lambda-definability/introduction.tex @@ -70,9 +70,9 @@ \num{n_1} \dots \num{n_{k-1}}$ has no normal form otherwise. \end{defn} -A very simple example are the constant functions. The term $C_k \ident +Very simple examples are the constant functions. The term $C_k \ident \lambd[x][\num{k}]$ !!{lambda define}s the function $c_k\colon \Nat \to -\Nat$ such that $c(n) = k$. For $C_k \, \num n \ident +\Nat$ such that $c_k(n) = k$. For $C_k \, \num n \ident (\lambd[x][\num{k}])\num n \redone \num{k}$ for any~$n$. The identity function is !!{lambda defined} by $\lambd[x][x]$. More complex functions are of course harder to define, and often require a lot of diff --git a/content/lambda-calculus/lambda-definability/lambda-definable-recursive.tex b/content/lambda-calculus/lambda-definability/lambda-definable-recursive.tex index 6073d375..25caff6e 100644 --- a/content/lambda-calculus/lambda-definability/lambda-definable-recursive.tex +++ b/content/lambda-calculus/lambda-definability/lambda-definable-recursive.tex @@ -20,13 +20,13 @@ \begin{proof} We only sketch the proof. First, we arithmetize $\lambd$-terms, - i.e., systematially assign G\"odel numbers to $\lambd$-terms, using + i.e., systematically assign G\"odel numbers to $\lambd$-terms, using the usual power-of-primes coding of sequences. Then we define a partial recursive function $\fn{normalize}(t)$ operating on the G\"odel number~$t$ of a lambda term as argument, and which returns the G\"odel number of the normal form if it has one, or is undefined otherwise. Then define two partial recursive functions - $\fn{toChurch}$ and $\fn{fromChurch}$ that maps natural numbers to + $\fn{toChurch}$ and $\fn{fromChurch}$ that map natural numbers to and from the G\"odel numbers of the corresponding Church numeral. Using these recursive functions, we can define the function~$f$ as a diff --git a/content/lambda-calculus/lambda-definability/lists.tex b/content/lambda-calculus/lambda-definability/lists.tex index b153162a..72960e81 100644 --- a/content/lambda-calculus/lambda-definability/lists.tex +++ b/content/lambda-calculus/lambda-definability/lists.tex @@ -13,6 +13,7 @@ \[ [M_1, M_2, \ldots, M_n] \ident \lambd[sz][s M_1 (s M_2 (\ldots (s M_n z)))] \] +Choose distinct $s,z$ that are free in none of $M_1,\dots,M_n$. Informally speaking, the term representing a list is the ``accumulator'' function of the list: a function that accepts two terms; the first is a function that receives accumulated value along @@ -34,7 +35,7 @@ \lambd[l][l \, (\lambd[xa][\fn{Add} \, a \, \num{1}]) \num{0}] \end{align*} -$\fn{Sum}$ calculates the sum of a list of church numerals. It works +$\fn{Sum}$ calculates the sum of a list of Church numerals. It works by doing an accumulation on the list, where the initial value is $\num{0}$ and for each element, return $\fn{Add} \, x\, a$ as the new value (where $x$ is the current element and $a$ is the accumulated diff --git a/content/lambda-calculus/lambda-definability/minimization.tex b/content/lambda-calculus/lambda-definability/minimization.tex index 7093464a..9d909f23 100644 --- a/content/lambda-calculus/lambda-definability/minimization.tex +++ b/content/lambda-calculus/lambda-definability/minimization.tex @@ -31,13 +31,14 @@ function and a fixpoint combinator: \begin{align*} \fn{Search} & \ident \lambd[g][\lambd[f\,\vec{x}\,y][ - \fn{IsZero} (f\, \vec{x}\, y)\, y\, (g\, f\, \vec{x} (\fn{Succ}\, y)]]]\\ + \fn{IsZero} (f\, \vec{x}\, y)\, y\, (g\, f\, \vec{x} (\fn{Succ}\, y))]]\\ H & \ident \lambd[\vec x][(Y \, \fn{Search}) F\, \vec{x}\, \num{0}], \end{align*} - where $Y$ is any fixpoint combinator. Informally speaking, - $\fn{Search}$ is a self-referencing function: starting with~$y$, - test whether $f\, \vec x\, y$ is zero: if so, return~$y$, otherwise call - itself with $\fn{Succ}\, y$. Thus $(Y \, \fn{Search}) F + where $Y$ is the Turing fixpoint combinator of \olref[fp]{defn:Turing-Y}. Informally speaking, + $\fn{Search}$ describes one search step: starting with~$y$, + test whether $f\,\vec x\,y$ is zero; if so, return~$y$, otherwise + call its parameter $g$ with $f$, $\vec x$, and $\fn{Succ}\,y$. + The fixed point $Y\,\fn{Search}$ supplies the recursive search. Thus $(Y \, \fn{Search}) F \num{n_1}\dots\num{n_k}\,\num{0}$ returns the least~$m$ for which $f(n_1, \dots, n_k, m) = 0$. diff --git a/content/lambda-calculus/lambda-definability/pairs.tex b/content/lambda-calculus/lambda-definability/pairs.tex index 54317d9f..cdddb25a 100644 --- a/content/lambda-calculus/lambda-definability/pairs.tex +++ b/content/lambda-calculus/lambda-definability/pairs.tex @@ -12,7 +12,7 @@ \begin{defn} The pair of $M$ and $N$ (written $\tuple{M,N}$) is defined as follows: \[ -\tuple{M,N} \ident \lambd[f][fMN]. +\tuple{M,N} \ident \lambd[f][fMN],\qquad f\notin\FV{M}\cup\FV{N}. \] \end{defn} diff --git a/content/lambda-calculus/lambda-definability/partial-recursive-functions.tex b/content/lambda-calculus/lambda-definability/partial-recursive-functions.tex index d6422a27..9d93cfb1 100644 --- a/content/lambda-calculus/lambda-definability/partial-recursive-functions.tex +++ b/content/lambda-calculus/lambda-definability/partial-recursive-functions.tex @@ -11,7 +11,7 @@ Partial recursive functions are those obtained from the basic functions by composition, primitive recursion, and unbounded -minimization. They differ from general recursive function in that the +minimization. They differ from general recursive functions in that the functions used in unbounded search are not required to be regular. Not requiring regularity means that functions defined by minimization may sometimes not be defined. @@ -23,10 +23,10 @@ !!{lambda define}d by $\lambd[x][F (G x)]$ if $f$ and $g$ are !!{lambda define}d by terms $F$ and~$G$, respectively. However, when the functions are partial, this is problematic. When $g(x)$ is undefined, -meaning $G x$ has no normal form. In most cases this means that $F (G +$G x$ has no normal form. In most cases this means that $F (G x)$ has no normal forms either, which is what we want. But consider -when $F$ is $\lambd[x][\lambd[y][y]]$, in which case $F (G x)$ does -have a normal form ($\lambd[y][y]$). +when $F$ is $\lambd[x][\num{0}]$, in which case $F (G x)$ does +have the normal form $\num{0}$. This problem is not insurmountable, and there are ways to !!{lambda define} all partial recursive functions in such a way that diff --git a/content/lambda-calculus/lambda-definability/primitive-recursive-functions.tex b/content/lambda-calculus/lambda-definability/primitive-recursive-functions.tex index 0fd5bed1..401afa4e 100644 --- a/content/lambda-calculus/lambda-definability/primitive-recursive-functions.tex +++ b/content/lambda-calculus/lambda-definability/primitive-recursive-functions.tex @@ -70,7 +70,7 @@ Informally speaking, the primitive recursive definition iterates the application of the function $g$ $y$ times and applies it to $f(x_1, \dots, x_n)$. This is reminiscent of the definition of Church - numerals, which is also defined as a iterator. + numerals, which are also defined as iterators. For simplicity, we give the definition and proof for a single additional argument~$x$. The function $h$ is !!{lambda define}d by: @@ -123,9 +123,9 @@ Finally, consider \begin{align*} - H\,\num n\,\num m &\ident \lambd[x][\lambd[y][\fn{Snd} (y + H\,\num n\,\num m &\ident (\lambd[x][\lambd[y][\fn{Snd} (y (\lambd[p].\tuple{\fn{Succ} (\fn{Fst}\, p), (G\, x\, - (\fn{Fst}\, p)\, (\fn{Snd}\, p))}) \tuple{\num{0}, F x})]]\\ + (\fn{Fst}\, p)\, (\fn{Snd}\, p))}) \tuple{\num{0}, F x})]])\\ & \qquad\,\num n\, \num m\\ & \red \fn{Snd} (\num m \, \underbrace{(\lambd[p].\tuple{\fn{Succ} (\fn{Fst}\, p), (G \,\num n\, diff --git a/content/lambda-calculus/lambda-definability/truth-values.tex b/content/lambda-calculus/lambda-definability/truth-values.tex index dc05b169..74a2c4c6 100644 --- a/content/lambda-calculus/lambda-definability/truth-values.tex +++ b/content/lambda-calculus/lambda-definability/truth-values.tex @@ -16,7 +16,7 @@ \end{align*} Truth values are represented as \emph{selectors}, i.e., functions that -accept two arguments and returning one of them. The truth value +accept two arguments and return one of them. The truth value $\fn{true}$ selects its first argument, and $\fn{false}$ its second. For example, $\fn{true}\, M N$ always reduces to $M$, while $\fn{false}\, M N$ always reduces to~$N$. diff --git a/content/lambda-calculus/syntax/abbreviated-syntax.tex b/content/lambda-calculus/syntax/abbreviated-syntax.tex index 468c6ca9..a13a3753 100644 --- a/content/lambda-calculus/syntax/abbreviated-syntax.tex +++ b/content/lambda-calculus/syntax/abbreviated-syntax.tex @@ -20,7 +20,7 @@ to right. For example, if $M$, $N$, $P$, and~$Q$ are terms, then $MNPQ$ abbreviates $(((MN)P)Q)$. \item Again, when parentheses are left out, lambda abstraction is - given the widest scope possible. From example, $\lambd[x][MNP]$ is + given the widest scope possible. For example, $\lambd[x][MNP]$ is read as $(\lambd[x][MNP])$. \item A lambda can be used to abstract multiple variables. For example, $\lambd[xyz][M]$ is short for diff --git a/content/lambda-calculus/syntax/alpha.tex b/content/lambda-calculus/syntax/alpha.tex index 7deabbc6..b40e21be 100644 --- a/content/lambda-calculus/syntax/alpha.tex +++ b/content/lambda-calculus/syntax/alpha.tex @@ -16,7 +16,7 @@ variable in the other. This is called \emph{$\alpha$-conversion}. \begin{defn}[Change of bound variable, $\aconvone$] - If a term $M$ contains an occurrence of $\lambd[x][N]$, $y \notin + If a term $M$ contains an occurrence of $\lambd[x][N]$, $x\ne y$, $y \notin \FV{N}$, and $\Subst{N}{y}{x}$ is defined, then replacing this occurrence by \begin{equation*} @@ -28,7 +28,7 @@ \begin{defn}[Compatibility of relation] A relation $R$ on terms is said to be \emph{compatible} - if it satisfies following conditions: + if it satisfies the following conditions: \begin{enumerate} \item If $R N N'$ then $R \lambd[x][N] \lambd[x][N']$ \item If $R P P'$ then $R (PQ) (P'Q)$ @@ -39,7 +39,7 @@ Thus let's rephrase the definition: \begin{defn}[Change of bound variable, $\aconvone$] \emph{Change of bound variable} ($\redone[\alpha]$) is - the smallest compatible relation on terms satisfying following + the smallest compatible relation on terms satisfying the following condition: \begin{align*} &\lambd[x][N] \redone[\alpha] \lambd[y][\Subst{N}{y}{x}] && \text{if @@ -70,12 +70,12 @@ exercise. From now on we will use the inductive definition. \begin{defn}[$\alpha$-conversion, $\aconv$] - \emph{$\alpha$-conversion} ($\aconv$) is the smallest reflexitive + \emph{$\alpha$-conversion} ($\aconv$) is the smallest reflexive and transitive relation on terms containing $\aconvone$. \end{defn} As above, ``smallest'' means the relation only contains pairs required -by transitivity, and $\aconvone$, which leads to the following +by reflexivity, transitivity, and $\aconvone$, which leads to the following equivalent definition: \begin{defn}[$\alpha$-conversion, $\aconv$] \ollabel{defn:aconv} @@ -92,7 +92,7 @@ $\lambd[x][f x]$ $\alpha$-converts to $\lambd[y][f y]$, and conversely. Informally speaking, they are both functions that accept an argument and - return $f$ of that argument, refering to the environment variable~$f$. + return $f$ of that argument, referring to the environment variable~$f$. $\lambd[x][f x]$ does not $\alpha$-convert to $\lambd[x][g x]$. Informally speaking, they refer to the environment variables @@ -134,7 +134,7 @@ \item If $x \notin FV(N)$, then: \begin{align*} \FV{\lambd[y][\Subst{N}{y}{x}]} - & = FV{\Subst{N}{y}{x}} \setminus \{y\} \\ + & = \FV{\Subst{N}{y}{x}} \setminus \{y\} \\ & = \FV{N} \setminus \{x\} && \text{by \olref[sub]{thm:notinfv}} \\ & = \FV{\lambd[x][N]}. @@ -158,7 +158,7 @@ \item If the last rule is \olref{defn:aconvone4}, then $P$ is of the form $\lambd[x][N]$ and $Q$ of the form $\lambd[y][\Subst{N}{y}{x}]$, where $x \neq y$, $y \notin \FV{N}$ - and $\Subst{N}{y}{x}$ defined. First, we have $y \notin + and $\Subst{N}{y}{x}$ defined. First, we have $x \notin \FV{\Subst{N}{y}{x}}$ by \olref[sub]{thm:clr}. By \olref[sub]{thm:inv} we have that $\Subst{\Subst{N}{y}{x}}{x}{y}$ is not only defined, but also equal to~$N$. Then by @@ -181,8 +181,8 @@ \begin{enumerate} \item For each term $M$, $M$ can be changed to $M$ by \emph{zero} changes of bound variables. - \item If $P$ is $\alpha$-converts to $Q$ by a series of changes - of bound variables, then from $Q$ we can just inverse these + \item If $P$ $\alpha$-converts to $Q$ by a series of changes + of bound variables, then from $Q$ we can just reverse these changes (by \olref{lem:inv}) in opposite order to obtain~$P$. \item If $P$ $\alpha$-converts to $Q$ by a series of changes of @@ -230,37 +230,36 @@ \end{thm} \begin{proof} - By induction on the formation of $M$: - \begin{enumerate} - \item $M$ is a variable~$z$: Exercise. - \item Suppose $M$ is of the form $\lambd[x][N]$. Select a variable - $z$ other than $x$ and $y$ and such that $z \notin \FV{N}$ and $z - \notin \FV{R}$. By inductive hypothesis, we there is $N'$ such - that $N' \aeq N$ and $\Subst{N'}{z}{x}$ is defined. Then - $\lambd[x][N] \aeq \lambd[x][N']$ too, by - \olref{defn:aconvone}\olref{defn:aconvone1}. Now $\lambd[x][N'] - \aeq \lambd[z][\Subst{N'}{z}{x}]$ by - \olref{defn:aconvone}\olref{defn:aconvone4}. We can do this - because $z \ne x$, $z \notin FV(N')$ and $\Subst{N'}{z}{x}$ is - defined. Finally, $\Subst{\lambd[z][\Subst{N'}{z}{x}]}{R}{y}$ is - defined, because $z \neq y$ and $z \notin FV(R)$. - - Moreover, if there is another $N''$ and $R''$ satisfying the same - conditions, - \begin{multline*} - \Subst{(\lambd[z][\Subst{N''}{z}{x}])}{R''}{y} =\\ - \begin{aligned} - &= \lambd[z][\Subst{\Subst{N''}{z}{x}}{R''}{y}] \\ - &= \lambd[z][\Subst{\Subst{N''}{z}{x}}{R}{y}] && \text{by - \olref{lem:sub:R}}\\ - &=\lambd[z][\Subst{\Subst{N'}{z}{x}}{R}{y}] - && \text{by inductive - hypothesis}\\ - &=\Subst{(\lambd[z][\Subst{N'}{z}{x}])}{R}{y} - \end{aligned} - \end{multline*} - \item $M$ is of the form $(PQ)$: Exercise. - \end{enumerate} +Represent a term by its binding tree: application and abstraction +nodes retain their positions; each variable leaf is labelled either +by its free variable name or by a pointer to the nearest abstraction +that binds it. Each allowed change of bound variable preserves this +tree, as follows directly from its freshness and definedness +conditions. + +Conversely, terms with the same binding tree are $\alpha$-equivalent. +For all their abstraction positions choose pairwise distinct fresh +names, avoiding every name in either original term. In each term +rename the binders from innermost to outermost, using the same fresh +name at corresponding positions. Each change is allowed: inner +binders already have distinct fresh names, so the required partial +substitution is defined, and the new name occurs nowhere in the +body. The resulting terms are literally identical. Reversibility +and transitivity of $\alpha$-conversion give the claim. + +For existence, apply this freshening procedure to $M$, also avoiding +$y$ and all names in $R$. Every binder of the resulting $M'$ differs +from $y$ and is absent from $\FV{R}$. Induction on $M'$ using the +substitution clauses now gives that $\Subst{M'}{R}{y}$ is defined. + +For uniqueness, defined substitution replaces exactly the free-$y$ +leaves of a binding tree by copies of the replacement's binding +tree. Internal binding pointers remain internal, and the +definedness conditions prevent capture of free replacement names. +If $M''\aeq M$ and $R''\aeq R$, their respective binding trees agree. +Thus the two defined substitutions in the theorem have the same +binding tree. The converse characterization just proved gives +$\Subst{M'}{R}{y}\aeq\Subst{M''}{R''}{y}$. \end{proof} \begin{prob} @@ -270,8 +269,8 @@ \begin{cor}\ollabel{cor:sub} For any $M$, $R$, and~$y$, there exists a pair of $M'$ and $R'$ such that $M' \aeq M$, $R \aeq R'$ and $\Subst{M'}{R'}{y}$ is - defined. Moreover, if there is another pair $M'' \aeq M$ and $R''$ - with $\Subst{M'}{R'}{y}$ defined, then $\Subst{M'}{R'}{y} \aeq + defined. Moreover, if there is another pair $M'' \aeq M$ and $R''\aeq R$ + with $\Subst{M''}{R''}{y}$ defined, then $\Subst{M'}{R'}{y} \aeq \Subst{M''}{R''}{y}$. \end{cor} diff --git a/content/lambda-calculus/syntax/beta.tex b/content/lambda-calculus/syntax/beta.tex index dc997729..2920e7d7 100644 --- a/content/lambda-calculus/syntax/beta.tex +++ b/content/lambda-calculus/syntax/beta.tex @@ -1,5 +1,5 @@ % Part: lambda-calculus -% Chapter: introduction +% Chapter: syntax % Section: beta \documentclass[../../../include/open-logic-section]{subfiles} @@ -94,7 +94,7 @@ strategy has the useful property that a term can be reduced to a normal form by some strategy iff it can be reduced to normal form using the natural strategy. In what follows we will use the natural - stratuegy unless otherwise specified. + strategy unless otherwise specified. \end{digress} \begin{defn}[$\beta$-equivalence, $\equal$] diff --git a/content/lambda-calculus/syntax/conversion.tex b/content/lambda-calculus/syntax/conversion.tex index 88201c36..49720771 100644 --- a/content/lambda-calculus/syntax/conversion.tex +++ b/content/lambda-calculus/syntax/conversion.tex @@ -9,13 +9,16 @@ \olfileid{lam}{int}{con} \olsection{Conversion and Reduction} -There three type of conversions or reductions in lambda calculus. The +There are three types of conversions or reductions in lambda calculus. The difference between conversion and reduction is whether the ``transformation'' is unidirectional or bidirectional, as we will see. The $\alpha$-conversion is about variable renaming. It is natural to consider $\lambda x. x$ and $\lambda y.y$ representing the same -function (the identity function), we formallize this idea as follows: +function (the identity function). This is formalized by changes of +bound variable in \olref[syn][alp]{sec}. The other two notions, +$\beta$- and $\eta$-reduction, are defined in \olref[bet]{sec} and +\olref[syn][eta]{sec}, respectively. \end{document} diff --git a/content/lambda-calculus/syntax/de-bruijn.tex b/content/lambda-calculus/syntax/de-bruijn.tex index dd06656e..49d2ca7c 100644 --- a/content/lambda-calculus/syntax/de-bruijn.tex +++ b/content/lambda-calculus/syntax/de-bruijn.tex @@ -21,15 +21,15 @@ this parameter. In the de Bruijn index, however, parameters have no name and reference to them in the function body is denoted by a number denoting the levels of abstraction between them. For example, consider -the example of $\lambd[x][\lambd[y][y x]]$: the outer abstraction is on +the example of $\lambd[x][\lambd[y][y x]]$: the outer abstraction binds the variable~$x$; the inner abstraction binds the variable -is~$y$; the sub-term $y x$ lies in the scope of the inner abstraction: +$y$; the sub-term $y x$ lies in the scope of the inner abstraction: there is no abstraction between $y$ and its abstract~$\lambd[y]$, but one abstract between $x$ and its abstract~$\lambd[x]$. Thus we write -$0\, 1$ for $y x$, and $\lambd[][\lambd[][01]]$ for the entire term. +$0\, 1$ for $y x$, and $\lambd[][\lambd[][0\,1]]$ for the entire term. \begin{defn} - De Bruijn terms are inductively defines as follows: + De Bruijn terms are inductively defined as follows: \begin{enumerate} \item $n$, where $n$ is any natural number. \item $PQ$, where $P$ and $Q$ are both De Bruijn terms. @@ -46,12 +46,12 @@ F_\Gamma(\lambd[x][N]) &= \lambd[][F_{x,\Gamma}(N)] \end{align*} where $\Gamma$ is a list of variables indexed from zero, and - $\Gamma(x)$ denotes the position of the variable $x$ in $\Gamma$. + $\Gamma(x)$ denotes the position of the first occurrence of the variable $x$ in $\Gamma$. For example, if $\Gamma$ is $x,y,z$, then $\Gamma(x)$ is $0$ and $\Gamma(z)$ is $2$. - $x,\Gamma$ denotes the list resulted from pushing $x$ to the head of - $\Gamma$; for instance, continuing the $\Gamma$ in last example, + $x,\Gamma$ denotes the list resulting from pushing $x$ to the head of + $\Gamma$; for instance, continuing the $\Gamma$ in the last example, $w,\Gamma$ is $w,x,y,z$. \end{defn} @@ -68,8 +68,8 @@ $\Gamma[n]$ denotes the variable in position~$n$. For example, if $\Gamma$ is $x,y,z$, then $\Gamma[1]$ is $y$. - The variable $x$ in last equation is chosen to be any variable that - not in $\Gamma$. + The variable $x$ in the last equation is chosen to be any variable that + is not in $\Gamma$. \end{defn} Here we give some results without proving them: diff --git a/content/lambda-calculus/syntax/eta.tex b/content/lambda-calculus/syntax/eta.tex index 5c6cc407..6e7af89b 100644 --- a/content/lambda-calculus/syntax/eta.tex +++ b/content/lambda-calculus/syntax/eta.tex @@ -12,7 +12,7 @@ There is another relation on $\lambda$ terms. In \olref[fv]{sec} we used the example $\lambd[x][(fx)]$, which accepts an argument and applies $f$ to it. In other words, it is the same function as~$f$: -$\lambd[x][(fx)]N$ and $fN$ both reduce to~$fN$. We use +$(\lambd[x][(fx)])N$ and $fN$ both reduce to~$fN$. We use $\eta$-reduction (and $\eta$-extension) to capture this idea. \begin{defn}[$\eta$-contraction, $\eredone$] @@ -27,7 +27,7 @@ \begin{defn}[$\beta\eta$-reduction, $\bered$] \ollabel{defn:bered} \emph{$\beta\eta$-reduction} ($\bered$) is the smallest reflexive, transitive relation on terms containing $\bredone$ and $\eredone$, - i.e., the rules of reflexivity and transitive plus the following two + i.e., the rules of reflexivity and transitivity plus the following two rules: \begin{enumerate} \item If $M \bredone N$ then $M \bered N$. \ollabel{defn:bered3} @@ -39,7 +39,7 @@ \begin{defn} We extend the equivalence relation $\equal$ with the $\eta$-conversion rule: \[ - \lambd[x][f x] \equal f + \lambd[x][M x] \equal M \qquad\text{provided }x\notin\FV{M} \] and denote the extended relation as $\equal[\eta]$. \end{defn} @@ -76,7 +76,7 @@ \equal N$ derived by the \ext{} rule, we have $Mx \equal[\eta] Nx$ as premise. Then we have $\lambd[x][Mx] \equal[\eta] \lambd[x][Nx]$ by a rule of $\equal$, applying $\eta$ - on both side gives us $M \equal[\eta] N$. + on both sides gives us $M \equal[\eta] N$. Similarly we prove that the $\eta$ rule is contained in $\equal[ext]$. For any $\lambd[x][Mx]$ and $M$ with $x \notin diff --git a/content/lambda-calculus/syntax/free-variables.tex b/content/lambda-calculus/syntax/free-variables.tex index 166c3898..299006cf 100644 --- a/content/lambda-calculus/syntax/free-variables.tex +++ b/content/lambda-calculus/syntax/free-variables.tex @@ -1,5 +1,5 @@ % Part: lambda-calculus -% Chapter: introduction +% Chapter: syntax % Section: free-variables \documentclass[../../../include/open-logic-section]{subfiles} @@ -21,7 +21,7 @@ \begin{defn}[Scope] If $\lambd[x][M]$ occurs inside a term~$N$, then the corresponding -occurrence of~$N$ is the \emph{scope} of the~$\lambd[x]$. +occurrence of~$M$ is the \emph{scope} of the~$\lambd[x]$. \end{defn} diff --git a/content/lambda-calculus/syntax/substitution.tex b/content/lambda-calculus/syntax/substitution.tex index fc9f1fee..8bf1d196 100644 --- a/content/lambda-calculus/syntax/substitution.tex +++ b/content/lambda-calculus/syntax/substitution.tex @@ -46,7 +46,7 @@ accepts an argument and returns it directly. But the term $\lambd[y][x]$ stands for a function that always returns the term~$x$ (or whatever $x$ refers to). So the result we actually want is a -function that accepts an argument, drop it, and returns the +function that accepts an argument, drops it, and returns the environment variable~$y$. To do this properly, we would first have to ``rename'' the bound variable~$y$. \end{explain} @@ -73,9 +73,9 @@ \item $M$ is of the form $\lambd[y][P]$, and since $\Subst{\lambd[y][P]}{N}{x}$ is defined, it has to be $\lambd[y][\Subst{P}{N}{x}]$. Then $\Subst{P}{N}{x}$ has to be - defined; also, $x \neq y$ and $x \notin \FV{Q}$. Then: + defined; also, $x \neq y$ and $x \notin \FV{P}$. Then: \begin{multline*} - \FV{\Subst{\lambd[y][P]}{N}{x}} = \\ + \FV{\Subst{\lambd[y][P]}{N}{x}} \\ \begin{aligned} & = \FV{\lambd[y][\Subst{P}{N}{x}]} && \text{by \olref{defn:substitution-4}}\\ @@ -93,7 +93,7 @@ \end{prob} \begin{thm} \ollabel{thm:infv} - If $x \in \FV{M})$, then $\FV{\Subst{M}{N}{x}} = (\FV{M} \setminus + If $x \in \FV{M}$, then $\FV{\Subst{M}{N}{x}} = (\FV{M} \setminus \{x\}) \cup \FV{N}$, provided the left hand is defined. \end{thm} @@ -102,24 +102,24 @@ \begin{enumerate} \item $M$ is a variable: exercise. \item $M$ is of the form $PQ$: Since - $\Subst{(PQ)}{N}{y}$ is defined, it has to be - $(\Subst{P}{N}{x})(\Subst{Q}{N}{x})$ with both substitution + $\Subst{(PQ)}{N}{x}$ is defined, it has to be + $(\Subst{P}{N}{x})(\Subst{Q}{N}{x})$ with both substitutions defined. Also, since $x \in \FV{PQ}$, either $x \in \FV{P}$ or $x \in \FV{Q}$ or both. The rest is left as an exercise. \item $M$ is of the form $\lambd[y][P]$. Since $\Subst{\lambd[y][P]}{N}{x}$ is defined, it has to be $\lambd[y][\Subst{P}{N}{x}]$, with $\Subst{P}{N}{x}$ - defined, $x \neq y$ and $y \notin \FV{N}$; also, since $y \in - \FV{\lambd[x][P]}$, we have $y \in \FV{P}$ too. Now: + defined, $x \neq y$ and $y \notin \FV{N}$; also, since $x \in + \FV{\lambd[y][P]}$, we have $x \in \FV{P}$ too. Now: \begin{multline*} - \FV{\Subst{(\lambd[y][P])}{N}{x}} = \\ + \FV{\Subst{(\lambd[y][P])}{N}{x}} \\ \begin{aligned} & = \FV{\lambd[y][\Subst{P}{N}{x}]} \\ & = \FV{\Subst{P}{N}{x}} \setminus \{y\} \\ - & = ((\FV{P} \setminus \{y\}) \cup (\FV{N} \setminus \{x\}) + & = ((\FV{P} \setminus \{x\}) \cup \FV{N}) \setminus \{y\} && \text{by inductive hypothesis} \\ & = (\FV{P} \setminus \{x, y\}) \cup \FV{N} - && x \notin \FV{N} \\ + && y \notin \FV{N} \\ & = (\FV{\lambd[y][P]} \setminus \{x\}) \cup \FV{N} \end{aligned} \end{multline*} diff --git a/content/lambda-calculus/syntax/term-revisited.tex b/content/lambda-calculus/syntax/term-revisited.tex index b80c9368..6579ea05 100644 --- a/content/lambda-calculus/syntax/term-revisited.tex +++ b/content/lambda-calculus/syntax/term-revisited.tex @@ -1,5 +1,5 @@ % Part: lambda-calculus -% Chapter: introduction +% Chapter: syntax % Section: term-revisited \documentclass[../../../include/open-logic-section]{subfiles} @@ -10,7 +10,7 @@ \olsection{Terms as $\alpha$-Equivalence Classes} From now on, we will consider terms up to $\alpha$-equivalence. That -means when we write a term, we mean its $\alpha$-equivalance class it +means when we write a term, we mean the $\alpha$-equivalence class it is in. For example, we write $\lambd[a][\lambd[b][a c]]$ for the set of all terms $\alpha$-equivalent to it, such as $\lambd[a][\lambd[b][a c]]$, $\lambd[b][\lambd[a][b c]]$, etc. @@ -18,14 +18,14 @@ Also, while in previous sections letters such as $N, Q$ are used to denote a term, from now on we use them to denote a class, and it is these classes instead of terms that will be our subjects of study in -what follows. Letters such as $x, y$ continues to denote a variable. +what follows. Letters such as $x, y$ continue to denote a variable. We also adopt the notation $\rep{M}$ to denote an arbitrary -!!{element} of the class~$M$, and $\rep{M}[0], \rep{M}[1], etc. $ if +!!{element} of the class~$M$, and $\rep{M}[0]$, $\rep{M}[1]$, etc. if we need more than one. We reuse the notations from terms to simplify our wording. We -have following definition on classes: +have the following definition on classes: \begin{defn} \begin{enumerate} \item $\lambd[x][N]$ is defined as the class containing @@ -45,11 +45,12 @@ This is well defined since $FV(\rep{M}[0]) = FV(\rep{M}[1])$, as shown in \olref[alp]{thm:fv}. -We also reuse the notation for substition into classes: +We also reuse the notation for substitution into classes: \begin{defn} \ollabel{def:sub} The \emph{substitution} of $R$ for $y$ in $M$, or $\Subst{M}{R}{y}$, is - defined to be $\Subst{\rep{M}}{\rep{R}}{y}$, for any $\rep{M}$ and - $\rep{R}$ making the substition defined. + defined to be the $\alpha$-equivalence class containing + $\Subst{\rep{M}}{\rep{R}}{y}$, for any $\rep{M}$ and + $\rep{R}$ making the substitution defined. \end{defn} This is also well defined as shown in \olref[alp]{cor:sub}. @@ -57,7 +58,7 @@ Note how this definition significantly simplifies our reasoning. For example: \begin{align} - \Subst{\lambd[x][x]}{y}{x} & =\ollabel{eq:1}\\ + \Subst{\lambd[x][x]}{y}{x} & \ollabel{eq:1}\\ &= \Subst{\lambd[z][z]}{y}{x} \ollabel{eq:2}\\ &= \lambd[z][\Subst{z}{y}{x}] \\ &= \lambd[z][z] diff --git a/content/lambda-calculus/syntax/unique-readability.tex b/content/lambda-calculus/syntax/unique-readability.tex index cc6a18fc..a20b804e 100644 --- a/content/lambda-calculus/syntax/unique-readability.tex +++ b/content/lambda-calculus/syntax/unique-readability.tex @@ -1,5 +1,5 @@ % Part: lambda-calculus -% Chapter: introduction +% Chapter: syntax % Section: unique-readability \documentclass[../../../include/open-logic-section]{subfiles} @@ -69,7 +69,7 @@ result of an abstraction on~$N$. By inductive hypothesis we know that formation of $N$ is itself unique. \item $M$ is of the form $(PQ)$, where $P$ and $Q$ are terms. - Since it starts with a parentheses, it cannot also be + Since it starts with a parenthesis, it cannot also be constructed by \olref[trm]{defn:term}\olref[trm]{defn:term-var}. By \olref{lem:term-start}, $P$ cannot begin with $\lambd$, so @@ -79,7 +79,7 @@ segment of $P'$ (or vice versa), and this is impossible by \olref{lem:initial}. So $P$ and $Q$ are uniquely determined, and by inductive hypothesis we know that formations - of $P$ and $Q$ is unique. + of $P$ and $Q$ are unique. \end{enumerate} \end{proof} @@ -89,7 +89,7 @@ \begin{enumerate} \item $x$, where $x$ is a variable uniquely determined by $M$. \item $(\lambd[x][N])$, where $x$ is a variable and $N$ is - another term, both of which is uniquely determined by $M$. + another term, both of which are uniquely determined by $M$. \item $(PQ)$, where $P$ and $Q$ are two terms uniquely determined by $M$. \end{enumerate} diff --git a/content/proof-theory/cut-elimination/ce-largest.tex b/content/proof-theory/cut-elimination/ce-largest.tex index 0a31f5d0..3d6e9dcc 100644 --- a/content/proof-theory/cut-elimination/ce-largest.tex +++ b/content/proof-theory/cut-elimination/ce-largest.tex @@ -26,9 +26,8 @@ with !!{proof}~$\pi'$ (or !!{proof}s~$\pi'$, $\pi''$ depending on whether the rule has one or two premises). Moreover, (a)~$\pheight{\pi'}\le\pheight{\pi}$ (and -$\pheight{\pi''}\le\pheight{\pi}$) and (b)~the number of \CutCS{} -inferences as well as their ranks is the same in~$\pi'$ (and $\pi''$) -as in~$\pi$. +$\pheight{\pi''}\le\pheight{\pi}$) and (b)~for each rank, the number of \CutCS{} +inferences in~$\pi'$ (and in~$\pi''$) is no greater than in~$\pi$. \end{lem} \begin{proof} @@ -40,8 +39,8 @@ sub-!!{proof}s are the !!{proof}s~$\pi_i$ we want, and (a) and~(b) are both satisfied. In all other cases, we applied the inductive hypothesis to the immediate sub-!!{proof}s of~$\pi$, i.e., those -leading to the premise(s) of the last inference~$R$, and then applied -that same rule $R$ to the results. The conditions (a) and~(b) hold for +leading to the premise(s) of the last inference~$S$, and then applied +that same rule $S$ to the results. The conditions (a) and~(b) hold for the immediate sub-!!{proof}s of the new proof, and so (a) and~(b) hold for the entire proof. It remains to verify the case where the last inference is~\CutCS. We do this again for one example only: suppose @@ -119,18 +118,23 @@ \CutCS{} inferences in~$\pi_1$ and $\pi_2$ must have rank $< \depth{!A} = 0$, there can be no \CutCS{} inferences in~$\pi_1$ or~$\pi_2$. We show that $\Gamma \Sequent \Delta$ has a cut-free proof -by induction on $\pheight{\pi_2}$. If $\pheight{\pi_2} = 0$, then $!A, -\Gamma \Sequent \Delta$ is an axiom. If $!A$ is not principal, some +by induction on $\pheight{\pi_2}$, uniformly for all such first-premise proofs and contexts. If $\pheight{\pi_2} = 0$, then $!A, +\Gamma \Sequent \Delta$ is an axiom. If $!A$ is not principal, either $\lfalse$ occurs in~$\Gamma$ or some atomic $!C$ is !!a{element} of both~$\Gamma$ and $\Delta$, and $\Gamma -\Sequent \Delta$ itself is an axiom. If $!A$ is principal, then -$\Delta = \Delta, !A$. In this case, $\pi_1$ ends in $\Gamma \Sequent +\Sequent \Delta$ itself is an axiom. If $!A \ident \lfalse$ is principal, the axiom is an +instance of \LeftR{\lfalse}; deleting the occurrences of~$\lfalse$ in +the succedents of~$\pi_1$ from which the end-sequent's $\lfalse$ +descends yields a cut-free proof of $\Gamma \Sequent \Delta$, since +$\lfalse$ is never principal on the right. If $!A$ is principal +otherwise, then +$\Delta = \Delta', !A$. In this case, $\pi_1$ ends in $\Gamma \Sequent \Delta', !A, !A$. We obtain a cut-free proof of $\Gamma \Sequent \Delta', !A$ by applying \olref[seq][inv]{prop:G3c-cont-adm} (admissibility of contraction). If $\pheight{\pi_2} > 0$ it ends in a rule~$R$. Take a premise of that rule: it has the form $!A, \Gamma', \Pi \Sequent \Delta', \Lambda$, where $\Pi$ and $\Lambda$ are the active !!{formula}s of~$R$. \olref[seq][adm]{prop:weak-G3c-adm} -applied to~$\pi_1$ and $\pi_2$ yields !!{proof}s of $\Gamma, \Gamma', +applied to~$\pi_1$ and the immediate sub-!!{proof} of~$\pi_2$ ending in that premise yields !!{proof}s of $\Gamma, \Gamma', \Pi \Sequent \Delta, \Delta', \Lambda, !A$ and $!A, \Gamma, \Gamma', \Pi \Sequent \Delta, \Delta', \Lambda$, to which the induction hypothesis applies. This gives us !!a{proof} of $\Gamma, \Gamma', \Pi @@ -218,9 +222,15 @@ \] \item $!A \ident \lforall[x][!B(x)]$. The !!{proof}s $\pi_1$ and $\pi_2$ end in $\Gamma \Sequent \Delta, \lforall[x][!B(x)]$ and - $\lforall[x][!B(x)], \Gamma \Sequent \Delta$. By + $\lforall[x][!B(x)], \Gamma \Sequent \Delta$. Choose $c$ fresh for both $\pi_1$ and~$\pi_2$. By \olref{lem:inv-G3c-cut}, there is !!a{proof}~$\pi_1'$ of $\Gamma \Sequent \Delta, !B(c)$. + Before using a copy of~$\pi_1'$ with an instance term~$t$, rename its + eigenvariables away from~$t$ and the contexts added by weakening. + The term~$t$ is closed. Uniform substitution and weakening preserve + \CutCS{} inferences and do not increase the depth of their cut + !!{formula}s, so the substitution and weakening arguments also apply + to these proofs with cuts of lower rank. Now consider the !!{proof}~$\pi_2$. It ends in $\lforall[x][!B(x)], \Gamma \Sequent \Delta$. Moving upward from the end-sequent @@ -239,9 +249,7 @@ None of them are active in a rule other than \LeftR{\lforall} (only active !!{formula}s of \LeftR{\lforall} get marked). Delete all marked occurrences of $\lforall[x][!B(x)]$ in $\pi_2$. - If this is a correct !!{proof}, the marked occurrences of - $\lforall[x][!B(x)]$ were never active; they all came directly from - axioms. The !!{proof} ends in~$\Gamma \Sequent \Delta$ and we can + If this is a correct !!{proof}, it ends in~$\Gamma \Sequent \Delta$ and we can replace $\pi$ by it. We have a removed a cut of maximal rank. Otherwise, what we have is not a correct proof because we have @@ -269,22 +277,31 @@ \DisplayProof \] and add $\Gamma$ to the left and $\Delta$ to the right of every - sequent below it. Repeat until all \LeftR{\lforall} ``inferences'' + sequent below it. At each binary rule, also weaken its companion + premise proof by the same contexts, so that the shared contexts + still agree; rename eigenvariables away from added contexts first. + Repeat until all \LeftR{\lforall} ``inferences'' with a marked $!B(t)$ in the premise have been replaced by a \CutCS{} inference on some~$!B(t)$. The end-sequent of the resulting !!{proof} (and it now is a correct !!{proof}) is of the form $\Gamma, \dots, \Gamma \Sequent \Delta, \dots, \Delta$. Apply - admissibility of contraction to turn it into !!a{proof} of~$\Gamma + admissibility of contraction (its proof carries over to !!{proof}s in + $\Log{G3c} + \CutCS$, without introducing cuts of higher rank) to turn it into !!a{proof} of~$\Gamma \Sequent \Delta$ and replace $\pi$ with it. We have replaced one cut on $\lforall[x][!B(x)]$ with (possibly many) cuts on $!B(t)$, but - these are all of lower rank. Any cuts already occurring in $\pi_1$ or - $\pi_2$ remain present, but they are also all of lower rank. + these are all of lower rank. Any surviving copies of cuts already occurring in $\pi_1$ or + $\pi_2$ are also all of lower rank. + \item $!A \ident \lexists[x][!B(x)]$. Dual to the previous case: + apply \olref{lem:inv-G3c-cut} to~$\pi_2$, mark the occurrences + of~$\lexists[x][!B(x)]$ in~$\pi_1$ from which the cut formula + descends, and replace the \RightR{\lexists} inferences with a marked + $!B(t)$ in the premise by cuts on~$!B(t)$, which are of lower rank. \end{enumerate} \end{proof} \begin{prob} Verify the case where $!A \ident (!B \land !C)$ in the proof of -\olref{lem:inv-G3c-cut}. That is, show that if there is +\olref{lem:max-cut-red-G3c}. That is, show that if there is !!a{proof}~$\pi$ ending in \[ \AxiomC{} @@ -308,7 +325,7 @@ % \end{prob} -\olref[top]{lem:cut-adm-G3c} establishes that we can replace a \CutCS{} +\olref{lem:max-cut-red-G3c} establishes that we can replace a \CutCS{} inference of highest rank in !!a{proof} by \CutCS{} inferences of lower rank. We can again use this lemma to show that we can eliminate any number of \CutCS{} inferences from !!a{proof} by successively diff --git a/content/proof-theory/cut-elimination/ce-topmost.tex b/content/proof-theory/cut-elimination/ce-topmost.tex index e6dfbd34..dcd93379 100644 --- a/content/proof-theory/cut-elimination/ce-topmost.tex +++ b/content/proof-theory/cut-elimination/ce-topmost.tex @@ -67,7 +67,10 @@ and a cut !!{height} $< \cheight{\pi}$, or has cut rank~$< \cutrank{\pi}$. The case where $\cheight{\pi} = 0$ (both premises are axioms) are covered by cases~A and~B. The cases where $\cheight{\pi} > -0$ are covered by cases C--D. +0$ are covered by cases C--E. + +The first versions of cases A and B assume that the axioms are atomic +identity axioms; the alternative versions below also cover falsity axioms. \paragraph{Case A:} Some $!B$ occurs in both $\Gamma$ and~$\Delta$. @@ -104,7 +107,7 @@ \Delta$ and $\Delta = \Delta', !A$. In the first case, $\pi_2$ is !!a{proof} of $!A, !A, \Gamma' \Sequent \Delta$ and by admissibility of \LeftR{\Contraction} (\olref[seq][inv]{prop:G3c-cont-adm}) there is -!!a{proof} of $\Gamma \Sequent \Delta$. In the second case, $\pi_2$ is +!!a{proof} of $\Gamma \Sequent \Delta$. In the second case, $\pi_1$ is !!a{proof} of $\Gamma \Sequent \Delta', !A, !A$ and by admissibility of \RightR{\Contraction} we get !!a{proof} of $\Gamma \Sequent \Delta$. @@ -164,7 +167,7 @@ \RightLabel{\CutCS} \BinaryInf$\Gamma, \Pi \fCenter \Delta', !D, \Lambda$ \RightLabel{$R$} -\UnaryInf$\Gamma, \fCenter \Delta', !D, !D$ +\UnaryInf$\Gamma \fCenter \Delta', !D, !D$ \DisplayProof \] We use !!{height}-preserving weakening to obtain $\pi_1'$ and $\pi_3'$ @@ -257,7 +260,7 @@ \UnaryInf$!A, \lexists[x][!B(x)], \Gamma' \fCenter \Delta$ \RightSubproofLabel{$\pi_2$} \RightLabel{\CutCS} -\BinaryInf$\Gamma' \fCenter \Delta$ +\BinaryInf$\lexists[x][!B(x)], \Gamma' \fCenter \Delta$ \DisplayProof \] We again apply the inductive hypothesis to @@ -320,7 +323,7 @@ \[ \AxiomC{} \RightLabel{$\pi_1''$} -\Deduce$\Gamma \fCenter \Delta, !B \land !C, !C, !A$ +\Deduce$\Gamma \fCenter \Delta', !B \land !C, !C, !A$ \AxiomC{} \RightLabel{$\pi_4'$} \Deduce$!A, \Gamma \fCenter \Delta', !B \land !C, !C$ @@ -349,7 +352,7 @@ \RightLabel{$\pi_6$} \Deduce$\Gamma \fCenter \Delta', !B \land !C, !C$ \RightLabel{\RightR{\land}} -\BinaryInf$\Gamma \fCenter \Delta, !B \land !C, !B \land !C$ +\BinaryInf$\Gamma \fCenter \Delta', !B \land !C, !B \land !C$ \DisplayProof \] To get !!a{proof} of $\Gamma \Sequent \Delta$, i.e., $\Gamma \fCenter @@ -362,7 +365,8 @@ one for each possible !!{main operator} of~$!A$. In each case, we turn a \CutCS{} with cut !!{formula}~$!A$ into one or more -cuts on sub-!!{formula}s of~$!A$, namely on the active !!{formula}s of +cuts on proper sub-!!{formula}s of~$!A$ or substitution instances of +its quantified matrix, all of smaller depth, namely on the active !!{formula}s of the inferences of which~$!A$ is the principal !!{formula}. These cases are therefore often referred to as ``reduction'' or ``conversion'' of the cut inference. @@ -481,8 +485,8 @@ \RightLabel{$\pi_1'$} \Deduce$!B, \Gamma \fCenter \Delta, !C$ \AxiomC{} -\RightLabel{$\pi_2''$} -\Deduce$!C, \Gamma \fCenter \Delta$ +\RightLabel{$\pi_2''[!B \Sequent {}]$} +\Deduce$!C, !B, \Gamma \fCenter \Delta$ \RightLabel{\CutCS} \BinaryInf$!B, \Gamma \fCenter \Delta$ \DisplayProof @@ -545,8 +549,10 @@ assume the !!{proof}~$\pi$ is regular, so $c$~is the eigenvariable of only the following~$\RightR{\lforall}$ inference and only occurs above it, i.e., only occurs in~$\pi_1'$ and is not an eigenvariable of an -inference in~$\pi_1'$. Since $c$ does not occur in~$\pi_2$, it cannot -occur in~$t$. By \olref[seq][qua]{lem:subst-regular}, the +inference in~$\pi_1'$. If $x$ is not free in~$!B(x)$, choose $t$ to be a fresh constant; +this does not change~$!B(t)$. Rename any eigenvariables of~$\pi_1'$ +that occur in~$t$ to fresh constants, without changing the end-sequent +or height. By \olref[seq][qua]{lem:subst-regular}, the !!{proof}~$\Subst{\pi_1'}{t}{c}$ is !!a{proof} of $\Gamma \Sequent \Delta, !B(t)$. We now apply the inductive hypothesis to the !!{proof} \[ @@ -574,7 +580,7 @@ \end{prob} \begin{prob} -Verify the sub-case of case~D in the proof of \olref{lem:cut-adm-G3c} +Verify the sub-case of case~C in the proof of \olref{lem:cut-adm-G3c} where $!A$ is not principal in the last inference of~$\pi_1$, which ends in~$\LeftR{\lforall}$. \end{prob} @@ -604,19 +610,20 @@ \RightLabel{$\pi_1'$} \Deduce$!B, \Gamma \fCenter \Delta, !C$ \AxiomC{} -\RightLabel{$\pi_2''$} -\Deduce$!C, \Gamma \fCenter \Delta$ +\RightLabel{$\pi_2''[!B \Sequent {}]$} +\Deduce$!C, !B, \Gamma \fCenter \Delta$ \RightLabel{\CutCS} \BinaryInf$!B, \Gamma \fCenter \Delta$ \RightSubproofLabel{$\pi_1''$} \RightLabel{\CutCS} -\BinaryInf$!B, \Gamma \fCenter \Delta$ +\BinaryInf$\Gamma \fCenter \Delta$ \DisplayProof \] The top \CutCS{} between $\pi_1'$ and $\pi_2''$ has both lower cut rank and lower cut !!{height} than~$\pi$. But the -!!{proof}~$\pi_1''$---the result of applying the inductive -hypothesis---no longer has lower cut !!{height} than~$\pi$. Since the +!!{proof} obtained by eliminating the upper cut may have greater +!!{height}, so the lower cut using it need not have lower cut +!!{height} than~$\pi$. Since the cut !!{formula} of the lower \CutCS{} is $!B$, its cut \emph{rank}, however, is lower than the cut rank of~$\pi$. diff --git a/content/proof-theory/cut-elimination/interpolation.tex b/content/proof-theory/cut-elimination/interpolation.tex index 7d72b7a6..1e944406 100644 --- a/content/proof-theory/cut-elimination/interpolation.tex +++ b/content/proof-theory/cut-elimination/interpolation.tex @@ -11,7 +11,7 @@ \olsection{Maehara's Lemma and Craig's Interpolation Theorem} The interpolation theorem, due to William Craig, states that if $!A -\Entails !B$ then there is !!a{sentence}~$!C$ (the \emph{interpolant}) +\Entails !B$ then there is !!a{formula}~$!C$ (the \emph{interpolant}) such that $!A \Entails !C$ and $!C \Entails !B$. Importantly, the interpolant~$!C$ can be chosen so that the !!{constant}s and !!{predicate}s occurring in~$!C$ all occur in both~$!A$ and~$!B$. (We @@ -71,8 +71,8 @@ $n=\pheight{\pi}$. If $n=0$, then $\maeh{\Gamma_1}{\Gamma_2} \Sequent - \maeh{\Delta_1}{\Delta_2}$ is an axiom, and some atomic - !!{formula}~$!A$ occurs in both $\Gamma_1, \Gamma_2$ and $\Delta_1, + \maeh{\Delta_1}{\Delta_2}$ is an axiom. First suppose it is an + atomic identity axiom, so some atomic !!{formula}~$!A$ occurs in both $\Gamma_1, \Gamma_2$ and $\Delta_1, \Delta_2$. There are four cases depending on whether $!A$~belongs to the first part or the second on the left, and whether it belongs to the first or second part on the right. @@ -81,15 +81,16 @@ that both $\Gamma_1 \Sequent \Delta_1, !C$ and $!C, \Gamma_2 \Sequent \Delta_2$ are !!{provable}. The first is already an axiom regardless of how we pick~$!C$ since $!A$ occurs on both the left - and right. Our only option to guarantee that $!C, \Gamma_2 - \Sequent \Delta_2$ is !!{provable} is to let $!C \ident \lfalse$. + and right. One choice guaranteeing that $!C, \Gamma_2 + \Sequent \Delta_2$ is !!{provable} is $!C \ident \lfalse$. \item $!A \in \Gamma_1$ and $!A \in \Delta_2$. Then $\Gamma_1 \Sequent \Delta_1, !A$ and $!A, \Gamma_2 \Sequent \Delta_2$ are both axioms, so we can pick $!C \ident !A$. \item $!A \in \Gamma_2$ and $!A \in \Delta_1$. Then $!A, \Gamma_1 \Sequent \Delta_1$ and $\Gamma_2 \Sequent \Delta_2, !A$ would be - axioms, but they have~$!A$ on the wrong sides. So $!A$ isn't the - interpolant. However, using $\RightR{\lnot}$ and $\LeftR{\lnot}$ + axioms, but they have~$!A$ on the wrong sides. These axioms do not + directly supply the two sequents required for $!A$ to be an + interpolant. Instead, using $\RightR{\lnot}$ and $\LeftR{\lnot}$ we can !!{prove} $\Gamma_1 \Sequent \Delta_1, \lnot!A$ and $\lnot !A, \Gamma_2 \Sequent \Delta_2$. @@ -134,8 +135,9 @@ first part we assigned the active !!{formula}~$!A$ also to the first part the premise. This is a choice we get to make. The inductive hypothesis would also apply if we assigned the active - formula to the other part, but then we would not be able to find - an interpolant (exercise: try it). + formula to the other part, but then the interpolant supplied by + the induction hypothesis would not directly give the two + sequents needed below (exercise: try this construction). Consider the first situation first, where $\lnot !A$~belongs to the first part. By inductive hypothesis, there is an @@ -351,8 +353,9 @@ of $\Gamma_1 \Sequent \Delta_1, !A(c), !C_1$ and $!C_1, \Gamma_2 \Sequent \Delta_2$. We can apply $\RightR{\lforall}$ to the first to obtain $\Gamma_1 \Sequent \Delta_1, \lforall[x][!A(x)], !C_1$. - (The eigenvariable condition is satisfied, since it was already - satisfied in the \RightR{\lforall} rule at the end of~$\pi$.) Thus + (The eigenvariable condition is satisfied: the original rule + excludes $c$ from its conclusion, and the language-intersection + argument below also excludes $c$ from the added context $!C_1$.) Thus $!C_1$ would be an interpolant if the condition that $\Lang L(!C_1) \subseteq \Lang L(\Gamma_1, \Delta_1, \lforall[x][!A(x)]) \cap \Lang L(\Gamma_2, \Delta_2)$ is satisfied. By the inductive @@ -401,7 +404,8 @@ L(!C_1)$ and $b \notin \Lang L(\Gamma_1, \Delta_1, \lexists[x][!A(x)]) \cap \Lang L(\Gamma_2, \Delta_2)$? First of all, by replacing all occurrences of~$b$ in~$!C_1$ by - !!a{variable}~$y$ we can write $!C_1 \ident \Subst{!C_1'}{b}{y}$ + !!a{variable}~$y$ that occurs neither free nor bound in~$!C_1$, + we can write $!C_1 \ident \Subst{!C_1'}{b}{y}$ where $!C_1'$~does not contain~$b$. Furthermore, either $b \notin \Lang L(\Gamma_1, \Delta_1, \lexists[x][!A(x)])$ or $b \notin \Lang L(\Gamma_2, \Delta_2)$. We can take $!C \ident @@ -515,39 +519,48 @@ \begin{proof} Suppose $\Gamma$ implicitly defines~$R$. Let $R'$, $\Gamma'$ be as - above and $\Lang L' = \Lang L(\Gamma') = \Lang L \setminus \{R\} - \cup \{R'\}$. By hypothesis, we have + above and let $\Lang L' = (\Lang L \setminus \{R\}) + \cup \{R'\}$ be the renamed ambient language, so that + $\Lang L(\Gamma') \subseteq \Lang L'$. By hypothesis, we have \begin{align*} \Gamma, \Gamma' & \Sequent \lforall[x_1][\dots\lforall[x_n][(R(x_1,\dots,x_n) \liff R'(x_1, \dots, x_n))]] - \intertext{Let $c_1$, \dots,~$c_n$ be !!{constant}s not occurring in~$\Gamma$. By the invertibility lemma we have} + \intertext{Let $c_1$, \dots,~$c_n$ be pairwise distinct !!{constant}s + not occurring in~$\Gamma$. By the invertibility lemma we have} \Gamma, \Gamma', R(c_1,\dots,c_n) & \Sequent R'(c_1, \dots, c_n) \intertext{Apply Maehara's Lemma to} \maeh{\Gamma, R(c_1,\dots,c_n)}{\Gamma'} & \Sequent \maeh{\ }{R'(c_1, \dots, c_n)} - \intertext{to find an~$!A \ident !A(x_1, \dots, x_n)$ such that} + \intertext{to find an interpolant, which we write as $!A(c_1,\dots,c_n)$. + Here $!A(x_1,\dots,x_n)$ is obtained by simultaneously replacing the + distinguished constants $c_i$ by variables $x_i$, first renaming + bound variables to avoid capture. Then} \Gamma, R(c_1,\dots,c_n) & \Sequent !A(c_1, \dots, c_n) \\ !A(c_1, \dots, c_n), \Gamma' & \Sequent R'(c_1, \dots, c_n) - \intertext{have !!{proof}s. Since $\Lang L(!A) = \Lang L_1 \cap - \Lang L_2 = \Lang L(\Gamma) \setminus \{R\}$, $!A$~does not contain~$R$. + \intertext{have !!{proof}s. The language of the interpolant $!A(c_1,\dots,c_n)$ is contained in + $\bigl(\Lang L(\Gamma) \setminus \{R\}\bigr) + \cup \{c_1,\dots,c_n\}$. In particular, $!A$~contains neither $R$ nor $R'$. Replace $R'$ everywhere by~$R$ in the !!{proof} of the second sequent to get !!a{proof} of} !A(c_1, \dots, c_n), \Gamma & \Sequent R(c_1, \dots, c_n) \end{align*} - Apply \RightR{\lif} and \RightR{\lforall} to get !!a{proof} of + Apply \RightR{\lif} to each direction, combine the two implications + using \RightR{\land} (with the usual definition of $\liff$), and + then apply \RightR{\lforall} successively to get !!a{proof} of \[ \Gamma \Sequent \lforall[x_1][\dots\lforall[x_n][(R(x_1,\dots,x_n) \liff !A(x_1, \dots, x_n))]]. \] - This shows that $!A(x_1, \dots, x_n)$ explicitly defines $!R$ + This shows that $!A(x_1, \dots, x_n)$ explicitly defines $R$ in~$\Gamma$. \end{proof} A third result which is equivalent to interpolation (and, like it, can be proved using Maehara's Lemma) is the following theorem: If two -consistent theories~$\Gamma_1$, $\Gamma_2$ contain a complete theory -$\Gamma$ in the language~$\Lang L(\Gamma) \subseteq \Lang L(\Gamma_1) -\cap \Lang L(\Gamma_2)$, then $\Gamma_1 \cup \Gamma_2$ is consistent. +consistent theories~$\Gamma_1$, $\Gamma_2$ contain a theory +$\Gamma$ that is complete with respect to every !!{sentence} in the +full common language $\Lang L(\Gamma_1) \cap \Lang L(\Gamma_2)$, +then $\Gamma_1 \cup \Gamma_2$ is consistent. Recall that a complete theory is one such that for every !!{sentence}~$!A$ in its language either $\Gamma \Proves !A$ or @@ -560,7 +573,7 @@ completeness of~$\Gamma$, $\Gamma \Entails \lnot !A$, and since $\Gamma \subseteq \Gamma_1$, $\Gamma_1 \Entails \lnot !A$, making $\Gamma_1$ inconsistent. So $\Gamma \Entails !A$ and since $\Gamma -\subseteq \Gamma_2$, $\Gamma_2 \Entails !A$. So $\Gamma \Entails/ +\subseteq \Gamma_2$, $\Gamma_2 \Entails !A$. So $\Gamma_2 \Entails/ \lnot !A$, or $\Gamma_2$ would be inconsistent. The non-existence of !!a{sentence}~$!A$ in the joint diff --git a/content/proof-theory/cut-elimination/introduction.tex b/content/proof-theory/cut-elimination/introduction.tex index 37d9ad67..a6e0ffd9 100644 --- a/content/proof-theory/cut-elimination/introduction.tex +++ b/content/proof-theory/cut-elimination/introduction.tex @@ -95,7 +95,7 @@ \[ \Axiom$\Gamma \fCenter \Delta, !A$ \Axiom$!A, \Gamma \fCenter \Delta$ -\RightLabel{\Cut} +\RightLabel{\CutCS} \BinaryInf$\Gamma \fCenter \Delta$ \DisplayProof \] diff --git a/content/proof-theory/cut-elimination/intuitionistic.tex b/content/proof-theory/cut-elimination/intuitionistic.tex index c2318f14..c6c6f964 100644 --- a/content/proof-theory/cut-elimination/intuitionistic.tex +++ b/content/proof-theory/cut-elimination/intuitionistic.tex @@ -1,3 +1,8 @@ +Here the retained-principal \LeftR{\lif} rule is used as a derived +rule of~\Log{G3c}: weaken its second premise with $!B \lif !C$, apply +the ordinary \LeftR{\lif} rule, and contract the two copies of +$!B \lif !C$ in the conclusion. + If $!A \ident (!B \lif !C)$ then $\pi$ ends in \[ \AxiomC{} @@ -40,7 +45,7 @@ \[ \AxiomC{} \RightLabel{$\pi_1'$} -\Deduce$B!, \Gamma \fCenter \Delta, !C$ +\Deduce$!B, \Gamma \fCenter \Delta, !C$ \AxiomC{} \RightLabel{$\pi_2''$} \Deduce$!C, \Pi \fCenter \Lambda$ @@ -50,8 +55,7 @@ \] Both its cut rank and cut !!{height} are less than the cut rank and !!{height} of~$\pi$, so the induction hypothesis yields a -\Log{G3c}-!!{proof}~$\pi_2'''$ of $!B, \Gamma, \Pi, \Pi \fCenter \Delta, \Lambda, -\Lambda$. Now apply the inductive hypothesis to the !!{proof} ending +\Log{G3c}-!!{proof}~$\pi_2'''$ of $!B, \Gamma, \Pi \fCenter \Delta, \Lambda$. Now apply the inductive hypothesis to the !!{proof} ending in \Cut, \[ \AxiomC{} @@ -59,13 +63,12 @@ \Deduce$\Gamma, \Pi \fCenter \Delta, \Lambda, !B$ \AxiomC{} \RightLabel{$\pi_2'''$} -\Deduce$!B, \Gamma, \Pi, \Pi \fCenter \Delta, \Lambda, -\Lambda$ +\Deduce$!B, \Gamma, \Pi \fCenter \Delta, \Lambda$ \RightLabel{\Cut} -\BinaryInf$!B, \Gamma, \Pi \fCenter \Delta, \Lambda$ +\BinaryInf$\Gamma, \Gamma, \Pi, \Pi \fCenter \Delta, \Delta, \Lambda, \Lambda$ \DisplayProof \] (it has cut rank $< \cutr{\pi}$) to obtain !!a{proof} of $\Gamma, -\Gamma, \Pi, \Pi, \Pi \fCenter \Delta, \Lambda, \Lambda, \Lambda$. We +\Gamma, \Pi, \Pi \fCenter \Delta, \Delta, \Lambda, \Lambda$. We obtain the !!{proof} $\pi'$ of $\Gamma, \Pi \fCenter \Delta, \Lambda$ by applying \olref[seq][inv]{prop:G3c-cont-adm}. \ No newline at end of file diff --git a/content/proof-theory/cut-elimination/midsequent.tex b/content/proof-theory/cut-elimination/midsequent.tex index 7fa3267a..630db834 100644 --- a/content/proof-theory/cut-elimination/midsequent.tex +++ b/content/proof-theory/cut-elimination/midsequent.tex @@ -19,7 +19,7 @@ quantifier inferences. (!!^a{formula}~$!A$ is \emph{prenex} (or in \emph{prenex form}) if it is of the form \[\mathsf{Q}_1x_1\dots\mathsf{Q}_nx_n\,!B(x_1,\dots,x_n)\] where each -$\mathsf{Q}_i$ is either $\lforall$ or~$\lexists$.) An important +$\mathsf{Q}_i$ is either $\lforall$ or~$\lexists$, and $!B$ is quantifier-free.) An important consequence of the midsequent theorem is Herbrand's theorem. Its general case is a little hard to describe, but very generally it takes the form: for every !!{provable} !!{sentence}~$!A$ of first-order @@ -45,10 +45,13 @@ !!{formula}~$\lexists[x][!B(x)]$. The converse, i.e., that if $\lexists[x][!B(x)]$ has a Herbrand disjunction, then it is provable, is easy. In fact, the Herbrand disjunction entails $\lexists[x][!B(x)]$. -E.g., here is !!a{proof} in~$\Log{G3c}$ for the case where $n=2$: +E.g., here is !!a{proof} in~$\Log{G3c}$ for the case where $n=2$, +using \olref[seq][ex]{prop:G3c-axioms} for the two top sub-!!{proof}s: \[ -\Axiom$!B(t_1) \fCenter \lexists[x][!B(x)], !B(t_1), !B(t_2)$ -\Axiom$!B(t_2) \fCenter \lexists[x][!B(x)], !B(t_1), !B(t_2)$ +\AxiomC{} +\Deduce$!B(t_1) \fCenter \lexists[x][!B(x)], !B(t_1), !B(t_2)$ +\AxiomC{} +\Deduce$!B(t_2) \fCenter \lexists[x][!B(x)], !B(t_1), !B(t_2)$ \RightLabel{\LeftR{\lor}} \BinaryInf$!B(t_1) \lor !B(t_2) \fCenter \lexists[x][!B(x)], !B(t_1), !B(t_2)$ \RightLabel{\RightR{\lexists}} @@ -72,8 +75,8 @@ \DisplayProof \] If these are all the $\RightR{\lexists}$ inferences in~$\pi$ with -$\lexists[x][!B(x)]$ active, then there are no other quantifier -inferences in~$\pi_1'$. That's because $!B(x)$ contains no other +$\lexists[x][!B(x)]$ principal, then there are no other quantifier +inferences in~$\pi_1$. That's because $!B(x)$ contains no other quantifiers, and the end-sequent doesn't contain any !!{formula}s on the left. In other words, $ \fCenter \lexists[x][!B(x)], !B(t_1), \dots, !B(t_n)$ is the mid-sequent of~$\pi$. Moreover, since there are @@ -103,9 +106,10 @@ number of propositional inferences below it, and the order~$o(\pi)$ of $\pi$ as the sum of the orders of all its quantifier inferences. If $o(\pi) = 0$, then no quantifier inference has a propositional - inference below it, and we are done: Since all quantifier inferences - have one premise, there is a single topmost quantifier inference. - Its premise is the midsequent. + inference below it, and we are done. If there is no quantifier + inference, the end-sequent is a midsequent. Otherwise, since all + quantifier inferences have one premise, there is a single topmost + quantifier inference, whose premise is the midsequent. If $o(\pi) > 0$, pick a bottom-most quantifier inference with order $>0$. Since it has order $>0$, there must be a propositional @@ -149,7 +153,7 @@ \RightLabel{$\pi_2'$} \Deduce$\Gamma' \fCenter \Delta', \lforall[x][!A(x)], !A(c), !B$ \AxiomC{} -\RightLabel{$\pi_3$} +\RightLabel{$\pi_3'$} \Deduce$!C, \Gamma' \fCenter \Delta', \lforall[x][!A(x)], !A(c)$ \RightLabel{\LeftR{\lif}} \BinaryInf$!B \lif !C, \Gamma' \fCenter \Delta', \lforall[x][!A(x)], !A(c)$ @@ -158,7 +162,8 @@ \DisplayProof \] where $\pi_2'$ is obtained from~$\pi_2$ by weakening with~$!A(c)$ on -the right. (This does not add any inferences, in particular, no +the right, and $\pi_3'$ is obtained from~$\pi_3$ by weakening with +$\lforall[x][!A(x)]$ on the right. (This does not add any inferences, in particular, no quantifier inferences which might affect the order. It also does not violate any eigenvariable conditions in~$\pi_2$, since no constants in~$!A(c)$ are used as eigenvariables in~$\pi_2$.) The eigenvariable @@ -169,11 +174,11 @@ obtain !!a{proof}~$\pi_1''$ of $!B \lif !C, \Gamma' \fCenter \Delta', \lforall[x][!A(x)]$. The proof of the admissibility of $\RightR{\Contraction}$ for $\lforall[x][!A(x)]$ and the proof of -invertibility of $\RightR{\lforall}$ used in that proof did not change +invertibility of $\RightR{\lforall}$ used in that proof did not increase the order of any inference: it, at most, deleted inferences. Thus, there are no more quantifier inferences in~$\pi_1''$ than in~$\pi_1$, -and each quantifier inference in~$\pi_1''$ has the same number of -proposional inferences below it as its corresponding inference +and each quantifier inference in~$\pi_1''$ has no more +proposional inferences below it than its corresponding inference in~$\pi_1$---with the exception of the last \RightR{\lforall}: it had a \LeftR{\lif} below it in~$\pi$, which we have moved above it in~$\pi_1''$. Replace $\pi_1$ in $\pi$ by $\pi_1''$. The resulting @@ -191,7 +196,7 @@ \RightLabel{$\pi_2$} \Deduce$\Gamma' \fCenter \Delta', \lexists[x][!A(x)], !A(t), !B$ \RightLabel{\RightR{\lexists}} -\UnaryInf$!\Gamma' \fCenter \Delta', \lexists[x][!A(x)], !B$ +\UnaryInf$\Gamma' \fCenter \Delta', \lexists[x][!A(x)], !B$ \AxiomC{} \RightLabel{$\pi_3$} \Deduce$\Gamma' \fCenter \Delta', \lexists[x][!A(x)], !C$ diff --git a/content/proof-theory/natural-deduction/grafting.tex b/content/proof-theory/natural-deduction/grafting.tex index 2d41f203..7c778b16 100644 --- a/content/proof-theory/natural-deduction/grafting.tex +++ b/content/proof-theory/natural-deduction/grafting.tex @@ -22,7 +22,7 @@ \AxiomC{$\Discharge{!B}{x}$} \DeduceC{$!A$} \DischargeRule{\Intro{\lif}}{x} -\UnaryInfC{$!B \lif !C$} +\UnaryInfC{$!B \lif !A$} \AxiomC{} \DeduceC{$!B$} \RightLabel{\Elim{\lif}} @@ -48,37 +48,50 @@ \end{defn} Provided that $\delta_1$ and $\delta_2$ don't have different -assumption !!{formula}s labelled with the same label, and no open -assumption of~$\delta_2$ contains an eigenvariable of~$\delta_1$, the +assumption !!{formula}s labelled with the same label, no open +assumption label of~$\delta_2$ is discharged in~$\delta_1$, and no +open assumption of~$\delta_2$ contains an eigenvariable of~$\delta_1$, the resulting $\Subst{\delta_1}{\delta_2}{!B^x}$ is a correct !!{proof}, -and its open assumptions are those of $\delta_1$ together with those -of~$\delta_2$. When grafting !!{proof}s, these conditions will -typically be satisfied. The first is satisfied whenever $\delta_1$ and -$\delta_2$ are subproofs of a larger !!{proof}. If the second is not -satisfied, we can rename the eigenvariables of~$\delta_1$ so that it -is. +and its open assumptions are those of $\delta_1$ other than the +replaced occurrences of~$!B^x$, together with those of~$\delta_2$. When grafting !!{proof}s, these conditions will +typically be satisfied. Compatibility holds whenever $\delta_1$ and $\delta_2$ are +subproofs of a larger !!{proof}. The remaining conditions can be +ensured by consistently renaming discharged-assumption labels and +eigenvariables of~$\delta_1$. Freshen internal discharged labels of +the inserted copies when necessary, preserving their open labels. A corresponding definition applies to \Log{N2c} and~\Log{N2i}. \begin{defn} If $\delta_1$ is a \Log{N2c}-!!{proof} (or \Log{N2i}-!!{proof}) of~$x:!B, \Gamma_1 \Sequent !A$, and $\delta_2$ is a -\Log{N1c}-!!{proof} (\Log{N1i}-!!{proof}) of~$\Gamma_2 \Sequent !B$, +\Log{N2c}-!!{proof} (\Log{N2i}-!!{proof}) of~$\Gamma_2 \Sequent !B$, then $\Subst{\delta_1}{\delta_2}{x:!B}$ is the result of replacing -every axiom $x:!B \Sequent !B$ in~$\delta_1$ by~$\delta_2$, and adding -$\Gamma_2$ to the context of every sequent below such axioms. +each axiom $x:!B \Sequent !B$ corresponding to the designated open +assumption by~$\delta_2$, and replacing $x:!B$ by~$\Gamma_2$ in the +context of every sequent below a replaced axiom. Discharged-assumption +labels are first renamed as necessary so that no already discharged +occurrence is mistaken for the designated open assumption. \end{defn} \begin{prop} If $\delta_1 \Proves x:!B, \Gamma_1 \Sequent !A$ and $\delta_2 \Proves \Gamma_2 \Sequent !B$, then $\Subst{\delta_1}{\delta_2}{x:!B} \Proves \Gamma_1, \Gamma_2 \Sequent -!A$, provided no eigenvariable of~$\delta_1$ occurs in~$\Gamma_2$. +!A$, provided the labels are compatible, no label in~$\Gamma_2$ +is discharged in~$\delta_1$, and no eigenvariable of~$\delta_1$ +occurs in~$\Gamma_2$. \end{prop} \begin{proof} - By induction on $\pheight{\delta}$. + By induction on $\pheight{\delta_1}$. At a designated axiom use + $\delta_2$; leave other axioms unchanged. At an inference, apply + the induction hypothesis to its immediate sub-!!{proof}s and repeat + the inference with the updated contexts. The label conditions + prevent discharge capture, and the eigenvariable condition is + preserved because the new open assumptions contain no eigenvariable + of~$\delta_1$. \end{proof} \end{document} \ No newline at end of file diff --git a/content/proof-theory/natural-deduction/quantifiers.tex b/content/proof-theory/natural-deduction/quantifiers.tex index c08648fb..5f66b159 100644 --- a/content/proof-theory/natural-deduction/quantifiers.tex +++ b/content/proof-theory/natural-deduction/quantifiers.tex @@ -29,7 +29,7 @@ \begin{lem}\ollabel{lem:subst-regular} If $\delta$ is regular, ends in~$!C$, $c$ is !!a{constant} not used as an eigenvariable -in~$\delta$, and $t$~is a term not containing any eigenvariables +in~$\delta$, and $t$~is a closed term not containing any eigenvariables of~$\delta$, then $\Subst{\delta}{t}{c}$ resulting from~$\delta$ by replacing every occurrence of~$c$ by~$t$ is a regular !!{proof}. The end-!!{formula} of $\Subst{\delta}{t}{c}$ is $\Subst{!C}{t}{c}$. If @@ -110,19 +110,24 @@ \] By induction hypothesis, $\Subst{\delta_1'}{t}{c}$ and $\Subst{\delta_2'}{t}{c}$ are regular !!{proof}s of - $\lexists[x][!A(x,c)]$ and of $!C$ from the open + $\lexists[x][!A(x,t)]$ and of $\Subst{!C}{t}{c}$ from the open assumption~$!A(a,t)$. Since $a$ is an eigenvariable of~$\delta$, $a$~does not occur in~$t$. Therefore, the last inference in $\Subst{\delta}{t}{c}$, \[ \AxiomC{} - \RightLabel{$\Subst{\delta'}{t}{c}$} - \DeduceC{$!A(a,t)$} - \RightLabel{\Intro{\lforall}} - \UnaryInfC{$\lforall[x][!A(x,t)]$} + \RightLabel{$\Subst{\delta_1'}{t}{c}$} + \DeduceC{$\lexists[x][!A(x,t)]$} + \AxiomC{$\Discharge{!A(a,t)}{x}$} + \RightLabel{$\Subst{\delta_2'}{t}{c}$} + \DeduceC{$\Subst{!C}{t}{c}$} + \DischargeRule{\Elim{\lexists}}{x} + \BinaryInfC{$\Subst{!C}{t}{c}$} \DisplayProof \] - is correct: $\Subst{!A(x,t)}{a}{x} \ident \Subst{!A(a,c)}{t}{c}$, neither the conclusion~$!C$ nor any open assumption contains~$a$. + is correct: $\Subst{!A(x,t)}{a}{x} \ident \Subst{!A(a,c)}{t}{c}$, + and neither the conclusion~$\Subst{!C}{t}{c}$ nor any remaining + open assumption contains~$a$. \end{enumerate} \end{proof} @@ -130,19 +135,26 @@ If $\delta$ is !!a{proof} in \Log{N1c} or \Log{N1i}, then there is a regular !!{proof}~$\delta'$ with the same structure (in particular, the same !!{height}) which differs from $\delta$ only by replacing -eigenvariables. +eigenvariables and consistently renaming discharged-assumption labels. \end{prop} \begin{proof} +First consistently rename discharged-assumption labels so that +no discharge label is reused outside the assumptions discharged by +its inference. This preserves all open assumptions and the proof +structure, and prevents later local substitutions from creating +incompatible formulas with the same label. For the purpose of the proof only, call an eigenvariable inference of~$\delta$ \emph{clean} if its eigenvariable is not the eigenvariable of another inference nor does it occur anywhere in~$\delta$ except the -immediate sub-!!{proof} of the inference, and \emph{dirty} otherwise. +immediate sub-!!{proof} of \Intro{\lforall}, or the sub-!!{proof} +leading to the minor premise of \Elim{\lexists}, respectively, and +\emph{dirty} otherwise. Let $n$ be the number of dirty eigenvariable inferences in~$\delta$. We show, by induction on~$n$, that $\delta$~can be transformed into the required regular !!{proof}~$\delta'$. If $n=0$, all eigenvariable inferences in~$\delta$ are clean, and so $\delta$ is regular, and there is -nothing to prove. Otherwise, pick a highest eigenvariable inference, +nothing to prove. Otherwise, pick a highest dirty eigenvariable inference, say \Intro{\lforall}. The sub-!!{proof}~$\delta_1$ of~$\delta$ ending in it is of the form \[ @@ -155,7 +167,9 @@ \] Note that as $c$ is an eigenvariable, it does not occur in~$\lforall[x][!A(x)]$ or an open assumption. The proof $\delta_2$ is -regular, since it contains no eigenvariable inferences at all. Let $a$ +regular, since all eigenvariable inferences above the selected +inference are clean. Moreover, $c$ is not an eigenvariable of +$\delta_2$, since such an upper inference would also be dirty. Let $a$ be !!a{constant} not occurring in~$\delta$. By \olref{lem:subst-regular}, $\Subst{\delta_2}{a}{c}$ is a regular proof of $!A(a)$. By the eigenvariable condition, no open assumption @@ -179,7 +193,7 @@ \begin{prob} Describe the case in the proof of \olref{prop:regular} where the -topmost eigenvariable inference is~\Elim{\lexists}. +selected highest dirty eigenvariable inference is~\Elim{\lexists}. \end{prob} We will not appeal to the proposition just proved explicitly, but we diff --git a/content/proof-theory/natural-deduction/rules-proofs.tex b/content/proof-theory/natural-deduction/rules-proofs.tex index b0718e89..2861db15 100644 --- a/content/proof-theory/natural-deduction/rules-proofs.tex +++ b/content/proof-theory/natural-deduction/rules-proofs.tex @@ -34,7 +34,7 @@ are the \emph{premises}. The !!{formula} on the left is the \emph{principal} !!{formula}~$!A \lif !B$. All !!{elimination} rules have one such premise, always on the far left. It is called the -\emph{major} premise of the inference. If there are others, such as an +\emph{major} premise of the inference. If there are others, such as in this case, they are called \emph{minor} premises. The premise(s) of !!{introduction} rules are also called major premise(s). The !!{formula} below the line is the \emph{conclusion}. @@ -65,7 +65,7 @@ assumptions: \[ \AxiomC{$\Discharge{!A}{y}$} -\DischargeRule{\Intro{\lif}}{x} +\RightLabel{\Intro{\lif}} \UnaryInfC{$!B \lif !A$} \DischargeRule{\Intro{\lif}}{y} \UnaryInfC{$!A \lif (!B \lif !A)$} @@ -128,18 +128,18 @@ the discharged~$!A(c)$, does not occur in~$!B$, and does not occur in~$!A$. This is called the \emph{eigenvariable condition}. -!!^{proof}s in \Log{N1c} and~\Log{N1i} are finite trees of sequents -that are inductively generated from axioms using the rules of +!!^{proof}s in \Log{N1c} and~\Log{N1i} are finite trees of !!{formula} occurrences +that are inductively generated from assumptions using the rules of inference. Each leaf is an assumption, possibly labelled with a discharge label, and every other !!{formula} follows from the !!{formula}s immediately above it by one of the inference rules of the -system. If an occurence of a !!{formula} as an assumption in the tree +system. If an occurrence of a !!{formula} as an assumption in the tree above an inference has not been discharged by an inference above it, it is called \emph{open} (at the inference). \begin{defn}\ollabel{defn:proof} \emph{!!^{proof}s} in \Log{N1c} and~\Log{N1i} are finite trees of -!!{formula}s inductively as follows: +!!{formula}s defined inductively as follows: \begin{enumerate} \item\ollabel{defn:prf:assumption} Every !!{formula} labelled by a discharge label such as $x$ or $y$, by itself is @@ -148,7 +148,7 @@ \item\ollabel{defn:prf:one-prem} If $R$ is a rule with one, two, or three premises $!A_1$, $!A_2$, $!A_3$, conclusion~$!A$, and $\delta_1$, $\delta_2$, $\delta_3$ are !!{proof}s ending in $!A_1$, - $!A_2$, $!A_3$, respectively, the + $!A_2$, $!A_3$, respectively, then \[ \AxiomC{} \RightLabel{$\delta_1$} @@ -175,7 +175,7 @@ \DeduceC{$!A_2$} \AxiomC{} \RightLabel{$\delta_3$} - \DeduceC{$!A_2$} + \DeduceC{$!A_3$} \RightLabel{$R$} \TrinaryInfC{$!A$} \DisplayProof @@ -188,7 +188,8 @@ \emph{open assumptions} of the !!{proof} if they are open assumptions of $\delta_1$, $\delta_2$, or~$\delta_3$, except those occurrences discharged by the rule. If the rule is labelled~$x$ (or - $x\, y$), then for \Intro{\lif} and~\Intro{\lnot}, that is all open + $x\, y$), then for \Intro{\lif}, \Intro{\lnot}, and (in \Log{N1c}) \FalseCl, + that is all open assumptions in~$\delta_1$ labelled~$x$; for \Elim{\lexists}, it is all open assumptions labelled~$x$ in~$\delta_2$; for \Elim{\lor}, it is all open assumptions labelled~$x$ in~$\delta_2$ and all open @@ -199,7 +200,7 @@ The !!{proof}s used in the inductive construction of !!a{proof} are called its \emph{sub-!!{proof}s}. The sub-!!{proof}s ending in the premises of an inference are called the \emph{immediate -sub-!!{proof}s} of the inference. The rules of \Log{N2c} and \Log{N2i} +sub-!!{proof}s} of the inference. The rules of \Log{N1c} and \Log{N1i} are given in \olref{tab:N1} \subfile{rules-N1} @@ -218,7 +219,7 @@ sub-!!{proof}s~$\delta_1$, $\delta_2$, and~$\delta_3$, then $\pheight{\delta} = \max(\pheight{\delta_1}, \pheight{\delta_2}, \pheight{\delta_3}) + 1$. \end{enumerate} -If a sequent~$S$ has !!a{proof} of height $\le n$, we write $\Proves[n] S$. +If !!a{formula}~$S$ has !!a{proof} of height $\le n$, we write $\Proves[n] S$. \end{defn} \begin{ex} @@ -229,7 +230,7 @@ \] is !!a{proof}~$\delta_1$. Its height is~$0$. From $\delta_1$ we can obtain two !!{proof}s~$\delta_2$ and~$\delta_3$ -by applying one of the two version of~\Elim{\land} +by applying one of the two versions of~\Elim{\land} \[ \AxiomC{$!A \land !B^x$} \RightLabel{\Elim{\land}[2]} @@ -242,9 +243,9 @@ \DisplayProof \] The immediate sub-!!{proof}s of the last inference in~$\delta_2$ and -in~$\delta_3$ is the same: $!A \land !B$. Both !!{proof}s have the +in~$\delta_3$ are the same: $!A \land !B$. Both !!{proof}s have the occurrence of $!A\land !B$ as an open assumption. We have -$\pheight{\delta_1} = \pheight{\delta_2} = 1$. +$\pheight{\delta_2} = \pheight{\delta_3} = 1$. The rule \Intro{\land} requires two premises of the form $!B$ and $!A$ to justify a conclusion of the form~$!B \land !A$. Thus, the following @@ -263,7 +264,7 @@ \DisplayProof \] Its height $\pheight{\delta_4} = \max(\pheight{\delta_2}, -\pheight{\delta_3})+1 = \max(1,1) + 1 = 2$. It has two occurences of +\pheight{\delta_3})+1 = \max(1,1) + 1 = 2$. It has two occurrences of $!A \land !B$ as assumptions, both are open. Finally we can apply \Intro{\lif} to obtain $\delta_5$: diff --git a/content/proof-theory/natural-deduction/sequents.tex b/content/proof-theory/natural-deduction/sequents.tex index ba46c567..e18c2bb0 100644 --- a/content/proof-theory/natural-deduction/sequents.tex +++ b/content/proof-theory/natural-deduction/sequents.tex @@ -10,7 +10,7 @@ \olsection{Natural Deduction with Sequents: \Log{N2c} and~\Log{N2i}} -!!^a{proof}~$\delta$ in \Log{G1c} or \Log{G1i} shows that its +!!^a{proof}~$\delta$ in \Log{N1c} or \Log{N1i} shows that its end-!!{formula}~$!A$ follows from its open assumptions. If $\Gamma$ is the set of !!{formula}s~$!B$, where $!B^x$ occurs as an open assumptions in~$\delta$, we can write this as $\delta \Proves \Gamma @@ -43,6 +43,8 @@ applications of the corresponding rules in \Log{N2c} and~\Log{N2i} also when the corresponding context !!{formula}s $!A$, $!B$, and $!A(a)$ are not present in the context of the relevant premise. +The same convention applies to \FalseCl in~\Log{N2c}: its indicated +negated assumption may be absent from the premise context. \begin{prop} If $\delta$ is !!a{proof} in~\Log{N1c} or \Log{N1i} of~$!A$, then @@ -80,7 +82,7 @@ \[ \AxiomC{} \RightLabel{$\delta_1'$} - \Deduce$x:B, \Gamma \fCenter !C$ + \Deduce$x:!B, \Gamma \fCenter !C$ \RightLabel{\Intro{\lif}} \UnaryInf$\Gamma \fCenter !B \lif !C$ \DisplayProof @@ -134,14 +136,14 @@ \UnaryInf$\Gamma \fCenter !B \lif !C$ \DisplayProof \] - By inductive hypothesis, there is !!a{proof} in~\Log{N1c} + By inductive hypothesis, there is !!a{proof}~$\delta_1'$ in~\Log{N1c} (\Log{N1i}) of~$!C$. In the first case, $!B^x$ is an open - assumption of~$\delta'$; in the second case it is not. We can take + assumption of~$\delta_1'$; in the second case it is not. We can take the !!{proof}~$\delta'$ to be \[ \bottomAlignProof \AxiomC{$\Discharge{!B}{x}$} - \RightLabel{$\delta_1$} + \RightLabel{$\delta_1\prime$} \DeduceC{$!C$} \DischargeRule{\Intro{\lif}}{x} \UnaryInfC{$!B \lif !C$} @@ -149,7 +151,7 @@ \quad\text{ or }\quad \bottomAlignProof \AxiomC{} - \RightLabel{$\delta_1$} + \RightLabel{$\delta_1\prime$} \DeduceC{$!C$} \RightLabel{\Intro{\lif}} \UnaryInfC{$!B \lif !C$} diff --git a/content/proof-theory/natural-deduction/translation-G2i.tex b/content/proof-theory/natural-deduction/translation-G2i.tex index d40847b8..3bf5ffc5 100644 --- a/content/proof-theory/natural-deduction/translation-G2i.tex +++ b/content/proof-theory/natural-deduction/translation-G2i.tex @@ -10,6 +10,19 @@ \olsection{Translating from \Log{G2i} to \Log{N2i}} +Here \Log{G2i} is the intuitionistic variant of \Log{G2c}: all +sequents have at most one formula on the right. In addition, replace +its \LeftR{\lor} rule by the shared-succedent rule +\[ +\Axiom$!A,\Gamma_1 \fCenter \Delta$ +\Axiom$!B,\Gamma_2 \fCenter \Delta$ +\RightLabel{\LeftR{\lor}} +\BinaryInf$!A\lor !B,\Gamma_1,\Gamma_2 \fCenter \Delta$ +\DisplayProof +\] +where $\Delta$ is empty or a singleton. All other axioms and rules +are those of \Log{G2c} subject to the same succedent restriction. + The antecedents of sequents in \Log{G2i} are multisets~$\Gamma$ of !!{formula}s, while those of sequents in \Log{N2i} are sets~$\Gamma'$ of labelled formulas with the property that every label occurs only @@ -22,13 +35,13 @@ \begin{prop}\ollabel{prop:G2i-to-N2i} If $\Log{G2i} + \Cut \Proves \Gamma \Sequent \Delta$ then $\Log{N2i} \Proves \Gamma' \Sequent !C$, where $!C \ident \lfalse$ if $\Delta$ is -empty and $\Delta = \{!A\}$ otherwise, and $\Gamma'$ corresponds +empty and $\Delta = \{!C\}$ otherwise, and $\Gamma'$ corresponds to~$\Gamma$. \end{prop} \begin{proof} We show that if $\pi$ is !!a{proof} of $\Gamma \Sequent \Delta$ in - \Log{G2ci}, then there is a~$\Gamma'$ corresponding to~$\Gamma$ and + $\Log{G2i}+\Cut$, then there is a~$\Gamma'$ corresponding to~$\Gamma$ and !!a{proof}~$\delta$ of~$\Gamma' \Sequent !C$ in~\Log{N2i}. We do this by induction on $n = \pheight{\pi}$. @@ -39,7 +52,7 @@ If $n>0$, $\pi$ ends in a rule~$R$. The inductive hypothesis guarantees that there are !!{proof}s of sequents corresponding to - the premises of that rule in~\Log{N2c}. We can assume that all + the premises of that rule in~\Log{N2i}. We can assume that all discharge labels in those proofs are distinct, and that a label $x$ only occurs above an inference that discharges it, if it is discharged at all (by relabelling if necessary). We then show how @@ -64,7 +77,7 @@ \AxiomC{} \RightLabel{$\pi_1$} \Deduce$\Gamma \fCenter \Delta$ - \RightLabel{\RightR{\Weakening}} + \RightLabel{\LeftR{\Weakening}} \UnaryInf$!A, \Gamma \fCenter \Delta$ \DisplayProof \] @@ -83,13 +96,13 @@ \UnaryInf$!A, \Gamma \fCenter \Delta$ \DisplayProof \] - The induction hypothesis applied to $\pi_1$ yields !!a{proof} + The induction hypothesis applied to $\pi_1$ yields !!a{proof}~$\delta_1$ of~$\Pi, \Gamma' \Sequent !C$, where $\Pi \subseteq \{x : !A, y:!A\}$. If $\Pi = \{x : !A, y:!A\}$, replace all labelled - !!{formula}s $y:!A$ in~$\pi_1$ by $x:!A$. Since $x$~occurs in the - context of the end-sequent of~$\pi_1$ we can assume that no - inference in~$\pi_1$ discharges !!a{formula} of the form~$x:!B$, - i.e., no $x:!B$ on the left side of a sequent in~$\pi_1$ is + !!{formula}s $y:!A$ in~$\delta_1$ by $x:!A$. Since $x$~occurs in the + context of the end-sequent of~$\delta_1$ we can assume that no + inference in~$\delta_1$ discharges !!a{formula} of the form~$x:!B$, + i.e., no $x:!B$ on the left side of a sequent in~$\delta_1$ is active. Consequently, the result is still !!a{proof} in~\Log{N2i}. \item If $R$ is $\RightR{\lif}$, $\pi$ ends in \[ @@ -102,8 +115,8 @@ \] By the inductive hypothesis, there is !!a{proof}~$\delta_1$ of $x: !A, \Gamma' \Sequent !B$ or $\Gamma' \Sequent !B$ where $\Gamma'$ - corresponds to~$\Gamma$. We can take $\delta_1$ - to be $\delta$ plus an application of \Intro{\lif}. + corresponds to~$\Gamma$. We can take $\delta$ + to be $\delta_1$ plus an application of \Intro{\lif}. \item If $R$ is \LeftR{\lif}, $\pi$ ends in \[ \AxiomC{} @@ -120,7 +133,7 @@ \Sequent !A$ and $\delta_2$ of $x: !B, \Gamma_2' \Sequent !C$ or of of $\Gamma_2' \Sequent !C$. If $\delta_2$ is of the latter form, $\delta_2$ can serve as~$\delta$. Otherwise, we can relabel all - formulas and discharge labels in~$\pi_1$ to ensure that no label + formulas and discharge labels in~$\delta_1$ to ensure that no label occurs in both $\delta_1$ and~$\delta_2$. Then $\Gamma_1' \cup \Gamma_2'$ corresponds to $\Gamma_1 \cup \Gamma_2$. Since $x:!B$ occurs in the end-sequent of~$\delta_2$, $x:!B$ cannot be active in @@ -132,10 +145,15 @@ \RightLabel{$\delta_1$} \Deduce$\Gamma_1' \fCenter !A$ \RightLabel{\Elim{\lif}} - \BinaryInf$x: !A \lif !B \fCenter !B$ + \BinaryInf$x: !A \lif !B, \Gamma_1' \fCenter !B$ \DisplayProof \] - and every occurrence of $x:!B$ in~$\delta_2$ by $x:!A \lif !B$. + and replace $x:!B$ in each affected context of~$\delta_2$ by + $x:!A \lif !B,\Gamma_1'$, as in the grafting definition. Before + grafting, rename eigenvariables of~$\delta_2$ away from the + inserted open assumptions, and freshen internal discharged labels + and eigenvariables of inserted copies while preserving their + open-assumption labels. The result $\Subst{\delta_2}{\delta_3}{x:!B}$ is !!a{proof} of $x:!A \lif !B, \Gamma_1', \Gamma_2' \Sequent !C$. \item If $R$ is \RightR{\land}, $\pi$ ends in @@ -151,8 +169,8 @@ \DisplayProof \] The inductive hypothesis yields proof $\delta_1$ of $\Gamma_1' - \Sequent !A$ and $\delta_2$ of $\Gamma_2' \Sequent !A$. By - relabelling all formulas and discharge labels in~$\pi_2$ we can + \Sequent !A$ and $\delta_2$ of $\Gamma_2' \Sequent !B$. By + relabelling all formulas and discharge labels in~$\delta_2$ we can ensure that no label occurs in both $\delta_1$ and $\delta_2$. Then $\Gamma_1' \cup \Gamma_2'$ corresponds to $\Gamma_1 \cup \Gamma_2$. We obtain !!a{proof}~$\delta$ by applying $\Intro{\land}$ @@ -201,6 +219,15 @@ $\delta_2$ by $\delta_1$ to obtain~$\delta$ as the !!{proof}~$\Subst{\delta_2}{\delta_1}{x:!A}$ of $\Gamma_1', \Gamma_2' \Sequent !C$. \end{enumerate} + The remaining right logical rules translate by the corresponding + introductions. For each remaining left rule, combine the induction + results with the corresponding elimination from a fresh assumption + of its principal formula, grafting at a used active assumption and + retaining an unchanged proof when that assumption is unused. + Discharge may be vacuous. The original eigenvariable conditions + hold for the smaller translated contexts. Before each graft, + freshen internal eigenvariables away from the inserted assumptions + and use the stated label convention. \end{proof} \end{document} \ No newline at end of file diff --git a/content/proof-theory/natural-deduction/translation-N2i.tex b/content/proof-theory/natural-deduction/translation-N2i.tex index e4458ab0..4c420b36 100644 --- a/content/proof-theory/natural-deduction/translation-N2i.tex +++ b/content/proof-theory/natural-deduction/translation-N2i.tex @@ -11,7 +11,7 @@ \olsection{Translating from \Log{N2} to \Log{G2}} \begin{prop}\ollabel{prop:N2-to-G2} If $\Log{N2c}\ (\Log{N2i}) \Proves -\Gamma \Sequent !A$ then $\Log{G2c}\ (\Log{N2i}) + \Cut \Proves \Gamma' +\Gamma \Sequent !A$ then $\Log{G2c}\ (\Log{G2i}) + \Cut \Proves \Gamma' \Sequent \Delta$ where $\Gamma'$ is the multiset of !!{formula}s resulting from $\Gamma$ by removing labels, and $\Delta = \{!A\}$ if $!A$ is not~$\lfalse$, and $\Delta = \emptyset$ if it is. @@ -52,8 +52,9 @@ \DisplayProof \] The inductive hypothesis yields !!a{proof}~$\pi_1$ of $\Gamma' - \Sequent !C$, from which we obtain $\pi$ by applying - \LeftR{\Weakening} with~$!B$, and then~\RightR{\lif}. + \Sequent !C$, or of $\Gamma'\Sequent\ $ if $!C\ident\lfalse$. + In the latter case first apply \RightR{\Weakening} with~$!C$. + Then apply \LeftR{\Weakening} with~$!B$ and \RightR{\lif} to obtain~$\pi$. \item If $R$ is \Elim{\lif}, $\delta$ ends in \[ \AxiomC{} @@ -68,7 +69,10 @@ \] where $\Gamma = \Gamma_1 \cup \Gamma_2$. The inductive hypothesis yields !!{proof}s $\pi_1$ of $\Gamma_1' \Sequent !B \lif !A$ and - $\pi_2$ of $\Gamma_2' \Sequent !B$. We obtain the !!{proof}~$\pi$ as + $\pi_2$ of $\Gamma_2' \Sequent !B$, except that the latter has + empty succedent when $!B\ident\lfalse$. In that case first add + \RightR{\Weakening} with~$!B$ to~$\pi_2$. If $!A\not\ident\lfalse$, + we obtain the !!{proof}~$\pi$ as \[ \AxiomC{} \RightLabel{$\pi_1$} @@ -89,10 +93,18 @@ $!C$ but $(\Gamma_1 \cup \Gamma_2)'$ contains only one copy. We can correct this by adding suitable \LeftR{\Contraction} inferences. - In the event that $!A \ident \lfalse$, the inductive hypothesis - applied to $\delta_2$ yields !!a{proof} of $\Gamma_2' \Sequent \ $, - from which we can obtain the !!{proof}~$\pi$ by adding suitable - \LeftR{\Weakening} inferences and a \RightR{\Weakening} with~$!A$. + If $!A\ident\lfalse$, use the axiom $\lfalse\Sequent\ $ in place + of $!A\Sequent !A$ in the same construction. Its \LeftR{\lif} + inference and subsequent \Cut$\,$ then both have empty succedent, + as required. Apply the same antecedent contractions. +\item For the remaining rules, translate introductions by the corresponding + right rules and eliminations by the corresponding left rules followed + by \Cut. As in the implication cases, use empty succedents for bottom + conclusions, restore an intermediate bottom formula by right weakening + when required, and use left weakening for vacuous discharge. Translate + \FalseInt{} by right weakening. Contract repeated contexts, and in + \Log{G2c} the repeated common succedent from \LeftR{\lor}, as necessary. + The original eigenvariable conditions survive removal of labels. \item If $R$ is \FalseCl, $\delta$ ends in \[ \AxiomC{} @@ -110,15 +122,23 @@ \UnaryInf$\fCenter !A, \lnot !A$ \AxiomC{} \RightLabel{$\pi_1$} - \Deduce$x: \lnot !A, \Gamma' \fCenter $ + \Deduce$\lnot !A, \Gamma' \fCenter $ \RightLabel{\Cut} \BinaryInf$\Gamma' \fCenter !A$ \DisplayProof \] + If $!A\ident\lfalse$, append a cut with the axiom + $\lfalse\Sequent\ $ to obtain the required empty succedent. + If the $\FalseCl$ inference discharges no assumption, its premise + lacks $x:\lnot !A$. The induction hypothesis then already supplies + $\Gamma'\Sequent\ $; retain that proof when $!A\ident\lfalse$, + and otherwise apply \RightR{\Weakening} with~$!A$. \end{enumerate} -Note that only the translation of \FalseCl{} results in -!!a{proof}~$\pi$ with more than one !!{formula} on the right. That is, -the translation of a~\Log{N2i} !!{proof} is a \Log{G2i}-!!{proof}. +All nonclassical cases can be carried out directly in +$\Log{G2i}+\Cut$, using its shared-succedent \LeftR{\lor} rule. +The \FalseCl construction uses a classical sequent with two formulas +on the right. Thus a~\Log{N2i} !!{proof} translates to a +$\Log{G2i}+\Cut$ !!{proof}. \end{proof} \end{document} \ No newline at end of file diff --git a/content/proof-theory/normalization/introduction.tex b/content/proof-theory/normalization/introduction.tex index 75534800..657efc23 100644 --- a/content/proof-theory/normalization/introduction.tex +++ b/content/proof-theory/normalization/introduction.tex @@ -13,7 +13,7 @@ If you have !!{prove}d a conditional~$!A \lif !B$, you might be in a position to use it in !!a{proof} of~$!B$ by using~\Elim{\lif}. This would of course also require !!a{proof}~$\delta_1$ of~$!A$. Your -!!{proof}~$\delta_1$ of~$!A \lif !B$, more likely than not, ends +!!{proof} of~$!A \lif !B$, more likely than not, ends in~\Intro{\lif}, which turns !!a{proof}~$\delta_2$ of~$!B$ from the open assumption~$!A$ into one of~$!A \lif !B$. If it does, your final !!{proof} has the form @@ -24,7 +24,7 @@ \DischargeRule{\Intro{\lif}}{x} \UnaryInfC{$!A \lif !B$} \AxiomC{} -\RightLabel{$\delta_2$} +\RightLabel{$\delta_1$} \DeduceC{$!A$} \RightLabel{\Elim{\lif}} \BinaryInfC{$!B$} @@ -51,10 +51,11 @@ than you can while avoiding them. There are other similarities: normal !!{proof} can be much longer than the shortest !!{proof} with detours of the same result, just like !!{proof}s in the sequent calculus can -be much shorter with cuts than the shortest cut-free !!{proof}. The -sub-!!{formula} property, that you can always !!{prove} a result using -only sub-!!{formula}s of the result in your !!{proof}, follows from -normalization for natural deduction just as it follows from -cut-elimination for the sequent calculus. +be much shorter with cuts than the shortest cut-free !!{proof}. Normalization also yields a sub-!!{formula} property. For +intuitionistic natural deduction, a result can be !!{prove}d using +sub-!!{formula}s of its conclusion and open assumptions, allowing +substitution instances of quantified sub-!!{formula}s and the logical +constant~$\lfalse$. The classical version requires a corresponding +qualification for the negated assumptions used by classical reductio. \end{document} diff --git a/content/proof-theory/normalization/normalization-thm.tex b/content/proof-theory/normalization/normalization-thm.tex index 0096d7fa..880c44b1 100644 --- a/content/proof-theory/normalization/normalization-thm.tex +++ b/content/proof-theory/normalization/normalization-thm.tex @@ -29,7 +29,9 @@ If the cut length is~$0$, there are no cuts, $\delta$ is already normal. So assume that cut rank and cut length of~$\delta$ are~$> - 0$. Pick a topmost, rightmost maximal cut segment. If the cut + 0$. Pick a maximal cut segment whose first occurrence is earliest in + the postorder defined for permutation conversions, with all minor + premises visited before the major premise at each elimination. If the cut segment has length $>1$, apply a permutation conversion. If the cut segment has length~$1$, apply the corresponding reduction conversion. This results in a new !!{proof} which either has the @@ -37,8 +39,8 @@ inductive hypothesis applies. \end{proof} -The strategy used in the above proof (always deal with a -topmost rightmost maximal cut) suggests a specific order in which +The strategy used in the above proof (always deal with the maximal +cut whose first occurrence is earliest in the specified postorder) suggests a specific order in which conversions must be applied to !!a{proof} in order to result in a normal !!{proof}. Surprisingly enough, the order actually does not matter. Applying permutation and reduction conversions in any order diff --git a/content/proof-theory/normalization/permutations.tex b/content/proof-theory/normalization/permutations.tex index 08f90082..5b0e72c0 100644 --- a/content/proof-theory/normalization/permutations.tex +++ b/content/proof-theory/normalization/permutations.tex @@ -19,7 +19,7 @@ !!{elimination} inference it is the major premise of. For instance, if the inferences involved are \Elim{\lor} and -\Elim{\land}, $!A \ident !B \lor !C$ and there is a +\Elim{\land}, $!A \ident !B \land !C$ and there is a sub-!!{proof}~$\delta_1$ that ends in: \[ \AxiomC{} @@ -65,24 +65,25 @@ \] The cuts that ended in the premise of \Elim{\land} below \Elim{\lor} now end in the premise of one of the \Elim{\land} inferences above the -minor premises of \Elim{\lor}, i.e., the length of each has decreased -by~$1$. +minor premises of \Elim{\lor}, i.e., each corresponding segment has shortened by~$1$. +A segment that becomes a singleton assumption may cease to be a cut. Moreover, any cut that lies entirely within $\delta_2$, $\delta_3$, or $\delta_4$, or entirely outside~$\delta_1$ in~$\delta$ is unchanged: it still involves the same !!{formula}s, goes through the same inferences, so in particular has the same rank and length as the -corresponding cut in~$\delta$. So the cut rank of the new !!{proof} has -not increased, and the cut length of the new !!{proof} is less than that -of the old !!{proof}. +corresponding cut in~$\delta$. Thus the cut rank does not increase. If the converted cut is +maximal, either the cut rank decreases or it stays the same and the +cut length decreases. \begin{prob} -After a permutation conversion, the length of at least one cut is -reduced by~$1$. If we permute \Elim{\land} across an~\Elim{\lor}, -there are actually two cut segments the length of which decrease, so -in this case the cut length of the !!{proof} decreases by at -least~$2$. Can the cut length of !!a{proof} decrease by more than~$2$ -by a single such permutation? Can the cut \emph{rank} decrease? +After a permutation conversion, at least one segment shortens +by~$1$ and may cease to be a cut. Suppose we permute \Elim{\land} +across an~\Elim{\lor} on a maximal cut, and the cut rank stays the +same. At least two maximal segments shorten or disappear, so the cut +length decreases by at least~$2$. Can it decrease by more than~$2$ +in this situation? Can such a permutation instead decrease the +cut \emph{rank}? \end{prob} The process of moving !!a{elimination} rule above an \Elim{\lor} or @@ -317,7 +318,7 @@ \begin{prob} Give the permutation conversions for \Elim{\lexists} followed by \Elim{\exists}. Explain why no eigenvariable condition is violated in -the latter. +this case. \end{prob} We should convince ourselves that when applying a permutation @@ -342,7 +343,8 @@ \BinaryInfC{$!C$} \DisplayProof \] -If we replace this by +Before the move, rename discharged-assumption labels away from +all open labels that will be moved into their scopes. Replace this by \[ \AxiomC{} \RightLabel{$\delta_2$} @@ -350,23 +352,27 @@ \AxiomC{$\Discharge{!D}{x}$} \RightLabel{$\delta_3$} \DeduceC{$\lexists[x][!B(x)]$} -\AxiomC{$\Discharge{!B(c)}{z}$} -\RightLabel{$\delta_5$} +\AxiomC{$\Discharge{!B(c_1)}{z_1}$} +\RightLabel{$\delta_5^{(1)}$} \DeduceC{$!C$} -\DischargeRule{\Elim{\lexists}}{z} +\DischargeRule{\Elim{\lexists}}{z_1} \BinaryInfC{$!C$} \AxiomC{$\Discharge{!E}{y}$} \RightLabel{$\delta_4$} \DeduceC{$\lexists[x][!B(x)]$} -\AxiomC{$\Discharge{!B(c)}{z}$} -\RightLabel{$\delta_5$} +\AxiomC{$\Discharge{!B(c_2)}{z_2}$} +\RightLabel{$\delta_5^{(2)}$} \DeduceC{$!C$} -\DischargeRule{\Elim{\lexists}}{z} +\DischargeRule{\Elim{\lexists}}{z_2} \BinaryInfC{$!C$} \DischargeRule{\Elim{\lor}}{x\,y} \TrinaryInfC{$!C$} \DisplayProof \] +Here $\delta_5^{(1)}$ and $\delta_5^{(2)}$ are independently freshened +copies: replace $c$ by distinct fresh constants $c_1,c_2$, and rename +all internal discharged labels and eigenvariables consistently, +while preserving the labels of open assumptions. we might worry that the eigenvariable~$c$ might occur in, say,~$!D$. After all, the assumption $!D$ is discharged above the original~$\Elim{\lexists}$ and so in the original !!{proof} it does not @@ -380,15 +386,27 @@ in the !!{proof}. In particular, $c$~cannot occur in $\delta_3$ or~$\delta_4$. -This example shows something else: Note that the new !!{proof} has two -copies of~$\delta_5$. This means that if $\delta_5$ contains a maximal -cut, we have \emph{not} reduced the cut length! Thus we must take care -that we apply a permutation conversion only when we know that there is -no maximal cut in $\delta_5$. We will ensure this by always selecting -a \emph{topmost} maximal cut, that is a maximal cut such that the -sub-!!{proof} (in this case,~$\delta_1$) contains no maximal cut that -ends above the last inference in the sub-!!{proof}. This rules out the -possibility that there are other maximal cuts in~$\delta_5$ (or indeed -in $\delta_2$, $\delta_3$, or~$\delta_4$). +The new !!{proof} has two copies of~$\delta_5$. If a maximal cut +starts in that sub-!!{proof}, even if it ends below it, duplication +can prevent the cut length from decreasing. We therefore select cuts +by their first occurrences, not only by their endpoints. + +Order formula occurrences by the following postorder traversal of the +proof tree: visit every immediate sub-!!{proof} before its conclusion; +at an !!{elimination} inference visit all minor-premise sub-!!{proof}s +before the major-premise sub-!!{proof}; use a fixed order for other +premises. Among maximal cuts choose one whose first occurrence comes +earliest in this order. + +Every side sub-!!{proof} copied in the permutation is visited before +the selected first occurrence. It therefore contains no first +occurrence of a maximal cut, including a cut that continues outside +that sub-!!{proof}. The selected segments shorten or disappear. A new +segment along the conclusion of the moved elimination either has +smaller rank (a component or matrix instance of the eliminated +formula), or, for \Elim{\lor} and \Elim{\lexists}, starts in a copied +minor sub-!!{proof} and so cannot have maximal rank. Thus cut rank +decreases, or remains unchanged while cut length decreases. The same +selection order will be used for reduction conversions. \end{document} diff --git a/content/proof-theory/normalization/reductions.tex b/content/proof-theory/normalization/reductions.tex index 06f1c0e4..a9c1eb89 100644 --- a/content/proof-theory/normalization/reductions.tex +++ b/content/proof-theory/normalization/reductions.tex @@ -12,8 +12,9 @@ If a cut in !!a{proof} in \Log{N1i} has length~$1$, it is a segment consisting of a single !!{formula} occurrence, and that !!{formula} is -both the conclusion of !!a{introduction} inference and the major -premise of !!a{elimination} inference. In the normalization proof, +both the conclusion of an !!{introduction} inference or of~\FalseInt, +and the major premise of an !!{elimination} inference. We first +consider the introduction case. In the normalization proof, such cuts are ``reduced'' by replacing the sub-!!{proof} ending in such an !!{introduction}/!!{elimination} pair by a new !!{proof} in which the pair of inferences has been eliminated. Such a replacement @@ -50,26 +51,30 @@ \DisplayProof \] By $\Subst{\delta_2}{\delta_3}{!B^x}$ we mean the !!{proof} that -results from~$\delta_2$ by replacing every assumption~$!B$ that's -labelled~$x$ with the entire !!{proof}~$\delta_3$. This !!{proof} no -longer has open assumptions of the form~$!B$ with label~$x$. It has no -other assumptions labelled~$x$, since we assume, as usual, that no two -!!{formula}s occur as assumptions with the same label. Hence, the new -!!{proof} has the same open assumptions as~$\delta_1$, every inference -in~$\delta_2$ that discharges assumptions discharges the same -assumptions in~$\Subst{\delta_2}{\delta_3}{!B^x}$, and every inference -in~$\delta_3$ that discharges assumptions results in possibly multiple -copies, which discharge the corresponding assumptions -in~$\Subst{\delta_2}{\delta_3}{!B^x}$. +results from~$\delta_2$ by replacing each open assumption~$!B^x$ +that the displayed introduction discharges with the entire +!!{proof}~$\delta_3$. First rename discharged-assumption labels in +the receiving proof to avoid capturing open labels of~$\delta_3$, +and rename its eigenvariables away from those open assumptions. +Freshen internal bound labels and eigenvariables independently in +inserted copies while preserving their open-assumption labels. -Any cut that lies entirely within $\delta_2$, $\delta_3$, or -$\delta_4$, or entirely outside~$\delta_1$ in~$\delta$ is unchanged: -it still involves the same !!{formula}s, goes through the same -inferences, so in particular has the same rank and length as the -corresponding cut in~$\delta$. We have removed a maximal cut of -length~$1$ and so either have reduced the cut length, or reduced the -cut rank (if the cut length of~$\delta$ was~$1$ and this was the only -maximal cut). +The new !!{proof} has the same conclusion as~$\delta_1$ and only +open assumptions already present in~$\delta_1$. Its open-assumption +set can be smaller: if the displayed introduction discharges no +assumption, no copy of~$\delta_3$ is inserted. With the stated +freshening, surviving discharge inferences close exactly their +intended assumptions. In particular, assumptions supplied by the +inserted proof are not accidentally discharged merely because a +label was reused. + +A surviving copy of a cut lying wholly inside $\delta_2$ or +$\delta_3$ and disjoint from the grafting boundaries has the same +rank and length as the original. Cuts wholly outside~$\delta_1$ are +unchanged. However, copies may be duplicated or discarded, and +segments meeting grafting boundaries may change. Removing the +selected maximal cut therefore gives the required decrease only +after the following duplication and boundary checks. However, two things may happen: \begin{enumerate} @@ -77,24 +82,28 @@ multiplied all the cuts in~$\delta_3$. If some of those were maximal cuts, the cut length of the new !!{proof} may be greater than the cut length of the old !!{proof}. We have to guarantee that this does not - happen. We do so by applying reduction conversions only to - \emph{rightmost} maximal cuts, that is, to cuts which are such that - no maximal cut lies on a branch through~$\delta$ to the right of the - cut being reduced. If there were a cut in~$\delta_3$ it would be to - the right of the cut being reduced here, and so we wouldn't be - working on a rightmost cut. By always selecting rightmost cuts, we - guarantee that either we decrease the cut length of the !!{proof}, - or even reduce the cut rank. + happen. Use the same selection order as for permutations: among + maximal cuts, choose the one whose first occurrence is earliest + in postorder, visiting minor-premise sub-!!{proof}s before the + major-premise sub-!!{proof} at every elimination. + In this implication example, all of~$\delta_3$ is visited before + the selected introduction conclusion. More generally, every + sub-!!{proof} copied by a reduction is either above that introduction + conclusion or in a minor premise visited first. Thus no maximal cut + starts in any copied sub-!!{proof}, even if it would end outside it. + This excludes duplication of maximal cuts uniformly for all rule + shapes; the new boundary cuts considered next have lower rank. \item If an assumption $!B^x$ in $\delta_2$ is the major premise of !!a{elimination} inference, and the last inference of~$\delta_3$ is - \Elim{\lor}, \Elim{\lexists}, or !!a{introduction} inference, we + \Elim{\lor}, \Elim{\lexists}, an !!{introduction} inference, or + \FalseInt, we have generated a new cut by grafting~$\delta_3$ onto $\delta_2$ at such an assumption. What was just an assumption in~$\delta_2$ is now - a cut of length~$1$ (the conclusion of !!a{introduction} inference - and major premise of !!a{elimination} inference) or the last + a cut of length~$1$ (the conclusion of an !!{introduction} inference + or of~\FalseInt, and major premise of !!a{elimination} inference) or the last !!{formula} occurrence of a cut segment (major premise of !!a{elimination} inference and conclusion of~\Elim{\lor} or - \Elim{\lexists}). If $B^x$ was a minor premise of \Elim{\lor} or + \Elim{\lexists}). If $!B^x$ was a minor premise of \Elim{\lor} or \Elim{\lexists}, it already was the first !!{formula} occurrence of a segment, and possibly of a cut segment. In the new !!{proof} that segment may now be longer. However, observe that the !!{formula} @@ -110,7 +119,10 @@ conversion} (or \emph{detour conversion}). The patterns for some of the rule pairs is given in \olref{tab:reduction-conversions}. (The remaining are left as -exercises.) +exercises.) Before a displayed quantifier substitution, rename all +internal eigenvariables away from the closed witness term~$t$. +Apply the capture-avoiding grafting conventions above to the resulting +proofs and to every inserted copy. \begin{table} \begin{multline*} @@ -301,10 +313,10 @@ \AxiomC{$\Discharge{!B}{x}$} \RightLabel{$\delta_3$} \DeduceC{$!D$} -\AxiomC{$\Discharge{!C}{x}$} +\AxiomC{$\Discharge{!C}{y}$} \RightLabel{$\delta_4$} \DeduceC{$!D$} -\RightLabel{\Elim{\lor}} +\DischargeRule{\Elim{\lor}}{x\,y} \TrinaryInfC{$!D$} \DisplayProof \quad\text{by}\quad diff --git a/content/proof-theory/normalization/segments.tex b/content/proof-theory/normalization/segments.tex index 7cfb717c..75652047 100644 --- a/content/proof-theory/normalization/segments.tex +++ b/content/proof-theory/normalization/segments.tex @@ -1,6 +1,6 @@ % Part: proof-theory % Chapter: normalization -% Section: introduction +% Section: segments \documentclass[../../../include/open-logic-section]{subfiles} @@ -63,8 +63,8 @@ account for all these possibilities, we define detours using certain kinds of sequences of !!{formula} occurrences in an \Log{N1i}-proof called \emph{segments}. In our example, it's a sequence of occurrences -of~$!A \lif !B$, where a minor premise of $\Elim{\lor}$ or -$\Elim{\lexists}$ follows its conclusion. In the example, there are +of~$!A \lif !B$, where the conclusion of $\Elim{\lor}$ or +$\Elim{\lexists}$ follows its minor premise. In the example, there are two such segments, each containing three occurrences of~$!A \lif !B$. Here is the official definition. @@ -75,14 +75,14 @@ \item $!A_1$ is not the conclusion of \Elim{\lor} or \Elim{\lexists}; \item $!A_n$ is not a minor premise of \Elim{\lor} or \Elim{\lexists}; \item For $i = 1$, \dots,~$n-1$, $!A_i$ is a minor premise of - \Elim{\lor} or \Elim{\lexists} and $A_{i+1}$ is the conclusion of + \Elim{\lor} or \Elim{\lexists} and $!A_{i+1}$ is the conclusion of that inference. \end{enumerate} The \emph{length} of that segment is~$n$. \end{defn} -Not every segment is a target for elimination (a detour). The ones that -are called \emph{cuts}. +Not every segment is a target for elimination (a detour). Those that +are targets for elimination are called \emph{cuts}. \begin{defn} A \emph{cut} is a segment in which $!A_n$ is the major premise of @@ -93,8 +93,8 @@ Note that a cut segment need not begin with the conclusion of !!a{introduction} rule. All that's required is that it ends with the major premise of !!a{elimination} rule. However, a segment of -length~$1$ does have to be the conclusions of !!{introduction} rules -to count as a cut. +length~$1$ does have to be the conclusion of an !!{introduction} +rule or of~\FalseInt{} to count as a cut. \begin{defn} The \emph{rank} of a cut is~$\depth{!A}$. The \emph{cut @@ -102,6 +102,7 @@ cuts in~$\delta$. A cut is \emph{maximal} in~$\delta$ if its rank is~$\cutrank{\delta}$, i.e., it has maximal rank. The \emph{cut length} of~$\delta$ is the sum of the lengths of all its maximal cuts. +If there are no cuts, both cut rank and cut length are defined to be~$0$. \end{defn} \end{document} diff --git a/content/proof-theory/normalization/translations.tex b/content/proof-theory/normalization/translations.tex index f713459e..abccca66 100644 --- a/content/proof-theory/normalization/translations.tex +++ b/content/proof-theory/normalization/translations.tex @@ -12,10 +12,10 @@ !!^{proof}s in \Log{N2i} can be translated to !!{proof}s in \Log{G2i} and vice versa. First of all, the result of translating cut-free -\Log{2i} !!{proof}s results in normal \Log{N2i}-!!{proof}s. +\Log{G2i} !!{proof}s results in normal \Log{N2i}-!!{proof}s. To state the result we need a bit of terminology to let us relate -antecendents of sequents in~\Log{N2i} and in~\Log{G2i} more easily: a +antecedents of sequents in~\Log{N2i} and in~\Log{G2i} more easily: a set~$\Gamma'$ of labelled !!{formula}s \emph{corresponds to} the multiset~$\Gamma$ of unlabelled !!{formula}s if, for every !!{formula}~$!A$, the number of !!{element}s of~$\Gamma'$ of the form @@ -25,8 +25,9 @@ \begin{cor} If $\Log{G2i} \Proves \Gamma \Sequent \Delta$ then there is a normal \Log{N2c}-!!{proof}~$\delta$ of $\Gamma' \Sequent !C$, where the -set~$\Gamma'$ of labelled !!{formula}s corresponds to the -multiset~$\Gamma$, i.e., for every !!{formula}~$!A$, the number of +formula $!C$ is $\lfalse$ when $\Delta$ is empty and is the sole +formula in~$\Delta$ otherwise, and the set~$\Gamma'$ of labelled +!!{formula}s corresponds to the multiset~$\Gamma$, i.e., for every !!{formula}~$!A$, the number of !!{element}s of~$\Gamma'$ of the form $x : !A$ is less than or equal to the multiplicity of~$!A$ (i.e., the number of copies of~$!A$) in~$\Gamma$. @@ -34,14 +35,18 @@ \begin{proof} By inspection of the proof of \olref[nat][tgi]{prop:G2i-to-N2i}: we -add !!{introduction} rules to the end of !!{proof}s, and -!!{elimination} rules only at the top of !!{proof}s, so never -introduce an !!{introduction} rule above !!a{elimination} rule. +add !!{introduction} rules at the ends of the translated proofs. +The elimination rules introduced by left-rule translations have a +fresh assumption as major premise, and any translated proofs combined +with them occur in minor-premise positions. Consequently no +introduction or \FalseInt conclusion is placed on an elimination +major-premise chain, and no case-elimination segment is made into a +cut. The resulting proof is normal. \end{proof} The translation of the \Cut{} rule given in \olref[nat][tgi]{prop:G2i-to-N2i}, however, can introduce cuts in the -\Log{N2i}-!!{proof}~$\delta$. If a \Log{G2i} !!{proof} ends in~\Cut{} +\Log{N2i}-!!{proof}~$\delta$. If a $\Log{G2i}+\Cut$ !!{proof} ends in~\Cut{} with immediate sub-!!{proof}s $\pi_1$ and $\pi_2$ of $\Gamma_1 \Sequent !A$ and $!A, \Gamma_2 \Sequent \Delta_2$, respectively, we graft the translation $\delta_1$ of~$\pi_1$ onto the axioms $x:!A @@ -55,13 +60,14 @@ in~\Log{G2i}. In the proof of \olref[nat][tni]{prop:N2-to-G2}, the translation of \Elim{\land}, \Elim{\lif}, \Elim{\lnot}, \Elim{\lforall} results in~\Cut{} inferences in the resulting -\Log{G2i} !!{proof}. If the \Log{N2i}-!!{proof} we start from, this +$\Log{G2i}+\Cut$ !!{proof}. If the \Log{N2i}-!!{proof} we start from is normal, this can, however, be avoided. -Let's call a list $S_1$, \dots,~$S_n$ of occurrences of sequents in a -\Log{N2i}-!!{proof}~$\delta$ a \emph{branch} if $S_1$ is an axiom, and -whenever $S_i$ is a major premise of an inference, $S_{i+1}$ is its -conclusion. In other words, a branch traces sequents downwards +Let's call a maximal list $S_1$, \dots,~$S_n$ of sequent occurrences +in a \Log{N2i}-!!{proof} $\delta$ a \emph{branch} if $S_1$ is an +axiom and, for every $i - \cutrank{P}$ for any proper sub-term $P$ which is also a redex - of course. Such a redex must exist, since any term only has - finitely many subterms. - - Let $N'$ denote the reductum of $N$. Now by the lemma - $\maxrank{N'} < \maxrank{N}$, thus we can see that $n$, the - number of redexes with $\cutrank=m$ is decreased. So $m$ is - decreased (by $1$ or more), and we can apply the inductive - hypothesis for~$m$. - \item For the induction step, assume $n>1$. the process is - similar, except that $n$ is only decreased to a positive number - and thus $m$ does not change. We simply apply the induction - hypothesis for~$n$. - \end{enumerate} -\end{enumerate} +Reconstruct the term's natural deduction using its free-variable +context. Apply the earlier normalization theorem for $\Log{N2i}$, +and assign terms to the resulting deductions. By the definition of +the full term conversions, each proof conversion is represented by +the corresponding term conversion. The final deduction and its term +are fully normal. Conversions may discard unused assumptions; +weakening restores any larger ambient typing context. This uses the +previous proof normalization theorem, not the local rank lemma. \end{proof} -The fact that typed $\lambd$-terms normalize means that every such -term \emph{has a normal form}. If we think of $\beta$-reducing -$\lambd$-terms to their normal form as executing a computation and the -normal form as the value of the computation, this means that every -computation in the typed $\lambd$-calculus eventually halts an +A typed $\lambd$-term beta-normalizes if it \emph{has a beta-normal form}. If we think of $\beta$-reducing +$\lambd$-terms to a beta-normal form as executing a computation and the +normal form as the value of the computation, weak beta normalization means that every +computation in the typed $\lambd$-calculus has an execution that halts and produces a value. Moreover, type preservation ensures that the value has the right type. E.g., if $N$ has type $!A \lif !B$ (i.e., it is a function that is supposed to work for arguments of type~$!A$ and @@ -171,36 +158,31 @@ In fact, terms in the typed $\lambd$-calculus don't just reduce to normal forms for one way of applying $\beta$-reductions to subterms, -but \emph{any} way of applying $\beta$-reductions to subtems +but \emph{any} way of applying $\beta$-reductions to subterms eventually terminates in a normal form. This property is called \emph{strong normalization}. It means that not only is there a way to guarantee that a computation eventually halts and produces a value, but \emph{any} way to execute the computation eventually produces a value. -How do we know that different ways of executing a computation produce -the \emph{same} value? So far we just know (from type preservation) -that all values it produces are of the same type. The typed -$\lambd$-calculus has another important property: it is -\emph{confluent} or \emph{Church-Rosser}. If $N \red N_1$ and $N \red -N_2$ then there is some term~$N'$ such that $N_1 \red N'$ and $N_2 \red -N'$. Recall that $N \red N'$ means: $N'$ results from zero or more -$\redone$-reduction steps. If $N_1$ is in normal form then the only -term $N'$ such that $N_1 \red N'$ is $N_1$ itself (via zero -$\redone$-reduction steps). It follows that if $N_1$ and $N_2$ are -both in normal form, then $N_1 = N' = N_2$. In other words, since -$\red$ is strongly normalizing, every way of reducing a term -eventually results in a normal form. Since $\red$ is Church-Rosser, -any two normal forms are equal. Hence, computation in the typed -$\lambd$-calculus always terminates and the value (normal form) is the -same regardless of how the computation proceeds. +Different beta computations of the same well-typed term produce +the same normal form, up to renaming bound variables. The one-step +relation $\redone[\beta]$ is strongly normalizing, and its reflexive +transitive closure $\red[\beta]$ is confluent: if +$N\red[\beta]N_1$ and $N\red[\beta]N_2$, there is an $N'$ with +$N_1\red[\beta]N'$ and $N_2\red[\beta]N'$. If both descendants +are beta-normal, these last reductions take zero steps, so the two +normal forms are equal up to bound-variable renaming. Termination +concerns one-step reduction, not its reflexive closure. We prove +confluence below for beta reduction only; no confluence assertion for +the larger full proof-conversion relation is needed. Proving that a relation is confluent is typically difficult. However, we can easily establish the following weaker condition: -\begin{prop}[Weak Church-Rosser Property] -If $N \redone N_1$ and $N \redone N_2$ then there is a term $N'$ such -that $N_1 \red N'$ and $N_2 \red N'$. +\begin{prop}[Weak Church-Rosser Property for beta reduction] +If $N \redone[\beta] N_1$ and $N \redone[\beta] N_2$ then there is a term $N'$ such +that $N_1 \red[\beta] N'$ and $N_2 \red[\beta] N'$. \end{prop} \begin{proof} @@ -219,36 +201,29 @@ subterm of $O_1$, then converting $M_2$ results in $O_1'$. So converting $M_1$ first and then $M_2$ results in $O_1'$. But converting $M_2$ first results in $\proj{1}{\pair{O_1'}{O_2}}$ and - this reduces also to~$O_2$. + this reduces also to~$O_1'$. \end{proof} \begin{lem}[Newman's Lemma] -If $\red$ is strongly normalizing and has the weak Church-Rosser -property, it is confluent. +If a one-step relation $\redone[\beta]$ is strongly normalizing +and has the weak Church-Rosser property, its reflexive transitive +closure $\red[\beta]$ is confluent. \end{lem} \begin{proof} - Since $\red$ is strongly normalizing, any reduction sequence results - in a normal form. Normal forms are unique iff $\red$ is confluent. - So suppose some term $N$ has two distinct normal forms $N'$ and - $N''$, the result of reduction sequences - \begin{align*} - N & = N_1' \redone N_2' \redone \dots \redone N_k' = N' \text{ and}\\ - N & = N_1'' \redone N_2'' \redone \dots \redone N_l'' = N'' - \end{align*} - (The reduction sequence must have length $>0$ since otherwise $N$ - would already be in normal form.) - - If $N_1' = N_1''$ then it has two distinct normal forms ($N'$ and - $N''$). If $N_1' \neq N_1''$ then by weak Church-Rosser there is - some $N'''$ such that $N_1' \red N'''$ and $N_1'' \red N'''$. Since - $N' \neq N''$, either $N''' \neq N'$ or $N''' \neq N''$. - Consequently, either $N_1'$ or $N_1''$ has two distinct normal - forms. We've shown that if $N$ has two distinct normal forms, there - is an $N_1$ such that $N \redone N_1$ and $N_1$ has two distinct - normal forms. Obviously we can keep going and produce $N \redone N_1 - \redone N_2 \redone \dots$, but this is impossible because $\redone$ - is strongly normalizing. +Strong normalization guarantees that every term has a normal form. +We prove uniqueness of normal forms by well-founded induction on the +one-step descendants of~$N$. Suppose $N$ reduces to normal forms +$U$ and $V$. If $N$ is already normal, both equal $N$. Otherwise +the two reductions begin with actual steps +$N\redone[\beta]N_1$ and $N\redone[\beta]N_2$. +Weak Church-Rosser gives a common descendant $Q$ of $N_1$ and $N_2$. +By strong normalization reduce $Q$ to a normal form $W$. +The induction hypothesis at the proper descendants $N_1$ and $N_2$ +gives $U=W$ and $V=W$, respectively. This proves uniqueness. +Finally any two descendants of $N$ can themselves be reduced to +normal forms. Their normal forms are also normal forms of $N$, so +they agree and give the required common descendant. \end{proof} diff --git a/content/proof-theory/propositions-as-types/proof-terms.tex b/content/proof-theory/propositions-as-types/proof-terms.tex index ce6f1314..e77228bf 100644 --- a/content/proof-theory/propositions-as-types/proof-terms.tex +++ b/content/proof-theory/propositions-as-types/proof-terms.tex @@ -1,4 +1,4 @@ -% part: intuitionistic-logic +% part: proof-theory % chapter: propositions-as-types % section: proof-terms @@ -10,9 +10,16 @@ \olsection{Proof Terms} +In this chapter the proof-term correspondence is restricted to the +propositional fragment with $\lif$, $\land$, $\lor$, and $\lfalse$; +negation is treated as the abbreviation $\lnot !A\equiv(!A\lif\lfalse)$. +The term-labelled propositional systems in the tables are +\Log{tN2ip} and \Log{tN3ip}; we abbreviate these names as +\Log{tN2i} and \Log{tN3i} in the prose. + We label assumptions in \Log{N1i} with variables (e.g., $!A^x$) as discharge labels. In \Log{N2i}, every sequent $\Gamma \Sequent !A$ -has a list of variable--!!{formula} pairs in the context~$\Gamma$ on +has a compatible set of variable--!!{formula} pairs in the context~$\Gamma$ on the left. Thus, in \Log{N2i}, every sequent in !!a{proof} carries not only the information what the !!{proof} so far has !!{prove}d (i.e., $!A$), but also which assumptions are open at each point (i.e., @@ -38,7 +45,7 @@ \Axiom$\Gamma_1 \fCenter N: !A$ \Axiom$\Gamma_2 \fCenter M: !B$ \RightLabel{\Intro{\land}} -\BinaryInf$\Gamma_1, \Gamma_2 \fCenter c^\land(N, m) : !A \land !B $ +\BinaryInf$\Gamma_1, \Gamma_2 \fCenter c^\land(N, M) : !A \land !B $ \DisplayProof \quad \Axiom$\Gamma \fCenter N: !A \land !B$ @@ -75,7 +82,7 @@ \[ \Axiom$\Gamma \fCenter N:!A$ \RightLabel{\Intro{\lor}[1]} -\UnaryInf$\Gamma \fCenter c^{\lor{!B}}_1:!A \lor !B$ +\UnaryInf$\Gamma \fCenter c^{\lor{!B}}_1(N):!A \lor !B$ \DisplayProof \quad \Axiom$\Gamma \fCenter N:\lfalse$ @@ -110,7 +117,7 @@ \item If $N$ is a proof term, then $\proj{i}{N}$ is also a proof term, where $i$ is $1$ or~$2$~(\Elim\land[i]). \item If $N$ is a proof term, and $!A$ is a formula, then - $\inj[!A]{i}{!M}$ is a proof term, where $i$ is $1$ or~$2$~(\Intro\lor[i]). + $\inj[!A]{i}{N}$ is a proof term, where $i$ is $1$ or~$2$~(\Intro\lor[i]). \item If $M$, $N_1$, $N_2$ are proof terms, and $x_1$, $x_2$ are variables, then $\dcase{M}{x_1}{N_1}{x_2}{N_2}$ is a proof term~(\Elim\lor). diff --git a/content/proof-theory/propositions-as-types/proofs-to-terms.tex b/content/proof-theory/propositions-as-types/proofs-to-terms.tex index ff5d4775..32ff51ab 100644 --- a/content/proof-theory/propositions-as-types/proofs-to-terms.tex +++ b/content/proof-theory/propositions-as-types/proofs-to-terms.tex @@ -20,9 +20,12 @@ the rules of \Log{tN2i}. \begin{prop} -Every !!{proof}~$\delta$ of $\Gamma \Sequent !A$ in \Log{N2i} +Every !!{proof}~$\delta$ of $\Gamma \Sequent !A$ in the stated +propositional fragment of \Log{N2i} corresponds to !!a{proof}~$\delta'$ of $\Gamma \Sequent N : !A$ in -\Log{tN2i}. The proof term $N$ is uniquely determined by~$\delta$. +\Log{tN2i}. The proof term $N$ is determined by~$\delta$ up to consistent +renaming of bound variables; fixing all discharge labels, including +vacuous ones, fixes a representative. \end{prop} \begin{proof} diff --git a/content/proof-theory/propositions-as-types/propositions-as-types.tex b/content/proof-theory/propositions-as-types/propositions-as-types.tex index 9948d01b..7c8a967d 100644 --- a/content/proof-theory/propositions-as-types/propositions-as-types.tex +++ b/content/proof-theory/propositions-as-types/propositions-as-types.tex @@ -11,8 +11,7 @@ This is a \emph{very experimental} draft of a chapter on the Curry--Howard correspondence. It needs more explanation and motivation, and there are probably errors and omissions. The proof - of normalization should be reviewed and expanded. There are no - examples for the product type. Permutation and simplification + of normalization should be reviewed and expanded. More examples for the product type would be useful. Permutation conversions have only one example, and simplification conversions are not covered. It will make a lot more sense once there is also material on the (typed) lambda calculus which is basically presupposed here. Use with extreme caution. diff --git a/content/proof-theory/propositions-as-types/reduction.tex b/content/proof-theory/propositions-as-types/reduction.tex index 27836b02..b4aa59c1 100644 --- a/content/proof-theory/propositions-as-types/reduction.tex +++ b/content/proof-theory/propositions-as-types/reduction.tex @@ -10,8 +10,8 @@ \olsection{Reduction} -In natural deduction !!{derivation}s, !!a{introduction} rule that is -followed by !!a{elimination} rule is a detour that can be ``reduced''. +In natural deduction !!{derivation}s, an !!{introduction} rule whose conclusion is immediately used as +the major premise of the corresponding !!{elimination} rule is a detour that can be ``reduced''. For instance, an $\Intro{\land}$ followed by $\Elim{\land}$ ``cancel out,'' since the conclusion of $\Elim{\land}$ is always one of the conjuncts of the conjunction that \Intro{\land} produces, and the @@ -47,20 +47,31 @@ the proof term for the proof on the left reduces (in one step) to the proof term for the proof on the right: \[ - \proj{i}{\pair{N_1, N_2}} \redone N_i + \proj{i}{\pair{N_1}{N_2}} \redone[\beta] N_i \] In the typed lambda calculus, this is the \emph{beta reduction} rule for the product type. In natural deduction, a pair of inferences such as a \Intro{\land} -folloed by \Elim{\land}, i.e., a pair that is subject to reduction, is +followed by \Elim{\land}, i.e., a pair that is subject to reduction, is called a \emph{cut}. In the typed lambda calculus the term on the left of $\redone$ is called a \emph{redex}, and the term to the right is called the \emph{reductum}. Unlike untyped lambda calculus, where only $(\lambd[x][N])Q$ is considered to be redex, in the typed lambda calculus the syntax is extended to terms involving $\pair{N}{M}$, -$\proj{i}{N}$, $\inj{i}{!A}{N}$, $\dcase{N}{x_1}{M_1}{x_2}{M_2}$, and -$\abort{!A}{N}$, with corresponding redexes. +$\proj{i}{N}$, $\inj[!A]{i}{N}$, $\dcase{N}{x_1}{M_1}{x_2}{M_2}$, and +$\abort{!A}{N}$. +We write $\redone[\beta]$ for the compatible closure of the three +principal beta contractions: application of an abstraction, projection +of a pair, and case analysis of an injection. The abort constructor +has no root beta contraction. + +The undecorated relation $\redone$ will denote the larger relation +transported from the propositional \Log{N2i} proof conversions, +including their permutation and falsity conversions. Thus every beta +step is a step of~$\redone$, but the converse need not hold. All +substitutions and conversions avoid capture, with bound variables +renamed as needed. Similarly we have reduction for disjunction: \begin{gather*} @@ -91,10 +102,10 @@ \end{gather*} This corresponds to a reduction on proof terms: \begin{gather*} - \dcase{\inj[!A_i]{i}{M}}{x_1}{N_1}{x_2}{N_2} \redone \Subst{N_i}{M}{x_i} + \dcase{\inj[!A_{3-i}]{i}{M}}{x_1}{N_1}{x_2}{N_2} \redone[\beta] \Subst{N_i}{M}{x_i} \end{gather*} where $M$ is the proof term of~$\delta$, and $N_i$ is the proof term -of~$\delta_i$. This is the beta reduction rule of for sum types. +of~$\delta_i$. This is the beta reduction rule for sum types. Here, $\Subst{M}{N_i}{x}$ means replacing all free occurrences of the variable~$x$ in $M$ by~$N_i$. @@ -126,7 +137,7 @@ For proof terms, this amounts to ordinary beta reduction: \begin{gather*} (\lambd[\typeof{x}{!A}][N]M) - \redone \Subst{N}{M}{x} + \redone[\beta] \Subst{N}{M}{x} \end{gather*} In addition to reduction conversions on !!{proof}s, we can consider @@ -172,7 +183,8 @@ \TrinaryInfC{$!C_i$} \DisplayProof \end{multline*} -If the proof terms of $\delta$, $\delta_1$, and $\delta_2$ are $M$, +If the proof terms of the entire disjunction-introduction proof, +$\delta_1$, and $\delta_2$ are $M$, $N_1$, and $N_2$, respectively, the corresponding reduction rule for proof terms, i.e., $\lambd$ terms, is: \[ @@ -182,16 +194,18 @@ Of course we can eliminate detours not just at the ends of !!{proof}s, but also within !!{proof}s, by applying the reduction conversion to a -sub-!!{proof} ending in a detour. Similarly, $\beta$-reduction applies -to subterms of $\lambd$-terms. If $N$ is a subterm of $M$, $N \redone +sub-!!{proof} ending in a detour. Each declared term-conversion relation is closed under +replacement of subterms. If $N$ is a subterm of $M$, $N \redone N'$, we can replace the subterm $N$ in~$M$ by $N'$ to obtain $M'$. In that case we also write $M \redone M'$. If there is a sequence $M = M_1 -\redone M_2 \redone M_2 \redone \dots \redone M_k = M'$ (including +\redone M_2 \redone M_3 \redone \dots \redone M_k = M'$ (including where $k=1$, i.e., $M = M'$) we write $M \red M'$. -A !!{proof} where no conversion can be applied to any sub-!!{proof} -is called \emph{normal}. Similarly, a $\lambd$-term where no -conversion can be applied (to any sub-term) is called \emph{normal}. A -normal $\lambd$-term is also called a \emph{normal form}. +Write $\red[\beta]$ for zero or more beta steps. A term is +\emph{beta-normal} if no $\redone[\beta]$ step applies. A proof, or +its corresponding term, is \emph{fully normal} if none of the full +proof conversions applies; for terms this means no $\redone$ step. +These notions differ in the presence of permutations or falsity +conversions. \end{document} diff --git a/content/proof-theory/propositions-as-types/rules-tN2.tex b/content/proof-theory/propositions-as-types/rules-tN2.tex index da36716f..7add0d27 100644 --- a/content/proof-theory/propositions-as-types/rules-tN2.tex +++ b/content/proof-theory/propositions-as-types/rules-tN2.tex @@ -1,6 +1,6 @@ % Part: proof-theory -% Chapter: natural-deduction -% Section: rules-N2 +% Chapter: propositions-as-types +% Section: rules-tN2 \documentclass[../../../include/open-logic-section]{subfiles} diff --git a/content/proof-theory/propositions-as-types/rules-tN3.tex b/content/proof-theory/propositions-as-types/rules-tN3.tex index e7b48d15..4079f32b 100644 --- a/content/proof-theory/propositions-as-types/rules-tN3.tex +++ b/content/proof-theory/propositions-as-types/rules-tN3.tex @@ -1,6 +1,6 @@ % Part: proof-theory -% Chapter: natural-deduction -% Section: rules-N2 +% Chapter: propositions-as-types +% Section: rules-tN3 \documentclass[../../../include/open-logic-section]{subfiles} diff --git a/content/proof-theory/propositions-as-types/sequent-natural-deduction.tex b/content/proof-theory/propositions-as-types/sequent-natural-deduction.tex index 54f1aa36..4d4abb00 100644 --- a/content/proof-theory/propositions-as-types/sequent-natural-deduction.tex +++ b/content/proof-theory/propositions-as-types/sequent-natural-deduction.tex @@ -17,9 +17,9 @@ We write $\Gamma, !A_1, \dots, !A_n$ for $\Gamma \cup \{!A_1, \dots, !A_n\}$, and $\Gamma, \Delta$ for $\Gamma \cup \Delta$. -Observe that when we have $\Gamma \Sequent !A \land !A$, meaning we +Observe that when we have $\Gamma \Sequent !A \land !B$, meaning we have !!a{derivation} with $\Gamma$ as !!{undischarged} assumptions and -$!A \land !A$ as end-!!{formula}, then by applying $\Elim{\land}$ at +$!A \land !B$ as end-!!{formula}, then by applying $\Elim{\land}$ at the bottom, we can get !!a{derivation} with the same !!{undischarged} assumptions and $!A$ as conclusion. In other words, if $\Gamma \Sequent !A \land !B$, then $\Gamma \Sequent !A$. @@ -113,14 +113,14 @@ assumptions from which it was !!{derive}d. \begin{prooftree} + \Axiom$!B \fCenter !B$ + \Axiom$!B \fCenter !B$ \Axiom$!A \fCenter !A$ - \UnaryInf $!A \fCenter !A \lor (!A \lif \lfalse)$ - \Axiom $!B \fCenter !B$ - \BinaryInf$!A, !B\lif \fCenter \lfalse$ - \UnaryInf$(!B \fCenter !A \lif \lfalse$ - \UnaryInf$( !B \fCenter !A \lor (!A \lif \lfalse)$ - \Axiom$(!B \fCenter !B$ - \BinaryInf$(!B \fCenter \lfalse$ + \UnaryInf$!A \fCenter !A \lor (!A \lif \lfalse)$ + \BinaryInf$!A, !B \fCenter \lfalse$ + \UnaryInf$!B \fCenter !A \lif \lfalse$ + \UnaryInf$!B \fCenter !A \lor (!A \lif \lfalse)$ + \BinaryInf$!B \fCenter \lfalse$ \UnaryInf$\fCenter !B \lif \lfalse$ \end{prooftree} where $!B$ is short for $(!A \lor (!A \lif \lfalse))\lif \lfalse$. diff --git a/content/proof-theory/propositions-as-types/type-preservation.tex b/content/proof-theory/propositions-as-types/type-preservation.tex index 2e0eca06..c6ac5c28 100644 --- a/content/proof-theory/propositions-as-types/type-preservation.tex +++ b/content/proof-theory/propositions-as-types/type-preservation.tex @@ -14,11 +14,10 @@ defined directly for the systems \Log{tN2i} and \Log{tN3i}. The system \Log{tN3i} defines the type of a $\lambd$-term~$N$ relative to the context~$\Gamma$ as the !!{formula}~$!A$ such that $\Gamma \Sequent N -: !A$ has !!a{proof} in \Log{tN3i}. The fact that the -$\beta$-reduction rules for $\lambd$-terms exactly mirror the -reduction and permutation conversions of !!{proof}s has an important -consequence: the type of a $\lambd$-term relative to a -context~$\Gamma$ remains the same after $\beta$-conversion. This +: !A$ has !!a{proof} in \Log{tN3i}. The declared term-conversion relation mirrors the corresponding +proof conversions. Consequently the type of a term relative to +$\Gamma$ is preserved by those conversions, and in particular by its +beta-reduction subrelation. This property is called \emph{type preservation}. \begin{prop} @@ -87,10 +86,12 @@ \end{multline*} Again the proof term of the !!{proof} on the right is exactly the result of $\beta$-reducing the proof term of the !!{proof} on the - left. Of course one would have to carefuly verify (by induction on - the height of~$\delta_2$) that if we replace all axioms of the form - $\Gamma' \Sequent x:!B_1$ in~$\delta_2$ by the !!{proof}~$\delta_3$ - of $\Gamma \Sequent M:!B_1$ actually results in !!a{proof} + left. Of course one would have to carefully verify (by induction on + the height of~$\delta_2$) that, after renaming the abstraction's bound variable~$x$ and + the intervening binders fresh for~$\Gamma$ and~$M$, replacing each + axiom $\Gamma'\Sequent x:!B_1$ by a copy of~$\delta_3$ weakened + from~$\Gamma$ to $\Gamma'\setminus\{x:!B_1\}$, and deleting + $x:!B_1$ from every affected context, results in !!a{proof} $\Subst{\delta_2}{\delta_3}{x:!B_1}$ of $\Gamma \Sequent \Subst{N}{M}{x} : !B_2$. \end{proof} @@ -103,11 +104,11 @@ \Sequent M: !B$) to which a conversion can be applied. If $N \redone N'$ by replacing $M$ by its reductum, the corresponding result of applying the reduction to~$\delta$ is !!a{proof} of $\Gamma \Sequent -N' : !A$. Hence every $\lambd$-term not in normal form $\beta$-reduces -to another. This property is called \emph{progress}. +N' : !A$. Hence every $\lambd$-term not in normal form has a term-conversion +step. This property is called \emph{progress}. -Progress together with type preservation ensure that $\beta$-reduction -of $\lambd$-terms never ``gets stuck'': if a term is well-typed and +Progress and type preservation ensure that the declared +conversions of $\lambd$-terms never ``get stuck'': if a term is well-typed and isn't in normal form, it reduces to another well-typed term (and that term is of the same type). diff --git a/content/proof-theory/propositions-as-types/types.tex b/content/proof-theory/propositions-as-types/types.tex index 519d0df7..0cdd2e96 100644 --- a/content/proof-theory/propositions-as-types/types.tex +++ b/content/proof-theory/propositions-as-types/types.tex @@ -22,7 +22,7 @@ \end{defn} Note that the definition does not require that $\Gamma$ contains -$x:!A$ \emph{only} for free variables of~$N$. This, e.g., $\Gamma = +$x:!A$ \emph{only} for free variables of~$N$. Thus, e.g., $\Gamma = \{x:!A, y:!B, z:!C\}$ is a context for $\pair{x}{y}$. \begin{defn}\ollabel{defn:type} @@ -67,7 +67,7 @@ Proof terms are terms in a version of the $\lambd$-calculus, the \emph{typed $\lambd$-calculus with products, sums, and empty type}. The -classical $\lambd$-calculus only has term built from variables, +classical $\lambd$-calculus only has terms built from variables, \emph{$\lambd$-abstracts}~$\lambd[x][N]$ and application $(MN)$, and it lacks the annotation by~$!A$ of the typed $\lambd$-abstract $\lambd[\typeof{x}{!A}][N]$. The $\lambd$-calculus is a model of @@ -104,7 +104,7 @@ intuitively name the right sort of thing, provided the terms it is applied to name certain things. E.g., ``if $N_1 : !A$ and $N_2 : !B$, then $\pair{N_1}{N_2} : !A \land !B$'' says that if $N_1$ names -somethign of type~$!A$ and $N_2$ names something of type~$!B$, then +something of type~$!A$ and $N_2$ names something of type~$!B$, then $\pair{N_1}{N_2}$ names something of type $!A \land !B$. \end{document} diff --git a/content/proof-theory/sequent-calculus/admissible-derivable.tex b/content/proof-theory/sequent-calculus/admissible-derivable.tex index dc60dd8d..d512cc86 100644 --- a/content/proof-theory/sequent-calculus/admissible-derivable.tex +++ b/content/proof-theory/sequent-calculus/admissible-derivable.tex @@ -59,12 +59,12 @@ \RightLabel{$\LeftR{\land}_2$} \UnaryInf$!A \land !B, !A \land !B, \Gamma \fCenter \Delta$ \RightLabel{\LeftR{\Contraction}} -\UnaryInf$!A \land !B \Gamma \fCenter \Delta$ +\UnaryInf$!A \land !B, \Gamma \fCenter \Delta$ \DisplayProof \] \end{ex} -Simulating a inferences using one rule using other rules is one way to +Simulating inferences using one rule using other rules is one way to show that a rule is admissible. But it is not the only way, and some rules are admissible but can't be so simulated. Rules that can be are called \emph{derivable}. @@ -112,7 +112,7 @@ \item \Axiom$\Gamma, !A, !B \fCenter \Delta$ \Axiom$\Gamma \fCenter \Delta, !A, !B$ \RightLabel{\LeftR{\liff}} -\BinaryInf$\Gamma \fCenter \Delta, !A \liff !B$ +\BinaryInf$!A \liff !B, \Gamma \fCenter \Delta$ \DisplayProof \item \Axiom$!A, \Gamma \fCenter \Delta, !B$ @@ -121,7 +121,8 @@ \BinaryInf$\Gamma \fCenter \Delta, !A \liff !B$ \DisplayProof \end{enumerate} -are derivable in (a)~\Log{G1c} and (b)~\Log{G3c}. +are derivable in~\Log{G1c}. In~\Log{G3c}, show that the right +rule is derivable and that both rules are admissible. \end{prob} @@ -136,9 +137,10 @@ is admissible in~\Log{G3c}. The idea of the proof is simple: suppose there is !!a{proof}~$\pi$ of the premise $\Gamma \Sequent \Delta$ in~\Log{G3c}. -Add the !!{formula}~$!A$ to the succedent of every sequent +First rename the eigenvariables of~$\pi$ so that none occurs in~$!A$, +without changing its height. Add the !!{formula}~$!A$ to the succedent of every sequent in~$\pi$. Axioms remain axioms; correct inferences are still correct -inferences. The end-!!{formula} of the new !!{proof} is $\Gamma \Sequent +inferences. The end-sequent of the new !!{proof} is $\Gamma \Sequent \Delta, !A$. The rule $\RightR{\Weakening}$ is, however, not derivable @@ -189,7 +191,7 @@ \end{defn} Note that it is enough for a rule to be !!{height}-preserving -admissable that, whenever the premises~$S_i$ have !!{proof}s~$\pi_i$ +admissible that, whenever the premises~$S_i$ have !!{proof}s~$\pi_i$ with !!{height}~$h_i = \pheight{\pi_i}$, there is !!a{proof}~$\pi$ of the conclusion of !!{height}~$\pheight{\pi}$ no greater than the maximum of the~$h_i$. In particular, if there is only one @@ -209,7 +211,8 @@ is a \Log{G3c}-!!{proof} $\pi'$ of $\Gamma \Sequent \Delta, !A$ with $\pheight{\pi'} = n$. We prove this by induction on~$n$. If $n=0$, then $\pi$ is just the axiom $\Gamma \Sequent \Delta$ (i.e., some - atomic $!C$ occurs in both $\Gamma$ and~$\Delta$), and so is $\Gamma + atomic $!C$ occurs in both $\Gamma$ and~$\Delta$, or $\lfalse$ occurs + in~$\Gamma$), and so is $\Gamma \Sequent \Delta, !A$. If $n = \pheight{\pi} >0$, the !!{proof}~$\pi$ has a last inference. We distinguish cases according to which rule was used. We give just one example: suppose the last inference was diff --git a/content/proof-theory/sequent-calculus/interpretation-rules.tex b/content/proof-theory/sequent-calculus/interpretation-rules.tex index 41861909..2eda55ba 100644 --- a/content/proof-theory/sequent-calculus/interpretation-rules.tex +++ b/content/proof-theory/sequent-calculus/interpretation-rules.tex @@ -11,7 +11,8 @@ \olsection{Interpretation of Rules} Recall the interpretation of a sequent: A sequent $\Gamma \Sequent -\Delta$ is true in !!a{structure}~$\Struct{M}$ if either at least one +\Delta$ is true in !!a{structure}~$\Struct{M}$ under a fixed variable +assignment if either at least one $!A \in \Gamma$ is false or at least one~$!A \in \Delta$ is true. We can read the logical rules of~\Log{G3c} as codifying the truth conditions for their principal !!{formula}s. Consider \RightR{\lif}. @@ -24,9 +25,11 @@ \lif !B$ is false if $!A$~is true and $!B$~is false. So $!A \lif !B \Sequent \ $ is true iff both $\ \Sequent !A$ and $!B \Sequent \ $ are true. The conclusion of \LeftR{\lif} is equivalent to the -conjunction of its premises. This pattern ensures that the rules -of~\Log{G3c} are sound (if all premises are true, the conclusion is -true). They also ensure completeness. +conjunction of its premises. This pattern ensures that the propositional rules +of~\Log{G3c} preserve truth in each fixed interpretation, and hence +are sound. The quantifier rules preserve validity, using their +eigenvariable conditions. The decomposition of truth conditions is +also used to prove completeness. In fact, the truth conditions for any truth-functional connective can be described in this way as a set of sequents. This follows from the @@ -65,8 +68,9 @@ rule.) \end{prob} -In \Log{G3c}, each connective and quantifier has exactly two rules: a -left rule and a right rule. In \Log{G1c}, however, there are two +In \Log{G3c}, each nonconstant primitive connective and each quantifier +has exactly two rules: a left rule and a right rule. Falsity is instead +governed by its axiom. In \Log{G1c}, however, there are two \LeftR{\land} and two \RightR{\lor} rules. The reason is that Gentzen's original system~\Log{LK}, on which \Log{G1c} is modeled, had a variant~\Log{LJ} for an important non-classical logic, viz., @@ -76,24 +80,25 @@ impossible to use the \RightR{\lor} rule of~\Log{G3c}, as its premise contains both $!A$ and~$!B$ in the succedent. Gentzen thus used a pair of \RightR{\lor} rules for \Log{LJ}, and used the same for~\Log{LK}. -The intuitionistic version~\Log{G1i} similarly is just~\Log{G1c} with -all succedents restricted to at most one !!{formula}. (\Log{G3c} also +The intuitionistic version~\Log{G1i} similarly restricts all succedents +to at most one !!{formula}, and changes the first premise of +$\LeftR{\lif}$ to $\Gamma \Sequent !A$, without the side succedent. (\Log{G3c} also has an intuitionistic version, but it some of its rules differ from the corresponding rules in~\Log{G3c}. For instance, it, too, uses a pair of \RightR{\lor} rules.) That the structural rules of~\Log{G1c} are sound is easy to see. For instance, if $\Gamma \Sequent \Delta$ contains a false !!{formula} on -the right or a true !!{formula} on the left, so does $\Gamma \Sequent +the left or a true !!{formula} on the right, so does $\Gamma \Sequent \Delta, !A$: the same one, whether $!A$ is true or false is irrelevant. So if the premise of~\RightR{\Weakening} is true, so is its conclusion. Note that here the converse is not true. The conclusion may be true because $!A$ is true, and then the premise is not guaranteed to be true. -Why have structural rules at all? Contraction (\RightR{\Contraction}, -\LeftR{\Contraction}) is needed for instance to !!{prove} $\ \Sequent !A -\lor \lnot !A$. If you start with $!A \Sequent !A$ you first get +Why have structural rules at all? For a predicate atom~$!A$, +contraction (\RightR{\Contraction}, \LeftR{\Contraction}) is needed +for instance to !!{prove} $\ \Sequent !A \lor \lnot !A$. If you start with $!A \Sequent !A$ you first get $\Sequent !A, \lnot !A$ by~\RightR{\lnot}. Then you can use the two versions of \RightR{\lor} in succession, once to get $!A \lor \lnot !A$ from $\lnot !A$, and once to get $!A \lor \lnot !A$ from~$!A$. @@ -113,11 +118,11 @@ \DisplayProof \] There are in fact valid sequents which you could not !!{prove} -in~\Log{G1c} without weakening or contraction. For instance, -!!a{proof} of the sequent $!A \Sequent !B \lif !A$ in~\Log{G1c} has to -end in \RightR{\lif} (since only $!B \lif !A$ can be principal), and -that requires $!B, !A \Sequent !A$ as a premise. This, in turn, -requires \LeftR{\Weakening} to get it from the axiom $!A \Sequent !A$: +in~\Log{G1c} without weakening or contraction. For instance, take $!A$ and~$!B$ to be distinct atomic !!{formula}s. +A proof of $!A \Sequent !B \lif !A$ using only axioms and logical rules +would have to end in \RightR{\lif}, with $!B, !A \Sequent !A$ as a +premise. This premise is neither an axiom nor the conclusion of a +logical rule. With \LeftR{\Weakening}, we obtain the following proof: \[ \Axiom$!A \fCenter !A$ \RightLabel{\LeftR{\Weakening}} diff --git a/content/proof-theory/sequent-calculus/introduction.tex b/content/proof-theory/sequent-calculus/introduction.tex index 7c358b19..038bd98c 100644 --- a/content/proof-theory/sequent-calculus/introduction.tex +++ b/content/proof-theory/sequent-calculus/introduction.tex @@ -49,7 +49,8 @@ the empty conjunction to be~$\ltrue$) and $!D$~be the disjunction of the !!{formula}s in~$\Delta$ (taking the empty disjunction to be~$\lfalse$). Then the sequent $\Gamma \Sequent \Delta$ is true (in -some structure~$\Struct{M}$) iff $!G \lif !D$ is true. In classical +some structure~$\Struct{M}$ under a fixed variable assignment) iff +$!G \lif !D$ is true. In classical logic, this amounts to the same as saying that either one of the !!{formula}s in~$\Gamma$ is false, or one of the !!{formula}s in~$\Delta$ is true. @@ -57,7 +58,7 @@ If $\Gamma$ is a multiset of !!{formula}s, we write $\Gamma, !A$ (or $!A, \Gamma$) for the result of adding $!A$ to~$\Gamma$. If $\Delta$ is also a multiset of !!{formula}s, then $\Gamma, \Delta$ is the -multiset union of the two sequences---if $\Gamma$ contains $!A$ with +multiset union of the two multisets---if $\Gamma$ contains $!A$ with \emph{multiplicity}~n (i.e., it contains $n$ copies of~$!A$) and $\Delta$ with multiplicity~$m$, then $\Gamma, \Delta$ contains $!A$ with multiplicity~$n+m$. If the multiset on one side of a sequent is @@ -88,8 +89,14 @@ called ``contraction'' (\LeftR{\Contraction}, \RightR{\Contraction}) and ``weakening'' (\LeftR{\Weakening}, \RightR{\Weakening}). +For the proof-theory calculi, $\ltrue$ abbreviates $\lnot\lfalse$ +and $!A\liff!B$ abbreviates $(!A\lif!B)\land(!B\lif!A)$. +Expand these recursively before applying rules or computing syntactic +measures or subformulas. + The systems \Log{G1c} and \Log{G3c} happen to be sound and complete -for classical logic. In other words, every sequent !!{provable} in +for classical first-order logic without identity, restricted to sequents +of !!{sentence}s. In other words, every such sequent !!{provable} in these systems is true in every !!{structure}, and every sequent that is true in every !!{structure} has !!a{proof}. So the question \emph{whether} a sequent has !!a{proof} can also be answered by other diff --git a/content/proof-theory/sequent-calculus/invertibility.tex b/content/proof-theory/sequent-calculus/invertibility.tex index 867eedbf..4f14546a 100644 --- a/content/proof-theory/sequent-calculus/invertibility.tex +++ b/content/proof-theory/sequent-calculus/invertibility.tex @@ -21,9 +21,9 @@ \DisplayProof \] is \emph{invertible} in a system if, whenever $\Proves S$ then -$\Proves[h_i] S_i$ for $i = 1$, \dots,~$n$. It is +$\Proves S_i$ for $i = 1$, \dots,~$n$. It is \emph{!!{height}-preserving invertible} (or \emph{!!{hp}-invertible}) -in a system if, whenever $\Proves_n S$ then $\Proves[n] S_i$ for $i = +in a system if, for every $h$, whenever $\Proves[h] S$ then $\Proves[h] S_i$ for $i = 1$, \dots,~$n$. \end{defn} @@ -71,7 +71,9 @@ \pheight{\pi}$. We do this by induction on $n = \pheight{\pi}$. If $n = 0$, $\pi$ consists of just an axiom: $!A \land !B, \Gamma -\Sequent \Delta$. In \Log{G3c}, axioms are of the form $!C, \Gamma +\Sequent \Delta$. If $\lfalse$ occurs in~$\Gamma$, the sequent $!A, !B, \Gamma +\Sequent \Delta$ is again a bottom-left axiom. Otherwise the axiom is +of the form $!C, \Gamma \Sequent \Delta, !C$ with $!C$ atomic. In other words, $!C$ can't be $!A \land !B$. If $!A \land !B, \Gamma \Sequent \Delta$ is an axiom, then some atomic $!C$ must be !!a{element} of both $\Gamma$ @@ -115,7 +117,7 @@ Here $!C \lif !D$ on the left is principal, and the context on the left is $!A \land !B, \Gamma'$ (i.e., $\Gamma = \Gamma', !C \lif !D$). The inductive hypothesis yields !!{proof}s $\pi_1'$ and $\pi_2'$ of -$!A \land !B, \Gamma' \Sequent \Delta, !C$ and $!A \land !B, \Gamma', +$!A, !B, \Gamma' \Sequent \Delta, !C$ and $!A, !B, \Gamma', !D \Sequent \Delta$, respectively. These two sequents can again serve as premises for the \LeftR{\lif} rule to get~$\pi'$: \[ @@ -169,7 +171,7 @@ ending in it has $\pheight{\pi_1} < \pheight{\pi}$. Moreover, the eigenvariable condition gives us that $a$ does not occur in $\Gamma$, $\Delta$, or $\lforall[x][!A(x)]$. Since we may assume that - $\pi_1$ is regular, $\Subst{\pi_1}{c}{a}$ is !!a{proof} of the same + $\pi_1$ is regular and that its eigenvariables are distinct from $a$ and~$c$, $\Subst{\pi_1}{c}{a}$ is !!a{proof} of the same !!{height} of $\Gamma \Sequent \Delta, !A(c)$ by \olref[qua]{lem:subst-regular}. @@ -230,10 +232,11 @@ If $n=0$, $\pi$ is just an axiom. But if $\Gamma \Sequent \Delta, !A, !A$ is an axiom of~\Log{G3c}, so is $\Gamma \Sequent \Delta, !A$: -either some atomic~$!C$ is !!a{element} of both $\Gamma$ and~$\Delta$, -or $!A$ is atomic and !!a{element} of~$\Gamma$. The same reasoning -applies if the end-sequent is $!A, !A, \Gamma \Sequent -\Delta$. +either $\lfalse$ occurs in~$\Gamma$, some atomic~$!C$ is !!a{element} +of both $\Gamma$ and~$\Delta$, or $!A$ is atomic and !!a{element} +of~$\Gamma$. The same reasoning applies if the end-sequent is +$!A, !A, \Gamma \Sequent \Delta$: contracting two left occurrences +of~$\lfalse$ still leaves a bottom-left axiom. If $n>0$, $\pi$ ends in some rule~$R$. If $!A$ is not principal in this last inference, we can obtain !!a{proof}~$\pi'$ as in the proof @@ -335,7 +338,7 @@ By \olref{lem:invert-quant}, there is !!a{proof}~$\pi_1'$ with !!{height} $\le \pheight{\pi_1}$ of $\Gamma \fCenter \Delta, !B(c), !B(a)$ for any~$c$ not occuring in $\Gamma \fCenter \Delta, -\lforall[x][!B(x)], !B(a)$. We may assume that $\pi_1'$ is regular; so +\lforall[x][!B(x)], !B(a)$. We may assume that $\pi_1'$ is regular and has no eigenvariable equal to $a$ or~$c$; so by \olref[qua]{lem:subst-regular} the !!{proof} $\Subst{\pi_1'}{a}{c}$ is !!a{proof} of $\Gamma \fCenter \Delta, !B(a), !B(a)$ also of !!{height} $\le \pheight{\pi_1}$. Now the inductive @@ -363,7 +366,7 @@ \DisplayProof \] The inductive hypothesis applies to~$\pi_1$ and there is -!!a{proof}s~$\pi_1'$ of $\Gamma \Sequent \Delta, \lexists[x][!B(x)], +!!a{proof}~$\pi_1'$ of $\Gamma \Sequent \Delta, \lexists[x][!B(x)], !B(t)$. (Note that no inversion lemma is needed here!) The !!{proof}~$\pi'$ then is: \[ diff --git a/content/proof-theory/sequent-calculus/proof-examples.tex b/content/proof-theory/sequent-calculus/proof-examples.tex index 5229ee7b..39afa052 100644 --- a/content/proof-theory/sequent-calculus/proof-examples.tex +++ b/content/proof-theory/sequent-calculus/proof-examples.tex @@ -12,7 +12,7 @@ To give !!{proof}s of sequents it is typically convenient to work your way upwards from the end-sequent by selecting !!a{formula} in it as -the active !!{formula} and writing the premises of the corresponding +the principal !!{formula} and writing the premises of the corresponding rule on top of the sequent, then repeating the process until it leads to axioms. For instance, suppose we want to prove the sequent \[(!C \land !D) \lif !E \Sequent !C \lif (!D \lif !E)\] @@ -23,14 +23,14 @@ \RightLabel{\RightR{\lif}} \UnaryInf$ \Gamma \fCenter \Delta, !A \lif !B $ \DisplayProof\] -suggests we should take $\Gamma = \{!C \lif (!D \lif !E)\}$, $\Delta = +suggests we should take $\Gamma = \{(!C \land !D) \lif !E\}$, $\Delta = \emptyset$, $!A \ident !C$ and $!B \ident !D \lif !E$. So the last inference of a proof could be \[\Axiom$ !C, (!C \land !D) \lif !E \fCenter !D \lif !E$ \RightLabel{\RightR{\lif}} \UnaryInf$(!C \land !D) \lif !E \fCenter !C \lif (!D \lif !E)$ \DisplayProof\] -If we repeat this idea, focusing on $!D \lif !E$ as active formula, we +If we repeat this idea, focusing on $!D \lif !E$ as principal formula, we generate \[\Axiom$ !D, !C, (!C \land !D) \lif !E \fCenter !E$ \RightLabel{\RightR{\lif}} @@ -62,7 +62,7 @@ \RightLabel{\RightR{\land}} \BinaryInf$!D, !C \fCenter !E, !C \land !D$ \Axiom$!D, !C, !E \fCenter !E$ -\RightLabel{\RightR{\lif}} +\RightLabel{\LeftR{\lif}} \BinaryInf$ !D, !C, (!C \land !D) \lif !E \fCenter !E$ \RightLabel{\RightR{\lif}} \UnaryInf$!C, (!C \land !D) \lif !E \fCenter !D \lif !E$ @@ -87,6 +87,7 @@ \UnaryInf$!D, !C \fCenter !C$ \RightLabel{\RightR{\Weakening}} \UnaryInf$!D, !C \fCenter !E, !C$ +\DisplayProof \] Overall, we have !!a{proof} in \Log{G1c} which looks like this: \[ @@ -104,7 +105,7 @@ \BinaryInf$!D, !C \fCenter !E, !C \land !D$ \Axiom$!E \fCenter !E$ \RightLabel{\LeftR{\Weakening}} -\UnaryInf$!C, !E \fCenter !C$ +\UnaryInf$!C, !E \fCenter !E$ \RightLabel{\LeftR{\Weakening}} \UnaryInf$!D, !C, !E \fCenter !E$ \RightLabel{\LeftR{\lif}} @@ -121,15 +122,16 @@ result will still be a !!{proof} in~\Log{G1c}. The proof in \Log{G1c} is \emph{schematic}. -In \Log{G3c}, axioms are sequents of the form $!A, \Gamma \Sequent -\Delta, !A$ where $!A$ must be atomic. So although $!D, !C \Sequent +In \Log{G3c}, the identity axioms are sequents of the form $!A, \Gamma \Sequent +\Delta, !A$ where $!A$ must be atomic (the other axioms are the sequents +$\lfalse, \Gamma \Sequent \Delta$). So although $!D, !C \Sequent !E, !C$ looks like an axiom of \Log{G3c} ($\Gamma = \{!D\}$; $\Delta = -\{!E\}$), it is only \emph{really} an axiom if $!C$ in fact is atomic. -Our proof fragment is only a complete proof in \Log{G3c} if $!C$, +\{!E\}$), it is certainly an axiom if $!C$ in fact is atomic. +Our proof fragment is a complete proof in \Log{G3c} if $!C$, $!D$, and $!E$ are atomic !!{formula}s. Although we haven't, strictly speaking, shown that -\[\Log{G1c} \Proves (!C \land !D) \lif !E \fCenter !C \lif (!D \lif +\[\Log{G3c} \Proves (!C \land !D) \lif !E \fCenter !C \lif (!D \lif !E),\] in practice this is all we need to do (and can do). That's because every sequent of the form $!A, \Gamma \Sequent \Delta, !A$ is provable in \Log{G3c}, even if $!A$ itself is not atomic. We can show @@ -139,17 +141,17 @@ The \emph{depth}~$\depth{!A}$ of !!a{formula} is defined as follows: \begin{enumerate} \item If $!A$ is atomic, $\depth{!A} = 0$. - \item If $!A \ident \lnot !B$, $!A \ident \lforall[x][A]$, or - $!A \ident \lexists[x][A]$, then $\depth{!A} = \depth{!B} + 1$. + \item If $!A \ident \lnot !B$, $!A \ident \lforall[x][!B]$, or + $!A \ident \lexists[x][!B]$, then $\depth{!A} = \depth{!B} + 1$. \item If $!A \ident (!B \land !C)$, $(!B \lor !C)$, or $(!B \lif !C)$, then $\depth{!A} = \max(\depth{!B},\depth{!C}) + 1$. \end{enumerate} \end{defn} It is not hard to prove that $\depth{A(x)} = \depth{A(t)}$ for any -term~$t$. The important fact for us is that in any rule, the depth of -the principal !!{formula} is always greater than the depth of the -active !!{formula}s. For instance, we have: +term~$t$. The important fact for us is that in any logical rule, the depth of +the principal !!{formula} is greater than the depth of the +active !!{formula}s other than retained copies of the principal !!{formula}. For instance, we have: \begin{align*} \depth{P(x)} = \depth{P(a)} & = 0,\\ \depth{\lforall[x][P(x)]} & = 1,\\ @@ -168,7 +170,7 @@ atomic and $!A \Sequent !A$ already is a !!{proof} in~\Log{G1c} of the required form. If $\depth{!A} > 0$, $!A$ is constructed from !!{formula}s of lower depth, e.g, $!A \ident \lnot !B$, $!A \ident - (!B \land !C)$, or $!A \ident \lforall[x][A(x)]$. The inductive + (!B \land !C)$, or $!A \ident \lforall[x][!B(x)]$. The inductive hypothesis is that for all $!D$ with $\depth{!D} < \depth{!A}$, $\Log{G1c} \Proves !D \Sequent !D$ from atomic axioms. @@ -197,26 +199,26 @@ \[ \AxiomC{} \RightLabel{$\pi_1$} - \Deduce$!B, \fCenter !B$ + \Deduce$!B \fCenter !B$ \RightLabel{\LeftR{\Weakening}} - \UnaryInf$!B, !C, \fCenter !B$ + \UnaryInf$!B, !C \fCenter !B$ \RightLabel{\LeftR{\land}} \UnaryInf$!B \land !C, !C\fCenter !B$ \RightLabel{\LeftR{\land}} \UnaryInf$!B \land !C, !B \land !C \fCenter !B$ \AxiomC{} \RightLabel{$\pi_2$} - \Deduce$!C, \fCenter !C$ + \Deduce$!C \fCenter !C$ \RightLabel{\LeftR{\Weakening}} - \UnaryInf$!B, !C, \fCenter !C$ + \UnaryInf$!B, !C \fCenter !C$ \RightLabel{\LeftR{\land}} \UnaryInf$!B \land !C, !C \fCenter !C$ \RightLabel{\LeftR{\land}} \UnaryInf$!B \land !C, !B \land !C \fCenter !C$ \RightLabel{\RightR{\land}} - \BinaryInf$!B \land !C \fCenter !B \land !C$ + \BinaryInf$!B \land !C, !B \land !C \fCenter !B \land !C$ \RightLabel{\LeftR{\Contraction}} - \UnaryInf$!B \land !C \fCenter !B$ + \UnaryInf$!B \land !C \fCenter !B \land !C$ \DisplayProof \] @@ -260,15 +262,16 @@ \] in the case where $!A \ident \lnot !B$. However, there are sequent systems in which this wouldn't have worked. The intuitionistic -sequent calculus \Log{G1i} is like \Log{G1c}, except it restricts all -sequents to at most one !!{formula} on the right side of a sequent. If -$\Delta = \emptyset$, then the first !!{proof} would also be -!!a{proof} in~\Log{G1i}, but the second would not be, since +sequent calculus \Log{G1i} restricts all sequents to at most one +!!{formula} on the right. It also changes the first premise of +$\LeftR{\lif}$ to $\Gamma \Sequent !A$, without the side succedent. If +the sub-!!{proof}~$\pi_1$ has at most one !!{formula} in every succedent, +then the first !!{proof} would also be !!a{proof} in~\Log{G1i}, but the second would not be, since one sequent contains both $!B$ and~$\lnot !B$ on the right. Note that even in \Log{G1c} we could not have used an alternate order of rules in the case where $!A \ident \lforall[x][!B(x)]$. The -following is \emph{not} !!a{proof} +following is \emph{not} !!a{proof} when $x$ occurs free in~$!B(x)$ \[ \AxiomC{} \RightLabel{$\pi_1$} @@ -279,7 +282,7 @@ \UnaryInf$\lforall[x][!B(x)] \fCenter \lforall[x][!B(x)]$ \DisplayProof \] -since the eigenvariable condition on~$\RightR{\lforall}$ is violated. +since then the eigenvariable condition on~$\RightR{\lforall}$ is violated. \begin{prop}\ollabel{prop:G3c-axioms} Any sequent of the form $!A, \Gamma @@ -294,12 +297,12 @@ \Gamma \Sequent \Delta, !A$ is an axiom of~\Log{G3c}. Now suppose $n>0$. Again we distinguish cases. The inductive -hypothesis is: for all $D!$ with $\depth{!D} < n$, and all $\Pi$ +hypothesis is: for all $!D$ with $\depth{!D} < n$, and all $\Pi$ and $\Lambda$, $\Log{G3c} \Proves !D, \Pi \Sequent \Lambda, !D$. Here is the case for $!A \ident (!B \land !C)$. We use the inductive hypothesis twice: once for $!D = !B$, $\Pi = !C, \Gamma$, and $\Lambda = \Delta$ to get !!a{proof}~$\pi_1$ of $!B, !C, \Gamma \Sequent -\Delta, !B$, and once for $!D = !C$, $\Pi = !B, \Lambda$, and $\Lambda +\Delta, !B$, and once for $!D = !C$, $\Pi = !B, \Gamma$, and $\Lambda = \Delta$ to get !!a{proof}~$\pi_2$ of $!B, !C, \Gamma \Sequent \Delta, !C$. Here is the !!{proof} of~$!B \land !C, \Gamma \Sequent \Delta, !B \land !C$: @@ -319,7 +322,7 @@ \DisplayProof \] -For $!A \ident \lforall[x][!B(x)]$, pick !!a{constant} not +For $!A \ident \lforall[x][!B(x)]$, pick !!a{constant}~$c$ not in~$\lforall[x][!B(x)]$, $\Gamma$, or~$\Delta$. Apply the inductive hypothesis for $!D = !B(c)$, $\Pi = \lforall[x][!B(x)], \Gamma$ and $\Lambda = \Delta$. This gives !!a{proof}~$\pi_1$ of $!B(c), diff --git a/content/proof-theory/sequent-calculus/quantifiers.tex b/content/proof-theory/sequent-calculus/quantifiers.tex index ae8b481c..5180ad01 100644 --- a/content/proof-theory/sequent-calculus/quantifiers.tex +++ b/content/proof-theory/sequent-calculus/quantifiers.tex @@ -29,7 +29,7 @@ \begin{lem}\ollabel{lem:subst-regular} If $\pi$ is regular, ends in $\Gamma \Sequent \Delta$, $c$ is !!a{constant} not used as an -eigenvariable in~$\pi$, and $t$~is a term not containing any +eigenvariable in~$\pi$, and $t$~is a closed term not containing any eigenvariables of~$\pi$, then $\Subst{\pi}{t}{c}$ resulting from~$\pi$ by replacing every occurrence of~$c$ by~$t$ is a regular !!{proof}. The end-sequent of $\Subst{\pi}{t}{c}$ is $\Subst{\Gamma}{t}{c} @@ -77,7 +77,7 @@ \AxiomC{} \RightLabel{$\pi'$} \Deduce$!A(s(c),c), \lforall[x][!A(x,c)], \Gamma(c) \fCenter \Delta'(c)$ - \RightLabel{\RightR{\lforall}} + \RightLabel{\LeftR{\lforall}} \UnaryInf$\lforall[x][!A(x,c)], \Gamma(c) \fCenter \Delta'(c)$ \DisplayProof \] @@ -89,7 +89,7 @@ \AxiomC{} \RightLabel{$\Subst{\pi'}{t}{c}$} \Deduce$!A(s(t),t), \lforall[x][!A(x,t)], \Gamma(t) \fCenter \Delta'(t)$ - \RightLabel{\RightR{\lforall}} + \RightLabel{\LeftR{\lforall}} \UnaryInf$\lforall[x][!A(x,t)], \Gamma(t) \fCenter \Delta'(t)$ \DisplayProof \] @@ -101,8 +101,8 @@ (or two regular !!{proof}s in the case of two-premise rules). The new sequent differs from the end-sequent of $\pi$ only in that $c$ was replaced by the term~$t$. Moreover, the eigenvariables of $\pi$ - and Since $t$ was assumed not to contain an eigenvariable of~$\pi$ - and $\Subst{\pi}{t}{c}$ are the same, the new end-sequent does not + and $\Subst{\pi}{t}{c}$ are the same. Since $t$ was assumed not to + contain an eigenvariable of~$\pi$, the new end-sequent does not contain an eigenvariable of $\Subst{\pi}{t}{c}$. Consequently, $\Subst{\pi}{t}{c}$ is regular. \end{proof} @@ -120,10 +120,10 @@ another inference nor does it occur anywhere in~$\pi$ except the immediate sub-!!{proof} of the inference, and \emph{dirty} otherwise. Let $n$ be the number of dirty eigenvariable inferences in~$\pi$. We -show, by induction on~$n$, that $\pi$~can be transformed into the +show, by strong induction on~$n$, that $\pi$~can be transformed into the required regular !!{proof}~$\pi'$. If $n=0$, all eigenvariable inferences in~$\pi$ are clean, so and $\pi$ is regular, and there is -nothing to prove. Otherwise, pick a highest eigenvariable inference, +nothing to prove. Otherwise, pick a highest dirty eigenvariable inference, say \RightR{\lforall}. The sub-!!{proof}~$\pi_1$ of~$\pi$ ending in it is of the form \[ @@ -136,7 +136,7 @@ \] Note that as $c$ is an eigenvariable, it does not occur in~$\Gamma$, $\Delta$, or $\lforall[x][!A(x)]$. The proof $\pi_2$ is regular, since -it contains no eigenvariable inferences at all. Let $a$ be +all its eigenvariable inferences are clean in~$\pi$. Let $a$ be !!a{constant} not occuring in~$\pi$. By \olref{lem:subst-regular}, $\Subst{\pi_2}{a}{c}$ is a regular proof of $\Gamma \fCenter \Delta, !A(a)$, to which we can apply~$\RightR{\lforall}$. If we replace $\pi_1$ in~$\pi$ by the proof $\pi_1'$, @@ -150,7 +150,7 @@ \] we have replaced a dirty eigenvariable inference by a clean one, and the only difference is the replacement of the eigenvariable $c$ -by~$a$. The resulting proof has $n-1$ dirty eigenvariable inferences, +by~$a$. The resulting proof has at most $n-1$ dirty eigenvariable inferences, and the result follows from the inductive hypothesis. \end{proof} diff --git a/content/proof-theory/sequent-calculus/rules-G1i.tex b/content/proof-theory/sequent-calculus/rules-G1i.tex index 1d799abf..987a943f 100644 --- a/content/proof-theory/sequent-calculus/rules-G1i.tex +++ b/content/proof-theory/sequent-calculus/rules-G1i.tex @@ -1,6 +1,6 @@ % Part: proof-theory % Chapter: sequent-calculus -% Section: rules-G1c +% Section: rules-G1i \documentclass[../../../include/open-logic-section]{subfiles} @@ -108,9 +108,9 @@ $\RightR{\forall}$ and $\LeftR{\exists}$, the !!{constant}~$a$ must not occur in the conclusion sequent. $\Gamma$ is a multisets of !!{formula}s, and $\Delta$ may be empty or contain a single -!!{formula}. There is no \RightR{\Contraction} rule. \Log{G1m} is -\Log{G1i} without~\RightR{\Weakening} and without axioms $\lfalse, -\Gamma \Sequent \Delta$.} +!!{formula}. There is no \RightR{\Contraction} rule. For \Log{G1m}, use nonempty succedents and read $\lnot !A$ +as $!A\lif\lfalse$, omitting both primitive negation rules. +Its remaining rules are those of \Log{G1i} without~\RightR{\Weakening} and without the axiom $\lfalse \Sequent \quad$.} \ollabel{tab:G1i} \end{table} diff --git a/content/proof-theory/sequent-calculus/rules-G2c.tex b/content/proof-theory/sequent-calculus/rules-G2c.tex index 4fd7a9b5..f29f5b6b 100644 --- a/content/proof-theory/sequent-calculus/rules-G2c.tex +++ b/content/proof-theory/sequent-calculus/rules-G2c.tex @@ -1,6 +1,6 @@ % Part: proof-theory % Chapter: sequent-calculus -% Section: rules-G1c +% Section: rules-G2c \documentclass[../../../include/open-logic-section]{subfiles} diff --git a/content/proof-theory/sequent-calculus/rules-G3c.tex b/content/proof-theory/sequent-calculus/rules-G3c.tex index 614099d3..0bc243fd 100644 --- a/content/proof-theory/sequent-calculus/rules-G3c.tex +++ b/content/proof-theory/sequent-calculus/rules-G3c.tex @@ -54,7 +54,7 @@ \UnaryInf$ \Gamma \fCenter \Delta, !A \lif !B $ \DisplayProof \\[4ex] -\Axiom$ !A(t), \lforall[x][!A(x)]\Gamma \fCenter \Delta$ +\Axiom$ !A(t), \lforall[x][!A(x)], \Gamma \fCenter \Delta$ \RightLabel{\LeftR{\lforall}} \UnaryInf$ \lforall[x][!A(x)],\Gamma \fCenter \Delta$ \DisplayProof diff --git a/content/proof-theory/sequent-calculus/rules-G3i.tex b/content/proof-theory/sequent-calculus/rules-G3i.tex index c7d950c1..03939e8c 100644 --- a/content/proof-theory/sequent-calculus/rules-G3i.tex +++ b/content/proof-theory/sequent-calculus/rules-G3i.tex @@ -1,6 +1,6 @@ % Part: proof-theory % Chapter: sequent-calculus -% Section: rules-G3c +% Section: rules-G3i \documentclass[../../../include/open-logic-section]{subfiles} @@ -39,14 +39,14 @@ \DisplayProof & \begin{tabular}[t]{@{}r@{}} -\Axiom$\Gamma \fCenter \Delta, !A$ +\Axiom$\Gamma \fCenter !A$ \RightLabel{\RightR{\lor}} -\UnaryInf$ \Gamma \fCenter \Delta, !A \lor !B$ +\UnaryInf$ \Gamma \fCenter !A \lor !B$ \DisplayProof \\[3ex] -\Axiom$ \Gamma \fCenter \Delta, !B$ +\Axiom$ \Gamma \fCenter !B$ \RightLabel{\RightR{\lor}} -\UnaryInf$ \Gamma \fCenter \Delta, !A \lor !B$ +\UnaryInf$ \Gamma \fCenter !A \lor !B$ \DisplayProof\\[3ex] \end{tabular} \\[4ex] @@ -61,7 +61,7 @@ \UnaryInf$ \Gamma \fCenter !A \lif !B $ \DisplayProof \\[4ex] -\Axiom$ !A(t), \lforall[x][!A(x)]\Gamma \fCenter \Delta$ +\Axiom$ !A(t), \lforall[x][!A(x)], \Gamma \fCenter \Delta$ \RightLabel{\LeftR{\lforall}} \UnaryInf$ \lforall[x][!A(x)],\Gamma \fCenter \Delta$ \DisplayProof @@ -86,8 +86,10 @@ not occur in the conclusion sequent. $\Gamma$ is a multisets of !!{formula}s, and $\Delta$ may be empty or contain a single !!{formula}. In axioms, the !!{formula}~$!C$ must be atomic. -\Log{G1m} is \Log{G1i} without axioms $\lfalse, \Gamma \Sequent -\Delta$.} +The minimal calculus \Log{G3m} uses the nonempty-succedent +fragment of \Log{G3i}, treats $\lnot !A$ as $!A\lif\lfalse$, +and omits the primitive negation rules and the falsity axioms +$\lfalse,\Gamma\Sequent\Delta$.} \ollabel{tab:G3i} \end{table} diff --git a/content/proof-theory/sequent-calculus/rules-LK.tex b/content/proof-theory/sequent-calculus/rules-LK.tex index be3f4a1b..eff042b3 100644 --- a/content/proof-theory/sequent-calculus/rules-LK.tex +++ b/content/proof-theory/sequent-calculus/rules-LK.tex @@ -122,7 +122,7 @@ $\LeftR{\exists}$, the !!{constant}~$a$ must not occur in the conclusion sequent. $\Gamma$, $\Delta$, and~$\Pi$ are sequences of !!{formula}s.} -\ollabel{tab:G1c} +\ollabel{tab:LK} \end{table} \end{document} \ No newline at end of file diff --git a/content/proof-theory/sequent-calculus/rules-mG3i.tex b/content/proof-theory/sequent-calculus/rules-mG3i.tex index a6ad463a..6bfffc3f 100644 --- a/content/proof-theory/sequent-calculus/rules-mG3i.tex +++ b/content/proof-theory/sequent-calculus/rules-mG3i.tex @@ -1,6 +1,6 @@ % Part: proof-theory % Chapter: sequent-calculus -% Section: rules-G3c +% Section: rules-mG3i \documentclass[../../../include/open-logic-section]{subfiles} @@ -54,14 +54,14 @@ \UnaryInf$ \Gamma \fCenter \Delta, !A \lif !B $ \DisplayProof \\[4ex] -\Axiom$ !A(t), \lforall[x][!A(x)]\Gamma \fCenter \Delta$ +\Axiom$ !A(t), \lforall[x][!A(x)], \Gamma \fCenter \Delta$ \RightLabel{\LeftR{\lforall}} \UnaryInf$ \lforall[x][!A(x)],\Gamma \fCenter \Delta$ \DisplayProof & \Axiom$ \Gamma \fCenter !A(a) $ \RightLabel{\RightR{\lforall}} -\UnaryInf$ \Gamma \fCenter \lforall[x][!A(x)]$ +\UnaryInf$ \Gamma \fCenter \Delta, \lforall[x][!A(x)]$ \DisplayProof \\[4ex] \Axiom$ !A(a), \Gamma \fCenter \Delta $ @@ -78,10 +78,11 @@ logic. In $\RightR{\forall}$ and $\LeftR{\exists}$, the !!{constant}~$a$ must not occur in the conclusion sequent. $\Gamma$~and $\Delta$ are multisets of !!{formula}s. In axioms, the -!!{formula}~$!C$ must be atomic. \Log{mG1m} is -\Log{mG1i} without axioms $\lfalse, -\Gamma \Sequent \Delta$.} -\ollabel{tab:G3c} +!!{formula}~$!C$ must be atomic. The minimal calculus \Log{mG3m} uses the fragment of +\Log{mG3i} with nonempty succedent multisets, treats $\lnot !A$ +as $!A\lif\lfalse$, and omits the primitive negation rules and +the falsity axioms $\lfalse,\Gamma\Sequent\Delta$.} +\ollabel{tab:mG3i} \end{table} \end{document} \ No newline at end of file diff --git a/content/proof-theory/sequent-calculus/rules-proofs.tex b/content/proof-theory/sequent-calculus/rules-proofs.tex index 7dffa212..0568b61a 100644 --- a/content/proof-theory/sequent-calculus/rules-proofs.tex +++ b/content/proof-theory/sequent-calculus/rules-proofs.tex @@ -127,8 +127,8 @@ It is often necessary to measure the complexity of !!{proof}s as a natural number. We could simply count the number of sequents in !!a{proof}, but often a more useful measure is the !!{height} of -!!a{proof}: it is the maximal number of sequents between the -end-sequent and an initial sequent. We can also give an inductive +!!a{proof}: it is the maximal number of inference steps from the +end-sequent to an initial sequent. We can also give an inductive definition. \begin{defn} @@ -153,7 +153,7 @@ we take $!C \ident !E$, $\Gamma = \{!D\}$ and $\Delta = \emptyset$ in $!C, \Gamma \Sequent \Delta, !C$ we get exactly the sequent $!D, !E \Sequent !E$. (Remember that we are dealing with multi\emph{sets} and -so $!D, !E \Sequent !E$ and $!E, !D \Sequent !D$ are the same +so $!D, !E \Sequent !E$ and $!E, !D \Sequent !E$ are the same sequent.) Since $!D, !E \Sequent !D$ is an instance of an axiom of~\Log{G3c}, it diff --git a/content/proof-theory/sequent-calculus/translations.tex b/content/proof-theory/sequent-calculus/translations.tex index 2b2a98ac..65c03983 100644 --- a/content/proof-theory/sequent-calculus/translations.tex +++ b/content/proof-theory/sequent-calculus/translations.tex @@ -30,7 +30,7 @@ If $n = 0$, then $\pi$ is an axiom. The axiom $\lfalse \Sequent \quad$ is also an axiom in~\Log{G3c} (take the context $\Gamma, - \Delta$ to be empty). In \Log{G3c}, axioms $!A \Sequent !A$ with + \Delta$ to be empty). In \Log{G1c}, axioms $!A \Sequent !A$ with arbitrary, not just atomic~$!A$ are allowed. But we proved in \olref[ex]{prop:G3c-axioms} that all such sequents are !!{provable} in~\Log{G3c}. @@ -40,10 +40,12 @@ in~\Log{G3c}, i.e., that the immediate sub-!!{proof}s have translations in~\Log{G3c}. If the rule~$R$ is also a rule in \Log{G3c}, we apply it to the translated !!{proof}s of the premises. - For those rules that are no also rules of~\Log{G3c}, we have already - shown that they are at least admissible. So, if rule~$R$ was - $\LeftR{\land}$ or $\RightR{\lor}$, apply - \olref[adm]{prop:lor-G3-adm}. If it was a weakening rule, apply + For rules that are not also rules of~\Log{G3c}, we use admissible + weakening. If rule~$R$ was $\LeftR{\land}$ or $\RightR{\lor}$, first + add the missing active conjunct or disjunct by + \olref[adm]{prop:weak-G3c-adm}, then apply the \Log{G3c} rule. + For $\LeftR{\lforall}$ or $\RightR{\lexists}$, first add the retained + principal !!{formula} by weakening, then apply the \Log{G3c} rule. If it was a weakening rule, apply \olref[adm]{prop:weak-G3c-adm}. If it was a contraction rule, apply \olref[inv]{prop:G3c-cont-adm}. \end{proof} @@ -75,8 +77,9 @@ If $\pi$ ends in a rule~$R$, the inductive hypothesis yields !!{proof}s in \Log{G1c} of the premises, and we can apply the same rule~$R$ to those !!{proof}s. The exceptions are the rules - \LeftR{\land} and \RightR{\lor}, which differ between \Log{G1c} - and~\Log{G3c}. The \Log{G3c} versions are derivable in \Log{G1c} as follows: + \LeftR{\land}, \RightR{\lor}, \LeftR{\lforall}, and \RightR{\lexists}, + which differ between \Log{G1c} and~\Log{G3c}. The first two + \Log{G3c} rules are derivable in \Log{G1c} as follows: \[ \Axiom$!A, !B, \Gamma \fCenter \Delta$ \RightLabel{\LeftR{\land}} @@ -91,11 +94,15 @@ \RightLabel{\RightR{\lor}} \UnaryInf$\Gamma \fCenter \Delta, !A \lor !B, !B$ \RightLabel{\RightR{\lor}} - \UnaryInf$\Gamma \fCenter \Delta, , !A \lor !B, !A \lor !B$ + \UnaryInf$\Gamma \fCenter \Delta, !A \lor !B, !A \lor !B$ \RightLabel{\RightR{\Contraction}} \UnaryInf$\Gamma \fCenter \Delta, !A \lor !B$ \DisplayProof \] + For \LeftR{\lforall} and \RightR{\lexists}, apply the \Log{G1c} rule + with the retained principal !!{formula} as part of the context. + This produces two copies of that !!{formula}; one application of + the corresponding contraction rule yields the required conclusion. \end{proof} \end{document} \ No newline at end of file