Search code examples
computer-scienceregular-languagefsm

Are L1 = {a^n b^n | n < 4 } and L2 = {a^n b^n | n < 10^10^10 }, regular languages?


Is L1 = {a^n b^n | n < 4 }, a regular language ?

In my opinion, it is regular, as I could draw an FSA for it, however, in class, my professor had taken an example, L2 = {a^n b^n | n < 10^10^10 } and said, this is not regular...

so, my question is, if I can draw fsa for L1, I can even draw for L2...why did prof. say, it is not regular? because, both the languages, L1 and L2, are finite... I had just taken L1 language on my own to just think over the question... L1 was not discussed in class... Also, I have read, that all finite languages are regular... so both of these should be, in my opinion... :)

if anyone can clarify, I would be grateful. Thank you very much, in advance.


Solution

  • Every language that has a finite number of strings is regular. So both L1 and L2 are regular. Because if a language has a finite number of strings we can construct the following NFA where ε denotes the empty transition:

     ------ first string
    |      
    ε
    |
     ------ second string
    |
    ε
    |
     ------ ...
    |
    .
    .
    .
    |
     ------ last string