1 / 55

Kleene Theorem II

Kleene Theorem II. Equivalence of FA, NDFA,NDFA- . Announcement. Microsoft is coming to RIT Integrating Technology for Performance Xcellence” Mike Adams, Director of Global Performance Xcellence Monday, April 1 – 3pm Webb Auditorium (Rm 1350) Booth Bld Reception will follow

jael
Download Presentation

Kleene Theorem II

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. Kleene Theorem II Equivalence of FA, NDFA,NDFA-

  2. Announcement • Microsoft is coming to RIT • Integrating Technology for Performance Xcellence” • Mike Adams, Director of Global Performance Xcellence • Monday, April 1 – 3pm • Webb Auditorium (Rm 1350) Booth Bld • Reception will follow • RSVP 475-2199 or dlsbbbu@rit.edu

  3. Announcement • CS Colloquium • Many to Many Invocation: A New Paradigm for Ad Hoc Collaborative Systems • Hans-Peter Bischof • Tuesday, April 2 • 1-2 pm • 10-1124

  4. Homework • Homework #1 returned today • Homework #2 due today

  5. Homework • Speaking of Homework • Here’s Homework #3 (Due April 4) • From the textbook • 4.8b,c • 4.13b,c • 4.16b,c • 4.31c,d • 4,32a

  6. Before We Start • Any questions?

  7. Plan for today • Last time • We introduced two variants of the FA • Today we will show that each of three FAs are equivalent w.r.t. the class of languages that they accept

  8. Languages • Recall. • What is a language? • What is a class of languages?

  9. Regular Languages • Regular languages • Means of defining: Regular Expressions • Machine for accepting: Finite Automata

  10. Finite Automata • A finite automaton (finite-state machine) is a 5-tuple (Q, , qo, , A) where • Q is a finite set (of states) •  is a finite alphabet of symbols • qo Q is the start state • A Q is the set of accepting states •  is a function from Q x  to Q (transition function)

  11. Kleene Theorem • A language L over  is regular iff there exists an FA that accepts L. • If L is regular there exists an FA M such that L = L(M) • For any FA, M, L(M) is regular L(M), the language accepted by the FA can be expressed as a regular expression.

  12. Proving Kleene Theorem • Approach • Define 2 variants of the Finite Automata • Nondeterministic Finite Automata (NDFA) • Nondeterministic Finite Automata with  transitions (NDFA- ) • Prove that FA, NDFA, and NDFA-  are equivalent w.r.t. the languages they accept • For a regular expression, build a NDFA-  that accepts the same language • For an FA build a regular expression that describes the language accepted by the FA.

  13. Tonight • Last time we defined these two FA variants: • Nondeterministic Finite Automata (NDFA) • Nondeterministic Finite Automata with  transitions (NDFA- ) • Today we show they are equivalent • Questions?

  14. Equivalence • If L is a language over *, then the following 3 statements are equivalent: • L is accepted by a FA • L is accepted by a NDFA • L is accepted by a NDFA-

  15. Equivalence • How we will show this • Given an NDFA that accepts L, create an FA that also accepts L • Given an NDFA-  that accepts L, create an NDFA that also accepts L • Given an FA that accepts L, create a NDFA-  that also accepts L. Are we ready?

  16. Step 1: NDFA->FA • Given NDFA find FA • Let M = (Q, , q0, A, ) be a NDFA then • There exists a FA, M1 = (Q1, , q1, A1, 1) • Such that L(M) = L(M1)

  17. Step 1: NDFA -> FA • Basic idea • Recall that for a NDFA, : Q x   2Q • Use the states of M1 to represent subsets of Q. • If there is one state of M1 for every subset of Q, then the non-determinism of M can be eliminated. • This technique, called subset construction, is a primary means for removing non-determinism from an NDFA.

  18. Step 1: NDFA -> FA • Formal definition • M = (Q, , q0, A, ) be a NDFA • We define FA, M1 = (Q1, , q1, A1, 1) • Q1 = 2Q • q1 = {q0} • For q  Q1 and a  , • A1 = {q  Q1 | q  A   } • Note that we need only include states on M1 (subsets of Q) if the state is reachable.

  19. Step 1: NDFA -> FA • Algorithm for building M1 • Add {q0} to Q1 • While there are states of Q1 whose transitions are yet to be defined • Let q  Q1 • For each a  , determine the set of states, P, in M that are reachable from q on input a • If there is no state in Q1 corresponding to P, add one. • Define 1 (q, a) = state in Q1 corresponding to P • Define A1 as any state in Q1 that corresponds to a subset containing any of the final states of M

  20. Step 1: NDFA -> FA • Example

  21. Step 1: NDFA -> FA q0q3 0 1 0 0 1 q0q2 q0q1q3 0 0 0 1 q0 q0q1 1 1 1 0 q0q2q3 q0q1q2 1 0 1 q0q1q2q3

  22. Step 1: NDFA -> FA • Now we must show that M1 accepts the same language as M • Will show that for all x  * • *1 (q1, x) = *(q0, x) • Show by structural induction • Base case when x =  • *1 (q1, ) = q1 definition of *1 • = {q0} definition of q1 • = *(q0, ) definition of * • = *(q0, x) since x = 

  23. Step 1: NDFA -> FA • Show by structural induction • Induction: • Assume *1 (q1, x) = *(q0, x) • Show *1 (q1, xa) = *(q0, xa) • *1 (q1, xa) = 1 (*1 (q1, x) , a) def of *1 • = 1 (*(q0, x), a) induction hypothesis • = def of 1 • = *(q0, xa) def of *

  24. Step 1: NDFA -> FA • Show that M and M1 recognize the same language • x is accepted by M1 iff *1 (q1, x)  A1 • x is accepted by M1 iff *(q0, x)  A1 • By def of A1, • x is accepted by M1 iff *(q0, x)  A   • Thus • x is accepted by M1 iff x is accepted by M

  25. What have we shown • In Step 1 we’ve shown: • Given a NDFA • There exists an FA that accepts the same language • Non-determinism can be removed from an NDFA by using a subset construction algorithm. • Questions?

  26. What have we shown FA NDFA If L  NDFA then L  FA

  27. Step 2: NDFA- -> NDFA • Given NDFA- find NDFA • Let M = (Q, , q0, A, ) be a NDFA- then • There exists a NDFA, M1 = (Q1, , q1, A1, 1) • Such that L(M) = L(M1)

  28. Step 2: NDFA- -> NDFA • Basic idea • Recall that a NDFA- is still non-deterministic • Replace  transitions with non- transitions • Let 1(q,a) be the set of states reachable from q, reading symbol a, including those reachable via  transitions • Which is just * (q,a) 0 0  0

  29. Step 2: NDFA- -> NDFA • Basic idea • Accepting states • If q0 is not an accepting state of M but it is possible to get to an accepting state by just using  transitions, then q0 must be added to the set of accepting states of M1

  30. Step 2: NDFA- -> NDFA • Formal definition • M = (Q, , q0, A, ) be a NDFA- • We define NDFA, M1 = (Q1, , q1, A1, 1) • Q1 = Q • q1 = q0 • 1 (q,a) = * (q,a) • A1 = A  {qo} if ({qo} )  A   in M • = A otherwise

  31. Step 2: NDFA- -> NDFA • Algorithm for constructing M1 • Set of states is the same as M • Start state is the same as M • Accepting states is the same as M • For each state, q, in M • compute the  closure • For each state in the  closure,p, and for each symbol a, add all elements of  (p,a) to the set 1(q, a) • If you can get to to an accepting state in M from qo by only using  transitions, add q0 to A1

  32. Step 2: NDFA- -> NDFA • Example

  33. Step 2: NDFA- -> NDFA

  34. Step 2: NDFA- -> NDFA r p s w q0 t v u

  35. Step 2: NDFA- -> NDFA • Now we must show that M1 accepts the same language as M • Will show that for all x  * • *1 (q, x) = *(q, x) • Show by structural induction • Base step: show true for x = a • *(q, a) = 1(q,a) def of 1 • *1 (q, a) = def of *1 • = 1(q,a) since *1 (q, ) = {q}

  36. Step 2: NDFA- -> NDFA • Show by structural induction • Assume: *1 (q, x) = *(q, x) • Show: *1 (q, xa) = *(q, xa) def of *1 induction hypothesis def of 1

  37. Where we are • In Step 2 we’ve shown: • Given an NDFA-  • There exists an NDFA that accepts the same language •  transitions can be removed from an NDFA-  by replacing  transitions with non-  transitions in an already non-deterministic NDFA.

  38. Where we are NDFA NDFA-  If L  NDFA-  then L  NDFA

  39. Where we are • We’ve shown that: • If L is accepted by an NDFA-  it is also accepted by an NDFA • If L is accepted by an NDFA it is also accepted by an FA • So if L is accepted by an NDFA- , it is accepted by an FA. • We still need to show: • If L is accepted by an FA, it is also accepted by an NDFA-  • Questions?

  40. Where we are NDFA FA NDFA- 

  41. Step 3: FA-> NDFA- • Given FA find NDFA- • Let M = (Q, , q0, A, ) be a FA then • There exists a NDFA -, M1 = (Q1, , q1, A1, 1) • Such that L(M) = L(M1)

  42. Step 3: FA-> NDFA- • Basic idea • Since FAs are more restrictive than NDFA-s, any FA is essentially an NDFA- that doesn’t take advantage of: • Non-determinism • -transitions • Must consider details of transition functions

  43. Step 3: FA-> NDFA- • Formal definition • M = (Q, , q0, A, ) be a FA • We define NDFA-, M1 = (Q1, , q1, A1, 1) • Q1 = Q • q1 = q0 • A1 = A • 1 (q, ) =  for all q  Q • 1 (q, a) = { (q, a)} for all q  Q, a  

  44. Step 3: FA-> NDFA- • Now we must show that M1 accepts the same language as M • Will show that for all x  * • *1 (q, x) = {*(q, x) } • Show by structural induction • Base step: show true for x =  • *1 (q, ) = (q) def of *1 • = {q} since 1 (q, ) =  • = *(q, ) def of *

  45. Step 3: FA-> NDFA- • Show by structural induction • Assume: *1 (q, x) = {*(q, x) } • Show: *1 (q, xa) = {*(q, xa) } • def of *1 • since 1 (q, ) =  • induction hyp. • = { (*(q, x), a) } • = {*(q, xa) } def of *

  46. Step 3: FA-> NDFA- • Show that M and M1 recognize the same language • x is accepted by M1 iff *1 (q0, x)  A   • x is accepted by M1 iff {*(q0, x)}  A   • That’s the same as saying • *(q0, x)  A or • x is accepted by M • Thus • x is accepted by M1 iff x is accepted by M

  47. Equivalence! • What we have shown • Given an NDFA that accepts L, create an FA that also accepts L • Given an NDFA-  that accepts L, create an NDFA that also accepts L • Given an FA that accepts L, create a NDFA-  that also accepts L. • All 3 are equivalent

  48. Equivalence! NDFA FA NDFA- 

  49. Equivalence! NDFA FA NDFA- 

  50. Questions • break

More Related