# Operations without common elements can not be generated using a finite state automata

I heard that some operations involving regexes that do not have common elements can NOT be generated using a finite automata. I do not remember what it was, where it was from, can anyone tell me what that could possibly be?

Edit : I finally managed to find the exact statement. Here it is, below :

A language (like $$(00)^n (11)^n$$) can not be generated by an FSM since there is no common character in "00" and "11". We need to keep count of both which is not possible with a finite automata as the count can be infinite.

• What do you mean by "regexes that do not have common elements"? Or "operations involving" such regexes? Can you be more specific? – D.W. Oct 15 '20 at 5:13
• @D.W. I managed to find the exact statement. It is from an online site and the answer is from a site tutor, or whatever that is called. I was not able to find the statement. – oldsailorpopoye Oct 15 '20 at 5:38
• I'm a bit confused $(00)^n(11)^n$ can neither be recognized by regex or by DFA (if you use the usual definitions for regex). Also $(10)^n(11)^n$ can't be recognized (by DFA/regex) despite there being common elements - the counting aspect of the statement is much more decisive. Anyhow is your question resolved? – plshelp Oct 15 '20 at 5:51
• It isn't. I do not understand the statement in italics. I need an explanation for why that (statement, and not the example language) is true in general. – oldsailorpopoye Oct 15 '20 at 5:53

The remark by the tutor is very poorly worded. My best guess is that it refers to the following situation. Let $$L_{x,y}$$ be the set of all words that have as many copies of $$x$$ as that of $$y$$. Then $$L_{0,1}$$ is not regular, but $$L_{01,10}$$ is regular, since it equals $$(0^+1^+)^*0^+ + (1^+0^+)^*1^+ + \epsilon$$.

• which according to him probably means that $L_{x,y}$ is regular $\implies$ $x \cap y \neq \phi$ (not necessarily vice versa). Does that hold true in general for an infinite language? – oldsailorpopoye Oct 15 '20 at 6:34
• I’m not sure what you mean by infinite language. – Yuval Filmus Oct 15 '20 at 8:19
• A language that generates words having length $\geq \text{N}$ for every $\text{N} \in \mathbb{N}$. One that can make use of the pumping lemma. – oldsailorpopoye Oct 15 '20 at 8:30
• I still don’t understand your question. – Yuval Filmus Oct 15 '20 at 8:32
• Conjecture : Denote by $L_{x,y}$ the set of all words that have as many copies of $x$ as that of $y$. Then if $L_{x,y}$ is regular, $x \cap y \neq \phi$. Is this conjecture true? There is something that I often see that FSA have constant memory, and this seems to violate that criteria. I am not sure what that means exactly, I have seen it. – oldsailorpopoye Oct 15 '20 at 8:39

One has to differentiate between regex in computer science and regex in real world programming languages. In compsci regular expressions are defined to only recognize regular languages, which are the same languages DFAs can recognize, thereby making DFAs and regex a descriptions of the same class of languages.

In real world application the recognition of regular languages is somewhat limiting which is the reason why many regex libraries introduce operators which allow you to recognize languages that are not regular. One such operator is recursion (?R) see here for an example using python. Notice that the language in the article is the balanced parentheses language which is a well known context free language that is not regular and thus can not be recognized by a DFA.

• I appreciate your answer. I have edited the question. – oldsailorpopoye Oct 15 '20 at 5:45