1 / 23

Lecture 16

Lecture 16. FSA’s Defining FSA’s Computing with FSA’s Defining L(M) Defining language class LFSA Comparing LFSA to set of solvable languages (REC). Quick Review. What is the functional definition of a configuration? What is a computation?. Finite State Automata. New Computational Model.

marlis
Télécharger la présentation

Lecture 16

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. Lecture 16 • FSA’s • Defining FSA’s • Computing with FSA’s • Defining L(M) • Defining language class LFSA • Comparing LFSA to set of solvable languages (REC)

  2. Quick Review • What is the functional definition of a configuration? • What is a computation?

  3. Finite State Automata New Computational Model

  4. a;a;R b;b;R a,b 2 2 1 1 a,b a;a;R b;b;R Finite State Automata (FSA) • Written character is identical to read character • Tape head moves right one cell • Model can be simplified by removing these elements

  5. FSA M=(Q,S,q0,A,d) Q = set of states = {1,2} S = character set = {a,b} q0 = initial state = 1 A = set of accepting (final) states = {1} d = state transition function Comments: Read only Tape head moves right a,b 2 1 a,b Formal Definition

  6. Exercise • FSA M = (Q, S, q0, A, d) • Q = {1, 2, 3} • S = {a, b} • q0 = 1 • A = {2,3} • d: {d(1,a) = 1, d(1,b) = 2, d(2,a)= 2, d(2,b) = 3, d(3,a) = 3, d(3,b) = 1} • Draw this FSA as a transition diagram

  7. a a b 2 1 b b 3 a Transition Diagram

  8. Computing with FSA’s

  9. (1, aabbaa) (1,abbaa) (1,bbaa) (2,baa) (3,aa) (3,a) (3,l) a a b 2 1 b b 3 a Computation Example Input: aabbaa

  10. Computation of FSA’s in detail • A computation of an FSA M on an input x is a complete sequence of configurations • We need to define • Initial configuration of the computation • How to determine the next configuration given the current configuration • Halting or final configurations of the computation

  11. Given an FSA M and an input string x, what is the initial configuration of the computation of M on x? (q0,x) Examples x = aabbaa (1, aabbaa) x = abab (1, abab) x = l (1, l) a a b 2 1 b b 3 a Initial Configuration FSA M

  12. (1, aabbaa) |-M (1, abbaa) config 1 “yields” config 2 in one step using FSA M (1,aabbaa) |-M (2, baa) config 1 “yields” config 2 in 3 steps using FSA M (1, aabbaa) |-M (2, baa) config 1 “yields” config 2 in 0 or more steps using FSA M Comment: |-M determined by transition functiond There must always be one and only one next configuration If not, M is not an FSA a a b 2 1 b b 3 a Definition of |-M 3 * FSA M

  13. Halting configuration (q, l) Examples (1, l) (3, l) Accepting Configuration State in halting configuration is in A Rejecting Configuration State in halting configuration is not in A a a b 2 1 b b 3 a Halting Configurations FSA M

  14. a a b FSA M b b a FSA M on x • Two possibilities for M running on x • M accepts x • M accepts x iff the computation of M on x ends up in an accepting configuration • (q0, x) |-M (q, l) where q is in A • M rejects x • M rejects x iff the computation of M on x ends up in a rejecting configuration • (q0, x) |-M (q, l) where q is not in A • M does not loop or crash on x • There is always one and only one next configuration. • Tape head always moves right one cell until EOF * *

  15. a a b FSA M b b a Examples • For the following input strings, does M accept or reject? • l • aa • aabba • aab • babbb

  16. Notation from the book d(q, c) = p dk(q, x) = p d*(q, cx) = p q, p in Q k is any integer >= 1 c in S x in S* or Sk Examples d(1, a) = 1 d(1, b) = 2 d4(1, abbb) = 1 d*(1, abbb) = 1 d*(2, baaaaa) = 1 a a b 2 1 b b 3 a Definition of d*(q, x) FSA M

  17. a a b FSA M b b a L(M) and LFSA • L(M) or Y(M) • The set of strings M accepts • Basically the same as Y(P) from previous unit • We say that M accepts/decides/recognizes/solves L(M) • Remember an FSA will not loop or crash • What is L(M) (or Y(M)) for the FSA M above? • N(M) • Rarely used, but it is the set of strings M rejects • LFSA • L is in LFSA iff there exists an FSA M such that L(M) = L.

  18. LFSA Unit Overview • Study limits of LFSA • Understand what languages are in LFSA • Develop techniques for showing L is in LFSA • Understand what languages are not in LFSA • Develop techniques for showing L is not in LFSA • Prove Closure Properties of LFSA • Identify relationship of LFSA to other language classes

  19. Comparing language classes Showing LFSA is a subset of REC, the set of solvable languages

  20. LFSA subset REC • Proof • Let L be an arbitrary language in LFSA • Let M be an FSA such that L(M) = L • M exists by definition of L in LFSA • Construct C++ program P from FSA M • Argue P solves L • There exists a C++ program P which solves L • L is solvable

  21. L L C++ Programs M P FSA’s Visualization • Let L be an arbitrary language in LFSA • Let M be an FSA such that L(M) = L • M exists by definition of L in LFSA • Construct C++ program P from FSA M • Argue P solves L • There exists a program P which solves L • L is solvable LFSA REC

  22. Construction FSA M Program P Construction Algorithm • The construction is an algorithm which solves a problem with a program as input • Input to A: FSA M • Output of A: C++ program P such that P solves L(M) • Informal description of algorithm • Implement FSA M as C++ program using switch statements, etc.

  23. Comparing computational models • The previous slides show one method for comparing the relative power of two different computational models • Computational model CM1 is at least as general or powerful as computational model CM2 if • Any program P2 from computational model CM2 can be converted into an equivalent program P1 in computational model CM1. • Question: How can we show two computational models are equivalent?

More Related