INHERENT LIMITATIONS OF COMPUTER PROGRAMS - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

Description:

Run E on tape 2; when E goes to 'print' state, Check if tape 2 ... Run M for k steps on all strings of length k. Whenever M accepts on string w, print w. ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 25
Provided by: nickh4
Category:

less

Transcript and Presenter's Notes

Title: INHERENT LIMITATIONS OF COMPUTER PROGRAMS


1
CSci 4011
INHERENT LIMITATIONS OF COMPUTER PROGRAMS
2
TURING MACHINE
q0
q1
I
N
P
U
T
A
INFINITE TAPE
3
A TM recognizes a language if it accepts
all strings in the language.
A TM decides a language if it accepts all strings
in the language and rejects all strings not in
the language
A language is called decidable or recursive if
some TM decides it
4
Theorem If L is decidable then so is its
negation.
Proof Let M (Q,?,?,?,q0,qaccept,qreject)
decide L. We construct M that decides L.
M (Q,?,?,?,q0,qreject,qaccept), i.e. M with
qreject and qaccept swapped.
Suppose that w 2 L. Then M rejects w, since M
will go to qaccept on w.
Suppose that w ? L. Then M accepts w, since M
will go to qreject on w.
5
Theorem If L1 and L2 are decidable then so is
L1 n L2 w w 2 L1 and w 2 L2 .
Proof Let M1 decide L1 and M2 decide L2. We
build a two-tape TM M to decide L1 n L2.
6
MULTITAPE TURING MACHINES
? Q ? Gk ? Q ? Gk ? L,R,Sk
7
Theorem If L1 and L2 are decidable then so is
L1 n L2 w w 2 L1 and w 2 L2 .
Proof Let M1 decide L1 and M2 decide L2. We
build a two-tape TM M to decide L1 \ L2.
M works as follows
1. Copy the input to tape 2 and move to left edge
2. Run M1 on tape 1 and M2 on tape 2.
If either M1 or M2 reject, go to qreject
If both M1 and M2 accept, go to qaccept
8
Formally, let Mi (Qi,?,?i,?i,qsi,qai,qri).
Then M (Q,?,?,?,q0,qa,qr), where
Q Q1 Q2 Qcp,
? ?1 ?2 ?cp,
?((q1,q2),s1,s2)
(qr,s1,s2,S,S), if q1 q1r or q2 q2r
(qa,s1,s2,S,S), if q1 q1a and q2 q2a
((q1,q2),s1,s2,S,d2), if q1q1a
((q1,q2),s1,s2,d1,S), if q2q2a
((q1,q2),s1,s2,d1,d2), else
where (qi,si,di) ?i(qi,si)
9
Theorem Every Multitape Turing Machine can be
transformed into a single tape Turing Machine
0
0
1


0
0
1

10
SIMULATING MULTIPLE TAPES
?
?
?
?
L1000?R
L10001R
L100??R
100
qi
qi1
qi1?
qi1??
qjRSS
qj
qj101RSS
1. Format tape.
2. For each move of the k-tape TM
Scan left-to-right, finding current symbols
Scan left-to-right, writing new symbols
Scan left-to-right, moving each tape head.
3. If a tape head goes off right end, insert
blank. If tape head goes off left end, move
back right.
11
DOUBLE UNBOUNDED TURING MACHINE
I
N
P
U
T
UNBOUNDED TAPE
12
Theorem Double Unbounded Turing Machines are
equivalent to ordinary Turing Machines
Proof
To simulate ordinary machine
Go left, writeL, go right.
On L in any state, go right.
To simulate a double unbounded tape
Insert L at left edge.
Write R at right edge.
On L or R insert ?.
13
ENUMERATORS
Are TMs with print and halt states
instead of accept and reject
A string w is in L(E) if E eventually goes into
print state with w on the tape.
14
Terminology
A TM decides L if it accepts all strings in L
language and rejects all strings not in L
A language is called decidable or recursive if
some TM decides it
A TM recognizes a language if it accepts all and
only those strings in the language
A language is called Turing-recognizable if some
TM recognizes it
A language L is called recursively enumerable
if for some enumerator E, L(E) L.
15
Theorem L is Turing-recognizable , L is
recursively enumerable.
( Let L be enumerated by E. We write a
2-tape TM that recognizes L.
INPUT ENUM
10110011
01101001
Run E on tape 2 when E goes to print
state, Check if tape 2 tape 1 and accept if
true.
16
Theorem L is Turing-recognizable , L is
recursively enumerable.
) Let L be recognized by M. We can enumerate L
as follows
Run M for 1 step on all strings of length 1
Run M for 2 steps on all strings of length 2
?
Run M for k steps on all strings of length k
?
Whenever M accepts on string w, print w.
17
A language is called Turing-recognizable or
recursively enumerable if some TM recognizes it
A language is called decidable or recursive if
some TM decides it
18
Theorem If A and ?A are r.e. then A is recursive
Given TM M1 that recognizes A and TM M2 that
recognizes ?A, we can build a new machine that
decides A
Run M1 on tape 1, and M2 on tape 2.
accept.
If M1 accepts,
If M2 accepts,
reject.
19
SO
TMs are equivalent to multitape TMs
TMs are equivalent to double unbounded TMs
TMs are equivalent to IDTMs.
TMs are equivalent to nondeterministic TMs
TMs are equivalent to 2-stack PDAs.
TMs are equivalent to primitive recursive
functions.
TMs are equivalent to cellular automata.
20
THE CHURCH-TURING THESIS
L is recognized by a program for some
computer , L is recognized by a TM
The computer must be reasonable
21
The Church-Turing Thesis is consistent with all
known reasonable computers.
SCRATCH
1111
1101001
R1
1011001
R2
?
101111011011011001...
RAM
Programs for a computer have instructions
like ADD R1, R2, R3 LOAD R1, R2 STORE
R1,R2 MUL R1, R2, R2 BRANCH R1, X
22
Programming languages like Java, Python, Scheme,
C, are equivalent to TMs
We call such languages Turing complete.
Corollary. If two programming languages are
Turing complete, then they can recognize exactly
the same set of languages.
23
Can we encode a TM as a string of 0s and 1s?
start state
reject state
n states
0n10m10k10s10t10r10u1
m tape symbols (first k are input symbols)
blank symbol
accept state
lt(p,a), (q,b,L)gt 0p10a10q10b10
24
Since TMs and other languages are equivalent we
can also express TMs as programs.
Since programs are strings, we can
consider languages whose elements are programs.
We let ltMgt denote the encoding of TM M.
Theorem. We can make a Universal TM, a TM that
takes any ltMgt and any string w as input and
simulates the computation of M on w.
Write a Comment
User Comments (0)
About PowerShow.com