\documentclass[12pt]{article}
\usepackage{amssymb, amsmath}

\textheight 23cm
\textwidth 6.5in
\oddsidemargin -.1in
\evensidemargin -.1in
\topmargin -1.5cm

\renewcommand{\theenumi}{\arabic{enumi}}
\renewcommand{\labelenumi}{\theenumi)}

\newtheorem{exer}{Exercise}

\newcommand{\eqsyn}{=_{syn}}
\newcommand{\ra}{\rightarrow}
\newcommand{\SL}{{\cal L}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\underN}{\underline{\mathbb{N}}}
\newcommand{\stand}{\underline{\mathbb{N}}}
\newcommand{\calM}{{\cal M}}
\newcommand{\calL}{{\cal L}}

\def\Konig{K\"{o}nig}
\def\Godel{G\"{o}del}
\def\Equiv{\Longleftrightarrow}

\input{prooftree}

\parskip 2ex
\parindent 0ex

\setcounter{page}{39}

\begin{document}

{\large\bf CS 4995}\hspace{.8in}{\large\bf Notes} (S. Cook and T. Pitassi)
\hfill {\large\bf Fall, 2022}

\bigskip

%{\bf Major Corollaries to the Completeness Theorem and its Proof}

%1) Lowenheim/Skolem Theorem: If a finite or countable set $\Phi$ of sentences 
%is satisfiable, then $\Phi$ is satisfiable in  a countable universe.
%(Thus, for example, no countable set of first-order sentences can
%characterize the real numbers.)

%This follows from the proof of completeness.  If $\Phi$ is satisfiable,
%then it has an exhausted tableau with a branch whose formulas form
%a Hintikka set.  This set has a model whose universe consists of the
%countable set of ground terms.

\begin{center}
{\Large\bf Herbrand Theorem, Equality, and Compactness}
\end{center}

\large
{\bf The Herbrand Theorem}
\normalsize

We now consider a complete method for proving the unsatisfiability
of sets of first-order sentences which is an alternative to $LK$.
This forms the basis of the resolution proof method for the
predicate calculus,
which is used extensively by automated theorem provers.
(See pp 6-9 for propositional resolution.)

{\bf Definitions (quantifier-free, $\forall$-sentence, ground instance)}:
A formula $A$ is {\em quantifier-free} if $A$
has no occurrence of either of the quantifiers $\forall$ or $\exists$.
A $\forall$-sentence is a sentence of the form
$\forall x_1...\forall x_k B$ where $k \ge 0$ and $B$ is
a quantifier-free formula.  A {\em ground instance} of
this sentence is a sentence of the form
$B(t_1/x_1)(t_2/x_2)...(t_k/x_k)$, where $t_1,...,t_k$ are ground
terms (i.e. terms with no variables) from the underlying language.

Notice that a ground instance of a $\forall$-sentence $A$ is a
logical consequence of $A$.  Therefore if a set $\Phi_0$ of
ground instances of $A$ is unsatisfiable, then $A$ is
unsatisfiable.

{\bf Definition:}
An $\cal L$-{\em truth assignment} (or just {\em truth assignment})
is a map
$$\tau:\{{\cal L}-\mbox{atomic formulas} \} \rightarrow \{T,F \}$$
We extend $\tau$ to the set of all quantifier-free $\cal L$-formulas
by applying the usual rules for propositional connectives (see
page 3).

The above definition of truth assignment is the same as in the propositional
calculus, except now we take the set of atoms to be the set of
$\cal L$-atomic formulas.  Thus we say that a set $\Phi_0$ of 
quantifier-free formulas is {\em propositionally unsatisfiable}
if no truth assignment satisfies every member of $\Phi_0$.
Note that this is different from simply saying that $\Phi_0$ is
{\em unsatisfiable}, by which we mean that there is no
structure $\calM$ and object assignment $\sigma$ which satisfies
$\Phi_0$ (see page 23).

{\bf Lemma}:  If a set $\Phi_0$ of quantifier-free sentences is 
propositionally unsatisfiable, then $\Phi_0$ is unsatisfiable (in
the first-order sense).

The converse of the Lemmas is also true, provided that $\Phi_0$
does not contain =.  This follows from the Herbrand Theorem below.

{\bf Proof of Lemma:}  We prove the contrapositive:  Suppose that $\Phi_0$
is satisfiable, and let $\calM$ be a structure and $\sigma$
an object assignment such that $\calM$ satisfies
$\Phi_0$ under $\sigma$.  Then $\calM$ and $\sigma$ induce a truth assignment
$\tau$ by the definition $B^{\tau} = T$ iff $\calM\models B[\sigma]$,
where $B$ is an atomic formula.  Then $B^{\tau} = T$ iff
$\calM\models B[\sigma]$
for each quantifier-free sentence $B$, so $\tau$ satisfies
$\Phi_0$.  $\Box$

We can now state our simplified proof method, which applies to
sets of $\forall$-sentences without =:  Simply take ground instances
of sentences in $\Phi$ until a propositionally unsatisfiable set
$\Phi_0$ is found.  The method does not specify how to check for
propositional unsatisfiability:  any method (such as truth tables)
for that will do.  Notice that by propositional compactness, 
it's sufficient to consider finite sets $\Phi_0$ of ground instances.
The Herbrand theorem states that this method is sound and complete.

{\bf Herbrand Theorem}:  Let $\cal L$ be a first-order language
without = and with
at least one constant symbol, and let $\Phi$ be a set of 
$\forall-\cal L$-sentences.  Then $\Phi$ is unsatisfiable iff some
finite set $\Phi_0$ of $\cal L$-ground instances of sentences in $\Phi$ is
propositionally unsatisfiable.

{\bf Herbrand with Equality:}  The above theorem holds when
the language $\cal L$ includes =, provided $\Phi$ includes
the equality axioms ${\cal E_L}$ for $\cal L$ (next section, 
page \pageref{EqAx}).

We suppose that $\cal L$ does not contain = for the remainder
of this section.

{\bf Notation:}  $c,d,e$ stand for constant symbols.

{\bf Example:}  Let 
\[ \Phi = \{ \forall x(Px \supset Pfx), Pc, \neg Pffc \}  .  \]
Then the set $\cal H$ of ground terms is $\{c,fc,ffc,...\}$.
We can take the set $\Phi_0$ of ground instances to be
\[  \Phi_0= \{(Pc \supset Pfc), (Pfc \supset Pffc), Pc, \neg Pffc \}. \]
Then $\Phi_0$ is propositionally unsatisfiable, so $\Phi$ is
unsatisfiable.

{\bf Proof (Soundness direction of Herbrand Theorem):}
We've already proved this:  If $\Phi_0$ is
propositionally unsatisfiable, then by the above lemma, $\Phi_0$ is
unsatisfiable, and hence $\Phi$ is unsatisfiable (because each ground
instance is a logical consequence of $\Phi$).

{\bf Proof (Completeness direction of Herbrand Theorem):}
We prove the contrapositive:  If every
finite set of ground instances of $\Phi$ is propositionally
satisfiable, then $\Phi$ is satisfiable. 

Let $\Phi_0$ be the set of {\em all} ground instances of $\Phi$
(using ground terms from $\cal L$).
Assuming that every finite subset of $\Phi_0$ is propositionally
satisfiable, it follows from the propositional compactness theorem
(page 15, Form 3)
that the entire set $\Phi_0$ is propositionally satisfiable.  Let
$\tau$ be a truth assignment which satisfies $\Phi_0$.  We use
$\tau$ to construct an $\cal L$-structure $\calM$ which 
satisfies $\Phi$.  We use a term model, similar to that used
in the proof of the Completeness Lemma (see page 32).

Let the universe $M$ of $\calM$ be the set $\cal H$ of all ground
${\cal L}$-terms.  

%For each variable $x$, let $x^\sigma = c$, for some constant symbol
%$c$.  (This part is unimportant, since $\Phi$ consists only of sentences.)

For each $n$-ary function symbol $f$ define
\[ f^\calM(t_1,...,t_n) = ft_1...t_n    .     \]

(In particular, $c^\calM = c$ for each constant $c$, and it follows by
induction that $t^\calM = t$ for each ground term $t$.)

For each $n$-ary predicate symbol $P$ of $\cal L$, define
\[   P^\calM = \{ \langle t_1,...,t_n \rangle : (Pt_1...t_n)^{\tau}=T\}
\]

This completes the specification of $\calM$.  It follows easily by
structural induction that $\calM\models B$ iff $B^{\tau}=T$ for
each quantifier-free $\cal L$-sentence $B$.  Thus
$\calM\models B$ for every ground instance $B$ of any sentence
in $\Phi$.  Since every member of $\Phi$ is a $\forall$-sentence,
and since the elements of the universe are precisely the ground terms,
it follows  that $\calM$ satisfies every member of $\Phi$.
(A formal proof would use the Basic Semantic Definition (page 22)
and the Substitution Theorem (page 26)).  $\Box$

\begin{exer}
Fill in the details in the above argument.
\end{exer}

\begin{exer}
Prove that a satisfiable set of $\forall$ sentences without = and without
function symbols except the constants $c_1,...,c_n$ for $n\geq 1$
has a model with exactly $n$ elements in the universe.  Give
an example with one binary predicate symbol $P$
showing that $n-1$ elements would not suffice in general.
(Hint:  Think of $P$ as $<$.)
\end{exer}


We show how to generalize the above method, by adding equality axioms,
to the case in which
$\cal L$ has = in the next section.  We now show how to generalize
the method to arbitrary sentences without equality.

{\bf Prenex Form}

{\bf Definition}: We say that a formula $A$ is in {\em prenex form}
if $A$ has the form $Q_1x_1...Q_nx_nB$, where each $Q_i$
is either $\forall$ or $\exists$, and $B$ is
a quantifier-free formula.

{\bf Theorem:}  There is a simple procedure which, given a formula
$A$, produces an equivalent formula $A^\prime$ in prenex form.

{\bf Proof:}  First rename all quantified variables in $A$ so that
they are all distinct (see page 27).  Now move all quantifiers
out past the connectives $\wedge, \vee, \neg$ by repeated use
of the equivalences below.  (Recall that by the Replacement Theorem,
page 27, we can replace a subformula in $A$ by an equivalent formula and
the result is equivalent to $A$.)

{\bf In each of the following equivalences, we must assume that $x$ does
not occur free in $C$.} 

$(\forall xB\wedge C)\Longleftrightarrow \forall x(B\wedge C)$\\
$(\forall xB\vee C)\Longleftrightarrow \forall x(B\vee C)$\\
$\neg\forall xB \Longleftrightarrow \exists x\neg B$\\
$(\exists xB\wedge C)\Longleftrightarrow \exists x(B\wedge C)$\\
$(\exists xB\vee C)\Longleftrightarrow \exists x(B\vee C)$\\
$\neg\exists xB \Longleftrightarrow \forall x\neg B $ \\
$\Box$

\newpage

{\bf Skolem Functions:}
To explain how to apply the Herbrand Theorem to a sentence $A$ that is not universal,
it is convenient (but not absolutely necessary) to
first put $A$ in prenex form.  Then we
get rid of the existential quantifiers by replacing each
existentially quantified variable $y$ by a function symbol $f_y(x_1,...,x_k)$,
where $x_1,...,x_k$ are the universally quantified variables preceding
$y$ in the prefix.  The function symbol $f_y$ is
called a {\em Skolem function}.

The simplest case is when the existential quantifier has no universal
quantifier in front of it: say $A$ is $\exists y B$, where
now $B$ can be any formula.  Then we replace $y$ by a new
constant $c$.

{\bf Lemma:}  $\exists y B$ is satisfiable iff $B(c/y)$
is satisfiable, provided $c$ does not occur in $B$.  More generally,
if $\Phi$ is a set of formulas, then
$\{\exists y B\}\cup \Phi$ is satisfiable iff $\{B(c/y)\}\cup\Phi$
is satisfiable, provided that $c$ does not occur in $B$, nor in
any formula in $\Phi$.

{\bf Proof:}  If $\calM\models (\{B(c/y)\}\cup\Phi)[\sigma]$, then
also $\calM\models (\{\exists y B\}\cup\Phi)[\sigma]$, since
$c^\calM[\sigma]$ satisfies the existential quantifier in
$\exists yB$.   Conversely, if
$\calM\models  ( \{\exists y B\}\cup\Phi)[\sigma]$, then we can
change $\calM$ to $\calM'$ by setting $c^{\calM'}$ equal to an
element in $M$ satisfying the existential quantifier in $\exists yB$.
Then  $\calM'\models B(c/y)$, and also $\calM'\models \Phi[\sigma]$,
because $c$ does not occur in $\Phi$.   $\Box$ 

