Learn Essays

HOME F.A.Q. REGISTER LOGIN SEARCH  
Essay Topics
Acceptance
Art
Business
Custom Written
Direct Essays
English
Example Essays
Foreign
History
Medical
Mega Essays
Miscellaneous
Movies
Music
Novels
People
Politics
Pre-Written
Religion
Science
Search
Speeches
Sports
Technology

Click here to get paid up to $147 / hour to take simple surveys


Featured Papers from RadEssays

1. Is Politics Science
2. Drinking and Driving
3. Lowering the Legal Drinking Age
4. Tacoma Narrows Bridge
5. The Death Penalty should not be part of the Judicial System
This is only a preview of the paper
Click here to register and get the full text.
Existing members click here to login

over the limit

DECIDABILITY In Chapter 3 we introduced the Turing machine as a model of a general purpose computer and defined the notion of algorithm in terms of Turing machines by means of the Church-Turing thesis. In this chapter we begin to investigate the power of algorithms to solve problems. We demonstrate certain problems that can be solved algorithmically and others that cannot. Our objective is to explore the limits of algorithmic solvability. You are probably familiar with solvability by algorithms because much of computer science is devoted to solving problems. The unsolvability of certain problems may come as a surprise. Why should you study unsolvability? After all, showing that a problem is unsolvable doesn't appear to be of any use if you have to solve it. You need to study this phenomenon for two reasons. First, knowing when a problem is algorithmically unsolvable is useful because then you realize that the problem must be simplified or altered before you can find an algorithmic solution. Like any tool, computers have capabilities and limitations that must be appreciated if they are to be used well. The second reason is cultural. Even if you deal with problems that clearly are solvable, a glimpse of the unsolvable can stimulate your imagination and help you gain an important perspective on computation. 4.1 DECIDABLE LANGUAGES In this section we give examples of languages that are decidable by algorithms. For example, we present an algorithm that tests whether a string is a member of a context-free language. This problem is related to the problem of recognizing and compiling programs in a programming language. Seeing algorithms solving various problems concerning automata is helpful, because later you will encounter other problems concerning automata that cannot be solved by algorithms. DECIDABLE PROBLEMS CONCERNING REGULAR LANGUAGES We begin with certain computational problems concerning finite automata. We give algorithms for testing whether a finite automaton accepts a string, whether the language of a finite automaton is empty, and whether two finite automata are equivalent. For convenience we use languages to represent various computational problems because we have already set up terminology for dealing with languages. For example, the acceptance problem for DFAs of testing whether a particular finite automaton accepts a given string can be expressed as a language, ADFA. This language contains the encodings of all DFAs together with strings that the DFAs accept. Let ADFA = {„´B, w„Ä | B is a DFA that accepts input string w}. The problem of testing whether a DFA B accepts an input w is the same as the problem of testing whether „´B, w„Ä is a member of the language ADFA. Similarly, we can formulate other computational problems in terms of testing membership in a language. Showing that the language is decidable is the same as showing that the computational problem is decidable. In the following theorem we show that ADFA is decidable. Hence this theorem shows that the problem of testing whether a given finite automaton accepts a given string is decidable. THEOREM 4.1 ADFA is a decidable language. PROOF IDEA The proof idea is very simple. We only need to present a TM M that decides ADFA. M = "On input „´B, w„Ä, where B is a DFA and w is a string: 1. Simulate B on input w. 2. If the simulation ends in an accept state, accept. If it ends in a non-accepting state, reject." PROOF We mention just a few implementation details of this proof. For those of you familiar with writing programs in any standard programming language, imagine how you would write a program to carry out the simulation. First, let's examine the input „´B, w„Ä. It is a representation of a DFA B together with a string w. One reasonable representation of B is simply a list of its five components, Q, ƒÃƒzƒnƒÔƒz q0, and F. When M receives its input, M first checks on whether it properly represents a DFA B and a string w. If not, M rejects. Then M carries out the simulation in a direct way. It keeps track of B's current state and B's current position in the input w by writing this information down on its tape. Initially, B's current state is q0 and B's current input position is the leftmost symbol of w. The states and position are updated according to the specified transition function ƒÔ. When M finishes processing the last symbol of w, M accepts the input if B is in an accepting state; M rejects the input if B is in a nonaccepting state. We can prove a similar theorem for nondeterministic finite automata. Let ANFA = {„´B, w„Ä | B is an NFA that accepts input string w}. THEOREM 4.2 ANFA is a decidable language. PROOF We present a TM N that decides ANFA. We could design N to operate like M, simulating an NFA instead of a DFA. Instead, we'll do it differently to illustrate a new idea: have N use M as a subroutine. Because M is designed to work with DFAs, N first converts the NFA it receives as input to a DFA before passing it to M. N = "On input „´B, w„Ä where B is an NFA, and w is a string: 1. Convert NFA B to an equivalent DFA C using the procedure for this conversion given in Theorem 1.19. 2. Run TM M from Theorem 4.1 on input „´C, w„Ä. 3. If M accepts, accept; otherwise reject." Running TM M in stage 2 means incorporating M into the design of N as a subprocedure. Similarly, we can test whether a regular expression generates a given string. Let AREX = {„´R,w„Ä | R is a regular expression that generates string w}. THEOREM 4.3 AREX is a decidable language. PROOF The following TM P decides AREX. P = "On input „´R, w„Ä where R is a regular expression and w is a string: 1. Convert regular expression R to an equivalent DFA A by using the procedure for this conversion given in Theorem 1.28. 2. Run TM M on input „´A, w„Ä. 3. If M accepts, accept; if M rejects, reject." Theorems 4.1, 4.2, and 4.3 illustrate that for decidability purposes, presenting the Turing machine with a DFA, NFA, or regular expression are all equivalent because the machine is able to convert one form of encoding to another. Now we turn to a different kind of problem concerning finite automata: emptiness testing for the language of a finite automaton. In the preceding theorems we had to test whether a finite automaton accepts a particular string. In the next proof we must test whether a finite automaton accepts any strings at all. Let EDFA = {„´A„Ä | A is a DFA and L(A) = „w}. THEOREM 4.4 EDFA is a decidable language. PROOF A DFA accepts some string if and only if reaching an accept state from the start state by traveling along the arrows of the DFA is possible. To test this condition we can design a TM T that uses a marking algorithm similar to that used in Example 3.14. T = "On input „´A„Ä where A is a DFA: 1. Mark the start state of A. 2. Repeat until no new states get marked: 3. Mark any state that has a transition coming into it from any state that is already marked. 4. If no accept state is marked, accept; otherwise reject." The next theorem states that testing whether two DFAs recognize the same language is decidable. Let EQDFA = {„´A, B„Ä | A and B are DFAs and L(A) = L(B)}. THEOREM 4.5 EQDFA is a decidable language. PROOF To prove this theorem we use Theorem 4.4. We construct a new DFA C from A and B, where C accepts only those strings that are accepted by either A or B but not by both. Thus, if A and B recognize the same language, C will accept nothing. This expression is sometimes called the symmetric difference of L(A) and L(B) and is illustrated in the following figure. Here is the complement of L(A). The symmetric difference is useful here because L( C) = „w if and only if L(A) = L(B). We can construct C from A and B with the constructions for proving the class of regular languages closed under complementation, union, and intersection. These constructions are algorithms that can be carried out by Turing machines. Once we have constructed C we can use Theorem 4.4 to test whether L(C) is empty. If it is empty, L(A) and L(B) must be equal. F = "On input „´A, B„Ä, where A and B are DFAs: 1. Construct DFA C as described. 2. Run TM T from Theorem 4.4 on input „´C„Ä. 3. If T accepts, accept. If T rejects, reject." DECIDABLE PROBLEMS CONCERNING CONTEXT-FREE LANGUAGES Here, we describe algorithms to test whether a CFG generates a particular string and to test whether the language of a CFG is empty.


Approximate Word count = 5907
Approximate Pages = 23.6
(250 words per page double spaced)
Over 101,000 Essays and Term Papers!!
Links
Why Does Our Law Limit Love

Foriegn Investment

Lowering the BAC Limit to 0 05

Why Does Our Law Limit Love

War a limit to intervension

Texas no limit hold em

Support
F.A.Q.
Custom Essays
Payment
Learn Essays
Forgot Password?
Activation Email
More Links
All Papers Are For Research And Reference Purposes Only! You may not turn these papers in as your own! You must cite our web site as your source!
Copyright 2003-2008 learnessays.com. All rights reserved.