Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: DFA (Deterministic Finite Automata)

  1. #1
    Apprentice123 is offline Programming Expert
    Join Date
    Jun 2008
    Posts
    397
    Rep Power
    0

    DFA (Deterministic Finite Automata)

    DFA M = ({q_0, q_1, q_2}, {0,1}, delta, q_0, {q_1}), delta is:

    delta | 0 1
    q_0 | q_0 q_1
    q_1 | q_0 q_2
    q_2 | q_2 q_1

    a) What graphic transition?

    My solution:

    q_0 ->1 0<- q1 ->1 1<- q2 0<-

    b) This automaton accepts the word 01, 101, 00111, 11001?

    My solution:

    Yes

    c) Find two words that the automaton rejects

    My solution:

    10 and 110


    Are correct ?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    bobdark's Avatar
    bobdark is offline Programmer
    Join Date
    Jan 2010
    Location
    Haifa, Israel
    Posts
    164
    Rep Power
    9

    Re: DFA (Deterministic Finite Automata)

    seems correct even though a) is not clear

  4. #3
    Apprentice123 is offline Programming Expert
    Join Date
    Jun 2008
    Posts
    397
    Rep Power
    0

    Re: DFA (Deterministic Finite Automata)

    Quote Originally Posted by bobdark View Post
    seems correct even though a) is not clear
    Thanks.

    I do not know how to make a table here


    Please see if this is correct:

    Do a DFA that recognizes all strings with prefix ab, on the alphabet {a,b}

    My solution:

    q_o => go "a" to q_2 => go "b" to q_1 => go "a,b" to q_1
    M = ({q_0, q_1, q_2}, {a,b}, delta, q_0, {q_1})

  5. #4
    bobdark's Avatar
    bobdark is offline Programmer
    Join Date
    Jan 2010
    Location
    Haifa, Israel
    Posts
    164
    Rep Power
    9

    Re: DFA (Deterministic Finite Automata)

    yeah its correct

  6. #5
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: DFA (Deterministic Finite Automata)

    Quote Originally Posted by Apprentice123 View Post
    Thanks.

    I do not know how to make a table here


    Please see if this is correct:

    Do a DFA that recognizes all strings with prefix ab, on the alphabet {a,b}

    My solution:

    q_o => go "a" to q_2 => go "b" to q_1 => go "a,b" to q_1
    M = ({q_0, q_1, q_2}, {a,b}, delta, q_0, {q_1})
    I believe what you described is an NFA. Your "DFA" does not account for the string "ba" for example.

    delta | a b
    q0 | q1 q3
    q1 | q3 q2
    q2 | q2 q2
    q3 | q3 q3

    M = ({q0, q1, q2, q3}, {a,b}, delta, q0, {q2})

  7. #6
    bobdark's Avatar
    bobdark is offline Programmer
    Join Date
    Jan 2010
    Location
    Haifa, Israel
    Posts
    164
    Rep Power
    9

    Re: DFA (Deterministic Finite Automata)

    No he's fine, because when you don't specify what does the DFA do in a specific state on a specific input, its interpreted as entering a "pit" state - one from which the automata can not accept any word.

  8. #7
    Apprentice123 is offline Programming Expert
    Join Date
    Jun 2008
    Posts
    397
    Rep Power
    0

    Re: DFA (Deterministic Finite Automata)

    Quote Originally Posted by John View Post
    I believe what you described is an NFA. Your "DFA" does not account for the string "ba" for example.

    delta | a b
    q0 | q1 q3
    q1 | q3 q2
    q2 | q2 q2
    q3 | q3 q3

    M = ({q0, q1, q2, q3}, {a,b}, delta, q0, {q2})
    The problem need to begin the prefix "ab" so I can not begin to "ba"

  9. #8
    Apprentice123 is offline Programming Expert
    Join Date
    Jun 2008
    Posts
    397
    Rep Power
    0

    Re: DFA (Deterministic Finite Automata)

    Quote Originally Posted by bobdark View Post
    yeah its correct
    Thank you. Please look this:

    Find a DFA that recognizes all strings over the alphabet {01}, except those containing the substring 001

    My solution:

    q0 => go "1" to q0 and "0" to q1
    q1 => go "1" to q0 and "0" to q2
    q2 => go "0" to q1 and "1" to q3
    q3 => go "0,1" to q3
    M = ({q0, q1, q2, q3}, {01}, delta, q0, {q0, q1, q2})

    is correct ?

  10. #9
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: DFA (Deterministic Finite Automata)

    Quote Originally Posted by bobdark View Post
    No he's fine, because when you don't specify what does the DFA do in a specific state on a specific input, its interpreted as entering a "pit" state - one from which the automata can not accept any word.
    Perhaps this is a shortcut you may take, but your assumption is not part of the formal definition. Q is the set of all states, therefore your "pit" state (my q3) must be an element of Q (which you did not formally define), and for each pair of state an input symbol, there is one transition to the next state. Therefore there _must_ be a transition for (q0, b) and (q1, a) and your "pit" state must also have a ("pit", a) and ("pit", b) all of which do not exist. You may interpret it however you would like, but formally, it is wrong.

    Quote Originally Posted by Apprentice123 View Post
    The problem need to begin the prefix "ab" so I can not begin to "ba"
    Right, your DFA is suppose to accept strings that begin with "ab" and reject strings that begin with aa, or b. However, your DFA does not accept nor reject strings that begin with aa or b - it just fails. Your professor may allow the shortcut bobdark suggested, but formally it is wrong.

    Quote Originally Posted by Apprentice123 View Post
    Thank you. Please look this:

    Find a DFA that recognizes all strings over the alphabet {01}, except those containing the substring 001

    My solution:

    q0 => go "1" to q0 and "0" to q1
    q1 => go "1" to q0 and "0" to q2
    q2 => go "0" to q1 and "1" to q3
    q3 => go "0,1" to q3
    M = ({q0, q1, q2, q3}, {01}, delta, q0, {q0, q1, q2})

    is correct ?
    Yes. (although I am assuming your alphabet is {0,1} not {01})

  11. #10
    Apprentice123 is offline Programming Expert
    Join Date
    Jun 2008
    Posts
    397
    Rep Power
    0

    Re: DFA (Deterministic Finite Automata)

    Quote Originally Posted by John View Post
    Perhaps this is a shortcut you may take, but your assumption is not part of the formal definition. Q is the set of all states, therefore your "pit" state (my q3) must be an element of Q (which you did not formally define), and for each pair of state an input symbol, there is one transition to the next state. Therefore there _must_ be a transition for (q0, b) and (q1, a) and your "pit" state must also have a ("pit", a) and ("pit", b) all of which do not exist. You may interpret it however you would like, but formally, it is wrong.


    Right, your DFA is suppose to accept strings that begin with "ab" and reject strings that begin with aa, or b. However, your DFA does not accept nor reject strings that begin with aa or b - it just fails. Your professor may allow the shortcut bobdark suggested, but formally it is wrong.


    Yes. (although I am assuming your alphabet is {0,1} not {01})
    Thank you.

    I find it odd, because the exercise is {01}

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Cellular Automata Help
    By ahmed in forum Java Help
    Replies: 4
    Last Post: 04-01-2011, 01:41 PM
  2. Recursive Descent Parsing and Deterministic Grammars
    By whateverme in forum General Programming
    Replies: 0
    Last Post: 03-01-2011, 05:59 PM
  3. Formal Languages and Automata
    By Apprentice123 in forum General Programming
    Replies: 19
    Last Post: 11-10-2010, 05:19 AM
  4. automata solution book by peter linz 3rd editin ?????
    By naeemaziz88 in forum General Programming
    Replies: 1
    Last Post: 10-24-2010, 06:46 AM
  5. Stack automata
    By Apprentice123 in forum General Programming
    Replies: 0
    Last Post: 08-24-2010, 12:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts