Firstly I don't have CS or DFA/NFA background knowledge about their theorems or lemmas, so I don't understand some related questions' answers like here. However, I can easily intuitively understand a language $L\subseteq\{0,1\}^*$ of strings which has equal number of 0s and 1s cannot be accepted by a FA thus non-regular since the number of states to represent the numbers of 0s and 1s as some counter cannot be bounded from above when the symbol tape from its alphabet keeps coming in.

However, it's a well-known fact that the language $L\subseteq\{0,1\}^*$ of strings which has equal number of 01 and 10 as substrings is regular! I can imagine there's some obvious reflexive symmetry relation/pattern between 01 and 10, but intuitively how can one just physically use a bounded finite number of states to represent the occurrences of 01 and 10 when the symbol tape from its alphabet keeps coming in? Can anyone kindly explain it using plain English or hint at some construction?

  • $\begingroup$ I guess you mean that the strings contain only 0 and 1? If so, just spend some time looking for different strings and counting 01 and 10 substrings in them. $\endgroup$ Aug 6 at 4:41
  • 2
    $\begingroup$ @DmitriUrbanowicz thx for ur quick hint! I always quickly felt bored when playing with meaningless strings in the past (though strings to CS is as numbers to Math), but in this case it seems very amazing. It seems the core intuition is to use subtraction to keep the counter states of either 01 or 10 bounded above (turn out actually cannot exceed 1!). Due to binary symmetry, I only need to try hard for the case start, say, with 0. Then most cases can be quickly seen the counter of 01 can be subtracted back after reading in 10 which is bound to happen due to simple binary possibilities... $\endgroup$
    – mohottnad
    Aug 6 at 5:37
  • $\begingroup$ @idmean thx for ur comment. I saw similar posts here to formally discuss the issue using regular expression theory (equivalent to FA without pushdown)(cs.stackexchange.com/questions/57342/…) $\endgroup$
    – mohottnad
    Aug 6 at 5:54
  • $\begingroup$ Indeed one can start counting the difference both substrings, and look what happens when we read a series of 0's and 1's. This apprach was explained by colleague gnasher729, here cs.stackexchange.com/a/104724/4287 $\endgroup$ Aug 6 at 18:42
  • $\begingroup$ @HendrikJan thx for ur background info for my rediscovery of this problem. It made me got some interest in meaningless strings related games at least... $\endgroup$
    – mohottnad
    Aug 6 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.