\documentclass[12pt]{article}
\usepackage{513defs2017}                   % 513defs.sty is my standard tex macros
\longwide
\begin{document}
\noindent\framebox[\textwidth]{
{\normalsize CS513:} \hfill {\bf Lecture 9:  Skolemization and First-Order Resolution} \hfill
{10/4/17, scribe: Itamar Levy-Or}}


\bbf{Recall:} 
\bbf{Completeness Theorem for PropCalc}:  Let $\Gamma \subseteq \pfmla$,
\quad $ \Gamma \models \bot \qLra \Gamma \proves \Box $.

That is, a set of propositional formulas, $\Gamma$, is unsatisfiable iff from $\Gamma$ written in
CNF as a set of clauses, where a  clause is a set of literals, we can use resolution to derive the
empty clause, $\Box$, from $\Gamma$.
 
\bbf{Resolution Method for Proving Propositional Formulas from a Set of Assumptions:}

To prove, $\Gamma \proves \alpha$, we show that $\Gamma \cup \set{\lnot \alpha} \proves \Box$.
 
\bbf{Example:}  Show that $(\alpha \rightarrow \beta) \land (\beta \rightarrow \gamma) \proves
(\alpha \rightarrow \gamma)$

Let $\Gamma' = \set{(\alpha \rightarrow \beta), (\beta \rightarrow \gamma), \lnot (\alpha \rightarrow
  \gamma)}$.  

Put into CNF, $\Gamma' = \set{C_1, C_2, C_3, C_4}$  where

$C_1 = \set{\lnot \alpha, \beta}$; $C_2 = \set{\lnot \beta, \gamma}$; 
$C_3 = \set{\alpha}$;  $C_4 = \set{\lnot\gamma}$ 
 
$C_5 \eqdef \Res(C_1, C_3) = \set{\beta}$

$C_6 \eqdef \Res(C_5, C_2) = \set{\gamma}$

$C_7 \eqdef \Res(C_6, C_4) = \Box$


\vspace*{.1in}




\begin{center}
\bbf{$\fosat$, $\fovalid$ and $\founsat$}

\vspace*{.1in}


\includegraphics[width =.8\textwidth]{fig/FOValid.pdf}
\end{center}

 


\begin{eqnarray*}
\mbox{\bbf{Define:}} \quad \fovalid &=& \bigset{\phi \in \sel(\Sigma)}{\mbox{for all } \A \in \struc{\Sigma}\, \A \models
  \phi}\\
\fosat &=& \bigset{\phi \in \sel(\Sigma)}{\mbox{for some } \A \in \struc{\Sigma}\, \A \models
  \phi}\\
\founsat &=& \bigset{\phi \in \sel(\Sigma)}{\mbox{for all } \A \in \struc{\Sigma}\, \A \models \lnot\phi}\\
\end{eqnarray*}

Recall that $\sat$ is NP complete.  We will see later that $\fovalid$ is r.e. complete, i.e., it is
undecidable and has the same complexity as the halting problem.

Note that there is a simple reduction from $\fovalid$ to $\founsat$ and the same reduction also
reduces $\founsat$ to $\fovalid$.  We write $A \leq B$ to mean that there is a first-order reduction
from $A$ to $B$.  Thus  complexity$(A) \leq$ complexity$(B)$.  The reduction in this case is just
taking the negation, i.e., for all $\phi\in\sel(\Sigma)$,
\[\phi \in \fovalid \qLra \lnot \phi \in \founsat \].

Later we will see that $\fovalid$ is r.e. complete.  From this it follows that so is $\founsat$, and
$\fosat$ is thus co-r.e. complete.


\vspace*{.1in}

 
\begin{center}
\bbf{Resolution Theorem Proving for FO}
\end{center}

To prove $\phi \in \sel(\Sigma)$ we will try to use resolution to derive $\Box$  from the
assumption, $\lnot \phi$.


First, put $\phi$ into rectified prenex form (RPF) and put its quantifier-free part into CNF.
 
\bbf{Aristotle's Example:}  All people are mortal, Socrates is a person, therefore Socrates is mortal:
 
Let $\Sigma_A = (P^1, M^1;s)$, where we have in mind that $P$ represents people, $M$ represents
mortal, and the constant symbol, $s$, represents Socrates.

\bbf{Goal:} show that $\set{\forall x (P(x) \rightarrow M(x)), P(s)} \proves M(s)$.
 
To do this we will show that  $\set{\forall x (P(x) \rightarrow M(x)), P(s), \lnot M(s)} \proves \Box$.
 
Let $\gamma = \forall x (P(x) \rightarrow M(x)) \land P(s) \land \lnot M(s)$.

Put $\gamma$ into RPF, with its quantifier-free part in CNF:
 
$\gamma \sE \forall x ((\lnot P(x) \lor M(x)) \land P(s) \land \lnot M(s))$

Thus, $\gamma = \set{C_1, C_2, C_3}$ where 

$C_1 = \set{\lnot P(x), M(x)}, C_2 = \set{P(s)}, C_3= \set{\lnot M(s)}$ and the variable, $x$, is
  understood to be universally quantified.

In order to perform resolution we substitute $s$ for $x$ in $C_1$ which we may do because of the
universal quantifier, i.e., from $C_1$, we know $C_1[x/t]$ for any term $t \in \term(\Sigma_a)$.

$C_4 \eqdef \Res(C_1[x/s],C_2) = \set{M(s)}$

$C_b \eqdef \Res(C_4,C_3) = \Box$.


\vspace*{.1in}


\begin{center}
\bbf{Skolemization: Getting rid of the $\exists$'s}
\end{center}


 \bbf{Idea:} Once $\phi$ is in RPF, we will convert $\phi$ to it's Skolemization:  $\phi_S$. To do
 this, we replace existentially quantified variables with a new function symbol applied 
to the variables that have been previously universally quantified.

We will see:

\bbf{Skolem's Theorem:} For any $\phi\in \sel(\Sigma)$, we can construct $\phi_S \in \sel(\Sigma')$
such that $\phi$ and $\phi_S$ are equi-satisifiable, i.e., $\phi \in \fosat \Leftrightarrow \phi_S
\in \fosat$.  

\bbf{As James points out:} $\alpha_S$ will usually not be equivalent to $\alpha$, but it will be the
case that $(\alpha_S \rightarrow \alpha) \in \fovalid$.
 
\bbf{First Skolemization Example:} $\alpha \se \exists x \forall y (x + y = y)$.  Note that $\alpha$
says that there is an  identity element for addition.

$\alpha_S = \forall y(c+y= y)$.  This says that $c$ is the identity element for addition. Note that
$\alpha_S$ implies $\alpha$ and it is more specific:  not ony is there an identity element for
addition, but we pick a particular one and give it a name, the new Skolem constant symbol, $c$.
 

\vspace*{.1in}

\bbf{Second Skolemization Example:} $\beta \se \forall x \exists y \; E(x,y)$.  $\beta$ says that
every vertex has an outgoing edge.  
 
$\beta_S \se \forall x \; E(x,f(s))$

Here $f$ is a new unary Skolem function symbol.  Observe that $\beta_S \rightarrow \beta$. $\beta_S$
is more specific than $\beta$.  Not only does every vertex have at least one outgoing edge, but the
function $f$ picks one.


\vspace*{.1in}

\gbf{Next time:  General First-Order Theorem Proving with Resolution}
 
\end{document}