Now consider the case $\forall x\exists y B$.  If this holds in
a structure, then for each value of $x$ we can choose a value $f(x)$
for $y$ making $B$ true.

{\bf Lemma}: $\forall x\exists y B$ is satisfiable iff
$\forall x B(fx/y)$ is satisfiable, provided $f$ is a unary function
symbol which does not occur in $B$.  More generally, if $\Phi$
is a set of formulas, then $\{\forall x\exists y B\}\cup \Phi$
is satisfiable iff $\{\forall xB(fx/y)\}\cup\Phi$
is satisfiable, provided that $f$ does not occur in $B$, nor in
any formula in $\Phi$.

{\bf Proof:}  Formalize the argument preceding the Lemma.  $\Box$

More generally, we construct the {\em functional form} of a prenex
formula $A$ by removing each existential quantifier $\exists y$
in the prefix and replacing $y$ in the formula by $f_yx_1...x_k$,
where $f_y$ is a new function symbol, and $x_1,...,x_k$ are the
universally quantified variables that precede the quantifier $\exists y$
in the prefix.

{\bf Important:} To form the functional forms of a set of sentences,
it is necessary to make every Skolem function symbol introduced distinct
from all Skolem function symbols in all other formulas.

{\bf Theorem}: A set $\Phi$ of sentences is satisfiable iff the set of 
functional forms of sentences in $\Phi$ is satisfiable.

