FSM that only accepts strings w/ equal number of 1's and 0's

  • Thread starter Thread starter goraemon
  • Start date Start date
  • Tags Tags
    Strings
Click For Summary
SUMMARY

A finite state machine (FSM) cannot accept strings with an equal number of 0's and 1's due to its lack of memory or counters. However, if one assumes the existence of such an FSM, it could theoretically track the count of consecutive 0's and ensure it matches the count of consecutive 1's. The discussion clarifies that while FSMs can be constructed for specific values of n (e.g., 0^3 1^3), they cannot handle arbitrary counts of zeros followed by ones, as this requires memory beyond the FSM's capabilities.

PREREQUISITES
  • Understanding of finite state machines (FSM)
  • Knowledge of formal language theory
  • Familiarity with the concept of counters in computational models
  • Basic understanding of string patterns and regular languages
NEXT STEPS
  • Research the limitations of finite state machines in formal language theory
  • Explore context-free grammars and their relationship to FSMs
  • Learn about pushdown automata and their capabilities compared to FSMs
  • Study examples of FSMs that accept specific patterns, such as 0^n 1^n for fixed n
USEFUL FOR

The discussion is beneficial for computer science students, theoretical computer scientists, and anyone interested in automata theory and the limitations of computational models.

goraemon
Messages
65
Reaction score
4
Thread moved from the technical forums, so no HH Template is shown.
Question: Suppose you have a finite state machine that accepts only strings with an equal number of zeros and ones. Show that you can then construct a finite state machine that accepts only strings of the form 0^n 1^n, i.e., an arbitrary finite number of zeros followed by the same number of ones.

My attempt at a response:

A Finite State Machine that accepts strings with an equal number of 0’s and 1’s (e.g. n zeros and n one's, where n is some arbitrary finite number), must have a counter that keeps track of the total number of 0's and 1's. This is impossible, since by definition a FSM has no counter or memory. But suppose this were possible. Then it’d be possible to construct another FSM that keeps track of the count of consecutive 0's in the prefix of a given string, and ensure that number equals the count of consecutive 1's in the suffix of that string.

----------------------------------------------
I feel like there is more to the answer than this, but I don't really know what else can be said. I know that no FSM can be constructed to accept only strings in the format 0^n 1^n where n could be any arbitrary nonnegative integer, but that it is possible to do for any fixed, specific value of n. For example, it's possible to build FSM to accept only strings that contain three 0's, followed by three 1's. But I don't know whether this detail is relevant at all. Thanks for any help.
 
Physics news on Phys.org
goraemon said:
This is impossible, since by definition a FSM has no counter or memory.
You do not need a counter or memory (besides the "memory" of the current state) to do this. But you don't have to care about this part: you can assume that such a machine exists here.
goraemon said:
Then it’d be possible to construct another FSM that keeps track of the count of consecutive 0's in the prefix of a given string, and ensure that number equals the count of consecutive 1's in the suffix of that string.
You do not have a counter. And you do not need one. You need some other way to validate the input.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 75 ·
3
Replies
75
Views
7K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 9 ·
Replies
9
Views
1K