Need help understanding the overall idea behind this scenario, I've got 3 input codes namely: A (0100) B (0010) and C (0001) and i'm supposed to have a odd parity of 0's. I've started making a machine that accepts A however i'm not sure how to incorporate the other letters as well. Been stuck on this for a few days now, any help would be greatly appreciated!
2 Answers
A cheap way to do it is the following:
You build an automaton R that recognizes the language $\{x^{2n}0 \mid n\geq 0\}\cup \{x^{2n+1}1 \mid n\geq 0\}$.
and an automaton R' which accepts only the three strings, and has a single final state.
Then you replace every $x$-transition from $q$ to $q'$ in R by a copy of the automaton R', merging $q$ with the initial state of the copy of R' and $q'$ with its final state.
You should have 2 $x$-transitions only, hence 2 copies of R' to replace them with.
Can you explain why this works.
- 19,645
- 43
- 77
Let's start with a regular expression for your language: $$ ((0100+0010+0001)(0100+0010+0001))^*0 +\\ ((0100+0010+0001)(0100+0010+0001))^*(0100+0010+0001)1. $$
The easiest way of approaching the construction of the FSA is probably presenting your language as the intersection of two simpler ones: $(0100+0010+0001)^*(0+1)$ and the language of words having an odd number of 0s. As a first step, construct FSAs for both languages. Then, use the product construction to construct an FSA for their intersection. You might notice a possible shortcut.
- 280,205
- 27
- 317
- 514