Our more general proof method applies to an arbitrary set $\Phi$
of sentences without equality.  We first put each sentence of $\Phi$
in prenex form, then in functional form, and then apply the Herbrand
Theorem.  It can be made to apply to sentence with = by including
the equality axioms E1,...,E5 (below) in $\Phi$.

{\bf Example}:  We can use this method to show that the set
\[   \{ (\forall x Px \vee \forall x Qx), \neg\forall x Px,\neg\forall xQx \}
\]
is unsatisfiable.   The prenex form of the first sentence is
$\forall x \forall y (Px \vee Qy)$.
The prenex forms of the last two sentences are
$\exists x \neg Px $ and $\exists x \neg Qx$, respectively.
Their functional forms are $\neg Pc$ and $\neg Qd$ (we must plug in distinct
constants for the distinct existential quantifiers).  Thus we are to
show that the set
\[  \{ \forall x \forall y( Px \vee  Qy), \neg Pc, \neg Qd    \} \]
is unsatisfiable.  By the Herbrand Theorem, it suffices to find a set
of ground instances which is propositionally unsatisfiable.  In
fact, the last two formulas are already ground instances, and we
need only take one ground instance of the first formula.  Thus the
propositionally unsatisfiable set of ground instances is
\[  \{  (Pc \vee Qd),  \neg Pc, \neg Qd  \}   . \]
We can check that this set is propositionally unsatisfiable by checking
that each of the four truth assignments to the two atomic formulas $Pc, Qd$
falsifies at least one of the three above formulas. 

\Large
{\bf Equality Axioms}
\normalsize

Definition:  A {\em weak} $\cal L$-structure $\calM$ is an ${\cal L}$-structure
in which we drop the requirement that $=^\calM$ is the equality relation
(i.e. $=^\calM$ can be any binary relation on $M$.)

Are there sentences $\cal E$ (axioms for equality) such that if $\calM$ is
any (proper) structure (i.e. $=^\calM$ is the equality relation)
then $\calM$ satisfies $\cal E$ and every weak structure
$\calM'$ such that $\calM'$ satisfies $\cal E$ must be a proper structure 
(i.e. $=^{\calM'}$ is equality)?

No such set $\cal E$ of axioms exists.  The reason is that if $\calM$ is any
(proper) structure with universe $M$, and $m \in M$ and $m' \notin M$
then we can define $M' = M \cup \{m'\}$ and define $(m,m') \in =^{\calM'}$
and let $\calM'$ be the same as $\calM$ except it has universe $M'$
and $\calM'$ on $m'$ acts like $\calM$ on $m$.
Then for all formulas $A$ and all object assignments $\sigma$,
$\calM\models A[\sigma]$ iff $\calM'\models A[\sigma]$,
but $\calM'$ is not a proper structure.  (In general, we can always
inflate a point in a model to a set of points, if = is not present.)

\begin{exer}
Show that for every integer $k\ge 1$ there is a sentence $\varphi$ with
vocabulary $\{;=\}$ for which the following holds:
$\varphi$ is satisfied by a structure with
universe $M$ iff $M$ has exactly $k$ elements.
\end{exer}

\begin{exer}
In contrast to the above, show that if $\Phi$ is any satisfiable
set of first order sentences {\em not} involving =, then $\Phi$
has a model with an infinite universe.
Use the idea of ``inflating'' a point, discussed in the
preceding paragraph.
\end{exer}


{\bf Example:}  The sentence
$$
  A =_{syn} \ \       \forall x\forall y (x=y)
