Advertisement
Guest User

a.dfa

a guest
Oct 7th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #This DFA recognizes { x in {0,1}* | x does not end in 000 }
  2.  
  3. states: lambda, # last bit was a 1 or non-existent
  4. 0, # last two bits were 10
  5. 00, # last three bits were 100
  6. 000 # last three bits were 000
  7.  
  8. input alphabet: 0,1
  9.  
  10. start state: lambda # no last bit when we start
  11.  
  12. accept states: lambda,0,00 # accept as long as the last three bits weren't 000
  13.  
  14. delta: # if we see a 1, reset
  15. lambda,1 -> lambda
  16. 0,1 -> lambda
  17. 00,1 -> lambda
  18. 000,1 -> lambda
  19.  
  20. # if we see a 0, count one more 0 than before
  21. lambda,0 -> 0
  22. 0,0 -> 00
  23. 00,0 -> 000
  24.  
  25. # until we get to three, and then just remember
  26. 000,0 -> 000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement