Download presentation
Presentation is loading. Please wait.
Published byBritton Simmons Modified over 8 years ago
1
2005 SDU Lecture11 Decidability
2
2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved by algorithms while other cannot. Explore the limits of algorithmic solvability. Demonstrate the un-solvability of certain problems.
3
2005 SDU 3 Example problems Consider the acceptance problem for DFAs: test whether a particular finite automaton accepts a given string. This can be expressed as a language A DFA. A DFA contains the encodings of all DFAs together with strings the DFAs accept, i.e., A DFA ={ | B is a DFA that accepts w} Hence, testing whether DFA B accepts w is the same as testing whether A DFA.
4
2005 SDU 4 Decidability related to DFA A DFA is a decidable language Proof idea: construct a TM M that decides A DFA M=“On input, where B is a DFA and w is a string: 1.Simulate B on w; 2.If the simulation ends in an accept state then accept; if it ends in a non-accept state then reject.” Note: w is finite and simulation always ends.
5
2005 SDU 5 Decidability related to NFA A NFA = { | B is an NFA that accepts string w} is decidable. N = “On input, where B is an NFA and w is a string: 1.Convert NFA B to a DFA C; 2.Run TM M on ; 3.If M accepts, accept; otherwise reject.” Note: running M in stage 2 means incorporating M into the design of N as a sub-procedure, where M is the decider of A DFA.
6
2005 SDU 6 Concerning regular expression A REX = { | R is a regular expression that yields string w} Conclusion: A REX is a decidable language. The following TM P decides A REX P=“On input, where R is a regular expression and w is a string 1.Convert R to an equivalent DFA A; 2.Run TM M on input ; 3.If M accepts, accept; if M rejects, reject.”
7
2005 SDU 7 Emptiness problem E DFA = { | A is a DFA and L(A)= } is decidable. Proof idea: A DFA accepts some string iff reaching a final state from the start state by traveling along the arrows of the DFA is possible. To test this condition we can construct the TM T that marks states of DFA using the state transition function of the DFA. Use T to solve the emptiness problem. T = “On input, where A is a DFA: 1.Mark the start state of A 2.Repeat until no new states get marked: –Mark any state that has a transition coming into it from any state that is already marked. 3.If no final state is marked, accept; otherwise, reject. ”
8
2005 SDU 8 Language equality The problem: for two DFA-s A and B, is L(A) = L(B)? The language: EQ DFA = { | A and B are DFAs and L(A) = L(B)} EQ DFA is decidable. Proof idea: 1.Construct a DFA C from A and B where C accepts only those strings that are accepted either by A or B but not by both. 2.If A and B recognize the same language, then C accepts nothing. 3.The language of C is defined by, which is called the symmetric difference of L(A) and L(B) 4. Use T to check whether L(C) is empty.
9
2005 SDU 9 Decide language equality F = “On input, where A and B are DFAs: 1.Construct DFA C that recognizes L(C) as described above; 2.Run TM T on input ; 3.If T accepts, accept; if T rejects, reject.”
10
2005 SDU 10 String generation problem Problem: For a given CFG grammar G =(V, , R, S) and a string w *, does G generates w (i.e., is S=>*w true?) Language: A CFG ={ | G is a CFG that generates string w} A CFG is decidable.
11
2005 SDU 11 Decidability concerning CFG Proof idea: For a CFG G and a string w: First idea: Go through all derivations generated by G checking whether any is a derivation of w. Since there are infinitely many derivations this idea does not work. If G does not generates w, the algorithm does not halt, i.e., this idea provides a recognizer but not a decider. If G is a CFG in Chomsky normal form then for any w L(G), where |w|=n, exactly 2n-1 steps are required for any derivation of w. Proof. Derivation rules of a Chomsky normal form are of the forms: A A 1 A 2 |A a. The rule A A 1 A 2 adds 1 to the length of w. That is if |w|=n, then S=>A 1 A 2 =>A 1 A 2 A 3 =>…A 1 A 2 …A n, using n-1 steps. To eliminate A 1, A 2, …, A n by rules of the from A a we need another n steps. Hence, only 2n-1 steps are required.
12
2005 SDU 12 Decide A CFG The TM S that decides A CFG is: S = “On input, where G is a CFG and w is a string: 1.Convert G to an equivalent grammar in Chomsky normal form; 2.List all derivations with 2n-1 steps, n = length (w) except if n 1; for n 1 list all derivations with 1 step; 3. If any of the derivations listed above generates w, accept; if not, reject.” Theorem 2.12 provides a mechanism to convert a CFG into a PDA and vice versa; hence, everything about decidability of problems concerning CFG applies equally to PDA.
13
2005 SDU 13 Decide CFL Every CFL is decidable Proof. Let A be a CFL and G be a CFG for A. Design a TM M G that decides A. We build a copy of G into M G. M G =“On input w: 1. Run TM S on input 2. If S accepts, accept, if it rejects, reject.” regular Context free decidable recognizable
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.