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!
-
I can't understand your problem. You are trying to construct an FSA for some language $L$, but I don't know what $L$ is. What alphabet is $L$ oveR? When is a word in $L$? Try giving some examples. – Yuval Filmus Apr 21 '15 at 14:45
-
So for example : (0100 + 0010 + 0001)*(0+1) – Daniel Munoz Apr 21 '15 at 14:49
-
I'm afraid you'll have to do more than that. Parity doesn't seem to come in in your "example". First explain when a word (over the alphabet ${0,1}$, apparently) is in your language, and when it is not. Then give some examples of words that are in your language, and some examples of words that are not in your language. – Yuval Filmus Apr 21 '15 at 14:58
-
so 0100001000010 won't work and 0100001000011 will – Daniel Munoz Apr 21 '15 at 15:06
-
There needs to be an odd amount of 0's at all times and we can do that by changing the last digit to either a 0 or a 1 depending on the circumstance – Daniel Munoz Apr 21 '15 at 15:13
-
2You should rewrite your question more clearly so that users do not need to read the comments to understand. Learning to do that is also a useful exercise. You do math or CS better, and think more clearly, when you know how to say/write things clearly. It does help doing proofs. – babou Apr 21 '15 at 16:03
-
possible duplicate of How to prove a language is regular? – D.W. Apr 22 '15 at 00:48
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,445
- 40
- 76
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.

- 276,994
- 27
- 311
- 503
-
That's where i'm hitting the wall, i've made my diagram for the odd parity part, however I can't seem to put together a diagram for the main part which has our 3 inputs – Daniel Munoz Apr 21 '15 at 15:49