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..85187566 100644 --- a/content/proof-theory/natural-deduction/rules-proofs.tex +++ b/content/proof-theory/natural-deduction/rules-proofs.tex @@ -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,8 +128,8 @@ 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 @@ -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} @@ -244,7 +245,7 @@ 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 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 diff --git a/content/proof-theory/natural-deduction/sequents.tex b/content/proof-theory/natural-deduction/sequents.tex index ba46c567..271c4056 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 @@ -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..ad5606fa 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,21 +82,25 @@ 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 @@ -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..71db2c56 100644 --- a/content/proof-theory/normalization/segments.tex +++ b/content/proof-theory/normalization/segments.tex @@ -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. @@ -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..31e215fd 100644 --- a/content/proof-theory/normalization/translations.tex +++ b/content/proof-theory/normalization/translations.tex @@ -12,7 +12,7 @@ !!^{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 @@ -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 @@ -178,29 +166,24 @@ 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 +202,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..f333204d 100644 --- a/content/proof-theory/propositions-as-types/proof-terms.tex +++ b/content/proof-theory/propositions-as-types/proof-terms.tex @@ -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..7930086c 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 @@ -59,8 +59,19 @@ 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,7 +102,7 @@ \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. @@ -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/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).