[step:Translate natural deduction derivations into typed lambda terms]We prove, by induction on a natural deduction derivation $\mathcal{D}$ of $\Gamma\vdash Q$, that there is a term $t$ with
\begin{align*}
\Gamma^\ast\vdash t:Q^\ast.
\end{align*}
If $\mathcal{D}$ is the assumption rule selecting the $i$th assumption $P_i$ in $\Gamma$, take $t=x_i$. Then $x_i:P_i^\ast$ occurs in $\Gamma^\ast$, so the variable typing rule gives
\begin{align*}
\Gamma^\ast\vdash x_i:P_i^\ast.
\end{align*}
For implication introduction, suppose the last rule derives $\Gamma\vdash P\to Q$ from a derivation of $\Gamma,P\vdash Q$. By the induction hypothesis, for a fresh variable $x:P^\ast$ there is a term $u$ such that
\begin{align*}
\Gamma^\ast,x:P^\ast\vdash u:Q^\ast.
\end{align*}
The function introduction rule gives
\begin{align*}
\Gamma^\ast\vdash \lambda x.u:P^\ast\to Q^\ast.
\end{align*}
Since $(P\to Q)^\ast=P^\ast\to Q^\ast$, this is the required typing judgment.
For implication elimination, suppose the last rule derives $\Gamma\vdash Q$ from derivations of $\Gamma\vdash P\to Q$ and $\Gamma\vdash P$. By the induction hypothesis there are terms $f$ and $a$ such that
\begin{align*}
\Gamma^\ast\vdash f:P^\ast\to Q^\ast.
\end{align*}
\begin{align*}
\Gamma^\ast\vdash a:P^\ast.
\end{align*}
The application rule gives
\begin{align*}
\Gamma^\ast\vdash f(a):Q^\ast.
\end{align*}
For conjunction introduction, derivations of $\Gamma\vdash P$ and $\Gamma\vdash Q$ translate to terms $a:P^\ast$ and $b:Q^\ast$ in context $\Gamma^\ast$. The product introduction rule gives
\begin{align*}
\Gamma^\ast\vdash (a,b):P^\ast\times Q^\ast.
\end{align*}
For conjunction elimination, a derivation of $\Gamma\vdash P\wedge Q$ translates to $p:P^\ast\times Q^\ast$, and the product projection rules give
\begin{align*}
\Gamma^\ast\vdash \pi_1(p):P^\ast.
\end{align*}
\begin{align*}
\Gamma^\ast\vdash \pi_2(p):Q^\ast.
\end{align*}
For disjunction introduction, a derivation of $\Gamma\vdash P$ translates to $a:P^\ast$, and the left sum injection gives
\begin{align*}
\Gamma^\ast\vdash \operatorname{inl}(a):P^\ast+Q^\ast.
\end{align*}
A derivation of $\Gamma\vdash Q$ translates to $b:Q^\ast$, and the right sum injection gives
\begin{align*}
\Gamma^\ast\vdash \operatorname{inr}(b):P^\ast+Q^\ast.
\end{align*}
For [disjunction elimination](/theorems/4625), suppose the last rule has premises $\Gamma\vdash P\vee Q$, $\Gamma,P\vdash R$, and $\Gamma,Q\vdash R$. The induction hypothesis gives terms
\begin{align*}
\Gamma^\ast\vdash s:P^\ast+Q^\ast.
\end{align*}
\begin{align*}
\Gamma^\ast,x:P^\ast\vdash u:R^\ast.
\end{align*}
\begin{align*}
\Gamma^\ast,y:Q^\ast\vdash v:R^\ast.
\end{align*}
The sum eliminator gives
\begin{align*}
\Gamma^\ast\vdash \operatorname{case}(s;x.u;y.v):R^\ast.
\end{align*}
For truth introduction, the unique natural deduction proof of $\top$ translates to the unit term:
\begin{align*}
\Gamma^\ast\vdash \ttstar:\mathbf{1}.
\end{align*}
For truth elimination, suppose the last rule derives $\Gamma\vdash R$ from derivations of $\Gamma\vdash\top$ and $\Gamma\vdash R$. The induction hypothesis gives terms $r$ and $c$ such that
\begin{align*}
\Gamma^\ast\vdash r:\mathbf{1}.
\end{align*}
\begin{align*}
\Gamma^\ast\vdash c:R^\ast.
\end{align*}
The unit eliminator gives
\begin{align*}
\Gamma^\ast\vdash \operatorname{let}_{\mathbf{1}}(r;c):R^\ast.
\end{align*}
For falsehood elimination, a derivation of $\Gamma\vdash\bot$ translates to a term $e:\mathbf{0}$, and the empty type eliminator gives, for every proposition $Q$,
\begin{align*}
\Gamma^\ast\vdash \operatorname{abort}_{Q^\ast}(e):Q^\ast.
\end{align*}
These cases exhaust the natural deduction rules for implication, conjunction, disjunction, truth, and falsehood, so the induction proves the first direction.[/step]