$$
has a model ${\cal M}_1$ consisting
of one element, and in fact every model (in our sense) of this sentence
must have a universe of a single element.   But now let $M$ be {\em any}
nonempty set (possibly infinite), and define the weak model ${\cal M}_{all}$
with universe $M$ such that $=^{{\cal M}_{all}}$ is
$M \times M$  (i.e.$=^{{\cal M}_{all}}$
holds for all pairs of elements of $M$.)  Note that ${\cal M}_{all}\models A$.
We claim that
if $\cal E$ is any set of equality axioms (by which we mean any set
of valid formulas with vocabulary ${\cal L}$ consisting of $=$ alone)
then ${\cal M}_{all} \models \cal E[\sigma]$ for any $\sigma$. 
This is because ${\cal M}_1\models \cal E$
(because $\cal E$ consists of valid formulas) and by structural induction
on $B$, it is easy to see that any formula $B$ involving only =
is satisfied by ${\cal M}_{all}$ iff it is satisfied by ${\cal M}_1$, (no
matter what object assignments $\sigma$ are chosen).

Nevertheless every language $\cal L$ has a standard set $\cal E_{\cal L}$
of equality axioms which satisfies the Equality Theorem below.

{\bf Equality Axioms of $\cal L$}  ($\cal E_{\cal L}$)

\label{EqAx}
E1: $\forall x(x=x)$ \ \ (reflexivity)\\
E2: $\forall x \forall y(x=y \supset y=x)$ \ \ (symmetry)\\
E3: $\forall x \forall y \forall z((x=y\wedge y=z)\supset x=z)$ \ \ 
(transitivity)\\
E4: $\forall x_1...\forall x_n\forall y_1...\forall y_n(x_1=y_1\wedge
...\wedge x_n=y_n)\supset fx_1...x_n=fy_1...y_n$
for each $n\geq 1$ and each $n$-ary function symbol $f$ in $\cal L$. \\
E5: $\forall x_1...\forall x_n \forall y_1...\forall y_n(x_1=y_1\wedge
...\wedge x_n=y_n) \supset (Px_1...x_n \supset Py_1...y_n)$
for each $n\geq 1$ and each $n$-ary predicate symbol $P$ in $\cal L$
other than =.

Axioms E1,E2, E3 assert that = is an equivalence relation.  Axiom E4
asserts that functions respect the equivalence classes, and
Axiom E5 asserts that predicates respect equivalence classes.
Together the axioms assert that = is a congruence relation with
respect to the function and predicate symbols.

{\bf Remark:}  The Equality Axioms are valid sentences.

{\bf Definition:}  A set $\Phi$ of formulas is {\em weakly satisfiable}
iff $\Phi$ is satisfied by some weak structure (i.e. a structure
that treats = as an any binary predicate symbol) under some
object assignment $\sigma$.

{\bf Equality Theorem}:  Let $\Phi$ be any set of $\cal L$-formulas.  Then
$\Phi$ is satisfiable iff $\Phi\cup \cal E_{\cal L}$ is
weakly satisfiable.

Let us define $\Phi \models_w A$ to mean that for every weak
${\cal L}$-structure $\calM$ and every object assignment $\sigma$,
if $\calM\models \Phi [\sigma]$ then $\calM\models A[\sigma]$
(i.e. $\Phi\cup \{\neg A\}$ is not weakly satisfiable).

\label{corEq}
{\bf Corollary 1}:  $\Phi \models A$ iff
$\Phi\cup {\cal E}_{{\cal L}}\models_w A$.

{\bf Corollary 2}:   $\forall\Phi \models A$ iff
$A$ has an $LK-\Psi$ proof, where $\Psi = \Phi\cup\cal E_{\cal L}$.

Corollary 1 follows immediately from the Equality Theorem 
and the observation that $\Phi\models A$ iff $\Phi\cup\{\neg A\}$
is unsatisfiable.

Corollary 2 follows from Corollary 1 and the derivational completeness
of $LK$ (see the theorem page 32), where in applying that theorem we treat
= as just another binary relation (so we can assume $\cal L$ does
not have the official equality symbol).

{\bf Proof of Equality Theorem}: The ONLY IF $(\Longrightarrow)$
direction is obvious, because
every structure $\calM$ must interpret = as true equality, and hence
$\calM$ satisfies the equality axioms $\cal E_{\cal L}$.

For the IF $(\Longleftarrow)$
direction, suppose that $\calM$ is a weak $\cal L$-structure
with universe $M$, such that $\calM$ satisfies $\Phi \cup \cal E_{\cal L}$
under some object assignment $\sigma$.
Our job is to construct a proper structure $\hat{\calM}$ and
object assignment $\hat{\sigma}$ such that
$\hat{\calM}$ satisfies $\Phi$ under $\hat{\sigma}$.

Denote $=^\calM$ by $\sim$.  In general $\sim$ is not the equality
relation, but it does satisfy the equality axioms E1,...,E5, so
it is an equivalence relation on $M$.  If $u \in M$, then we use
the notation $[u]$ for the equivalence class of $u$.  Thus
$$[u]=\{v \in M|v \sim u\}$$
Note the following properties of $\sim$ and $[u]$:\\
(i) $u\sim v$ iff $[u]=[v]$.\\
(ii) $u \not\sim v$ iff $[u]\cap [v] = \varnothing$.

We define the elements of the universe $\hat{M}$ of
$\hat{\calM}$ to be the equivalence classes of $\sim$.
Each relation $P^\calM$ induces a relation $P^{\hat{\calM}}$
on $\hat{M}$ and each function $f^\calM$ induces a function
$f^{\hat{\calM}}$ on $\hat{M}$.  Specifically, for every variable $x$,
every ${\cal L}$-function symbol $f$, and every ${\cal L}$-predicate
symbol $P$,
\begin{equation}
\label{fun}
  f^{\hat{\calM}}([u_1],...,[u_n])=[f^\calM(u_1,...,u_n)]
\end{equation}
\begin{equation}
\label{pred}
  <[u_1],...,[u_n]> \in P^{\hat{\calM}} \mbox{ iff }
          <u_1,...,u_n> \in P^\calM
\end{equation}
It is important to check that (\ref{fun}) and (\ref{pred}) give
consistent definitions of $f^{\hat{\calM}}$ and $P^{\hat{\calM}}$,
independent of the choices of the representatives $u_1,...,u_n$
for the equivalence classes $[u_1],...,[u_n]$.
This consistency follows from equality axioms E4 and E5 and
(i) above.

