\documentstyle[12pt,twoside,psfig,amssymb]{article}
\input{defs-6045}
\newcommand{\mless}{\leq_m}
\newcommand{\tless}{\leq_T}
\newcommand{\meq}{\equiv_m}
\newcommand{\cmp}{\overline}
\newtheorem{prop}[theorem]{Proposition}
\newcommand{\nat}{{\Bbb N}}

\begin{document}

\handout{lecture23}{Notes on Lecture 23 (4/1/92)}{April 8, 1992}

This class is devoted to various  undecidable problems  with
context free grammars and in logic.


\section{Undecidable problems with CFL's}
We saw that the following problems are undecidable:
\begin{itemize}
\item Given two CFGs $G_1$ and $G_2$, is $L(G_1) \cap L(G_1) = \emptyset$?
\item  Given the CFG $G$, is $G$ ambiguous?
\item  Given the CFG $G$, does $G$ generate $\Sigma^*$?
\end{itemize}
All these points are well addressed in chapter~20 of Martin.

\section{Undecidable Problems in Logic}
We give here the  example of a logic: 
we have at our disposal some {\em symbols},
from which we can derive  {\em well formed formulas}. 
Working within this set of well formed formulas we
then build up a logical universe:
departing from a set of {\em axioms} we can derive 
{\em theorems} and {\em proofs}.

\begin{enumerate}
\item We use a set of symbols: $a,b, x,y,f, g, P, Q, ( ,) ,\Rightarrow,
\wedge, \vee, \forall, \exists$. 
Lower case symbols as $a,b,\ldots$ are called constants.
Lower case symbols as $x,y\ldots$ are called variables.
Lower case symbols as $f,g, \ldots$ are called functions.
Upper case symbols as $P,Q \ldots$ are called predicates...

\item Using these symbols we can then build up well formed formulas
(called also {\em sentences}) of the type ``$(x+y) = (z+y)$''.

\item We assume a set of axioms, as the logical building blocks
from which theorems will be derived. For instance we can consider the
following mix up of axioms integrating axioms from the set theory
definition of $\nat$ (Peano's axiomatic), and axioms defining
 its ring structure (i.e. the definition of addition and multiplication).
$0$ is the symbol of a constant, and $S$ is the symbol of a function called
the {\em successor} function.
	\begin{enumerate}
	\item $(x=y) \Rightarrow (S(x)=S(y))$
	\item $(S(x)=S(y))  \Rightarrow (x=y)$
	\item $(S(x))\not = 0$
	\item $x+0 = x$
	\item $x+S(y) = S(x+y)$ 
	\item $x.0 = 0$
	\item $x.S(y) = (x.y)+x$
	\item $\left[A[0], (\forall  x) [A[x] \Rightarrow A[s[x]]]\right] \Rightarrow
    	 	(\forall x) A[x]$.
	\end{enumerate}

The last axiom is called the ``induction principle''. 

\item A {\em proof} is then by definition a sequence
of wff's such that each of them is derived from the previous
one by application of a single modification rule given in the axioms
list.

\item A {\em theorem} of a logic ${\cal L}$
is defined (informally) as a (set of) wff('s) that 
can be derived from a proof built up from the set of axioms of 
${\cal L}$.
\end{enumerate}

For example, in our previous example ``$x+S(0) = S(x)$'' is a theorem. A two line
proof for it is:
$$\begin{array}{rclll}
x + S(0) & = & S(x + 0) \ & & \mbox{ by axiom (e)}\\
x + S(0) & = & S(x) \ & & \mbox{ by axiom (d)}.\\
\end{array}
$$

The question is then: ``Is there a mechanical process to derive 
all the proofs?'' We remark that if it is decidable whether or not a string 
of symbols is a proof (of some theorem $T$), then the set of theorems is decidable.
We first begin with:
\begin{theorem}
The set  $\{(T ,{\cal L})$: 
$T$ is a theorem  provable
within the logic ${\cal L})\}$ is r.e.
\end{theorem}


\begin{proof}
In effect we can produce in a dovetailing fashion
all the sets of finite axioms and then search through 
all the strings (also in a dovetailing fashion)
asking for each of them whether it is a theorem!
\end{proof}


\begin{theorem}
The set $\{(T ,{\cal L})$: 
$T$ is a theorem  provable
within the logic ${\cal L})\}$ is not decidable.
\end{theorem}


\begin{proof}
We will show that the Post correspondence problem can be 
many-one reduced to the set $\{(T ,{\cal L})\}$ of theorems
true within a logic.
More precisely for each instance $\alpha$ of PCP, there is
a constructible wff $\{(T_\alpha ,{\cal L}_\alpha)\}$ such that
 $T_\alpha$ 
is a theorem in the logic system ${\cal L}_\alpha $ iff 
$\alpha$ has a 
a solution in the Post Correspondence Problem. This
means that PCP $\leq_m \{({\cal L},T)$:  $T$ is a  true theorem in ${\cal L}\}$.

Instead of a formal description of the reduction we will give an example
ilustrating how it works.

Consider the following instance $\alpha$ of {\bf PCP:}
\begin{center}
$\left\{ \begin{array}{cc}
   a\\ ab 
     \end{array}
  \right\}$,
$\left\{ \begin{array}{cc}
   bb\\ baa
     \end{array}
  \right\}$,
$\left\{ \begin{array}{cc}
   abab,\\ \Lambda
     \end{array}
  \right\}$

\end{center}

We can  derive from it the following set of axioms,
which ``encode'' what are the allowed pairs of words 
derived from the PCP. 
For simplicity we will omit some parenthesis and
write for instance $ABAB(0)$ instead of $A(B(A(B(0))))$.

{\bf Axioms of a logic ${\cal L}_{\alpha}$:}
\begin{enumerate}
\item $R(ABAB(0),0); \ R(A(0),AB(0));\ R(BB(0),BAA(0))$
\item $R(x,y)\Rightarrow R(A(x),AB(y))$
\item $R(x,y)\Rightarrow R(BB(x),BAA(y))$
\item $R(x,y)\Rightarrow R(ABAB(x),y)$
\end{enumerate}

The question is then whether 
$T \stackrel{\mbox{\tiny def}}{=} [(\exists x) R(x,x)]$ is a theorem
within the  logic ${\cal L}_{\alpha}$: indeed $T$ is provable iff the PCP
${\alpha}$ has a solution.
(We can check that this is the case here with $x= ABBAAABAB (0)$.)
\end{proof}
\end{document}
