Open In App

Construct a Turing machine for L = {aibjck | i< j< k; i ≥ 1}

Last Updated : 23 Apr, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite – Turing Machine
In given language L = {aibjck | i< j< k; i≥ 1}, every string of ‘a’, ‘b’ and ‘c’ have certain number of a’s, then certain number of b’s and then certain number of c’s. The condition is that count of 1st symbols should be atleast 1. ‘b’ and ‘c’ can have thereafter be as many but count of a is less than count of ‘b’ and count of ‘b’ is less than count of ‘c’. Assume that string is ending with ‘$’.
Examples:

Input: a a a b b c  
       Here a = 3, b = 2, c = 1 but |a|<|b|<|c|
Output: NOT ACCEPTED
          
Input: a b b c c c
       Here a = 1, b = 2, c = 3 
Output:ACCEPTED 

Tape Representation:

Approach:

  1. Comparing two elements by making D & C as a single element.
  2. After that Comparing D & C.
  3. If |A| is greater than |(D, C)|, then it is not accepted.
  4. If |C| is greater than |D|, then it is not accepted.
  5. Else it is accepted.

Steps:

  • Step-1: Convert A into X and move right and goto step 2.If Y is found ignore it and move right to step-5.
  • Step-2: Keep ignoring A and Y and move towards right. Convert D into Y and move right and goto step-3.
  • Step-3: Keep ignoring D and Z and move towards right.If C is found make it Z and move left to step 4.
  • Step-4: Keep ignoring Z, A, Y and D and move towards left.If X is found ignore it and move right and goto step-1.
  • Step-5: Keep ignoring Y and move towards right. Ignore Z move left and goto step-8.If D is found make it Y and move right to step-6.
  • Step-6: Keep ignoring D and Z and move towards right.Convert C into Z and move left and goto step-7.
  • Step-7: Keep ignoring D and Z and move towards left.If Y is found ignore it and move right and goto step-5.
  • Step-8: Stop the Machine (String is accepted)

State transition diagram :

Here, Q0 shows the initial state and Q1, Q2, Q3, Q4, Q5, Q6 shows the transition state and Q7 shows the final state. A, C, D are the variables used and R, L shows right and left.

Explanation:

  • Using Q0, when A is found make it X and go to the right and to state Q1. And, when Y is found ignore it and go to the right and to state Q4
  • On the state Q1, ignore all A and Y and goto right. If D found, make it Y and goto right into next state Q2.
  • In Q2, ignore all D, Z and move right. If C found, make it Z move left and to Q3.
  • In Q3 state, ignore all Z, D, Y, A and move left. If X found, ignore it move right to Q0.
  • In Q4, ignore all Y and move right. If Z found, ignore it move left to state Q6. If D is found, make it Y and move to the right to Q5.
  • In Q5 state, ignore all D, Z and move right. If C found, make it Z move left to state Q6
  • In Q6, ignore all D, Z and move left. If Y found, ignore it and move right to state Q4.
  • If Q7 state is reached it will produce the result of the acceptance of string.

Note: For comparison of |A|, |D|, |C|, the concept of Turing Machine as Comparator is used.


Similar Reads

