Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.

Similar presentations


Presentation on theme: "Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars."— Presentation transcript:

1 Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars

2 Fall 2004COMP 3352 When we say: We are given a Regular Language We mean:Language is in a standard representation

3 Fall 2004COMP 3353 Elementary Questions about Regular Languages

4 Fall 2004COMP 3354 Membership Question Question:Given regular language and string how can we check if ? Answer:Take the DFA that accepts and check if is accepted

5 Fall 2004COMP 3355 DFA

6 Fall 2004COMP 3356 Given regular language how can we check if is empty: ? Take the DFA that accepts Check if there is any path from the initial state to a final state Question: Answer:

7 Fall 2004COMP 3357 DFA

8 Fall 2004COMP 3358 Given regular language how can we check if is finite? Take the DFA that accepts Check if there is a walk with cycle from the initial state to a final state Question: Answer:

9 Fall 2004COMP 3359 DFA is infinite DFA is finite

10 Fall 2004COMP 33510 Given regular languages and how can we check if ? Question: Find if Answer:

11 Fall 2004COMP 33511 and

12 Fall 2004COMP 33512 or

13 Fall 2004COMP 33513 Non-regular languages

14 Fall 2004COMP 33514 Regular languages Non-regular languages

15 Fall 2004COMP 33515 How can we prove that a language is not regular? Prove that there is no DFA that accepts Problem: this is not easy to prove Solution: the Pumping Lemma !!!

16 Fall 2004COMP 33516 The Pigeonhole Principle

17 Fall 2004COMP 33517 pigeons pigeonholes

18 Fall 2004COMP 33518 A pigeonhole must contain at least two pigeons

19 Fall 2004COMP 33519........... pigeons pigeonholes

20 Fall 2004COMP 33520 The Pigeonhole Principle........... pigeons pigeonholes There is a pigeonhole with at least 2 pigeons

21 Fall 2004COMP 33521 The Pigeonhole Principle and DFAs

22 Fall 2004COMP 33522 DFA with states

23 Fall 2004COMP 33523 In walks of strings:no state is repeated

24 Fall 2004COMP 33524 In walks of strings:a state is repeated

25 Fall 2004COMP 33525 If string has length : Thus, a state must be repeated Then the transitions of string are more than the states of the DFA

26 Fall 2004COMP 33526 In general, for any DFA: String has length number of states A state must be repeated in the walk of...... walk of Repeated state

27 Fall 2004COMP 33527 In other words for a string : transitions are pigeons states are pigeonholes...... walk of Repeated state

28 Fall 2004COMP 33528 The Pumping Lemma

29 Fall 2004COMP 33529 Take an infinite regular language There exists a DFA that accepts states

30 Fall 2004COMP 33530 Take string with There is a walk with label :......... walk

31 Fall 2004COMP 33531 If string has length (number of states of DFA) then, from the pigeonhole principle: a state is repeated in the walk...... walk

32 Fall 2004COMP 33532...... walk Let be the first state repeated in the walk of

33 Fall 2004COMP 33533 Write......

34 Fall 2004COMP 33534...... Observations:lengthnumber of states of DFA length

35 Fall 2004COMP 33535 The string is accepted Observation:......

36 Fall 2004COMP 33536 The string is accepted Observation:......

37 Fall 2004COMP 33537 The string is accepted Observation:......

38 Fall 2004COMP 33538 The string is accepted In General:......

39 Fall 2004COMP 33539 In General:...... Language accepted by the DFA

40 Fall 2004COMP 33540 In other words, we described: The Pumping Lemma !!!

41 Fall 2004COMP 33541 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we can write with and such that:

42 Fall 2004COMP 33542 Applications of the Pumping Lemma

43 Fall 2004COMP 33543 Theorem: The language is not regular. Proof: Use the Pumping Lemma

44 Fall 2004COMP 33544 Assume that is a regular language Since is an infinite language, we can apply the Pumping Lemma

45 Fall 2004COMP 33545 Let be the integer in the Pumping Lemma Pick a string such that: (1)and We pick: (2) length

46 Fall 2004COMP 33546 it must be that length From the Pumping Lemma Write: Thus:

47 Fall 2004COMP 33547 From the Pumping Lemma: Thus:

48 Fall 2004COMP 33548 From the Pumping Lemma: Thus:

49 Fall 2004COMP 33549 But: CONTRADICTION!!!

50 Fall 2004COMP 33550 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

51 Fall 2004COMP 33551 Regular languages Non-regular languages

52 Fall 2004COMP 33552 More Applications of the Pumping Lemma

53 Fall 2004COMP 33553 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we can write with and such that:

54 Fall 2004COMP 33554 Regular languages Non-regular languages

55 Fall 2004COMP 33555 Theorem: The language is not regular Proof: Use the Pumping Lemma

56 Fall 2004COMP 33556 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

57 Fall 2004COMP 33557 We pick Let be the integer in the Pumping Lemma Pick a string such that: length and

58 Fall 2004COMP 33558 Write it must be that length From the Pumping Lemma Thus:

59 Fall 2004COMP 33559 From the Pumping Lemma: Thus:

60 Fall 2004COMP 33560 From the Pumping Lemma: Thus:

61 Fall 2004COMP 33561 BUT: CONTRADICTION!!!

62 Fall 2004COMP 33562 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

63 Fall 2004COMP 33563 Regular languages Non-regular languages

64 Fall 2004COMP 33564 Theorem: The language is not regular Proof: Use the Pumping Lemma

65 Fall 2004COMP 33565 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

66 Fall 2004COMP 33566 We pick Let be the integer in the Pumping Lemma Pick a string such that: length and

67 Fall 2004COMP 33567 Write it must be that length From the Pumping Lemma Thus:

68 Fall 2004COMP 33568 From the Pumping Lemma: Thus:

69 Fall 2004COMP 33569 From the Pumping Lemma: Thus:

70 Fall 2004COMP 33570 BUT: CONTRADICTION!!!

71 Fall 2004COMP 33571 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

72 Fall 2004COMP 33572 Regular languages Non-regular languages

73 Fall 2004COMP 33573 Theorem: The language is not regular Proof: Use the Pumping Lemma

74 Fall 2004COMP 33574 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

75 Fall 2004COMP 33575 We pick Let be the integer in the Pumping Lemma Pick a string such that: length

76 Fall 2004COMP 33576 Write it must be that length From the Pumping Lemma Thus:

77 Fall 2004COMP 33577 From the Pumping Lemma: Thus:

78 Fall 2004COMP 33578 From the Pumping Lemma: Thus:

79 Fall 2004COMP 33579 Since: There must exist such that:

80 Fall 2004COMP 33580 However:for for any

81 Fall 2004COMP 33581 BUT: CONTRADICTION!!!

82 Fall 2004COMP 33582 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:


Download ppt "Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars."

Similar presentations


Ads by Google