Tell me more ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Is there a way to guess if a language is regular from the first sight? I.e. in order to choose proof methods, I have to have some hypothesis at first. Do you know any hints/patterns?

I need this to reduce time consumption: for instance, in order not to spend time on pumping lemma/Myhill–Nerode theorem, when in fact the language IS regular and I need to construct DFA/grammar.

The language is expressed as a set of all its words possible. For example:

$$ L = \left\{ {(0)^{2n}(10)^{3k+1}1^m }, n, k, m ≥ 0 \right\}, \Sigma = \left\{{0,1}\right\} $$

share|improve this question
How about standard criteria like left-linear/right-linear grammar? – Johannes Kloos Jan 19 at 20:06
To say how the first sight may help, can you tell how the language you talking about is expressed? By the way, there is also Computer Science.SE beta – Ilya Jan 19 at 20:06
3  
Imagine that you’re reading a word one symbol at a time. How much do you have to remember as you go along in order to decide whether the word is in the language? Is that amount bounded, or can it be arbitrarily large (as with the language of words of the form $0^n1^n$, for instance). If it’s bounded, you have a regular language. If it appears not to be bounded, you probably don’t have a regular language, though the impression that it’s unbounded may of course have been wrong. – Brian M. Scott Jan 19 at 20:16
1  
Unlike the pumping lemma, Myhill-Nerode works in both directions: A language $L$ is regular if and only if the number of Myhill-Nerode equivalence classes is finite (the equivalence relation being $u \sim v$ iff for every $w$, the strings $uw$ and $vw$ are either both in $L$ or both not in $L$.) – Ted Jan 19 at 20:50
@Ilya, I added an example showing how the language is expressed in my case. – petajamaja Jan 19 at 20:54
show 6 more comments

2 Answers

up vote 2 down vote accepted

One simple criterion that works in many cases is that if you see only linear functions in the exponents (like $2n$, $3k+1$, $m$ in your formula), and no variable appears more than once in the exponents, then the language is regular. This is because a language like $\{ 0^{2n} : n \ge 0\}$ corresponds to the regular expression $(00)^*$. A rigorous proof of this rule (which also needs to be stated more precisely before it can be proved) uses closure properties of regular languages, which you should also know.

share|improve this answer

Imagine that you’re reading a word one symbol at a time. How much do you have to remember as you go along in order to decide whether the word is in the language? Is that amount bounded, or can it be arbitrarily large (as with the language of words of the form $0^n1^n$, for instance). If it’s bounded, you have a regular language. If it appears not to be bounded, you probably don’t have a regular language, though the impression that it’s unbounded may of course have been wrong.

share|improve this answer
Very good answer, thanks a lot! Unfortunately I can't mark all the answers as accepted, otherwise I would have done that here too. – petajamaja Jan 19 at 21:13
@Umari: You're welcome. – Brian M. Scott Jan 19 at 21:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.