Now define the object assignment $\hat{\sigma}$ on $\hat{\calM}$ by
\begin{equation}
\label{var}
  \hat{\sigma}(x)= [\sigma(x)]
\end{equation}
for each variable $x$.

{\bf Lemma 1:} $t^{\hat{\calM}}[\hat{\sigma}] = [t^\calM[\sigma]]$
for each ${\cal L}$-term $t$.

{\bf Proof:}  Structural induction on terms.  The base case is (\ref{var}),
and the induction step uses (\ref{fun}) and the Basic Semantic
Definition.

{\bf Lemma 2:} For every formula $A$ and object assignment $\sigma$,
$$
 \hat{\calM}\models A[\hat{\sigma}] \mbox{ iff }
\calM\models A[\sigma]
$$

{\bf Proof:}  Structural induction on formulas $A$.  The base case
($A$ is atomic) follows from (\ref{pred}) and Lemma 1, and the
Basic Semantic Definition.  The induction step follows from the Basic
Semantic Definition.

This completes the proof of the Equality Theorem.

{\large\bf Equality Axioms for $LK$}

For the purpose of using an $LK$ proof to establish $\Phi\models A$,
we can replace the standard equality axioms E1,...,E5 by the
following simpler sequents, where we include an instance of the
sequent for all ${\cal L}$-terms $t,u,v,t_i,u_i$:

EL1:  $\ra t=t$\\
EL2:  $t=u\ra u=t$\\
EL3:  $t=u,u=v\ra t=v$\\
EL4:  $t_1=u_1,...,t_n=u_n\ra ft_1...t_n=fu_1...u_n$, for each $f$ in $\cal L$\\
EL5:  $t_1=u_1,...,t_n=u_n, Pt_1...t_n\ra Pu_1...u_n$, for each $P$ in $\cal L$
(Here $P$ is not =)

The fact that these sequents suffice for $LK$ proofs involving equality
follows from the Equality Theorem and
the Derivational Completeness Theorem (page 32).
Note that it is not necessary to put in universal quantifiers in these 
equality axioms because quantifiers can be introduced as
needed by the rule $\forall$-{\bf right}.  In fact, we do not
need EL1,...,EL5 for all terms $t,u,v,t_i,u_i$, but only for
variables.  The reason for including all terms is that it makes
it unnecessary to introduce these quantifiers (unless the quantified
axioms are subformulas of  the conclusion), as indicated by
Anchored Completeness with Equality below.

{\bf Revised Definition:} If $\Phi$ is a set of $\cal L$-formulas,
where $\cal L$ includes =, then by an $LK-\Phi$ proof we now mean an
$LK-\Psi$ proof in the sense of the earlier definition, page 31,
where $\Psi$ is $\Phi$ together with all instances of the equality axioms
EL1,...,EL5.  If $\Phi$ is empty, we simply refer to an $LK$-proof
(but allow axioms EL1,...,EL5).

{\bf Example}

Let the vocabulary ${\cal L} =[0,s,+;=]$.  Let the set $\Phi$ of axioms
consist of all term substitution instances of the formulas
\begin{align*}
   &  x + 0 = x \\
   &   (x+ sy) = s(x+y)
\end{align*}
(as in the Anchored Completeness Theorem page 37). 
We want to find an $LK-\Phi$ proof of
$0+s0=s0$.  We need the following two instances of equality axioms:
\begin{align*}
&   EL3: \ \ 0+s0=s(0+0), s(0+0)=s0 \  \ra \  0+s0 = s0 \\
&   EL4: \ \ 0+0=0 \ \ra \  s(0+0)=s0
\end{align*}
Here is the $LK-\Phi$ proof, where the unlabelled leaves are axioms
in $\Phi$:
$$
\begin{prooftree}
   \[  EL3   \qquad  \ra 0+s0=s(0+0) 
         \justifies  s(0+0)=s0 \ra 0+s0=s0 \using \mbox{cut} \]  \qquad
   \[  EL4  \qquad \ra 0+0=0  \justifies   \ra s(0+0)=s0 \using \mbox{cut} \]
          \justifies \ra 0+s0=s0  \using \mbox{cut}
\end{prooftree}
$$


From the above discussion, we have


{\bf Revised Derivational Soundness and Completeness of $LK$}:  For any set
$\Phi$ of formulas and formula $A$, 
$$   \forall\Phi \models A \mbox{ iff   $\ra A$   has an $LK-\Phi$ proof}$$

{\bf Notation:}  $\Phi \vdash A$ means that there is an $LK-\Phi$
proof of $\ra A$.

Recall that if $\Phi$ is a set of sentences, then $\forall\Phi$
is the same as $\Phi$.  Therefore
$$ \Phi \models A \mbox{ iff } \Phi \vdash A, \ \
\mbox{ if $\Phi$ is a set of sentences}  $$

\begin{exer}
Give an LK proof of the sequent $A\ra B$, where
\marginpar{[10]}

$A =_{syn} \forall x\exists y \  x=fy$\\
$B =_{syn} \forall x\exists y \ x=ffy$

Start by giving the specific instances of the LK equality axioms
EL1,...,EL5 that you need in your proof.

You may use abbreviations for formulas in your proof.  You do not
need to indicate weakinings or exchanges.
\end{exer}

\begin{exer}
Consider the following formulas over the vocabulary
$\calL_A = [0,s,+,\cdot;=]$:

Q1:  $x+0 = x$ \\
Q2:  $x+sy=s(x+y)$ \\
Q3:  $x\cdot 0=0$ \\
Q4:  $x\cdot sy = (x\cdot y)+x$

Let $\Phi$ be the set of ground substitution instances of $\{$Q1,Q2,Q3,Q4$\}$,
where a ground substitution instance of $A$ is the result of substituting
ground terms for all free variables in $A$.  (Here a {\em ground term}
is a term over $\calL_A$ with no variables.)

