\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[10pt]{beamer}

\usepackage[english]{babel}
%\usepackage{multicol}
%\usepackage{amsmath,amssymb,amsthm,amsfonts}
%\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps}
%\usepackage{hyperref}
%\usepackage{algorithmic}
%\usepackage{algorithm}
%\usepackage{marvosym}
%\usepackage{graphics}
%\usepackage{xcolor}
%\usepackage{fancybox}
%\usepackage{listings}
\usepackage{xcolor}
\usepackage{ulem}

\newcommand{\msout}[1]{\text{\sout{\ensuremath{#1}}}}

%\newtheorem{theorem}{Theorem}
%\newtheorem{lemma}[theorem]{Lemma}
%\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
%\newtheorem{definition}{Definition}
\newtheorem{notation}{Notation}
\newtheorem{remark}{Remark}

\newcommand{\setT}{ {\mathbb T} }
\newcommand{\setF}{ {\mathbb F} }
\newcommand{\setN}{ {\mathbb N} }
\newcommand{\setZ}{ {\mathbb Z} }
\newcommand{\setQ}{ {\mathbb Q} }

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist

% beamer footnotes http://www.math.umbc.edu/~rouben/beamer/quickstart-Z-H-17.html#node_sec_17

\usepackage[absolute,overlay]{textpos}
\newenvironment{reference}[2]{%
\begin{textblock*}{\textwidth}(#1,#2)
      \footnotesize\it\bgroup\color{red!50!black}}{\egroup
\end{textblock*}}



\newcommand*\oldmacro{}
\let\oldmacro\insertshortauthor% save previous definition
\renewcommand*\insertshortauthor{%
\leftskip=.3cm% before the author could be a plus1fill ...
\insertframenumber\,/\,\inserttotalframenumber\hfill\oldmacro}

\setbeamercovered{transparent}

\usefonttheme{structurebold}

\setbeamertemplate{navigation symbols}{}
%\setbeamertemplate{footline}[frame number] % to have the slides numbered including the first one


\newenvironment{mylisting}
{\begin{list}{}{\setlength{\leftmargin}{1em}}\item\small\tt}
{\end{list}}

\newenvironment{listing}
{\begin{list}{}{\setlength{\leftmargin}{-2em}}\item \footnotesize}
{\end{list}}

\newenvironment{glists}[4]{
                 \begin{list}{}{
                     \setlength{\labelwidth}{#2}
                     \setlength{\labelsep}{#3}
                     \setlength{\leftmargin}{#1}
                     \addtolength{\leftmargin}{\labelwidth}
                     \addtolength{\leftmargin}{\labelsep}
                     \setlength{\parsep}{#4}
                     \setlength{\topsep}{\parsep}
                     \setlength{\itemsep}{\parsep}
                     \setlength{\listparindent}{0in}
                     }
                 }{
                 \end{list}
                 }
\newenvironment{clists}{
\begin{glists}{0em}{3.5em}{0.5em}{0.5em}
}{
\end{glists}
}
\newenvironment{slists}{
\begin{glists}{0em}{2.0em}{0.5em}{0.5em}
}{
\end{glists}
}
\newcommand{\iteml}[1]{\item[#1 \hfill]}
\newcommand{\itemr}[1]{\item[\hfill #1]}
\newcommand{\itemc}[1]{\item[\hfill #1 \hfill]}
\newcommand{\bitem}[1]{\item[$\bullet$ #1 \hfill]}
\newcommand{\ditem}[1]{\item[$\diamond$ #1 \hfill]}
\newcommand{\citem}[1]{\item[\sf #1\hfill]}


%\def\autorightarrow#1#2{{\displaystyle\operatorname*{\downarrow}^{#1}_{#2}}}
%\newcommand{\ForAll}[1]{\underset{#1}\forall}
%\newcommand{\Exists}[1]{\underset{#1}\exists}

%==========
\title[FOL]%(optional, only for long titles)
{Logic 1}
\subtitle{\textit{First-Order Logic}}

\author[Era\c{s}cu, Jebelean] % (optional, for multiple authors)
{M\u{a}d\u{a}lina Era\c{s}cu
\and Tudor Jebelean}
\institute[RISC] % (optional)
{Research Institute for Symbolic Computation,\\
 Johannes Kepler University, Linz, Austria
 \medskip

\texttt{\{merascu,tjebelea\}@risc.jku.at}

}

\date{November 21, 2013}

\titlegraphic{
\centering{
  \includegraphics[height=1.0cm]{RISClogo}
}
}


\begin{document}

\frame{\titlepage}
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Outline}
    \tableofcontents[currentsection]
  \end{frame}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% sec: Syntax %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Syntax}
\frame{\frametitle{Syntax}

The language of FOL consists in \textcolor{red}{terms} and \textcolor{red}{formulas}.

\smallskip

\begin{overprint}
\onslide<2->{

\textcolor{red}{Terms} are defined recursively as follows:
\begin{enumerate}
\item<3-> A constant is a term.
%
\item<4-> A variable is a term.
%
\item<5-> If $f$ is an $n$-place function symbol, and $t_1$, ..., $t_n$ are terms then $f[t_1,...,t_n]$ is a term.
%
\item<6-> All terms are generated by applying the above rules.
\end{enumerate}
}

\onslide<7->{

\medskip

If $P$ is an $n$-place predicate symbol and $t_1$, ..., $t_n$ are terms then $P[t_1,...,t_n]$ is an atom.
\smallskip

}

\onslide<8->{

\medskip An \textcolor{red}{atom} is $\setT$, $\setF$, or an $n$-ary predicate applied to $n$ terms.

\smallskip

}

\onslide<9->{

\medskip A \textcolor{red}{literal} is an atom or its negation.

\smallskip

}
\end{overprint}
}%endframe

\frame{\frametitle{Syntax (cont'd)}

\begin
{overprint}

\onslide<1->{

\textcolor{red}{Formulas} are defined as follows:
}

\onslide<2->{
\begin{enumerate}
\item<2-> An atom is a formula.
%
\item<3-> If $F$ and $G$ are formulas then $\neg F$, $F \vee G$, $F \wedge G$, $F \Longrightarrow G$, and $F \iff G$ are formulas.
%
\item<4-> If $F$ is a formula and $x$ is a variable, then $\underset{x} \forall F$ and $\underset{x} \exists F$ are formulas.
%
\item<5-> Formulas are generated only by a finite number of applications of the above rules.
%
\end{enumerate}


\smallskip
}

\onslide<6->{
A variable $x$ is \textcolor{red}{bound} in the formula $F$ if there is an occurrence
of $x$ in the scope of a binding quantifier $\underset{x}\forall$ or �$ \underset{x} \exists$.
\smallskip
}

\onslide<7->{
A variable $x$ is \textcolor{red}{free} in the formula $F$ if there is an occurrence of $x$ that is not bound by any quantifier.
\smallskip

}

\onslide<8->{\textcolor{ForestGreen}{Examples:} Identify constants, variables (free, bound), quantifiers, functions, predicates, atoms, terms, formulas from the bellow

\begin{enumerate}
\item<9-> $\underset{x} \forall \ x + 1 \ge x$
\item<10-> $\neg \left( \underset{x} \exists \ E[0,f[x]]\right)$
\item<11-> $\underset{x} \forall \ \underset{y} \exists
\left( E[y, f[x]] \ \wedge \ \underset{z} \forall \left( E[z, f[x]] \Rightarrow E[y,z]\right) \right)$
\end{enumerate}

}
\end{overprint}
}%endframe



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% sec: Semantics %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Semantics}
\frame{\frametitle{Semantics}
\begin{overprint}
\onslide<1->{

An \textcolor{red}{interpretation} $I$ of a formula $F$ in FOL consists of a nonempty domain $D$ and an assignment of values to each constant, function, symbol and predicate symbol occurring in $F$ as follows:

\begin{itemize}
\item<2-> to each constant we assign an element in $D$
%
\item<3-> to each function symbol we assign a mapping from $D^n$ to D
%
\item<4-> to each predicate symbol we assign a mapping from $D^n$ to $\{\setT,\setF\}$.
\end{itemize}

\medskip
}

\onslide<5->{

Then the semantics of the formula $F$ is a function $f : \mathcal{I} \rightarrow \{\setT,\setF\}$, where $I \in \mathcal{I}$ and $\mathcal{I}$ is the set of all interpretations of the formula $F$.

}

\end{overprint}


}%endframe

\frame{\frametitle{Semantics (cont'd)}
\textcolor{ForestGreen}{Example:} Find the truth value of the formulas:

\begin{itemize}
\item $F_{1}:\iff\underset{x}{\forall}\ \underset{y}{\forall}\ x\leq y$,
\ where $\ I:\left\{
\begin{tabular}
[c]{l}%
$D=\{0,1\}$\\
$\leq_{I}$ $\rightarrow$ $\leq_{\mathbb{Z}}$%
\end{tabular}
\ \ \right.  $

\item $F_{2}:\iff\underset{x}{\forall}\ \underset{y}{\exists}\ x+y>c$, \ where
$\ I:\left\{
\begin{tabular}
[c]{l}%
$D=\{0,1\}$\\
$c_{I}=0$\\
$+_{I}$ $\rightarrow$ $+_{\mathbb{Z}}$\\
$>_{I}$ $\rightarrow$ $>_{\mathbb{Z}}$%
\end{tabular}
\ \ \right.  $

\item
$F_{3}:\iff\underset{x}{\forall}\ \left(  P[x]\Longrightarrow
Q[f[x],a]\right)  $, where
\[
I:\left\{
\begin{tabular}
[c]{ll}%
$D=\{1,2\}$ & \\
$a_{I}=1$ & \\
$f_{I}:D\rightarrow D$ & $\left\{
\begin{tabular}
[c]{l}%
$f_{I}[1]=1$\\
$f_{I}[2]=1$%
\end{tabular}
\right.  $\\
$P_{I}:D\rightarrow\left\{  {\mathbb{T},\mathbb{F}}\right\}  $ & $\left\{
\begin{tabular}
[c]{l}%
$P_{I}[1]=\mathbb{T}$\\
$P_{I}[2]=\mathbb{F}$%
\end{tabular}
\right.  $\\
$Q_{I}:D^{2}\rightarrow\left\{  {\mathbb{T},\mathbb{F}}\right\}  $ & $\left\{
%
\begin{tabular}
[c]{ll}%
$Q_{I}[1,1]=\mathbb{T}$ & $Q_{I}[1,2]=\mathbb{F}$\\
$Q_{I}[2,1]=\mathbb{F}$ & $Q_{I}[2,2]=\mathbb{T}$%
\end{tabular}
\right.  $%
\end{tabular}
\right.
\]

\end{itemize}


	} %endframe
	
	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%% sec: Satisfiability and Validity %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{(Un)Satisfiability \& (In)Validity}
\frame{\frametitle{(Un)Satisfiability \& (In)Validity}

\begin{overprint}
\onslide<1->{
A formula $F$ is \textcolor{red}{satisfiable (consistent)} iff there exists an interpretation $I$ such that $F$ is evaluated to $\setT$ in $I$.

\smallskip
}

\onslide<2->{
A formula $F$ is \textcolor{red}{unsatisfiable (inconsistent)} iff for all interpretations $I$, $F$ is evaluated to $\setF$ in $I$.

\smallskip
}

\onslide<3->{
A formula $F$ is \textcolor{red}{valid} iff for all interpretations $I$, $F$ is evaluated to $\setT$ in $I$.

\smallskip
}

\onslide<4->{
A formula $F$ is \textcolor{red}{invalid} iff there exists an interpretation $I$, such that $F$ is evaluated to $\setF$ in $I$.

\smallskip
}

\onslide<5->{
A formula $G$ is a \textcolor{red}{logical consequence} of formulas $F_1$, $F_2$, ..., $F_n$ iff for every interpretation $I$, if $F_1 \ \wedge \ F_2 \ \wedge \ ...\ \wedge \ F_n$ is true in $I$, $G$ is also true in $I$.

\smallskip
}

\onslide<6->{
\textcolor{red}{Note that validity and satisfiability applies to closed formulas.}

\medskip
}

\onslide<7->{\textcolor{ForestGreen}{Examples:} Prove that
\begin{itemize}
\item<5-> $\underset{x} \forall P[x] \ \wedge \ \underset{y} \exists \neg P[y] $ is inconsistent.
\end{itemize}
}

\end{overprint}
}%endframe



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% sec: Normal Forms %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Equivalences of Formulas}
\frame{\frametitle{Equivalences of Formulas}

\begin{overprint}
\only<1>{
Two formulas $F$ and $G$ are \textcolor{red}{equivalent} iff the truth values of $F$ and $G$ are the same under any interpretation.
}
\onslide<2->{
\begin{changemargin}{-0.5cm}{-0.5cm}
\begin{tabular}{l||l}
$F\iff G\ \ \equiv \ \ \left( F\Rightarrow G\right) \wedge \left(
G\Rightarrow F\right) $ &  \\
$F\Rightarrow G\ \ \equiv \ \ \lnot F\vee G$ &  \\
$F\vee G\ \ \equiv \ \ G\vee F$ & $F\wedge G\ \ \equiv \ \ G\wedge F$ \\
$\left( F\vee G\right) \vee H\ \ \equiv \ \ F\vee \left( G\vee H\right) $ & $%
\left( F\wedge G\right) \wedge H\ \ \equiv \ \ F\wedge \left( G\wedge
H\right) $ \\
$F\vee \left( G\wedge H\right) \ \ \equiv \ \ \left( F\vee G\right) \wedge
\left( F\vee H\right) $ & $F\wedge \left( G\vee H\right) \ \ \equiv \ \
\left( F\wedge G\right) \vee \left( F\wedge H\right) $ \\
$F\vee \mathbb{T}\ \ \equiv \ \ \mathbb{T}$ & $F\wedge \mathbb{T}\ \ \equiv
\ \ F$ \\
$F\vee \mathbb{F}\ \ \equiv \ \ F$ & $F\wedge \mathbb{F}\ \ \equiv \ \
\mathbb{F}$ \\
$F\vee \lnot F\ \ \equiv \ \ \mathbb{T}$ & $F\wedge \lnot F\ \ \equiv \ \
\mathbb{F}$ \\
$\lnot \left( \lnot F\right) \ \ \equiv \ \ F$ &  \\
$\lnot \left( F\vee G\right) \ \ \equiv \ \ \lnot F\wedge \lnot G$ & $\lnot
\left( F\wedge G\right) \ \ \equiv \ \ \lnot F\vee \lnot G$ \\
$(Qx)F[x]\vee G\ \ \equiv \ \ (Qx)\left( F[x]\vee G\right) $ & $%
(Qx)F[x]\wedge G\ \ \equiv \ \ (Qx)\left( F[x]\wedge G\right) $ \\
$\lnot \underset{x}{\forall }F[x]\ \ \equiv \ \ \underset{x}{\exists }\lnot
F[x]$ & $\lnot (\underset{x}{\exists }x)F[x]\ \ \equiv \ \ \underset{x}{%
\forall }\lnot F[x]$ \\
\textcolor{red}{$\underset{x}{\forall }F[x]\ \vee \ \underset{x}{\forall }G[x]\ \ \not\equiv
\ \ \underset{x}{\forall }\left( F[x]\ \vee \ G[x]\right) $} & $\underset{x%
}{\forall }F[x]\wedge \underset{x}{\forall }G[x]\ \ \equiv \ \ \underset{x}{%
\forall }\left( F[x]\wedge G[x]\right) $ \\
$\underset{x}{\exists }F[x]\vee \underset{x}{\exists }G[x]\ \ \equiv \ \
\underset{x}{\exists }\left( F[x]\vee G[x]\right) $ & \textcolor{red}{$\underset{x}{\exists }%
F[x]\ \wedge \ \underset{x}{\exists }G[x]\ \ \not\equiv \ \ \underset{x}{%
\exists }\left( F[x]\ \wedge \ G[x]\right)$}
\end{tabular}
\end{changemargin}

}

\onslide<3->{\textcolor{red}{Which implications do not hold in the $\not\equiv$ above?}

\smallskip

\onslide<4->{
\begin{changemargin}{-0.5cm}{-0.5cm}
\begin{tabular}{l||l}
  $\qquad\qquad \qquad \qquad \textcolor{red}{\Longrightarrow} \qquad\qquad \qquad \quad \!$
& $\qquad\qquad \qquad \qquad \textcolor{red}{\not \Longrightarrow}$ \\
  $\qquad\qquad \qquad \qquad \textcolor{red}{\not\Longleftarrow}$
& $\qquad\qquad\qquad \qquad \textcolor{red}{\Longleftarrow}$
\end{tabular}
\end{changemargin}

}


}


\end{overprint}


} %endframe

\frame{\frametitle{Equivalences of Formulas (cont'd)}

\textcolor{red}{Note that}

\medskip

\begin{tabular}{l}
\textcolor{red}{$\underset{x}{\forall }F[x]\vee \underset{x}{\forall }G[x]\ \ \equiv \ \
\underset{x}{\forall }F[x]\vee \underset{y}{\forall }G[y]\ \ \equiv \ \
\underset{x,y}{\forall }F[x]\vee G[y]$} \\
\textcolor{red}{$\underset{x}{\exists }F[x]\ \wedge \ \underset{x}{\exists }G[x]\ \ \equiv \
\ \underset{x}{\exists }F[x]\wedge \underset{y}{\exists }G[y]\ \ \equiv \ \
\underset{x,y}{\exists }F[x]\wedge G[y]$}
\end{tabular}

} %endframe


\section{Normal Forms}
\frame{\frametitle{Normal Forms}

\begin{overprint}
\onslide<1->{

Normal forms:


\begin{enumerate}
\item<2-> CNF

\item<3-> DNF

\item<4-> negation normal form (NNF)

\item<5-> prenex normal form (PNF)

\item<6-> Skolem standard form
\end{enumerate}

\medskip

}

\onslide<7->{
\textcolor{red}{Negation normal form (NNF)} requires that $\neg$, $\wedge$, and $\vee$ to be the only logical connectives and that negations appear only in literals.

\medskip

}


\onslide<8->{
A formula $F$ in FOL is said to be in \textcolor{red}{prenex normal form (PNF)} iff the formula is in the form $(Q_1 x_1)...(Q_n x_n)\ M$, where $Q_i \in \{\forall,\exists \}$ and $M$ is quantifier-free.

\medskip

}

\onslide<9->{

A FOL formula is in \textcolor{red}{Skolem standard form} if it is of the form $\underset{x_1,...,x_n}\forall M, $
where $M$ is a quantifier-free formula in CNF.

\medskip

}
\end{overprint}


}%endframe

\frame{\frametitle{Normal Forms (cont'd)}

\begin{overprint}
\onslide<1->\textcolor{ForestGreen}{Examples:}

\begin{enumerate}
\item<2-> Prove the following by bringing the formulas into conjunctive normal form
\[
\left(  \underset{x}{\forall}P[x]\right)  \Rightarrow Q\text{ \ }\equiv\text{
\ }\underset{x}{\exists}\left(  P[x]\Rightarrow Q\right)  .
\]
\item<3-> Bring the following formulas into Skolem standard form

\begin{itemize}
\item<4-> \[
\underset{x}{\forall}\ \underset{y,z}{\exists}\left(  (\lnot P[x,y]\text{
}\wedge\text{ }Q[x,z])\text{ }\vee\text{ }R[x,y,z]\right)
\]
\item<5-> \[
\underset{x,y}{\forall}\left(  \underset{z}{\exists}P[x,z]\wedge
P[y,z]\right)  \text{ }\Rightarrow\text{ }\underset{u}{\exists}Q[x,y,u]
\]
\end{itemize}

\end{enumerate}

\end{overprint}

}

%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%% sec: Formula Clausification %%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Formula Clausification}

\frame{\frametitle{Formula Clausification}
\begin{overprint}
\onslide<1->{

A \textcolor{red}{clause} is a disjunction of literals.

\smallskip

}
%
\onslide<2->{

\textcolor{ForestGreen}{Examples:} $\neg P[x] \vee Q[y,f[x]]$, $P[x]$

\smallskip

}
%
\onslide<3->{

A \textcolor{red}{set of clauses} $S$ is regarded as a conjunction of all clauses in $S$, where every variable in $S$ is considered governed by a universal quantifier.

\smallskip

}
%
\onslide<4->{

\textcolor{ForestGreen}{Example:} Let \[
\underset{x}{\forall}\ \underset{y,z}{\exists}\left(  (\lnot P[x,y]\text{
}\wedge\text{ }Q[x,z])\text{ }\vee\text{ }R[x,y,z]\right)
\]

The standard form of the formula above, that is

\begin{align*}
 &  \ \ \underset{x}{\forall}\left(  (\lnot P[x,f[x]]\text{ }\vee\text{
}R[x,f[x],g[x]])\text{ }\wedge\text{ }(Q(x,g[x])\text{ }\vee\text{
}R[x,f[x],g[x]])\right)
\end{align*}

can be represented by the following set of clauses

$$\left \{  \lnot P[x,f[x]]\text{ }\vee\text{
}R[x,f[x],g[x]],  Q(x,g[x])\text{ }\vee\text{
}R[x,f[x],g[x]] \right \}$$

}
%
\onslide<5->{

\textcolor{red}{Note that}, if $S$ is a set of clauses that represents a standard form of a formula $F$, then $F$ is inconsistent iff $S$ is inconsistent.
\smallskip

}
\end{overprint}
} %endframe

\frame{\frametitle{Formulas Clausification (cont'd)}
\begin{overprint}

\onslide<1->{

\textcolor{ForestGreen}{Example :}

Transform the formulas $F_{1}$, $F_{2}$,$F_{3}$,$F_{4}$, and
$\lnot G$ into a set of clauses, where%
\[%
\begin{tabular}
[c]{ll}%
$F_{1}:$ & $\underset{x,y}{\forall}\ \underset{z}{\exists}P[x,y,z]$\\
& \\
$F_{2}:$ & $%
\begin{array}
[c]{l}%
\underset{x,y,z,u,v,w}{\forall}\left(  (P[x,y,u]\text{ }\wedge\text{
}P[y,z,v]\text{ }\wedge\text{ }P[u,z,w])
\text{ \ }\Rightarrow\text{
\ }P[x,v,w]\right)  \\
\wedge\\
\underset{x,y,z,u,v,w}{\forall}\left(  P[x,y,u]\text{ }\wedge\text{
}(P[y,z,v]\text{ }\wedge\text{ }P[x,v,w])\text{ \ }\Rightarrow\text{
\ }P[u,z,w]\right)
\end{array}
$\\
& \\
$F_{3}:$ & $\underset{x}{\forall}P[x,e,x]$ $\wedge$ $\underset{x}{\forall
}P[e,x,x]$\\
& \\
$F_{4}:$ & $\underset{x}{\forall}P[x,i[x],e]$ $\wedge$ $\underset{x}{\forall
}P[i[x],x,e]$\\
& \\
$G:$ & $\left(\underset{x}{\forall}P[x,x,e]\right)$ $\ \Rightarrow$ $\ \underset
{u,v,w}{\forall}\left(  P[u,v,w]\text{\ }\Rightarrow\text{ }P[v,u,w]\right)  $%
\end{tabular}
\ \ \
\]

} %endframe
%
%
\end{overprint}
} %endframe

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%% sec: Substitution \& Unification %%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Substitution}
\frame{\frametitle{Substitution}
\begin{overprint}
%\onslide<1->{
%\textcolor{red}{Motivation:} apply resolution principle to FOL formulas.
%
%\smallskip
%}

\onslide<2->{
\textcolor{ForestGreen}{Example:}
Let
\begin{equation*}
\begin{tabular}{lll}
$C_{1}:$ &  & $P[x]$ $\vee $ $Q[x]$ \\
$C_{2}:$ &  & $\lnot P[f[x]]$ $\vee $ $R[x]$%
\end{tabular}%
\end{equation*}%
}

\only<3-6>{
Let \textcolor{blue}{$x\rightarrow f[a]$} in $C_{1},$ \textcolor{blue}{$x\rightarrow a$} in $C_{2}.$

\smallskip
}

\only<4-6>{
We have%
\begin{equation*}
\begin{tabular}{lll}
$C_{1}^{\prime }:$ &  & $P[\textcolor{blue}{f[a]}]$ $\vee $ $Q[\textcolor{blue}{f[a]}]$ \\
$C_{2}^{\prime }:$ &  & $\lnot P[f[\textcolor{blue}{a}]]$ $\vee $ $R[\textcolor{blue}{a}]$%
\end{tabular}
\end{equation*}
}

\only<5,6>{
$C_{1}^{\prime }$ and $C_{2}^{\prime }$ are \textcolor{red}{ground} instances.

\smallskip
}

\only<6>{
A \textcolor{red}{resolvent} of $C_{1}^{\prime }$ and $C_{2}^{\prime }$ is
\begin{equation*}
\begin{tabular}{lll}
$C_{3}^{\prime }:$ &  & $Q[f[a]]$ $\vee $ $R[a]$%
\end{tabular}%
\end{equation*}
\smallskip
}

\onslide<7->
Let $\textcolor{blue}{x\rightarrow f[x]}$ in $C_{1}.$ We have

\smallskip


\onslide<8->{
\begin{equation*}
\begin{tabular}{lll}
$C_{1}^{\ast }:$ &  & $P[\textcolor{blue}{f[x]}]$ $\vee $ $Q[\textcolor{blue}{f[x]}]$%
\end{tabular}%
\end{equation*}
}

\onslide<8->{
$C_{1}^{\ast }$ is an \textcolor{red}{instance} of $C_{1}.$

\smallskip

}

\onslide<9->{

A resolvent of
\begin{equation*}
\begin{tabular}{lll}
$C_{2}:$ &  & $\lnot P[f[x]]$ $\vee $ $R[x]$ \\
$C_{1}^{\ast }:$ &  & $P[f[x]]$ $\vee $ $Q[f[x]]$%
\end{tabular}%
\end{equation*}
is%
}

\onslide<10->{

\begin{equation*}
\begin{tabular}{lll}
$C_{3}:$ &  & $Q[f[x]]$ $\vee $ $R[x]$%
\end{tabular}%
\end{equation*}
}

\onslide<11->{

$C_{3}^{\prime }$ is an instance of $C_{3}.$ $C_{3}$ is the \textcolor{red}{most general clause}.


\smallskip

}	


\end{overprint}

}%endframe

\frame{\frametitle{Substitution (cont'd)}


\begin{overprint}
\onslide<1->{

A \textcolor{red}{substitution} $\sigma$ is a finite set of the form $\{v_1 \rightarrow t_1, ..., v_n \rightarrow t_n \}$ where every $t_i$ is a term different from $v_i$ and no two elements in the set have the same variable $v_i$.

\medskip
}

\onslide<2->{
Let $\sigma$ be defined as above and $E$ be an expression. Then $E \sigma$ is an expression obtained from $E$ by replacing simultaneously each occurrence of $v_i$ in $E$ by the term $t_i$

\medskip

}

\onslide<3->{\textcolor{ForestGreen}{Example:} Let $\sigma = \{x \rightarrow z, z \rightarrow h[a,y]\}$ and $E = f[z,a,g[x],y]$. Then $E\sigma = f[h[a,y],a,g[z],y]$.

    \medskip

}

\end{overprint}

}%endframe

\frame{\frametitle{Substitution (cont'd)}


\begin{overprint}

\onslide<1->{Let
\begin{align*}
\theta &=\{x_{1}\rightarrow t_{1},\text{...},x_{n}\rightarrow t_{n}\} \\
\lambda & = \{y_{1}\rightarrow u_{1},\text{...},y_{n}\rightarrow u_{n}\}
\end{align*}

Then the \textcolor{red}{composition} of $\theta$ and $\lambda$ ($\theta \circ \lambda$) is obtained from the set
%
$$\{x_1 \rightarrow t_1 \lambda, ..., x_n \rightarrow t_n \lambda, y_{1}\rightarrow u_{1},\text{...},y_{n}\rightarrow u_{n}\}$$

by deleting any element $x_j \rightarrow t_j \lambda$ for which $x_j = t_j \lambda$ and any element $y_i \rightarrow u_i$ such that $y_i$ is among $\{x_1,...,x_n\}$.

\medskip

}

\end{overprint}

}%endframe

\frame{\frametitle{Substitution (cont'd)}


\begin{overprint}

\onslide<1->{\textcolor{ForestGreen}{Example 1:}
%
\begin{align*}
\theta &=\{ x \rightarrow f[y], y \rightarrow z \} \\
\lambda & = \{ x \rightarrow a, y \rightarrow b, z \rightarrow y \}
\end{align*}
}

\onslide<2->{Then
%
\begin{align*}
\theta \circ \lambda & = \{x \rightarrow f[b], y \rightarrow y, x \rightarrow a, y \rightarrow b, z \rightarrow y \}\\
                     & = \{x \rightarrow f[b], z \rightarrow y \}
\end{align*}

\smallskip

}

\onslide<3->{\textcolor{ForestGreen}{Example 2:}
%
\begin{align*}
\theta_1 &=\{ x \rightarrow a, y \rightarrow f[z], z \rightarrow y \} \\
\theta_2 & = \{ x \rightarrow b, y \rightarrow z, z \rightarrow g[x] \}
\end{align*}
}

\onslide<4->{Then
%
\begin{align*}
\theta_1 \circ \theta_2 & = \{x \rightarrow a, y \rightarrow f[g[x]], z \rightarrow z, x \rightarrow b, y \rightarrow z, z \rightarrow g[x]  \}\\
                        & =  \{x \rightarrow a, y \rightarrow f[g[x]]  \}
\end{align*}

\smallskip

}

\end{overprint}

}%endframe
%
%
%
%\frame{\frametitle{Unification}
%\begin{overprint}
%\onslide<1->{
%A substitution $\theta$ is called a \textcolor{red}{unifier} for a set $\{E_1,...,E_k\}$ iff $E_1 \theta = ... = E_k \theta $. The set $\{E_1,...,E_k\}$ is said to be \textcolor{red}{unifiable} iff there exists an unifier for it.
%
%\smallskip
%}
%
%\onslide<2->{
%A unifier $\sigma$ for a set $\{E_1,...,E_k\}$ of expressions is a \textcolor{red}{most general unifier} iff for each unifier $\theta$ for the set there is a substitution $\lambda$ such that $\theta = \sigma \circ \lambda$.
%
%\smallskip
%}
%
%\onslide<3->{\textcolor{ForestGreen}{Example:}
%%
%The set $\{P[a,y],P[x,f[b]]\}$ is unifiable since $\sigma = \{x\rightarrow a, y \rightarrow f[b]\}$ is a unifier for the set.
%}
%
%\end{overprint}
%}%endframe
%
%\frame{\frametitle{Unification Algorithm}
%\begin{overprint}
%\onslide<1->{
%\textcolor{red}{Unification algorithm} for finding a most general unifier (mgu), or its nonexistence, for a finite set of nonempty expressions.
%
%\smallskip
%}
%\onslide<2->{
%The \textcolor{red}{disagreement set} of a nonempty set $W$ of expressions is obtained by
%\begin{itemize}
%\item<3->locating the first symbol (starting from the left) at which not all the expressions in $W$ have exactly the same symbol and then
%\item<4-> extracting from each expression in $W$ the subexpression that begins with the symbol occupying that position.
%\end{itemize}
%
%\smallskip
%}
%
%\onslide<5->{\textcolor{ForestGreen}{Example:} The disagreement set of $\{P[a,x,f[g[y]]], P[z,f[z], f[u]]\}$ is $\{a,z\}$.
%}
%
%\end{overprint}
%} %endframe
%
%\frame{\frametitle{Unification Algorithm (cont'd)}
%\begin{overprint}
%
%\onslide<1->{
%\textcolor{red}{\textbf{Unification Algorithm}}
%\begin{enumerate}
%\item<2-> $k:= 0$, $W_k:=W$, $\sigma_k:=\varepsilon$
%\item<3-> If $W_k$ is singleton then stop; $\sigma_k$ is mgu of $W$. Otherwise find the disagreement set $D_k$ of $W_k$.
%\item<4-> If there exists $v_k,\ t_k\in D_k$ s.t. $v_k$ is a variable which does not occur in $t_k$, go to $4$. Otherwise, stop; $W$ is not unifiable.
%\item<5-> Let $\sigma_{k+1} = \sigma_k \circ \{v_k \rightarrow t_k\}$ and $W_{k+1} = W_{k} \{v_k \rightarrow t_k\}$.
%\item<6-> $k=k+1$ and go to $2$.
%
%\end{enumerate}
%
%\smallskip
%}
%
%\onslide<7->{
%\textcolor{ForestGreen}{Example:} Find a most general unifier for
%\begin{enumerate}
%\item<8-> $W = \{P[a,x,f[g[y]]], \ P[z,f[z],f[u]] \}$
%\item<9-> $W = \{Q[a], \ Q[b] \}$
%\item<10-> $W = \{ P[x], \ P[f[x]] \}$
%\item<11-> $W = \{ P[x], \ Q[y] \}$
%\end{enumerate}
%
%
%}
%\end{overprint}
%}%endframe
%
%
%
%
%
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%% sec: Resolution Principle for FOL  %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Resolution Principle for FOL}
%\frame{\frametitle{Resolution Principle for FOL}
%
%\begin{overprint}
%\onslide<1->{ If two or more literals (with the same sign) of a clause $C$ have $\sigma$ the mgu, then $C\sigma$ is called a \textcolor{red}{factor} of $C$.
%
%\smallskip
%
%}
%\onslide<2->{\textcolor{ForestGreen}{Example:} Let $C: \ P[x] \ \vee \ P[a] \ \vee \ Q[f[x]] \ \vee  Q[f[a]]$ be a clause. Then the mgu is $\sigma = \{x \rightarrow a\}$ and $C\sigma:\ P[a] \ \vee Q[f[a]]$ is a factor of $C$.
%
%\smallskip
%
%}
%\onslide<3->{ Let $C_1$ and $C_2$ be two clauses with \textit{no variables in common}. Let $L_1$ and $L_2$ be two literals in $C_1$ and $C_2$, respectively. If $L_1$ and $\neg L_2$ have mgu $\sigma$, then the clause $C_1 \sigma \ \vee \ C_2\sigma$ is called a \textcolor{red}{binary resolvent} of $C_1$ and $C_2$.
%
%\smallskip
%
%}
%
%\onslide<4->{\textcolor{ForestGreen}{Example:} Let
%
%\begin{align*}
%C_{1}: \ \  P[x] \vee Q[x] \\
%\alt<4>{C_{2}: \ \ \lnot P[a] \vee R[x]}{\msout{C_{2}: \ \ \lnot P[a] \vee R[x]}}
%\end{align*}%
%}
%\onslide<5->{
%By renaming $x$ with $y$ in $C_{2},$ we have%
%$$
%\begin{tabular}{lll}
%$C_{2}:$ &  & $\lnot P[a]$ $\vee $ $R[y]$%
%\end{tabular}%
%$$
%}
%\onslide<6->{
%Let $\sigma =\{x\rightarrow a\}$ a mgu of the literals $P[x]$ and $\lnot
%P[a].$ Then a binary resolvent of $C_{1}$ and $C_{2}$ is $Q[a]$ $\vee $ $%
%R[y].$
%\smallskip
%
%}
%\end{overprint}
%}%endframe
%
%\frame{\frametitle{Resolution Principle for FOL (cont'd)}
%
%\begin{overprint}
%\onslide<1->{\textcolor{red}{Resolution:} (Robinson, 1965)
%\begin{itemize}
%\item<2->is an inference rule which generates resolvents from a set of clauses
%\item<3->is a refutation proof procedure: empty clause is tried to be derived from a set of clauses
%\item<4->is \textcolor{red}{refutationally complete}: a set of clauses is unsatisfiable iff the empty clause can be derived
%\end{itemize}
%
%\smallskip
%
%}
%
%
%\onslide<5->{\textcolor{red}{\textbf{How does resolution work?}}
%
%\textcolor{red}{Given:} formulas $F_1$, ..., $F_n$\\
%\textcolor{red}{Prove:} $G$ by \textcolor{red}{resolution}.
%
%\smallskip
%
%\begin{enumerate}
%\item<6-> Bring $F_1$, ..., $F_n$, ..., $\neg G$ into standard form and write the clauses which are obtained
%\item<7-> Start derivation and try to obtain the empty clause from the set $C$ of clauses.
%\item<8-> In the derivation use resolution inference rule and factoring rules to derive new clauses; these new clauses are added to $C$.
%\item<9->  If the empty clause appears, stop: Contradiction found, $G$ is proved.
%\item<10-> If no step can be made and the empty clause is not found, then $H$ can not be proved.
%\end{enumerate}
%}
%
%\end{overprint}
%} %endframe
%
%\frame{\frametitle{Resolution Principle for FOL. Correctness \& Completeness}
%
%\begin{theorem}
%A set of clauses $S$ is unsatisfiable iff there is a deduction of the empty clause from $S$.
%\end{theorem}
%
%\begin{overprint}
%\onslide<2->{\textit{\textcolor{blue}{Proof.}}
%
%\smallskip
%
%}
%
%\onslide<3->{\textcolor{red}{"$\Longrightarrow$" (Completeness)}}
%
%\onslide<4->{... \smallskip }
%
%\onslide<3->{\textcolor{red}{"$\Longleftarrow$" (Correctness)} }
%
%\onslide<5->{
%\begin{itemize}
%\item<5-> Assume $S$ is satisfiable and derive a contradiction.
%\item<6-> Since there exists a deduction from $S$, we have the resolvents $R_1$,...$R_n$ obtained in this deduction.
%\item<7-> Since $S$ is satisfiable there exists an interpretation satisfying each clause in $S$.
%\item<8-> Any resolvent of any two clauses in $S$ is also satisfied by $I$, since \textcolor{red}{these resolvents are logical consequences of the two clauses}.
%\item<9> Hence $I$ satisfies $R_1$,...$R_n$ which is impossible since one of $R_i$ is the empty clause.
%\end{itemize}
%}
%%
%\end{overprint}
%
%} %endframe
%
%\frame{\frametitle{Resolution Principle for FOL. Correctness \& Completeness (cont'd)}
%
%\begin{lemma}
%Given two clauses $C_1$ and $C_2$, a resolvent $C$ of $C_1$ and $C_2$ is a logical consequence of $C_1$ and $C_2$.
%\end{lemma}
%
%\begin{overprint}
%\onslide<2->{\textit{\textcolor{blue}{Proof.}}}
%
%\onslide<3->{
%\smallskip
%
%Let%
%\begin{equation*}
%\begin{tabular}{lll}
%$C_{1}:$ &  & $L$ $\vee $ $C_{1}^{\prime }$ \\
%$C_{2}:$ &  & $\lnot L$ $\vee $ $C_{2}^{\prime }$%
%\end{tabular}%
%\end{equation*}%
%}
%
%\onslide<4->{
%\noindent We have to prove that
%
%\begin{equation*}
%L\vee C_{1}^{\prime },\text{ }\lnot L\vee C_{2}^{\prime }\text{ \ }\models
%\text{ \ }C_{1}^{\prime }\vee C_{2}^{\prime }
%\end{equation*}%
%}
%
%\onslide<5->{
%that is, for any interpretation $I$ if $\left\langle L\vee C_{1}^{\prime
%}\right\rangle _{I}=\left\langle \lnot L\vee C_{2}^{\prime }\right\rangle
%_{I}=\setT$ then $\left\langle C_{1}^{\prime }\vee C_{2}^{\prime
%}\right\rangle _{I}=\setT.$
%}
%\begin{itemize}
%\item<6-> Case $\left\langle L\right\rangle _{I}=\setT.$ Then $\left\langle
%C_{2}^{\prime }\right\rangle _{I}=\setT.$ Hence $\left\langle
%C_{1}^{\prime }\vee C_{2}^{\prime }\right\rangle _{I}=\setT.$
%%
%%
%\item<7-> Case $\left\langle L\right\rangle _{I}=\setF.$ Then $\left\langle
%C_{1}^{\prime }\right\rangle _{I}=\setT.$ Hence $\left\langle
%C_{1}^{\prime }\vee C_{2}^{\prime }\right\rangle _{I}=\setT.$
%\end{itemize}
%
%\end{overprint}
%} %endframe
%
%
%\frame{\frametitle{Resolution Principle for FOL. Examples}
%
%\begin{overprint}
%\onslide<1->{\textcolor{ForestGreen}{Example 0:} Let
%$$
%\begin{tabular}{lll}
%$C_{1}:$ &  & $P[x]$ $\vee $ $Q[x]$ \\
%$C_{2}:$ &  & $\lnot P[a]$ $\vee $ $R[x]$%
%\end{tabular}%
%$$
%
%Apply resolution.
%} %endframe
%
%\onslide<2->{\textcolor{ForestGreen}{Example 1:} Prove by resolution the following%
%\[
%\underset{x}{\forall}F[x]\text{ }\vee\text{ }\underset{x}{\forall}H[x]
%\ \ \ \not \equiv \ \ \ \underset{x}{\forall}\left(  F[x]\text{ }\vee\text{
%}H[x]\right)
%\]
%} %endframe
%
%
%\onslide<3->{\textcolor{ForestGreen}{Example 2:} Prove by resolution that $G$ is a logical consequence of
%$F_{1}$ and $F_{2}$ where%
%\[%
%\begin{tabular}
%[c]{ll}%
%$F_{1}:$ & $\underset{x}{\forall}\left(  C[x]\ \ \Rightarrow\ \ \left(
%W[x]\text{ }\wedge\text{ }R[x]\right)  \right)  $\\
%$F_{2}:$ & $\underset{x}{\exists}(C[x]$ $\wedge$ $O[x])$\\
%$G:$ & $\underset{x}{\exists}(O[x]$ $\wedge$ $R[x])$%
%\end{tabular}
%\]
%
%\medskip
%
%}
%
%
%
%\end{overprint}
%} %endframe
%
%
%
%
%\frame{\frametitle{Resolution Principle for FOL. Examples (cont'd)}
%
%\begin{overprint}
%
%\onslide<1->{\textcolor{ForestGreen}{Example 3:} Prove by resolution that $G$ is a logical consequence of
%$F_{1}$ and $F_{2}$ where%
%\[%
%\begin{tabular}
%[c]{ll}%
%$F_{1}:$ & $\underset{x}{\exists}\left(  P[x]\ \wedge\ \underset{y}{\forall
%}\left(  D[y]\text{ }\Rightarrow\text{ }L[x,y]\right)  \right)  $\\
%$F_{2}:$ & $\underset{x}{\forall}\left(  P[x]\ \Rightarrow\ \underset
%{y}{\forall}\left(  Q[y]\text{ }\Rightarrow\text{ }\lnot L[x,y]\right)
%\right)  $\\
%$G:$ & $\underset{x}{\forall}\left(  D[x]\ \Rightarrow\ \lnot Q[x]\right)  $%
%\end{tabular}
%\ \
%\]
%}
%\onslide<2->{\textcolor{ForestGreen}{Example 4:} Prove by resolution that $G$ is a logical consequence of $F$
%where%
%\[%
%\begin{tabular}
%[c]{ll}%
%$F:$ & $\underset{x}{\forall}\underset{y}{\exists}\left(  S[x,y]\text{ }%
%\wedge\text{ }M[y]\right)  \ \ \Rightarrow\text{ \ }\underset{y}{\exists
%}\left(  I[y]\text{ }\wedge\text{ }E[x,y]\right)  $\\
%$G:$ & $\lnot\underset{x}{\exists}I[x]\ \ \Rightarrow$ \ $\underset
%{x,y}{\forall}$ $(S[x,y]$ $\Rightarrow$ $\lnot M[y])$%
%\end{tabular}
%\
%\]
%
%}
%
%\end{overprint}
%} %endframe
%
%
%
%\frame{\frametitle{Resolution Principle for FOL. Examples (cont'd)}
%
%\begin{overprint}
%
%\onslide<1->{\textcolor{ForestGreen}{Example 5:} Prove by resolution that $G$ is a logical consequence of
%$F_{1},F_{2},$ and $F_{3}$ where%
%\[%
%\begin{tabular}
%[c]{ll}%
%$F_{1}:$ & $\underset{x}{\forall}\left(  Q[x]\text{ }\Rightarrow\text{ }\lnot
%P[x]\right)  $\\
%$F_{2}:$ & $\underset{x}{\forall}\left(  \left(  R[x]\text{ }\wedge\text{
%}\lnot Q[x]\right)  \text{ \ }\Rightarrow\text{ \ }\underset{y}{\exists
%}\left(  T[x,y]\text{ }\wedge\text{ }S[y]\right)  \right)  $\\
%$F_{3}:$ & $\underset{x}{\exists}\left(  P[x]\text{ }\wedge\text{ }%
%\underset{y}{\forall}\left(  T[x,y]\text{ }\Rightarrow\text{ }P[y]\right)
%\text{ }\wedge\text{ }R[x]\right)  $\\
%$G:$ & $\underset{x}{\exists}\left(  S[x]\wedge P[x]\right)  $%
%\end{tabular}
%\]
%
%}
%\end{overprint}
%} %endframe
	



\end{document}

