Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.

Similar presentations


Presentation on theme: "Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state."— Presentation transcript:

1 Fall 2004COMP 3351 Single Final State for NFA

2 Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state

3 Fall 2004COMP 3353 NFA Equivalent NFA Example

4 Fall 2004COMP 3354 NFA In General Equivalent NFA Single final state

5 Fall 2004COMP 3355 Extreme Case NFA without final state Add a final state Without transitions

6 Fall 2004COMP 3356 Properties of Regular Languages

7 Fall 2004COMP 3357 Concatenation: Star: Union: Are regular Languages For regular languages and we will prove that: Complement: Intersection: Reversal:

8 Fall 2004COMP 3358 We say: Regular languages are closed under Concatenation: Star: Union: Complement: Intersection: Reversal:

9 Fall 2004COMP 3359 Regular language Single final state NFA Single final state Regular language NFA

10 Fall 2004COMP 33510 Example

11 Fall 2004COMP 33511 Union NFA for

12 Fall 2004COMP 33512 Example NFA for

13 Fall 2004COMP 33513 Concatenation NFA for

14 Fall 2004COMP 33514 Example NFA for

15 Fall 2004COMP 33515 Star Operation NFA for

16 Fall 2004COMP 33516 Example NFA for

17 Fall 2004COMP 33517 Reverse NFA for 1. Reverse all transitions 2. Make initial state final state and vice versa

18 Fall 2004COMP 33518 Example

19 Fall 2004COMP 33519 Complement 1. Take the DFA that accepts 2. Make final states non-final, and vice-versa

20 Fall 2004COMP 33520 Example

21 Fall 2004COMP 33521 Intersection DeMorgan’s Law: regular

22 Fall 2004COMP 33522 Example regular

23 Fall 2004COMP 33523 Regular Expressions

24 Fall 2004COMP 33524 Regular Expressions Regular expressions describe regular languages Example: describes the language

25 Fall 2004COMP 33525 Recursive Definition Are regular expressions Primitive regular expressions: Given regular expressions and

26 Fall 2004COMP 33526 Examples A regular expression: Not a regular expression:

27 Fall 2004COMP 33527 Languages of Regular Expressions : language of regular expression Example:

28 Fall 2004COMP 33528 Definition For primitive regular expressions :

29 Fall 2004COMP 33529 Definition (continued) For regular expressions and

30 Fall 2004COMP 33530 Example Regular expression:

31 Fall 2004COMP 33531 Example Regular expression

32 Fall 2004COMP 33532 Example Regular expression

33 Fall 2004COMP 33533 Example Regular expression = {all strings with at least two consecutive 0}

34 Fall 2004COMP 33534 Example Regular expression = { all strings without two consecutive 0 }

35 Fall 2004COMP 33535 Equivalent Regular Expressions Definition: Regular expressions and are equivalent if

36 Fall 2004COMP 33536 Example = { all strings without two consecutive 0 } and are equivalent Reg. expressions

37 Fall 2004COMP 33537 Regular Expressions and Regular Languages

38 Fall 2004COMP 33538 Theorem Languages Generated by Regular Expressions Regular Languages

39 Fall 2004COMP 33539 Theorem - Part 1 1. For any regular expression the language is regular Languages Generated by Regular Expressions Regular Languages

40 Fall 2004COMP 33540 Theorem - Part 2 Languages Generated by Regular Expressions Regular Languages 2. For any regular language, there is a regular expression with

41 Fall 2004COMP 33541 Proof - Part 1 1. For any regular expression the language is regular Proof by induction on the size of

42 Fall 2004COMP 33542 Induction Basis Primitive Regular Expressions: NFAs regular languages

43 Fall 2004COMP 33543 Inductive Hypothesis Assume for regular expressions and that and are regular languages

44 Fall 2004COMP 33544 Inductive Step We will prove: are regular Languages.

45 Fall 2004COMP 33545 By definition of regular expressions:

46 Fall 2004COMP 33546 By inductive hypothesis we know: and are regular languages Regular languages are closed under: Union Concatenation Star We also know:

47 Fall 2004COMP 33547 Therefore: Are regular languages

48 Fall 2004COMP 33548 And trivially: is a regular language

49 Fall 2004COMP 33549 Proof – Part 2 2. For any regular language there is a regular expression with Proof by construction of regular expression

50 Fall 2004COMP 33550 Since is regular, take an NFA that accepts it Single final state

51 Fall 2004COMP 33551 From, construct an equivalent Generalized Transition Graph in which transition labels are regular expressions Example:

52 Fall 2004COMP 33552 Another Example:

53 Fall 2004COMP 33553 Reducing the states:

54 Fall 2004COMP 33554 Resulting Regular Expression:

55 Fall 2004COMP 33555 In General Removing states:

56 Fall 2004COMP 33556 The final transition graph: The resulting regular expression:


Download ppt "Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state."

Similar presentations


Ads by Google