An example of a sentence in $\Phi$ obtained from Q2 is
$s0+s0=s(s0+0)$.

Let $A\eqsyn s0 \cdot s0 = s0$.

You are to give an {\bf LK}-$\Phi$ proof of $A$.

Do this as follows:\\
First list all sentences in $\Phi$ that you will need in your LK proof.

Now list all {\em instances} of the LK equality axioms
$EL1,\cdots,EL5$ given on page 45 that you will need for the proof.
The instances should be specific; for example an instance of
$EL1$ is $\ra ss0=ss0$.

Now give the required {\bf LK}-$\Phi$ proof, using names for all of the
above sentences.  You may break the tree into pieces for readability
if you wish. (Note that no variables appear in your proof, so
you will not need any quantifier rules.)
\end{exer}


We can strengthen the derivational completeness theorem as follows:

{\bf Anchored Completeness with Equality:}  Suppose that $\Phi$
is a set of formulas (possibly with =) closed under substitution of terms for
variables, and $\Gamma\ra\Delta$ is a logical consequence
of $\forall\Phi$.  Then there is $LK-\Phi$ proof of $\Gamma\ra\Delta$
in which every cut  formula is either in $\Phi$ or it is an equation
of the form $t=u$, for some terms $t,u$.

This follows from a slight strengthening of
the Anchored Completeness Theorem on page 37, together with the
Equality Theorem (and the Revised Definition above).
Note that we have only proved this for the countable case,
although it holds in general.


{\bf Major Corollaries of Completeness}

First recall that a set $S$ is {\em countable} if there is a map
from $\NN$ onto $S$.  In other words, $S$ is countable if its
members can be placed into a list $S = \{s_0, s_1, s_2,...\}$.
We allow repetitions, so that all finite sets are countable.

(1) {\bf Lowenheim-Skolem Theorem:} If a set $\Phi$
of sentences from a countable language
is satisfiable, then $\Phi$ is satisfiable in a
countable universe. 

{\bf Proof:}  Suppose that $\Phi$ is a satisfiable set of sentences.
We apply the proof of the Completeness Lemma (page 32), treating =
as any binary relation, replacing $\Phi$ by
$\Phi'=\Phi\cup\cal E_{\cal L}$, and taking $\Gamma\ra\Delta$ to be
the empty sequent (always false).  In this case $\Gamma\ra\Delta$
is not a logical consequence of $\Phi'$, so the proof constructs
a structure $\cal M$ satisfying $\Phi'$ (see page 35).  This
structure has a countable universe $M$ consisting of all the $\cal L$-terms.
By the proof of the Equality Theorem, we can pass to equivalence classes
and construct a countable structure $\hat{\calM}$ which satisfies
$\Phi$ (and interprets = as true equality).  $\Box$

As an application of the above theorem, we conclude that no countable
set of first-order sentences can characterize the real numbers.
This is because if the field of real numbers forms a model for
the sentences, then there will also be a countable model for the
sentences.  But the countable model cannot be isomorphic to the
field of reals, because there are uncountably many real numbers.

{\bf ``Skolem's Paradox'':}  The set of real numbers can be
characterized as an ordered field such that every bounded
nonempty set of elements has a least upper bound.   These conditions can
be stated as first-order sentences in the language of set theory.
But according to the Lowenheim/Skolem Theorem, these sentences
have a countable model even though the set of real numbers
is uncountable.  The paradox is resolved by realizing
that it is impossible to have first-order axioms for set theory
which enforce the condition that all models must include all sets.
Nevertheless, there are axioms of set theory called ZFC
(Zermelo-Fraenkel with
the axiom of choice) which apparently suffice for formalizing all proofs in
(ordinary) existing mathematics.

(2) {\bf First-Order Compactness Theorem:}
An infinite set $\Phi$ of (first-order)
formulas is unsatisfiable iff some finite subset is unsatisfiable.
(See also the three alternative forms, page 15.)

{\bf Proof:}  The direction $\Longleftarrow$ is obvious, so we
prove the direction $\Longrightarrow$.  Assume that $\Phi$ is
unsatisfiable.  Then according to Corollary 1 of the Equality Theorem
(page \pageref{corEq}) it follows that $\Phi\cup {\cal E}_{\cal L}$
does not even
have a weak $\cal L$ model (take $A$ to be any unsatisfiable formula).
Hence we can apply the Completeness Lemma (page 32), since we may
treat = like any binary predicate symbol, and take 
$\Gamma$ and $\Delta$ empty (the empty sequent is unsatisfiable)
to conclude that there is a finite subset $\Gamma'$ of
$\Phi\cup {\cal E}_{\cal L}$ such that $\Gamma' \ra$ has an $LK$ proof.
By soundness of $LK$ we conclude that $\Gamma'$ does not have a weak
model.  Hence $\Phi_0\cup {\cal E}_{\cal L}$ does not have a weak
model, where $\Phi_0 = \Gamma'\cap \Phi$.  Hence again by Corollary 1
of the Equality Theorem, it follows that $\Phi_0$ is unsatisfiable.
\hfill $\Box$

(3) {\bf Theorem}: Suppose ${\cal L}$ has only
finitely many function and predicate
symbols. Then the set of valid ${\cal L}$-sentences is recursively
enumerable. Similarly for the set of unsatisfiable ${\cal L}$-sentences.

Concerning the third corollary, a set is {\em recursively enumerable}
if there is an algorithm for enumerating its members.  (This idea
will be defined later in these notes.)
To enumerate the valid formulas, enumerate finite $LK$ proofs.
To enumerate the unsatisfiable formulas, note that
$A$ is unsatisfiable iff $\neg A$ is valid.

{\bf Definition:}  A set $\Phi$ of sentences is {\em decidable} if there
is an algorithm which, given a sentence $B$, determines whether
$B$ is in $\Phi$.

Again this notion will be defined formally later.

Later we will show that if $\cal L$ is the language ${\cal L}_A$
of arithmetic,
then the set of valid $\cal L$-sentences is not decidable.
In fact, this is true of every language  $\cal L$ which contains
at least one binary predicate symbol other than =.

\begin{exer}\label{vaught}
(Countable Vaught's Test, an application of Lowenheim-Skolem):
A set $\Phi$ of ${\cal L}$-sentences is said to be {\em complete}
if for every ${\cal L}$-sentence $A$, either $\Phi \models A$
or $\Phi \models \neg A$.  Prove that if ${\cal L}$ is a countable
language and $\Phi$ is a set of $\cal L$-sentences such that
any two countable models of $\Phi$ are isomorphic, then $\Phi$
is complete.  (Use the fact that if $\calM$ and $\calM'$ are
isomorphic structures, then $\calM\models A$ iff $\calM'\models A$,
for any sentence $A$.)
\end{exer}

\begin{exer}
The following set $\Phi$ of sentences comprise the axioms for
a dense linear order with first element 0 and last element 1,
over the language ${\cal L} =[0,1\ ; \ <,=]$.

$0<1$\\
$\forall x\neg x<x$  (irreflexive)\\
$\forall x\forall y\forall z((x<y\wedge y<z)\supset x<z)$ (transitive)\\
$\forall x\forall y(x<y\vee x=y\vee y<x)$ (linear)\\
$\forall x\forall y\exists z(x<y\supset (x<z\wedge z<y))$ (dense)\\
$\forall x(0=x\vee 0<x)$\\
$\forall x(x=1\vee x<1)$

Note that the structure $\mathbb{Q}[0,1]$ whose universe is the
closed interval [0,1] of rational numbers, with $0,1,<$ getting their
standard meanings, is a countable model for $\Phi$.

a) Prove that any two countable models of $\Phi$ are isomorphic
(i.e. have an order preserving bijection between them).  Hint:
Enumerate each of the models $u_1,u_2,...$ without repetition and
after initializing the bijection $\psi$, successively define
$\psi(u_1),\psi(u_2),...$.

b) Let $\mathbb{Q}[0,1]$ be the $\cal L$-structure defined above.
Prove that for every $\cal L$ sentence $A$,
$\mathbb{Q}[0,1] \models A$ iff $\Phi\models A$.
(Use Exercise \ref{vaught}.)
\end{exer}


