7. Let Σ = {a}, and consider the language L = {a n : n is a prime number} = {a 2 , a3 , a5 , a7 , a11 , . . .}.
Is L a regular language?
Why or why not? (Hint: L contains a 11 , a 17 , a 23 , a 29, but not a 77 since 77 is divisible by 11. . . )
8. Design a Turing machine that calculates the sum of two unary numbers. (You can assume the input consists of two unary numbers separated by a single blank space.)
7.
L is not a regular language.
The strings enumerated by the given language are { a^2, a^3, a^5, a^7, a^11, ......... }
A language on a unary alphabet can be accepted by a finite automata only where there is an arithmetic progression with respect to the unary alphabet. Here, the unary alphabet is a and there is no pattern of arithmetic progression among the strings a^2, a^3, a^5, a^7, a^11, ..........
So, the given language L is not a regular language.
8.
In order to build a turing machine to add 2 unary numbers with a blank symbol B in between the numbers, let's consider a string as an instance of the given language.
The string to be considered is represented in the tape as :
1 | 1 | B | 1 | 1 | 1 | B |
Here, the unary numbers to be added are 11 and 111 and this would give 11111 that is 2 + 3 = 5.
So, at first, let the initial state be q0.
State q0 on seeing input symbol 1 will remain in the same state, makes no changes to the symbol and moves the head towards the right.
The partial turing machine is :
The tape will remain as it is.
State q0 on seeing blank symbol B, will change B to symbol 1, change itself to state q1 and move the head towards the right.
The partial turing machine is :
The tape will become :
1 | 1 | 1 | 1 | 1 | 1 | B |
State q1 on seeing 1 will remain in the same state, make no changes to the symbol and move the head towards the right.
The partial turing machine is :
The tape will remain as it is.
State q1 on seeing blank input B will go to state q2, make no changes to the symbol and move the head towards the left.
The partial turing machine is :
The tape will remain as it is.
State q2 on seeing the symbol 1 to the left of the blank symbol will change to the final state q3, change the symbol 1 to blank symbol B and move the head towards the right.
The partial turing machine is :
The tape will become :
1 | 1 | 1 | 1 | 1 | B | B |
The output 11111 is displayed on the tape which is the required value.
So, the final turing machine for the given language is :
Question 7. Let Σ = {a}, and consider the language L = {a^n : n is a prime number} = {a 2 , a3 , a5 , a7 , a11 , . . .}. Is L a regular language? Why or why not? (Hint: L contains a 11 , a 17 , a 23 , a 29, but not a 77 since 77 is divisible by 11. . . )
Let Σ = { a } , and consider the language L = { a n : n is a prime number } = { a 2 , a 3 , a 5 , a 7 , a 11 , . . . } . Is L a regular language? Why or why not? (Hint: L contains a 11 , a 17 , a 23 , a 29 , but not a 77 since 77 is divisible by 11. ....
Question 8. Design a Turing machine that calculates the sum of two unary numbers. (You can assume the input consists of two unary numbers separated by a single blank space.)
6. Determine whether or not the following languages on Σ-(a) are regular (a) L = {an : n > 2, is a prime number) (b) L fa"n : n is not a prime number. (c) L-(an . Ti--k3 for some k 20} Tt . L={an : n = 2k for some k > 0} (e) L an: n is the product of two prime numbers). (f) L = {an : n is either prime or the product of two or...
Question 5. Let Σ = {a, b}, and consider the language L = {a^n : n is even} ∪ {b^n : n is odd}. Draw a graph representing a DFA (not NFA) that accepts this language.
Let Σ = { a, b } , and consider the language L = { a n : n is even } ∪ { b n : n is odd } . Draw a graph representing a DFA (not NFA) that accepts this language.
Question 5. Let Σ = {a, b}, and consider the language L = {a n : n is even} ∪ {b n : n is odd}. Draw a graph representing a DFA (not NFA) that accepts this language. Question 6. Give a brief description of the language generated by the following production rules. S → abc S → aXbc Xb → bX Xc → Ybcc bY → Yb aY → aa aY → aaX
Question 1. Let Σ = {a, b}, and consider the language L = {w ∈ Σ ∗ : w contains at least one b and an even number of a’s}. Draw a graph representing a DFA (not NFA) that accepts this language. Question 2. Let L be the language given below. L = {a n b 2n : n ≥ 0} = {λ, abb, aabbbb, aaabbbbbb, . . .} Find production rules for a grammar that generates L.
T F 5, Σ = {a,b), L = { s: s = anbm, nzn, m20, Isl s IP(Σ)13. (Th not longer than the number of elements in the power set of 2.) The re language pumping theorem could show that L RLs. T F 6. An NDFSM that recognizes a language L may have computation branc at is, s e L iff s is it accepts a string w L. 7. ISI = Ko, where S is a set. Ir(s)l...
Automata: solve a - e 2. (10+10+10+10+10-50 points) Agrammar is a 4-tuple G, G-ON,E,11,L$) where N is a finite set of nonterminal symbols Σ is a finite set of terminal symbols is a finite set of rules S is the starting symbol Let N- (S, T s-{a, b, c} s-> ab aT >aaTb aT-ac S is the starting symbol. (a 10 points) Prove that the given grammar G is a context sensitive grammar. (b-10 points) What is the language L-...