in Theory of Computation
379 views
2 votes
2 votes

Complement of :  {anbn | n>=0} ?

Also tell if it is CFL or CSL?

in Theory of Computation
by
379 views

1 Answer

4 votes
4 votes
Best answer

Complement of a language L is defined as  L'  =  Σ* - L..This means all strings that can be made by the given alphabet except those in the language L should come in the language L'..

Given L = { an bn | n >= 0 }

   So there are 2 such types of strings which wont come in the above L..

  a) Number of a's and number of b's should be different with the a's followed by b's..This is represented as : {an bm | m != n}

  b) One inversion i.e. 'ba' and anything before and after it just to break the order of a's and b's in ab.This is represented as : 

    { (a+b)* ba (a+b)* }

 Hence  L' =  {an bm | m != n}  ∪  { (a+b)* ba (a+b)* }

  Here the first part is DCFL and second part is regular..

  Hence the overall language is DCFL as DCFL union with regular is DCFL only..

  Hence the complement of the given language is DCFL..

selected by

3 Comments

Beautiful explanation :)
1
1
@habibkhan

I think you missed out the a,aa,aaa,aaaa...and b,bb,bbb,bbbb...am i right?
0
0
That is included in first part of my language itself as described above.. For : a, aa, aaa.....keep n = 0.. And for b, bb etc.. keep n = 1
1
1