Upload
beverly-stone
View
212
Download
0
Embed Size (px)
Citation preview
NKU CSC 685 Kirby
First-Order Logic and Undecidability
A decision ("yes/no") problem is decidable if there is an algorithm that takes any problem instance and returns the correct true/false answer.
A decision problem is semi-decidable if there is an algorithm that takes any problem instance and returns true if and only if the correct answer is "true".
von Neumann Machine
Multitape TM
NondeterministicTM
Random AccessMachine
procedural pseudocode
your favorite algorithmic formalism
Church-Turing thesis
Turing Machine easy to prove stuff here
easy to do stuff here
Finite Automata
Context-Free Grammar
This sentence is false.
Some self-referential sentences make statementsthat are perfectly acceptable, like this one.
Do we "reject" self-reference?
Deep Computer Science Idea:Programs are strings.Programs can process strings.So: Programs can 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.
bool halts( string pgm, string w ){ // pgm is the source code of a void function that takes one string parameter. // Return true if pgm halts on input w, false otherwise}
bool halts( string pgm, string w ){ // pgm is the source code of a void function that takes one string parameter. // Return true if pgm halts on input w, false otherwise}
Proof that the Halting Problem is Undecidable - 1
Example: void f( string w ){ if ( w[0]=='b' ) for (;;) ;}
void f( string w ){ if ( w[0]=='b' ) for (;;) ;}
p1
halts( p1, "hi" ) == true halts( p1, "bye") == false halts( p1, p1 ) == true
Suppose it were decidable. Then we'd have the following function:
Proof that the Halting Problem is Undecidable - 2
Of course, programs whose functions call functions are nbd...
Example: void g(){ for ( ;; ) ;}
void f( string w ){ if ( w[0]=='b' ) g() ;}
void g(){ for ( ;; ) ;}
void f( string w ){ if ( w[0]=='b' ) g() ;}
p2
halts( p2, "hi" ) == truehalts( p2, "bye") == falsehalts( p2, p2 ) == true
Proof that the Halting Problem is Undecidable - 3
What happens here?
Example:
p3
halts( p3, p3 ) == ?!!! true false true … contradiction
bool halts( string pgm, string w ){ // ...}void f( string w ){
if ( halts( w, w ) )for( ;; ) ;
}
bool halts( string pgm, string w ){ // ...}void f( string w ){
if ( halts( w, w ) )for( ;; ) ;
}
Conclusion: HP is unsolvable.
Halting Problem Unsolvable⇒Post Correspondence Problem Unsolvable⇒First-Order Logic Validity Problem Unsolvable
First-Order Logic Validity Problem Solvable⇒Post Correspondence Problem Solvable⇒Halting Problem Solvable⇒
Usually we work by proof by contradiction
Post Correspondence ProblemCan copies of a set of dominos be sequenced so that the string on top is the same as the string on the bottom?
1111
1111
1011110
1011110
100
100
Example problem instance:1
111
1111
1111
1111
1011110
1011110
1011110
1011110
100
100
100
100
Example problem instance:10
101
10101
01111
01111
101011
101011
Answer: No
10101
1010110
101
10101
01111
01111
01111
01111
101011
101011101011
101011
Answer: Yes 1011110
1011110
1111
1111
1111
1111
100
100
PCPCan copies of a set of dominos be sequenced so that the string on top is the same as the string on the bottom?
Example problem instance:
Answer: Yes
0010
0010
01011
01011
01101
01101
10001
10001
(but 66 dominos needed!)
PCP:Given {(r1,s1), ... (rn,sn)} where ri,si {0,1}*, does thereexist a sequence {i1...ik} such that ri1ri2...rik = si1si2...sik ?
0010
0010
01011
01011
01101
01101
10001
10001
HP solver
Post Correspondence Problem Solvable⇒Halting Problem Solvable
M,w instance converter
{(r1,s1), ... (rn,sn)}
(hypothetical)PCP solver
yes/no
Ensure:M halts on wiff {(r1,s1), ... (rn,sn)}has a solution
PROBLEM REDUCTION
PCP solver
PCP Solvable⇒First-Order Logic Validity Problem Solvable
instance converter
{ (r1,s1), ...(rn,sn) }
(hypothetical)Validity Detector
yes/no
Ensure:{(r1,s1), ... (rn,sn)}has a solutioniff is a valid wff.
PROBLEM REDUCTION
PCP reduction
PCP instance: 10101
10101
01111
01111
101011
101011
10101
10101gf
gfg
gfgfg
01111
01111fgggg
fgggg
101011
101011gfgfgg
gfgfgg
= ( 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)))) vw { 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
Wffify!
One constant: eTwo one-place function symbols: f,gOne two-argument predicate: P
Expressing unreachability
u v v is unreachable from u
R
In SECOND-ORDER logic:
unreachable( R,u,v):=Pxyz( Pxx (PxyPyz Pxz) Puv (Rxy Pxy))
Can we express this in first order logic?