%! TEX root = LC.tex
% vim: tw=50
% 14/10/2024 11AM

\subsection*{Rules for Intuitionistic Propositional
Calculus (IPC)}

\glsnoundefn{ipc}{IPC}{??}%

\begin{enumerate}[($\pand$-I)]
  \item[($\pand$-I)] $\frac{\Gamma \syn A, \Gamma \syn
    B}{\Gamma \syn A \pand B}$
  \item[($\por$-I)] $\frac{\Gamma \syn A}{\Gamma
    \syn A \por B}$, $\frac{\Gamma \syn B}{\Gamma
    \syn A \por B}$
  \item[($\pand$-E)] $\frac{\Gamma \syn A \pand
    B}{\Gamma \syn A}$ and $\frac{\Gamma \syn A
    \pand B}{\Gamma \syn B}$
  \item[($\por$-E)] $\frac{\Gamma, A \syn C
    ~~\Gamma, B \syn C ~~ \Gamma \syn A \por
    B}{\Gamma \syn C}$
  \item[($\to$-I)] $\frac{\Gamma, A \syn B}{\Gamma
    \syn A \to B}$
  \item[($\to$-E)] $\frac{\Gamma \syn
    A \to B, \Gamma \syn A}{\Gamma \syn B}$
  \item[($\perp$-E)] $\frac{\Gamma \syn
    \false}{\Gamma \syn A}$ for any $A$
  \item[(Ax)] $\frac{}{\Gamma, A \syn A}$ for any
    $A$
  \item[(Weak)] $\frac{\Gamma \syn B}{\Gamma, A
    \syn B}$
  \item[(Contr)] $\frac{\Gamma, A, A \syn
    B}{\Gamma, A \syn B}$
\end{enumerate}
We obtain classical propositional logic (CPC) by
adding either:
\begin{itemize}
  \item $\frac{}{\Gamma \syn A \por \pnot A}$
  \item $\frac{\Gamma, \pnot A \syn \false}{\Gamma
    \syn A}$ (reductio ad absurdum)
\end{itemize}
By
\[
  \frac{
    \begin{matrix}
      [A] \\
      \vdots \\
      X
    \end{matrix}
    \quad
    \begin{matrix}
      [B] \\
      \vdots \\
      Y
    \end{matrix}
  }{C}
  (A, B)
\]
we mean `if we can prove $X$ assuming $A$ and we
can prove $Y$ assuming $B$, then we can infer $C$
by ``discharging / closing'' the open assumptions
$A$ and $B$'.

In particular, the ($\to$-I)-rule can be written
as
\[
  \frac{
    \begin{matrix}
      \Gamma, [A] \\
      \vdots \\
      B
    \end{matrix}
  }{\Gamma \syn A \to B}(A)
.\]
We obtain intiuitionistic first-order logic (IQC)
by adding rules for quantification:
\begin{enumerate}[($\pand$-I)]
  \item[($\exists$-I)] $\frac{\Gamma \syn
    \varphi[x \defeq t]}{\Gamma \syn \exists x
    .\varphi(x)}$, where $t$ is a term.
  \item[($\exists$-E)] $\frac{\Gamma \syn \exists
    x.\varphi ~~ \Gamma, \varphi \syn \psi}{\Gamma
    \syn \psi}$, if $x$ is not free in $\Gamma,
    \psi$.
  \item[($\forall$-I)] $\frac{\Gamma \syn
    \varphi}{\Gamma \syn \forall x.\varphi}$ if
    $x$ is not free in $\Gamma$.
  \item[($\forall$-E)] $\frac{\Gamma \syn \forall
    x.\varphi(x)}{\Gamma \syn \varphi[x \defeq
    t]}$, where $t$ is a term.
\end{enumerate}

\begin{example}
  % Example 1.1.2
  Let's give a natural deduction proof of $A \pand
  B \to B \pand A$.
  \[
    \frac{
      \frac{
        \frac{[A \pand B]}{A}
        \quad
        \frac{[A \pand B]}{B}
      }{B \pand A}
    }{A \pand B \to B \pand A}(A \pand B)
  .\]
\end{example}

\begin{example}
  % EXample 1.1.3
  Let's prove the Hilbert-style axioms $\varphi
  \to (\psi \to \varphi)$ and $(\varphi \to (\psi
  \to \chi)) \to ((\varphi \to psi)\to (\varphi \to
  \chi))$.
  \[
    \frac{
      \frac{
        [\varphi] ~~ [\psi]
      }{\psi \to \varphi}(\psi)
    }{\varphi \to (\psi \to \varphi)}(\varphi)
  \]
  \begin{logicproof}
    \ass{\varphi \to (\psi \to \chi)} \quad \ass{\varphi
    \to \psi} \quad \ass{\varphi}
    \\(toE)
    \psi \to \chi \quad \psi
    \\(toE)
    \chi
    \\(toI,\psi)
    \varphi \to \chi
    \\(toI, \varphi \to \psi)
    (\varphi \to \psi) \to (\varphi \to \chi)
    \\(toI, (\varphi \to (\psi \to \chi)))
    (\varphi \to (\psi \to \chi)) \to ((\varphi
    \to \psi) \to (\varphi \to \chi))
  \end{logicproof}
\end{example}
If $\Gamma$ is a set of propositions in the
language and $\varphi$ is a proposition, we write
$\Gamma \syn_{\text{IPC}} \varphi$, $\Gamma
\syn_{\text{IQC}} \varphi$, $\Gamma
\syn_{\text{CPC}} \varphi$, $\Gamma
\syn_{\text{CQC}} \varphi$, if there is a proof of
$\varphi$ from $\Gamma$ in the respective logic.

\begin{fclemma}[]
  % Lemma 1.1.4
  Assuming:
  - $\Gamma \syn_{\text{IPC}} \varphi$
  - $\psi$ a proposition
  Then:
  $\Gamma, \psi \syn_{\text{IPC}} \varphi$. Moreover, if $p$ is a
  primitive proposition and $\psi$ is any
  proposition, then
  \[
    \Gamma[p \defeq \psi] \syn_{\text{IPC}}
    \varphi[p \defeq \psi]
  .\]
\end{fclemma}

\begin{proof}
  Induction over the size of proofs.
\end{proof}

\subsection{The simply typed
\texorpdfstring{$\lambda$}{λ}-calculus}

\glssymboldefn{stype}%
\glsnoundefn{type}{type}{types}%
For now we assume given a set $\Pi$ of
\emph{simple types} generated by a grammar
\[
  \Pi \defeq U | \Pi \to \Pi
,\]
where $U$ is a countable set of \emph{type variables},
as well as an infinite set $V$ of variables.
