NPDA for accepting the language L = {aibjckdl | i==k or j==l,i>=1,j>=1}

Last Updated : 28 Aug, 2019
Prerequisite – Pushdown automata, Pushdown automata acceptance by final state Problem – Design a non deterministic PDA for accepting the language L = { : i==k or j==l, i>=1, j>=1}, i.e.,
L = {abcd, aabccd, aaabcccd, abbcdd, aabbccdd, aabbbccddd, ......}
In each string, the number of a’s are followed by any number of b’s and b’s are followed by the number of câ€™s equal to the number of a’s and c’s are followed by number of dâ€™s equal number of b’s. Explanation – Here, we need to maintain the order of aâ€™s, b’s, c’s and dâ€™s.That is, all the a’s are coming first then all the b’s are coming and then all the c’s are coming then all the d’s are coming . Thus, we need a stack along with the state diagram. The count of aâ€™s and bâ€™s is maintained by the stack.We will take 2 stack alphabets:
 = { a, b, c, d, z }
Where, = set of all the stack alphabet z = stack start symbol Approach used in the construction of PDA – In designing a NPDA, for every aâ€™, â€˜bâ€™, â€˜câ€™ and â€˜dâ€™ will comes in proper order.
• For i==k : Whenever â€˜aâ€™ comes, push it in stack and if â€˜aâ€™ comes again then also push it in the stack.After that, if ‘b’ comes not do any operation. After that, when â€˜câ€™ comes then pop â€˜aâ€™ from the stack each time.After that, if ‘d’ comes not do any operation.
• For j==l : Whenever â€˜aâ€™ comes, not do any operation.After that, if ‘b’ comes push it in stack and if â€˜bâ€™ comes again then also push it in the stack. After that, when â€˜câ€™ comes not do any operation.After that, if ‘d’ comes then pop â€˜bâ€™ from the stack each time.
So that the stack becomes empty.If stack is empty then we can say that the string is accepted by the PDA. Stack transition functions –
(q0, a, z)  (q1, az)
(q0, a, z)  (q3, z)
(q1, a, a)  (q1, aa)
(q1, b, a)  (q1, a)
(q1, c, a)  (q2, )
(q2, c, a)  (q2, )
(q2, d,  )  (q2, )
(q2, , z)  (qf1, z)
(q3 a, z)  (q3, z)
(q3 b, z)  (q3, bz)
(q3 b, b)  (q3, bb)
(q3 c, b)  (q3, b)
(q3, d, b)  (q4, )
(q4, d, b)  (q4, )
(q4, , z)  (qf2, z)

Where, q0 = Initial state qf1, qf2 = Final state = indicates pop operation So, this is our required non deterministic PDA for accepting the language L ={ : i==k or j==l, i>=1, j>=1}.

Previous
Next