Construct Turing machine for L = {a<sup>n</sup> b<sup>m</sup> a<sup>(n+m)</sup> | n,m≥1}
L = {an bm a(n+m) | n,m≥1} represents a kind of language where we use only 2 character, i.e., a and b. The first part of language can be any number of "a" (at least 1). The second part be any number of "b" (at least 1). The third part of language is a number of "a" whose count is sum of count of a's in first part of string and count of b's in secon
3 min read
Construct a Turing Machine for language L = {0<sup>n</sup>1<sup>n</sup>2<sup>n</sup> | n≥1}
Prerequisite - Turing Machine The language L = {0n1n2n | n≥1} represents a kind of language where we use only 3 character, i.e., 0, 1 and 2. In the beginning language has some number of 0's followed by equal number of 1's and then followed by equal number of 2's. Any such string which falls in this category will be accepted by this language. The be
3 min read
Construct a Turing machine for L = {a<sup>i</sup>b<sup>j</sup>c<sup>k</sup> | i &lt; j &lt; k or i &gt; j &gt; k}
Prerequisite – Turing Machine The language L = {aibjck | i &lt; j &lt; k or i &gt; j &gt; k} is same as the union of two languages L1={aibjck | i &lt; j &lt; k } and L2={aibjck | i &gt; j &gt; k } In this language, every string of ‘a’, ‘b’ and ‘c’ have certain number of a’s, then certain number of b’s and then certain number of c’s. The condition i
5 min read
Construct a Turing machine for L = {a<sup>i</sup>b<sup>j</sup>c<sup>k</sup> | i*j = k; i, j, k ≥ 1}
Prerequisite – Turing Machine In a given language, L = {aibjck | i*j = k; i, j, k ≥ 1}, where every string of 'a', 'b' and 'c' has a certain number of a's, then a certain number of b's and then a certain number of c's. The condition is that each of these 3 symbols should occur at least once. 'a' and 'b' can occur however many times, but the occurre
2 min read
Construct Pushdown automata for L = {0<sup>n</sup>1<sup>m</sup>2<sup>m</sup>3<sup>n</sup> | m,n ≥ 0}
Prerequisite - Pushdown automata, Pushdown automata acceptance by final state Pushdown automata (PDA) plays a significant role in compiler design. Therefore there is a need to have a good hands on PDA. Our aim is to construct a PDA for L = {0n1m2m3n | m,n ≥ 0} Examples - Input : 00011112222333 Output : Accepted Input : 0001122233 Output : Not Accep
3 min read
NPDA for accepting the language L = {a<sup>m</sup> b<sup>n</sup> c<sup>p</sup> d<sup>q</sup> | m+n=p+q ; m,n,p,q&gt;=1}
Prerequisite - Pushdown automata, Pushdown automata acceptance by final state Problem - Design a non deterministic PDA for accepting the language L = {[Tex]a^m[/Tex] [Tex]b^n[/Tex] [Tex]c^p[/Tex] [Tex]d^q[/Tex] | m + n = p + q : m, n, p, q&gt;=1}, i.e., L = {abcd, abbcdd, abbccd, abbbccdd, ......} In each of the string, the total number of 'a' and
2 min read
NPDA for accepting the language L = {a<sup>i</sup>b<sup>j</sup>c<sup>k</sup>d<sup>l</sup> | i==k or j==l,i&gt;=1,j&gt;=1}
Prerequisite - Pushdown automata, Pushdown automata acceptance by final state Problem - Design a non deterministic PDA for accepting the language L = {[Tex]a^i[/Tex] [Tex]b^j[/Tex] [Tex]c^k[/Tex] [Tex]d^l[/Tex] : i==k or j==l, i&gt;=1, j&gt;=1}, i.e., L = {abcd, aabccd, aaabcccd, abbcdd, aabbccdd, aabbbccddd, ......} In each string, the number of a
3 min read
Construct a Turing Machine for language L = {0<sup>2n</sup>1<sup>n</sup> | n&gt;=0}
Prerequisite - Turing Machine The language L = {02n1n | n &gt;= 0} represents a kind of language where we use only 2 symbols, i.e., 0 and 1. In the beginning language has some number of 0's followed by exactly half number of 1's . Any such string which falls in this category will be accepted by this language. Examples : Input : 001 Output : YES Inp
2 min read
Construct Pushdown automata for L = {0<sup>m</sup>1<sup>(n+m)</sup>2<sup>n</sup> | m,n &ge; 0}
Prerequisite – Pushdown automata, NPDA for accepting the language L = {amb(n+m)cm | m, n &gt;= 1} Problem: Construct Pushdown automata for L = {0m1(n+m)2n | m,n &ge; 0} Example: Input: 011122 Output: Accepted Input: 00000112222 Output: Not Accepted Approach used in this PDA – There can be four cases while processing the given input string. Case 1-
2 min read
Construct Pushdown automata for L = {0<sup>(n+m)</sup>1<sup>m</sup>2<sup>n</sup> | m, n &ge; 0}
Prerequisite – Pushdown automata Problem: Construct Pushdown automata for L = {0(n+m)1m2n | m, n &ge; 0} Similar PDA's- This PDA seems to be similar to PDA of S2 = {0m1(n+m)2n} but the production is different. S2 will produce output which have no of 1's equal to the sum of no of 0's and 2's, while S1 does not. This PDA seems to be similar to PDA of
3 min read