简体   繁体   中英

How can I construct finite automata

I have to create a deterministic finite automata accepting the set of strings with an even number of 1 and ends with 0.Should I include 0 as a string from this set? and how can I do this?

Should I include 0 as a string from this set?

Yes

And how do I do this?

To construct a finite automaton, you need to identify the states and transitions. The Myhill-Nerode theorem allows you to find the necessary (and sufficient.) states of for a finite automaton if you are able to identify the equivalence classes of "indistinguishable" strings.

Two strings x and y are indistinguishable, in this sense, if for any other string z , either both xz and yz are in the language, or neither is.

In your case, let's try to identify equivalence classes. The empty string is in some equivalence class. The string 0 is in a different equivalent class, since you can add the empty string to 0 and get a string in the language (whereas you can't add the empty string to the empty string to get a string in the language). We have found two distinct equivalence classes so far - one for the empty string, one for 0 . Both of these will need different states in our FA.

What about the string 1 ? It's distinguishable from both 0 and the empty string, since you can add 10 to 1 to get 110 , a string in the language, but you can't add it to 0 or the empty string to get a string in the language. So we have yet another state.

What about the string 00 ? This string is not in the language, and no other string can be added to this string to get a string in the language. This is another equivalence class. It turns out that the next strings, 01 and 10 , are also in this class.

The string 11 ends up being in the same class as the empty string: you can add any string in the language to 11 and get another string in the language. If you try all strings of length 3, you will find that all of those already fall into one of the above classes, and you can stop checking at that point.

So we have four states - let's call them [-] , [0] , [1] , and [00] . Now we figure out transitions.

If you get a 0 in [-] , you need to go to [0] ... and if you get a 1 , you need to go to [1] . For the rest, just figure out what string you'd get by adding to the canonical one, and which class the resulting string would be in... and go to that state.

Given Question is to construct a Finite Automata with even number of 1's and ends with 0. So the alphabet of the language is {0,1} These are the the strings that are accepted by the language. The Language always consists of '0' before its final state as it is the end of the string and we reach the final state when we reach the last '0' in the string. Here in the normal procedure of conversion of it into the finite automata we get NFA

Then we need to convert the NFA to DFA by combining 2 states into single and simplifying them. New transition diagram

Here we had drawn the new transition diagram based on the states reached by a specific state at a given input. Then the new states formed by joining 2 states [ here {q0,q2} state is formed] This new state {q0,q1} on 0 as input goes to itself (as q0 on 0 goes to q0 and q2 on 0 goes to q2).

So let us conside this new state {q0,q2} as a new state q2'

So by using the Transition state diagram we can easily make the required DFA

Deterministic Finite Automata The above diagram is the constructed finite automata accepting the set of strings with an even number of 1's and ending with 0.

q0 - is the Initial state

q2'- is the Final state

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM