NKU CSC 685 Kirby First-Order Logic and Undecidability.
-
Upload
beverly-stone -
Category
Documents
-
view
212 -
download
0
Transcript of NKU CSC 685 Kirby First-Order Logic and Undecidability.
![Page 1: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/1.jpg)
NKU CSC 685 Kirby
First-Order Logic and Undecidability
![Page 2: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/2.jpg)
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".
![Page 3: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/3.jpg)
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
![Page 4: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/4.jpg)
This sentence is false.
Some self-referential sentences make statementsthat are perfectly acceptable, like this one.
Do we "reject" self-reference?
![Page 5: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/5.jpg)
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.
![Page 6: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/6.jpg)
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:
![Page 7: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/7.jpg)
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
![Page 8: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/8.jpg)
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.
![Page 9: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/9.jpg)
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
![Page 10: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/10.jpg)
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
![Page 11: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/11.jpg)
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
![Page 12: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/12.jpg)
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
![Page 13: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/13.jpg)
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
![Page 14: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/14.jpg)
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
![Page 15: NKU CSC 685 Kirby First-Order Logic and Undecidability.](https://reader035.fdocuments.us/reader035/viewer/2022072006/56649d1a5503460f949f0418/html5/thumbnails/15.jpg)
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?