Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cohen, Chapter 61 Introduction to Computational Theory Chapter 6.

Similar presentations


Presentation on theme: "Cohen, Chapter 61 Introduction to Computational Theory Chapter 6."— Presentation transcript:

1 Cohen, Chapter 61 Introduction to Computational Theory Chapter 6

2 Cohen, Chapter 62 Automatic Door/FA Front pad Rear pad closedopen Front Neither Front, Rear, Both Rear, Both, Neither

3 Cohen, Chapter 63 Nondeterministic When the ultimate path through a machine is not determined by input alone the machine is nondeterministic.

4 Cohen, Chapter 64 Preamble to Chapter 6 n NFAs – Non-deterministic finite automata – Vs. DFAs (deterministic – the book calls FAs) n We allow multiple transitions per letter per state – Including “lambda-transitions” n Move on a whim (w/o consuming input) – Accept if a path exists to a final state n Transition relation:

5 Cohen, Chapter 65 a - + + a a a -+ aa a,b a - + b a b Examples

6 Cohen, Chapter 66 Why Non-determinism? n More expressive model n Easier to find machines for a language – E.g., unions of two languages/machines

7 Cohen, Chapter 67 Examples n (ab + aba)* n Language over {a b} where last symbol is repeated

8 Cohen, Chapter 68 NFA – DFA Equivalence n There is an algorithm to convert a NFA to a DFA n Just track all the possibilities – Collapse lambda moves n States are a subset of 2 Q n “Rabin-Scott” Algorithm n Example: a + c*b*

9 Cohen, Chapter 69 Lambda Transitions n Handy for combining machines – E.g., union of two languages: create a new start state with lambda moves to the start states of the two machines

10 Cohen, Chapter 610 Examples a -+ b b a x1x1 x2x2 x4x4 x3x3 a,b

11 Cohen, Chapter 611 Examples bb - x1x1 x2x2 + x4x4 x3x3 b b

12 Cohen, Chapter 612 Examples bb - x1x1 x2x2 + x3x3 a,b

13 Cohen, Chapter 613 Examples b b - x1x1 x2x2 x3x3 a,b x5x5 x6x6 x7x7 + b a a a

14 Cohen, Chapter 614 Transition Graphs Abandon the requirement that the edges eat just one letter at a time. -+ baa a,bAll else a,b -+ baa All else

15 Cohen, Chapter 615 Crashes (Formerly, Hell State or Jail) When an input string that has not been completely read reaches a state (final or otherwise) that it cannot leave because there is no outgoing edge that it may follow, we say that the input (or the machine) crashes at that state.

16 Cohen, Chapter 616 Rejected Input n Trace a path ending in a non-final state n Crash while being processed -+ a,b aa, bb baa

17 Cohen, Chapter 617 Acceptance A string is accepted by a TG if there is some way it could be processed as to arrive at a final state. There may also be ways in which this string does not get to a final state, but we ignore all failures.

18 Cohen, Chapter 618 Transition Graph A collection of three things: 1. A finite set of states, at least one of which is designated as the start state ( - ) and some (maybe none) of which are designated as final states ( + ) 2. An alphabet of possible input letters from which input strings are formed. 3. A finite set of transitions (edge labels) that show how to go from some states to some others, based on reading specified substrings of input letters (possibly even the null string )

19 Cohen, Chapter 619 Successful Path A successful path through a transition graph is a series of edges forming a path beginning at some start state (there may be several) and ending at a final state. 1- 23 4+ abba aa b Free Ride abbab… abbaa… abbababba A Lambda transition occurs when you get a free transition that was not initiated by user or system action/interaction. Move on a whim (w/o consuming input). Slide modified by Seals

20 Cohen, Chapter 620 Equivalent Language Acceptors +- 2 3 aba a b 1 2- 3- + aba a b 1-

21 Cohen, Chapter 621 Examples -- + - - baa abba

22 Cohen, Chapter 622 Examples -+ ++ a bb -+ a,ba,b

23 Cohen, Chapter 623 Examples (a + b)*b -+ a,ba,b b TG -+ a bb a FA

24 Cohen, Chapter 624 Examples + a,ba,b b + a,ba,b a - b a

25 Cohen, Chapter 625 Examples (EVEN-EVEN; cf. p. 69) aa,bb ab.ba aa,bb ab.ba

26 Cohen, Chapter 626 Example (p. 84) a,ba,b ab bb b bbb a aa a a b b - +

27 Cohen, Chapter 627 Examples (p. 85) a a + - a a + - +

28 Cohen, Chapter 628 Example (Problem 17, p. 91) n L = {a abb bbaab bbbaa} n 1) given a FA that accepts L, construct a TG that accepts transpose(L) – Invert start/final states; reverse arrows n 2) given a TG that accepts L, construct a TG that accepts transpose(L) – Same as 1, but reverse transition strings

29 Cohen, Chapter 629 Generalized Transition Graph (GTG) A collection of three things: 1. A finite set of states, at least one of which is designated as the start state ( - ) and some (maybe none) of which are designated as final states ( + ) 2. An alphabet of possible input letters from which input strings are formed. 3. Directed edges connecting some pairs of states, each labeled with a regular expression.

30 Cohen, Chapter 630 Examples 3+ 1- 2 L1L1 L2L2 L3L3 L4L4 L5L5 + (ab + a)* a a


Download ppt "Cohen, Chapter 61 Introduction to Computational Theory Chapter 6."

Similar presentations


Ads by Google