in Theory of Computation
498 views
0 votes
0 votes
Is the following language context free:
The set of all strings with number of a’s equal to number of b’s and the sum of a’s and b’s to be divisible by 3.
in Theory of Computation
498 views

1 comment

We can use Pumping lemma here
0
0

1 Answer

3 votes
3 votes
Best answer

Yeah it will be context free. 

1st part : Set of all strings with equal noof a's and B's is a standard CFL Language accepted by Push Down Automata. 

2nd : sum of a's and B's divisible by 3 is regular language 

And intersection of regular language and  context free language is CONTEXT FREE. 

 

Theorem : If L1 is a CFL and L2 is regular then L1 $\cap$ L2 is CFL.

 

Proof for above : https://www.cs.umd.edu/~gasarch/COURSES/452/F14/cfgreg.pdf

 

selected by

Related questions