Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.

Similar presentations


Presentation on theme: "1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse."— Presentation transcript:

1 1 More Properties of Regular Languages

2 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse

3 3 Namely, for regular languages and : Union Concatenation Star operation Reverse Regular Languages

4 4 We will prove Regular languages are closed under: Complement Intersection

5 5 Namely, for regular languages and : Complement Intersection Regular Languages

6 6 Complement Theorem: For regular language the complement is regular Proof: Take DFA that accepts and make nonfinal states final final states nonfinal Resulting DFA accepts

7 7 Example:

8 8 Intersection Theorem: For regular languages and the intersection is regular Proof:Apply DeMorgan’s Law:

9 9 regular

10 10 Standard Representations of Regular Languages

11 11 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars

12 12 When we say: We are given a Regular Language We mean:Language is in a standard representation

13 13 Elementary Questions about Regular Languages

14 14 Membership Question Question:Given regular language and string how can we check if ? Answer:Take the DFA that accepts and check if is accepted

15 15 DFA

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

17 17 DFA

18 18 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:

19 19 DFA is infinite DFA is finite

20 20 Given regular languages and how can we check if ? Question: Find if Answer:

21 21 and

22 22 or

23 23 Non-regular languages

24 24 Regular languages Non-regular languages

25 25 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 !!!

26 26 The Pigeonhole Principle

27 27 pigeons pigeonholes

28 28 A pigeonhole must contain at least two pigeons

29 29........... pigeons pigeonholes

30 30 The Pigeonhole Principle........... pigeons pigeonholes There is a pigeonhole with at least 2 pigeons

31 31 The Pigeonhole Principle and DFAs

32 32 DFA with states

33 33 In walks of strings:no state is repeated

34 34 In walks of strings:a state is repeated

35 35 If the walk of string has length then a state is repeated

36 36 If in a walk of a string transitions states of DFA then a state is repeated Pigeonhole principle for any DFA:

37 37 In other words for a string : transitions are pigeons states are pigeonholes

38 38 In general: A string has length number of states A state must be repeated in the walk...... walk of

39 39 The Pumping Lemma

40 40 Take an infinite regular language DFA that accepts states

41 41 Take string with There is a walk with label :......... walk

42 42 If string has lengthnumber of states then, from the pigeonhole principle: a state is repeated in the walk...... walk

43 43 Write......

44 44...... Observations:length number of states length

45 45 The string is acceptedObservation:......

46 46 The string is accepted Observation:......

47 47 The string is accepted Observation:......

48 48 The string is accepted In General:......

49 49 In other words, we described: The Pumping Lemma !!!

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

51 51 Applications of the Pumping Lemma

52 52 Theorem: The language is not regular Proof: Use the Pumping Lemma

53 53 Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma

54 54 Let be the integer in the Pumping Lemma Pick a string such that: length Example: pick

55 55 Write: it must be that: length From the Pumping Lemma Therefore:

56 56 From the Pumping Lemma: Thus: We have:

57 57 Therefore: BUT: CONTRADICTION!!!

58 58 Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:

59 59 Regular languages Non-regular languages


Download ppt "1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse."

Similar presentations


Ads by Google