1 / 21

CS310

CS310. Finite Automata Sections: Sep 3, 2008. Quick Review. Alphabet: ∑ = {a,b} ∑*: Closure: String: any finite sequence of symbols from a given alphabet. |w| = length Concatenation/Prefix/Suffix/Reverse Language L over ∑ is a subset of ∑* L= { x | rule about x}

cwerth
Download Presentation

CS310

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS310 Finite Automata Sections: Sep 3, 2008 CS 310 – Fall 2008 Pacific University

  2. Quick Review • Alphabet: ∑ = {a,b} ∑*: Closure: • String: any finite sequence of symbols from a given alphabet. |w| = length Concatenation/Prefix/Suffix/Reverse • Language L over ∑ is a subset of ∑* L= { x | rule about x} Concatenation/Union/Kleene Star Recursive Definition CS 310 – Fall 2008 Pacific University

  3. Finite Automata • How can we reason about computation? • Simple model of computation • Finite Automata • extremely limited amount of memory • represent states of computation CS 310 – Fall 2008 Pacific University

  4. Front pad Rear pad Door Door State: Open, Closed Inputs: Front, Rear, Both, Neither State Transition Table CS 310 – Fall 2008 Pacific University

  5. Closed Open State Diagram CS 310 – Fall 2008 Pacific University

  6. More uses… • Recognize patterns in data • Build an automata that can classify a string as part of a language or not Language: L = { x є {0,1}* | x contains at least one 1 and the last 1 is followed by even number of 0s} CS 310 – Fall 2008 Pacific University

  7. 1 0 1 0 q1 q2 q3 1, 0 Inputs: Accept or Reject? 1101 1110 0 1100 1 11 Set of all strings (A) accepted by a machine (M) is the Language of the Machine M recognizes A or M accepts A CS 310 – Fall 2008 Pacific University

  8. Formal Definition • Deterministic Finite Automata: 5-tuple (Q, ∑ , δ,q0, F) Q: finite set of states ∑: alphabet (finite set) δ : transition function (δ: Qx∑->Q) q0: start state F : accepting states (subset of Q) CS 310 – Fall 2008 Pacific University

  9. 1 0 1 0 q1 q2 q3 1, 0 Q: finite set of states ∑: alphabet δ : transition function q0: start state F : accepting states CS 310 – Fall 2008 Pacific University

  10. 1 0 1 Q: What strings get ∑: accepted? δ : q0: L(M) = { } F : q1 q2 0 CS 310 – Fall 2008 Pacific University

  11. Designing a DFA • Identify small pieces • alphabet, each state needs a transition for each symbol • finite memory, what crucial data does the machine look for? • can things get hopeless? do we need a trap? • where should the empty string be? • what is the transition into the accept state? • can you transition out of the accept state? • Practice! CS 310 – Fall 2008 Pacific University

  12. L(M) = { w | w = ε or w ends in 1} ∑ = { 0,1} Q: δ : q0: F : CS 310 – Fall 2008 Pacific University

  13. ∑ = {0,1}, L(M)={w | odd # of 1s} CS 310 – Fall 2008 Pacific University

  14. Build a DFA to do math! L(M) = Accept sums that are multiples of 3 ∑ = { 0,1,2, <Reset>} Keep a running total of input, modulo 3 q0 CS 310 – Fall 2008 Pacific University

  15. ∑ = {0,1}, L(M)={w | begins with 1, ends with 0} CS 310 – Fall 2008 Pacific University

  16. ∑ = {0,1}, L(M)={w | contains 110} CS 310 – Fall 2008 Pacific University

  17. ∑ = {0,1}, L(M)={w | does not contain 110} CS 310 – Fall 2008 Pacific University

  18. ∑ = {0,1}, L(M)={w | (01)* } CS 310 – Fall 2008 Pacific University

  19. ∑ = {0,1}, L(M)={w | w even #0s, odd #1s } CS 310 – Fall 2008 Pacific University

  20. ∑ = {0,1}, L(M)={w | w any string except 11 and 111 } CS 310 – Fall 2008 Pacific University

  21. Formal Definition of Computing • Given a machine M= (Q, ∑ , δ,q0, F) and a string w=w1w2…wn over ∑, then M accepts w if there exists a sequence of states r0,r1…rn in Q such that: • r0 = q0 : r0 is the start state • δ (ri, wi+1) = ri+1 ,i=0,…,n-1 : legal transitions • rnє F : stop in an accept state • M recognizes A if A={w | M accepts w} • Language A is regular if there exists a Finite Automata that recognizes A. CS 310 – Fall 2008 Pacific University

More Related