Title: NKU CSC 685 Kirby
1NKU CSC 685 Kirby First-Order Logic and Undecidab
ility
2A decision ("yes/no") problem is decidable
if there is an algorithm that takes any problem
instance and returns the correct true/false answ
er.
A decision problem is semi-decidable
if there is an algorithm that takes any problem
instance and returns true if and only if the cor
rect answer is "true".
3Finite Automata
Context-Free Grammar
von Neumann Machine
easy to do stuff here
4This sentence is false.
Do we "reject" self-reference?
Some self-referential sentences make statements
that are perfectly acceptable, like this one.
5Deep Computer Science Idea Programs are strings
. Programs can process strings. So Programs c
an process programs.
program "print sqrt(81)" strlen( program )
14 execute( program ) 9 execute( "for
()" )
C interrupted by user
Self-reference is inescapable in computer science.
6Proof that the Halting Problem is Undecidable - 1
Suppose it were decidable. Then we'd have the
following function
bool halts( string pgm, string w )
// pgm is the source code of a void functio
n that takes one string parameter.
// Return true if pgm halts on input w, false
otherwise
halts( p1, "hi" ) true halts( p1, "bye")
false
halts( p1, p1 ) true
7Proof that the Halting Problem is Undecidable - 2
Of course, programs whose functions call
functions are nbd...
Example
p2
void g() for ( ) void f( stri
ng w )
if ( w0'b' ) g()
halts( p2, "hi" ) true halts( p2, "bye") fa
lse
halts( p2, p2 ) true
8Proof that the Halting Problem is Undecidable - 3
What happens here?
Example
p3
bool halts( string pgm, string w )
// ... void f( string w ) if ( ha
lts( w, w ) )
for( )
halts( p3, p3 ) ?!!! true ? false ? true
contradiction
Conclusion HP is unsolvable.
9Halting Problem Unsolvable ? Post Correspondence
Problem Unsolvable ? First-Order Logic Validity
Problem Unsolvable
10Post Correspondence Problem Can copies of a set o
f dominos be sequenced so that
the string on top is the same as the string on
the bottom?
Example problem instance
1 111
10111 10
10 0
1 111
10111 10
10 0
1 111
10111 10
10 0
Example problem instance
10 101
011 11
101 011
10 101
011 11
101 011
10 101
011 11
101 011
Answer No
11PCP Can copies of a set of dominos be sequenced s
o that the string on top is the same as the stri
ng on the bottom?
Example problem instance
001 0
01 011
01 101
10 001
001 0
01 011
01 101
10 001
Answer Yes
(but 66 dominos needed!)
PCP Given (r1,s1), ... (rn,sn) where ri,si ?
0,1, does there exist a sequence i1...ik such
that ri1ri2...rik si1si2...sik ?
12Post Correspondence Problem Solvable?Halting
Problem Solvable
instance converter
M,w
(r1,s1), ... (rn,sn)
Ensure M halts on w iff (r1,s1), ... (rn,sn)
has a solution
(hypothetical) PCP solver
yes/no
PROBLEM REDUCTION
13PCP Solvable?First-Order Logic Validity Problem
Solvable
instance converter
(r1,s1), ... (rn,sn)
?
Ensure (r1,s1), ... (rn,sn) has a solution i
ff ? is a valid wff.
(hypothetical) Validity Detector
yes/no
PROBLEM REDUCTION
14PCP reduction
gf gfg
fgg gg
gfg fgg
10 101
011 11
101 011
PCP instance
10 101
011 11
101 011
Wffify!
One constant e Two one-place function symbols f
,g
One two-argument predicate P
? ( P(f(g(e)), g(f(g(e)))) ? P(g(g(f(e)
)), g(g(e))) ? P(g(f(g(e))),g(g(f(e))))
? ?v?w Pvw ? P(f(g(v)), g(f(g(w
)))) ? P (g(g(f(v))), g(g(w))) ?
P(g(f(g(v))),g(g(f(w)))) ) ? ?z Pzz
15Expressing unreachability
R
u
v is unreachable from u
v
In SECOND-ORDER logic unreachable( R,u,v) ?
P?x?y?z( Pxx ? (Pxy?Pyz ?Pxz) ? ?Puv ?
(Rxy ?Pxy))
Can we express this in first order logic?