\begin{exer}
(Application of compactness).  Show that if a set $\Phi$ of sentences
has arbitrarily large finite models, then $\Phi$ has an infinite model.
(Hint:  For each $n$ construct a sentence $A_n$ which is satisfiable
in any universe with $n$ or more elements but not satisfiable in
any universe with fewer than $n$ elements.)
\end{exer}

\begin{exer}
(Application of compactness).  
Let $A$ be a first-order sentence over the language ${\cal L} = [;R,=]$
where $R$ is a binary predicate symbol.  Suppose that for each $n\geq 3$,
$A$ has a model consisting of a directed cycle with $n$ nodes, where
$R$ represents the edge relation of a directed graph.  Prove that
$A$ has a model $\cal M$ whose universe $M$ includes an infinite path; i.e.
a set of distinct elements $v_0,v_1,...$ such that $R^{{\cal M}}(v_i,v_{i+1})$
holds for all $i\geq 0$.
\end{exer}


\begin{exer}\label{finite}
(Application of compactness).  A set $\Phi$ of $\cal L$-sentences is
said to be {\em finitely axiomatizable} if there is a finite
set $\Gamma$ of $\cal L$-sentences such that $\Phi$ and $\Gamma$ have
the same set of models. (Note that $\Gamma$ is not necessarily a
subset of $\Phi$.)  Prove that if
$\Phi=\{A_1,A_2,...\}$ and for all sufficiently large $i$
$$   \{A_1,...,A_{i-1}\} \not\models A_i   $$
then $\Phi$ is not finitely axiomatizable.  (Note that it is NOT enough
to show that for all $i$, $\{A_1,...,A_i\}$ does not axiomatize $\Phi$.)
\end{exer}

\begin{exer}
(Application to algebraic fields).
Let $\cal L$ be the language $[0,1,+,\cdot]$ and let $\Phi_1$ be the
axioms for a field expressed as $\cal L$-sentences
($0\not= 1$, $+$ and $\cdot$ are commutative and associative,
$x\cdot(y+z)=x\cdot y+x\cdot z$,
$0+x=x,1\cdot x=x$, all elements have additive inverses and
nonzero elements have multiplicative inverses).
Let $p_1,p_2,...$ be the sequence of prime numbers, and
let $\hat{p_i}$ stand for the term $((..(1+1)+1...+1)$ with $p_i$ 1's.
Let
$$ \Phi_2= \{\hat{p_1}\not= 0, \hat{p_2}\not= 0,...\}  $$
Thus the models of $\Phi_1\cup\Phi_2$ are precisely the fields
of characteristic 0.  Use Exercise \ref{finite} to prove that
$\Phi_1\cup\Phi_2$ is not finitely axiomatizable.
\end{exer}

\medskip
{\bf Nonstandard Models of Arithmetic}

Let ${\cal L}_s$ (the language of successor) be the language $[0,s;=]$.
The {\em standard model} $\stand_s$ for $\SL_s$ has universe $\NN$,
and 0 and $s$ get their standard meanings (zero and successor).

Let $Th(s)$ (theory of successor) be the set of all sentences of
$\SL_s$ which are true in the standard model.  It turns out that 
there is a simple (but infinite) complete set of axioms for $Th(s)$,
namely the set $\Psi_s$:

S1) $\forall x (sx \ne 0)$  (zero has no predecessor)\\
S2) $\forall x \forall y (sx=sy \supset x=y)$ (successor is one-one)\\
S3) $\forall x (x=0 \vee \exists y (x=sy))$  (every nonzero element has
 a predecessor)

S4) $\forall x (sx\neq x)$\\
S5) $\forall x (ssx\neq x)$\\
S6) $\forall x (sssx\neq x)$\\
   .  \\
   .  \\
   .  

The axioms S4, S5, ... assert that successor cannot form a finite loop.

