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

\begin{fcprop}[]
  % Proposition 1.4.3
  Assuming:
  - $L$ is a \gls{bdd} \gls{latt}
  - $\le$ is
  the order induced by the operations in $L$ ($a
  \le b$ if $a \wedge b = a$)
  Then:
  $\le$ is a partial order with least element
  $\bot$, greatest element $\top$, and for any $a,
  b \in L$, we have $a \wedge b = \inf \{a, b\}$
  and $a \wedge b = \sup \{a, b\}$.

  Conversely, every partial order with all finite
  infs and sups is a \gls{bdd} \gls{latt}.
\end{fcprop}

\begin{proof}
  Exercise.
\end{proof}

Classically, we say that $\Gamma \models t$ if for
every valuation $v : L \to \{0, 1\}$
with $v(p) = 1$ for all $p \in \Gamma$ we have
$v(t) = 1$.

We might want to replace $\{0, 1\}$ with some
other \gls{ba} to get a semantics for \gls{ipc},
with an accompanying Completeness Theorem. But
\glspl{ba} believe in the Law of Excluded Middle!

\begin{fcdefn}[Heyting algebra]
  \glsnoundefn{ha}{Heyting algebra}{Heyting
  algebras}%
  \glsnoundefn{hh}{Heyting homomorphism}{Heyting
  homomorphisms}%
  \glssymboldefn{himplies}%
  % Definition 1.4.4
  A Heyting algebra is a \gls{bdd} \gls{latt}
  equipped with a binary operation $\Rightarrow : H
  \times H \to H$ such that
  \[
    a \wedge b \le c \qquad \iff \qquad a \le (b
    \Rightarrow
    c)
  \]
  for all $a, b, c \in L$.

  A morphism of Heyting algebras is a function
  that preserves all finite meets, finite joins,
  and $\Rightarrow$.
\end{fcdefn}

\begin{example}
  % Example 1.4.5
  \phantom{}
  \begin{enumerate}[(1)]
    \item Every \gls{ba} is a \gls{ha}: define $a
      \himplies b \defeq a^* \vee b$, where $a^*$
      is the complement of $a$. Note that we must
      have $a^* = (a \himplies \bot)$.
    \item Every topology on a set $X$ is a
      \gls{ha}, where
      \[
        (U \himplies V) \defeq \interior((X \setminus U)
        \cup V)
      .\]
      \begin{center}
        \includegraphics[width=0.6\linewidth]{images/009f0a6ea60647ed.png}
      \end{center}
    \item A finite \gls{dist} \gls{latt} has to be
      a \gls{ha} (see Example Sheet 2).
  \end{enumerate}
\end{example}

\begin{fcdefn}[Valuation in Heyting algebras]
  \glsnoundefn{valt}{valuation}{valuations}%
  \glsnoundefn{hvalt}{$H$-valuation}{$H$-valuations}%
  \glsadjdefn{hvalid}{$H$-valid}{proposition}%
  \glssymboldefn{hmodels}%
  % Definition 1.4.6
  Let $H$ be a \gls{ha} and $L$ be a propositional
  language with a set $P$ of primitive
  propositions. An \emph{$H$-valuation} is a
  function $v : P \to H$, extended to the whole of
  $L$ recursively by setting:
  \begin{citems}
    \item $v(\false) = \bot$,
    \item $v(A \pand B) = v(A) \wedge v(B)$,
    \item $v(A \por B) = v(A) \vee v(B)$,
    \item $v(A \to B) = v(A) \himplies v(B)$.
  \end{citems}
  A proposition $A$ is \emph{$H$-valid} if $v(A) =
  \top$ for all $H$-valuations $v$, and is an
  \emph{$H$-consequence} of a (finite) set of
  propositions $\Gamma$ if $v(\bigwedge \Gamma) \le
  v(A)$ for all $H$-valuations $v$ (written $\Gamma \models_H A$).
\end{fcdefn}

\begin{fclemma}[Soundness of Heyting semantics]
  \label{hssoundness}
  % Lemma 1.4.7
  Assuming:
  - $H$ is a \gls{ha}
  - $v : L \to H$ is a \gls{valt}
  Then:
  $\Gamma \syn_{\text{IPC}} A$ implies $\Gamma
  \hmodels A$.
\end{fclemma}

\begin{proof}
  By induction over the structure of the proof
  $\Gamma \syn A$.
  \begin{enumerate}[($\to$-I)]
    \item[(Ax)] As $v((\bigwedge \Gamma) \wedge A)
      = v(\bigwedge) \wedge v(A) \le v(A)$ for any
      $\Gamma$ and $A$.
    \item[($\pand$-I)] $A = B \wedge C$ and we
      have derivations $\Gamma_1 \syn B$, $\Gamma_2
      \syn C$, with $\Gamma_1, \Gamma_2 \subseteq
      \Gamma$. By the induction hypothesis, we
      have $v(\bigwedge \Gamma) \le v(\bigwedge
      \Gamma_1) \cap v(\bigwedge \Gamma_2) \le
      v(B) \wedge v(C) = v(B \wedge C) = v(A)$,
      i.e. $\Gamma \hmodels A$.
    \item[($\to$-I)] $A = B \to C$ and so we must
      have $\Gamma \cup \{B\} \syn C$. By
      induction hypothesis, we have $v(\bigwedge
      \Gamma) \wedge v(B) = v(\bigwedge \gamma
      \wedge B) \le v(C)$. By the definition of
      $\himplies$, this implies $v(\bigwedge
      \Gamma) \le [v(B) \himplies v(C)] = v(B \to
      C) = v(A)$, i.e. $\Gamma \hmodels A$.
    \item[($\por$-I)] $A = B \por C$ and without
      loss of generality we have a derivation
      $\Gamma \syn B$. By the induction hypothesis
      we have $v(\bigwedge \Gamma) \le v(B)$, but
      $v(B \por C) = v(B) \vee v(C)$, and hence
      $v(B) \le v(B \vee C) = v(A)$.
