Presentation is loading. Please wait.

Presentation is loading. Please wait.

NKU CSC 685 Kirby First-Order Logic and Undecidability.

Similar presentations


Presentation on theme: "NKU CSC 685 Kirby First-Order Logic and Undecidability."— Presentation transcript:

1 NKU CSC 685 Kirby First-Order Logic and Undecidability

2 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".

3 von Neumann Machine Multitape TM Nondeterministic TM Random Access Machine procedural pseudocodeyour favorite algorithmic formalism Church-Turing thesis Turing Machine easy to prove stuff here easy to do stuff here Finite Automata Context-Free Grammar

4 This sentence is false. Some self-referential sentences make statements that are perfectly acceptable, like this one. Do we "reject" self-reference?

5 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.

6 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:

7 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" ) == true halts( p2, "bye") == false halts( p2, p2 ) == true

8 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.

9 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

10 Post Correspondence Problem Can copies of a set of dominos be sequenced so that the string on top is the same as the string on the bottom? 1 111 1 111 10111 10 10111 10 0 10 0 Example problem instance: 1 111 1 111 1 111 1 111 10111 10 10111 10 10111 10 10111 10 0 10 0 10 0 10 0 Example problem instance: 10 101 10 101 011 11 011 11 101 011 101 011 Answer: No 10 101 10 101 10 101 10 101 011 11 011 11 011 11 011 11 101 011 101 011 101 011 101 011 Answer: Yes 10111 10 10111 10 1 111 1 111 1 111 1 111 10 0 10 0

11 PCP Can 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 001 0 001 0 01 011 01 011 01 101 01 101 10 001 10 001 (but 66 dominos needed!) PCP: Given {(r 1,s 1 ),... (r n,s n )} where r i,s i  {0,1}*, does there exist a sequence {i1...ik} such that r i1 r i2...r ik = s i1 s i2...s ik ? 001 0 001 0 01 011 01 011 01 101 01 101 10 001 10 001

12 HP solver Post Correspondence Problem Solvable ⇒ Halting Problem Solvable M,w instance converter {(r 1,s 1 ),... (r n,s n )} (hypothetical) PCP solver yes/no Ensure: M halts on w iff {(r 1,s 1 ),... (r n,s n )} has a solution PROBLEM REDUCTION

13 PCP solver PCP Solvable ⇒ First-Order Logic Validity Problem Solvable instance converter { (r 1,s 1 ),... (r n,s n ) } (hypothetical) Validity Detector yes/no Ensure: {(r 1,s 1 ),... (r n,s n )} has a solution iff  is a valid wff. PROBLEM REDUCTION 

14 PCP reduction PCP instance: 10 101 10 101 011 11 011 11 101 011 101 011 10 101 10 101 gf gfg gf gfg 011 11 011 11 fgg gg fgg gg 101 011 101 011 gfg fgg gfg fgg  = ( 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 Wffify! One constant: e Two one-place function symbols: f,g One two-argument predicate: P

15 Expressing unreachability u v v is unreachable from u R 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?


Download ppt "NKU CSC 685 Kirby First-Order Logic and Undecidability."

Similar presentations


Ads by Google