Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem,...
-
Upload
vladimir-kulyukin -
Category
Technology
-
view
1.145 -
download
2
Transcript of Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem,...
![Page 1: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/1.jpg)
Theory of Computation
Trivial & Non-Trivial Program Properties, The Halting Problem,
Index Sets, Rice's TheoremVladimir Kulyukin
www.vkedco.blogspot.com
![Page 2: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/2.jpg)
Outline
● STP Theorem● Trivial and Non-Trivial Program Properties● Halting Problem● Example of Self-Reference Argument● Index Sets● Statement of Rice's Theorem
![Page 3: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/3.jpg)
STP Theorem
![Page 4: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/4.jpg)
Theorem 3.2 (Ch. 4): STP Theorem
( )recursive. primitive is
,,,..., predicate the,0For 1)( tyxxSTPn n
n>
![Page 5: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/5.jpg)
The Big Picture
GÖDEL Coder
GÖDEL Decoder
L Program Number Universal Program
Number
???
GÖDEL Coder = CompilerGÖDEL Decoder = Reverse CompilerUniversal Program = Operating System/VM/Interpreter
Universality Theorem
Simulator
Step-Counter Theorem
![Page 6: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/6.jpg)
Interesting Implications
• We do not have to be tied to a specific universal program (operating system) to run our programs– Example: We do not need the L operating system to run L
programs. We can implement an L simulator on Linux in C and run L programs
• We can simulate one universal program (operating system) on another universal program (operating system)– Example: Virtual Box is can simulate Linux on Windows
![Page 7: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/7.jpg)
Trivial & Non-Trivial Program Properties&
The Halting Problem
![Page 8: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/8.jpg)
Trivial & Non-Trivial Program Properties&
The Halting Problem
![Page 9: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/9.jpg)
Program Properties
● Can we determine non-trivial properties of programs?
● Examples:– Does a program halt on a given input?– Does a program compute a specific
function?– Does a program plagiarize another program?
![Page 10: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/10.jpg)
The Halting Problem
.number input on
halts number program),(
x
yyxHALT ⇔
![Page 11: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/11.jpg)
The Halting Problem
( )
( )( )
( )( )
↑
↓=
↑↓
=
=
xΨ
xΨyxHALT
yxΦ
yxΦyxHALT
yPP
P
P
)1(
)1(
if 0
if 1),(
, if 0
, if 1),(
.# such that program a be Let
![Page 12: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/12.jpg)
Theorem 2.1 (Ch. 4)
computablenot is ),( yxHALT
![Page 13: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/13.jpg)
Proof
● Suppose that HALT(x,y) is computable● Consider the following L program P:
[A1] IF HALT(X1,X1) GOTO A1
Y Y + 1←
![Page 14: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/14.jpg)
Proof: What Does P Do?
● P is a valid L program● It considers X1 to be a program number, i.e., a Gödel
number● If X1 halts on its own Gödel number, P goes into an
infinite loop, i.e., its output is undefined● If X1 does not halt on its own Gödel number, P goes to
line 2 and sets Y to 1
![Page 15: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/15.jpg)
Proof
( )
( )
( )
¬↑
=
==↑
=
),( if 1
),( if
:
0),( if 1
1),( if
? isWhat
)1(
)1(
)1(
xxHALT
xxHALTxΨ
Or
xxHALT
xxHALTxΨ
xΨ
P
P
P
![Page 16: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/16.jpg)
Proof
( )( )
( ) ),( iff ),(
:
0),( if 1),( .2
1),( if 0),( 1.
Then .#Let
.# computecan weprogram, L valida is Since
0
0
0
0
xxHALTyxHALTx
Or
xxHALTyxHALT
xxHALTyxHALT
yP
PP
¬∀
====
=
![Page 17: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/17.jpg)
Proof
( )
).,( iff ),(
Then .Let
).,( iff ),( that know We
?),( isWhat
0000
0
0
00
yyHALTyyHALT
yx
xxHALTyxHALTx
yyHALT
¬=
¬∀
![Page 18: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/18.jpg)
Important Implication
.on halt
eventually willnot or whether determinecan
, input an and language)other any (or in
program agiven that,algorithm no is There
x
P
xLP
![Page 19: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/19.jpg)
Example of the Self-Reference Argument
● Suppose that some security expert comes to you and says that he/she has developed a program that detects all viruses of type Z
● Let us assume, for the sake of simplicity, that Z viruses are programs of one argument (e.g., a file path)
● Suppose the expert's program implements the predicate isVirusZ(x,y), where y is the compiled source code of a suspect program and x is an input to y (e.g. x is a file path)
● Question: Is isVirusZ(x,y) really computable?
![Page 20: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/20.jpg)
Example of the Self-Reference Argument
● Suppose that isVirus(X1, X2) is computable● Suppose that we have implemented ApplyVirusZ(X1)
that applies virus Z to X1● Consider this program P of two arguments X1 and X2:
Y 0←
IF isVirusZ(X1, X2) GOTO A1
ApplyVirusZ(X1) GOTO E
[A1] Y Y + 1←
![Page 21: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/21.jpg)
Example of the Self-Reference Argument
( ) ( ) ( )( ) ( ) ( )
( )( ) ( ) ( )
( ) 1, thus Z,Virusapply does
and 0, then ,0, If
0, thus Z,Virusapply not does
and 1, then ,1, If
?, is What . Suppose
00
00002
P
00
00002
P
002
P0
===
===
=
yyisVirusZP
yyisVirusZyyΨ
yyisVirusZP
yyisVirusZyyΨ
yyΨyP#
![Page 22: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/22.jpg)
Index Sets
![Page 23: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/23.jpg)
Definition: Index Set
{ }.|
variable.one of functions computablepartially of collection a is
Γ∈Φ∈=Γ
Γ tNtR
![Page 24: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/24.jpg)
Examples● Example 1
– Γ = primitive recursive functions of one variable– RΓ = L-program numbers that compute primitive recursive functions of one
variable● Example 2
– Γ = functions that map a specific program to a plagiarized version of that program
– RΓ = L-program numbers that compute these plagiarizing functions of one variable
● Example 3– Γ = sorting functions of one variable– RΓ = L-program numbers that compute sorting functions of one variable
![Page 25: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/25.jpg)
Rice's Theorem
![Page 26: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/26.jpg)
Properties of Programs
.in function a
computes program particular a on whether
depending FALSEor TRUE returns and
input as programs accepts that algorithman is
thereifonly and if decidable is in Membership
Γ
ΓR
![Page 27: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/27.jpg)
Rice’s Theorem
● The theorem is named after Henry Gordon Rice, a U.S. mathematician
● Rice’s Theorem (Informal Statement): For any non-trivial property of partially computable functions, there is no general and effective method to decide whether an algorithm computes a partially computable function with that property
● A property is trivial if it holds for all partially computable functions or for none
![Page 28: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/28.jpg)
Rice’s Theorem
( ) ( )
( ) ( ) recursive.not is Then . ,
such that functions computablepartially
be ,Let variable.one of functions
computablepartially of collection a be Let
ΓΓ∉Γ∈
Γ
Rxgxf
xgxf
![Page 29: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/29.jpg)
Rice’s Theorem: Original Formulation
{ }
variable.one of
functions computablepartially all includes
or ifonly and if recursive
is |Then variable.one of
functions p.c. of collection a be Let
CC
Cx
C
x
∅=∈Φ
![Page 30: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/30.jpg)
Proof Sketch
● Suppose we have Γ, a non-trivial collection of partially computable functions
● Suppose that there exists an algorithm (an L-program) that decides if another algorithm computes a function in Γ. To put it differently, Γ has a computable characteristic function
● Let us call this algorithm isInGamma(x), where x is a Gödel number, i.e. a compiled L-program
● We now proceed to show that we can use this algorithm to solve the Halting Problem
![Page 31: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/31.jpg)
Proof Sketch: Reduction
● We will use the so-called reduction argument● Suppose that we have a problem A that we know to be
undecidable, e.g. the Halting Problem● Suppose that we are given another problem B ● If we want to show that B is undecidable, we can assume that B
is decidable and then conclude that the decidability of B leads to the decidability of A
● This is a contradiction, of course, because we know that A is undecidable
● In this case, A is the Halting Problem and B is Rice’s theorem
![Page 32: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/32.jpg)
Proof Sketch
● Since Γ is non-trivial, let f(x) be a partially computable function in Γ and let F be a corresponding L-program
● Since Γ is non-trivial, let g(x) be a partially computable function not in Γ and let G be a corresponding L-program
● For any two values of z and w, we can construct the following program P:
IF HALT(z,w) GOTO A1 Y G(X1)←
GOTO E[A1] Y F(X1)←
![Page 33: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/33.jpg)
Proof Sketch● Since isInGamma(x) is an algorithm that computes a
characteristic function of Γ, it must return 1 or 0 for any natural number x
● Since P is a valid L program, it has a unique Gödel number #(P)
● Let x = #(P). Then isInGamma(x) = 1 if and only if HALT(z, w) = 1
● Since we can do this construction for any numbers of z and w, the existence of isInGamma shows that the Halting Problem is computable (or decidable), which is a contradiction
![Page 34: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/34.jpg)
Brief & Gentle Introduction to
Turing Machines
![Page 35: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/35.jpg)
Hilbert’s Lecture
David HilbertMathematical Problems
Lecture at the International Congress of Mathematicians, Paris 1900
![Page 36: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/36.jpg)
Hilbert’s 10th Problem
Given a Diophantine equation with any number of unknown quantities and with rational integral numerical coefficients: To devise a process according to which it can be determined by a finite number of operations whether the equation is solvable in rational integers.
![Page 37: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/37.jpg)
Diophantine Problem
A Diophantine equation is an equation in which only integers solutions are allowed
ax + by = c, where a, b, c are integers
![Page 38: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/38.jpg)
Turing Machines
● Alan Turing discovered this device in 1936-37● A Turing Machine (TM) is a device with internal states● At any particular instant, the device is scanning one
square on a linear tape which is infinite in both directions
● The combination of the current symbol and the state determines what the device does next
![Page 39: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/39.jpg)
Turing Machines
● A TM is a theoretical symbol manipulating device● A TM can simulate any computer algorithm (this is a
simple formulation of what came to be known as the Church-Turing thesis, a version of Church's thesis)
● TMs are useful for simulating and understanding how computer CPUs work
![Page 40: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/40.jpg)
Alan Turing's Description
...an infinite memory capacity obtained in the form of an infinite tape marked out into squares, on each of which a symbol could be printed. At any moment there is one symbol in the machine; it is called the scanned symbol. The machine can alter the scanned symbol and its behavior is in part determined by that symbol, but the symbols on the tape elsewhere do not affect the behavior of the machine. However, the tape can be moved back and forth through the machine, this being one of the elementary operations of the machine. Any symbol on the tape may therefore eventually have an innings.
Alan Turing, “Intelligent Machinery,” 1948
![Page 41: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/41.jpg)
Turing Machines
● The actions available to the device are:– Print a symbol– Move right– Move left– Enter a new state
![Page 42: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/42.jpg)
Turing Machines: Notation
blank. i.e. ,
symbols. printablerepresent ,...,, Symbols
states.represent ...,, Symbols
0
210
321
Bs
sss
qqq
=
![Page 43: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/43.jpg)
Turing Machines: A Perspective
● A Turing Machine (TM) is another formalism that captures the intuitive notion of computation
● We will confine ourselves with the formal definition of TM and a brief review of several TM theorems
● The most important results are 1) Any partially computable function can be computed by a TM and 2) The Universality Theorem can be proved with Turing Machines (there exists a Universal Turing Machine)
![Page 44: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/44.jpg)
Turing Machines: Alphabet
{ }
alphabet. theofpart
not is that , symbol,blank special a is There
.,...,, TM a ofalphabet The
0
21
Bs
sss m
==
![Page 45: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/45.jpg)
Action Quadruples
. into go andleft square one move
,s scanning and statein When
s .3
. into go andright square one move
,s scanning and statein When
s .2
. into go and print
,s scanning and statein When
s 1.
l
ji
lji
l
ji
lji
lk
ji
lkji
q
q
qLq
q
q
qRq
qs
q
qsq
![Page 46: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/46.jpg)
Turing Machine: Definition
A Turing Machine is a finite set of action quadruples
![Page 47: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/47.jpg)
Deterministic Turing Machine
A deterministic Turing Machine is a
finite set of quadruples no two of which
begin with the same pair qisj
![Page 48: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/48.jpg)
Non-deterministic Turing Machine
A non-deterministic Turing Machine is a
finite set of quadruples some of which
may begin with the same pair qisj
![Page 49: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/49.jpg)
Turing Machines: Computation
tape.on theleft
symbolsblank -non theis TM a ofoutput The .3
. start with that quadruples no are thereand
scanning statein isit when halts TMA .2
. statein starts always TMA 1. 1
ji
ji
sq
sq
q
![Page 50: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/50.jpg)
Example
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
:TM following heConsider t
qBq
Rqq
qBq
Rqq
BRqq
![Page 51: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/51.jpg)
Example: Input 1
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 B B B B
q1
MOVE 1: Action quadruple 1 applies. The TM moves rights and goes into q2.
![Page 52: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/52.jpg)
Example: Input 1
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 B B B B
q2
MOVE 2: Action quadruple 2 applies. The TM moves rights and stays in q2.
![Page 53: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/53.jpg)
Example: Input 1
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 B B B B
q2
MOVE 3: Action quadruple 3 applies. The TM prints 1 over B and goes into q3.
![Page 54: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/54.jpg)
Example: Input 1
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 B B B
q3
MOVE 4: Action quadruple 4 applies. The TM moves right and stays in q3.
![Page 55: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/55.jpg)
Example: Input 1
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 B B B
q3
MOVE 5: Action quadruple 5 applies. The TM prints 1 over B and goes into q1.
![Page 56: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/56.jpg)
Example: Input 1
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 1 B B
q1
No action quadruple applies so the TM halts with theoutput 111.
![Page 57: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/57.jpg)
Example: Input 2
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 B B B
q1
MOVE 1: Action quadruple 1 applies. The TM moves rights and goes into q2.
![Page 58: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/58.jpg)
Example: Input 2
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 B B B
q2
MOVE 2: Action quadruple 2 applies. The TM moves rights and stays in q2.
![Page 59: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/59.jpg)
Example: Input 2
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 B B B
q2
MOVE 3: Action quadruple 2 applies. The TM moves rights and stays in q2.
![Page 60: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/60.jpg)
Example: Input 2
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 B B B
q2
MOVE 4: Action quadruple 3 applies. The TM prints 1 over B and goes in q3.
![Page 61: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/61.jpg)
Example: Input 2
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 1 B B
q3
MOVE 5: Action quadruple 4 applies. The TM moves right and stays in q3.
![Page 62: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/62.jpg)
Example: Input 2
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 1 B B
q3
MOVE 6: Action quadruple 5 applies. The TM prints 1 and goes into q1.
![Page 63: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/63.jpg)
Example: Input 2
13
33
32
22
21
1 .5
1 .4
1 .3
1 .2
.1
qBq
Rqq
qBq
Rqq
BRqqB 1 1 1 1 B
q1
NO MOVE: No action quadruple is applicable. The TM halts with the output 1111.
![Page 64: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/64.jpg)
Question
What does the TM in the previous example compute?
![Page 65: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/65.jpg)
Answer
f(x) = x + 2
![Page 66: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/66.jpg)
Two Fundamental Theoremson Turing Machines
![Page 67: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/67.jpg)
Theorem 1
. computes that TM a is there
Then .alphabet somefor ,on function
computablepartially ary -man be Let *
f
AA
f
![Page 68: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/68.jpg)
Theorem 2
There exists a universal TM, i.e., a TM that takes a code (description) of an arbitrary TM and its input and proceeds to execute that TM on that input.
![Page 69: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/69.jpg)
Theorem 3: Proof Outline
( )
( )
( )
( ). computes that TM a ofn descriptio thecalled is context, TM In the
:)on s terminateprogram the(if tapeon the of ueoutput val the
leaves andion configurat following in the starts .it call number, a havemust
programThat it. computes that in program a is therefunction, partial a is if
Thus, . and 1 symbolsonly usingit computes that TM a is thereTheorem),
ity Universalin thein proved (wefunction computable partial a is , Since
0
1
0
0
xgz
q
BxBz
xxg
Mz
Lxg
BM
zxΦ
↑
![Page 70: Theory of Computation (Fall 2013): Trivial & Non-Trivial Program Properties, The Halting Problem, Index Sets, Rice's Theorem, Turing Machines](https://reader033.fdocuments.in/reader033/viewer/2022052823/55502331b4c905af648b5510/html5/thumbnails/70.jpg)
Reading Suggestions
● Ch. 4, Computability, Complexity, and Languages, 2nd Edition, by Davis, Weyuker, Sigal