简体   繁体   中英

How to construct DFA that L accept : w contain '110' and doesn't contain '010'?

L = { w belongs {0,1}* | w contain '110' and doesn't contain '010'}

I need to construct DFA that receives L.

How can I draw a DFA that will do the both of conditions?

hints will be a great help.

A finite state machine (or automaton) consists of:

  • A finite set of symbols, called the "alphabet".
  • A finite set of states. There is no information in a state other than its label.
  • A transition table, which maps each pair <state, symbol> to a new state.
  • The starting state: the name of the state which the machine is in before it reads the first symbol.
  • The accepting state set: A subset of the set of states which define a successful match.

The machine starts in the starting state, and then reads each symbol in turn. When it reads a symbol, it uses the transition table to decide which is the next state. When it reaches the end, it announces success if the current state is in the accepting set; otherwise, it announces failure.

In a deterministic finite-state automaton (DFA), the transition table is single-valued and complete; that is, every entry is filled in with exactly one state. (Constructing a DFA usually involves adding a "sink state", which is non-accepting and has a self-transition on every symbol. This state is used to handle inputs which cannot be at the beginning of an accepted input.)

If you have a DFA which recognises a language L, you can construct a DFA for the complement of L by simply replacing the set of accepting states with the set of non-accepting states. So if you have a DFA which recognises any input containing 010, you can construct a DFA which recognises any input which does not contain 010 by using just changing the accepting state list.

If you have two DFAs which recognise the languages L 1 and L 2 , you can construct a new DFA which recognises only those strings in both L 1 and L 2 -- that is, the intersection L 1 ∩ L 2 -- using the Cartesian product of the two DFAs. In the new machine:

  • the alphabet is the intersection of the original alphabets. (Usually, all the alphabets are the same in this operation. I just note this for completeness.)
  • the states of the new machine are the Cartesian product of the states of the original machines. In other words, the new states are all the pairs <q i , r j > where q i is a state of the first machine and r j is a state of the second machine.
  • The transition table is constructed using both original transition tables. If there is a transition in the first machine on symbol α from q i to q i' and a transition in the second machine on the same symbol α from r j to r j' , then in the combined machine there is a transition on α from <q i , r j > to <q i' , r j' >.
  • The starting state of the combined machine is the pair of starting states of the original machines.
  • The accepting states of the combined machine are all pairs <q i , r j > where q i is an accepting state of the first machine and r j is an accepting state of the second machine.

So if you can construct DFAs for:

  • The language of strings which contain 110
  • The language of strings which contain 010 then you can use the above procedures to construct a DFA for the contain 110 and don't contain 010 by using the above two procedures.

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