Obviously each of the above sentences is true in the standard model.
It is not obvious, but true
that every sentence true in the standard
model is a logical consequence of this set $\Psi_s$ of axioms.
Thus $Th(s)$ is precisely the set of sentences which are  logical
consequences of $\Psi_s$.  This is a so-called {\em complete theory},
meaning that for every $\SL_s$ sentence $A$, either $A\in Th(s)$
or $\neg A\in Th(s)$ (i.e. either $\Psi_s\models A$ or 
$\Psi_s\models \neg A$).

\begin{exer}\label{not_fin_ax}
(Application of compactness)
Use Exercise \ref{finite} to show that $Th(s)$ is not finitely
axiomatizable.
\end{exer}

Later we will show that in general, if the set of sentences true in some
structure has a nice axiomatization such as $\Psi_s$, then this set
is decidable.  Thus $Th(s)$ forms a decidable set of sentences.

A {\em nonstandard} model of $Th(s)$ is any model of $Th(s)$ which is not
isomorphic to (i.e. is not a renaming of)
the standard model $\stand$.  It is possible to give
a complete characterization of all of these nonstandard models.

For each set $I$ ($I$ is an ``index'' set) we
construct a model $\calM_I$ of $Th(s)$ as follows.
Let the universe $M$ be $\NN \cup (I\times {\mathbb Z})$, where ${\mathbb Z}$
is the set of integers.  Then define $0^\calM$ to be the zero in $\NN$.
Also, $s^\calM$ is the successor function in $\NN$, and in $I\times {\mathbb Z}$
we define $s(<x,n>)=<x,n+1>$.

It is easy to see that every axiom in $\Psi_s$ is true in the structure
$\calM_I$.  Hence by the discussion above, every sentence true in
the standard model is also true in $\calM_I$.

It is not too hard to see that every model of $\Psi_s$ (and hence
every model of $Th(s)$) is isomorphic to $\calM_I$ for some index set $I$.
To see this, let $\calM$ be such a model.  Divide the universe
$M$ into equivalence classes, using the equivalence relation:
two elements are equivalent if one can be obtained from the other
by finitely many applications of the successor function $s^{\calM}$.
Then the equivalence class that contains the element $0^{\calM}$
must be isomorphic to $\NN$, and every other equivalence class is
isomorphic to ${\mathbb Z}$.  Thus the index set $I$ is the set of equivalence
classes, other than the one containing $0^{\calM}$.

{\bf Presburger Arithmetic:}  Let $\SL_+$ (the language of addition)
be the language $[0,s,+;=]$.  Let $\NN_+$ be the standard model for
$\SL_+$, and let $Th(+)$ be the set of all sentences of $\SL_+$
which are true in the standard model.  In 1928, Presburger showed in
his PhD thesis that $Th(+)$ is a decidable set, and has a nice
axiomatization.

An example of a nonstandard model for $Th(+)$ can be obtained by
the ring ${\mathbb Q}[x]$ of polynomials with rational number coefficients.
Let the universe $M$ consist of zero, together with all polynomials
in ${\mathbb Q}[x]$ with both a positive leading coefficient and an integer
constant term.  Define + as polynomial addition, and successor as +1.
The result is a nonstandard model for Presburger Arithmetic.  (All
sentences in the language $\SL_+$ which are true in the standard model
are also true in this structure.)

{\bf True Arithmetic}
Recall that $\SL_A = [0,s,+,\cdot\ ; =]$ is the language of addition
and multiplication, and $\stand$ is its standard model.  Let
{\bf TA} (True Arithmetic) be the set of all $\SL_A$-sentences which
are true in the standard model.  It follows from \Godel's incompleteness
theorem (later in the course) that {\bf TA} is undecidable, and does
not have any decidable set of axioms.  {\bf TA} does have nonstandard
models, but no ``nice'' nonstandard models.  In fact, it has been
shown that in any nonstandard model for {\bf TA}, the interpretations
of + and $\cdot$ cannot be computable functions.

{\bf Theorem:}  (Application of compactness) {\bf TA} has a nonstandard model.

{\bf Proof:}
Let $c$ be any
constant symbol (not in $\SL_A$), and let $\Psi$ be the infinite set of
sentences
$$ \Psi = \{ c\ne 0, c\ne s0, c\ne ss0,...\}  $$
It is easy to see that every finite subset of {\bf TA}$\cup \Psi$
is satisfiable, since the standard model, with $c$ interpreted as
some large integer, will satisfy the finite set.  Therefore, by
the compactness theorem, {\bf TA}$\cup \Psi$ has a model 
$\calM$.  But this model cannot be isomorphic to the standard
model, since the element which interprets $c$ must satisfy all sentences
in $\Psi$, and therefore cannot be a standard natural number. $\Box$

\begin{exer}
Although the language  $\SL_A = [0,s,+,\cdot\ ; =]$ does not include
the order relation $\le$, we can define $a \le b$ as follows:
$$
  a\le b \leftrightarrow \exists x(a+x=b)
$$
Under this definition, every model of {\bf TA} is a totally ordered
set, since the properties of a total order (namely $\le$ is reflexive,
semi-antisymmetric, transitive, and any two elements are comparable)
can all be expressed by first-order formulas in the vocabulary $\SL_A$,
and all must be true in the model.
Prove that every countable nonstandard model of {\bf TA} is order-isomorphic
to
$$
    \mathbb{N} \oplus \mathbb{Q} \times \mathbb{Z}
$$
i.e. it begins with a copy of $\mathbb{N}$, and is followed by copies
of $\mathbb{Z}$ which are densely ordered.  (See the discussion following
Exercise \ref{not_fin_ax}.)
\end{exer}

\begin{exer}
Suppose that $\calL$ is a language which includes an infinite list
$c_1, c_2, ...$ of constant symbols.  Let $\Gamma$ be the set of
sentences
$$  \Gamma = \{c_i\neq c_j\mid i,j\in{\NN}, i<j\}  $$
Let $A$ be a sentence such that $\Gamma\models A$.  Prove that $A$
has a model with a finite universe.
\end{exer}




\end{document}
