Download presentation

Presentation is loading. Please wait.

Published byArline Woods Modified over 4 years ago

1
Regular Languages A language is regular over if it can be built from ;, { }, and { a } for every a 2 , using operators union ( [ ), concatenation (. ) and Kleene star ( * ). Example : ( { a } [ { b } ) * { a } { a } ( { a } [ { b } ) * [ ( { a } [ { b } )* { b } { b } ( { a } [ { b } ) * [Section 3.1]

2
Regular Languages A language is regular over if it can be built from ;, { }, and { a } for every a 2 , using operators union ( [ ), concatenation (. ) and Kleene star ( * ). Example : ( { a } [ { b } ) * { a } { a } ( { a } [ { b } ) * [ ( { a } [ { b } )* { b } { b } ( { a } [ { b } )^* Simplify as : [Section 3.1]

3
A language is regular over if it can be built from ;, { }, and { a } for every a 2 , using operators union ( [ ), concatenation (. ) and Kleene star ( * ). Recursive definition of regular languages over : [Section 3.1] Regular Languages

4
Recursive definition of regular expressions over : 1) ;, { }, and { a } for every a 2 are regular languages represented by regular expressions __, __, __, respectively. 2) If L 1, L 2 are regular languages represented by regular Expressions r 1 and r 2, then L 1 [ L 2, L 1 L 2, and L 1 * are regular languages represented by regular expressions _____, _____, _____, respectively. 3) No other expressions are regular expressions. [Section 3.1] Regular Expressions

5
Comments : - For convenience, we will also use r + and r i for i 2 N. - The priority of operators in decreasing order : Kleene’s star, concatenation, union. Parenthesize : a + b * c a + bc * [Section 3.1]

6
Regular Expressions Simplify the following regular expressions : - a * (a+ ) - a * a * - (a * b * ) * - (a+b) * ab(a+b) * + a * b * [Section 3.1]

7
Regular Expressions Give a regular expression for each of the following : - the language of all strings over {a,b} of even length, - the language of all strings over {a,b,c} in which all a’s precede all b’s, - the language of all strings over {a,b} with length greater than 3, - the language of all odd-length strings over {a,b} containing the string bb, - the language of all strings over {a,b} that do not contain the string aaa. Is the language { a k b k | k 2 N } regular ? [Section 3.1]

8
Finite Automata Our simplest model of computation : - has a tape with input, read once from left to right - has only a single memory register with the state [Sections 3.2, 3.3]

9
Finite Automata Example : the language of all strings over {a,b} with an even number of a’s. [Sections 3.2, 3.3]

10
Finite Automata More examples : - Language of strings over {a,b} with at least 3 a’s. - Language of strings over {a,b} containing substring aaba. - Language of strings over {a,b} not containing substring aaba. - Language of strings over {a,b} with even number of a’s and odd number of b’s. [Sections 3.2, 3.3]

11
Finite Automata A (deterministic) finite automaton (FA, in some books also abbreviated as DFA) is a 5-tuple (Q, ,q 0,A, ) where - Q is a finite set of states - is a finite alphabet (input symbols) - q o 2 Q is the initial state - A µ Q is a set of accepting states - : Q £ Q is the transition function [Sections 3.2, 3.3]

12
Finite Automata Comment : We saw that we can represent a finite automaton by a transition diagram. Draw the transition diagram for ( {q a,q b }, {a,b}, q a, {q b }, ) where is given by the following table (q a,a) q a (q a,b) q b (q b,a) q a (q b,b) q b Which strings does this FA accept ? [Sections 3.2, 3.3]

13
Finite Automata Defining the computation of an FA M=(Q, ,q 0,A, ). Extended transition function * : Q £ * Q : 1) For every q 2 Q, let * (q, ) = 2) For every q 2 Q, y 2 *, and 2 , let * (q,y ) = We say that a string x 2 * is accepted by M if __________. A string which is not accepted by M is rejected by M. The language accepted by M, denoted by L(M) is the set of all strings accepted by M. [Sections 3.2, 3.3]

14
Finite Automata Kleene’s Thm: A language L over is regular iff there exists a finite automaton that accepts L. Recall L = { a k b k | k ¸ 0 }. Is it regular ? [Section 3.4]

15
Operations on Finite Automata Let M 1 = (Q 1, ,q 1,A 1, 1 ) and M 2 = (Q 2, ,q 2,A 2, 2 ) be two FA’s. Union: We know that L(M 1 ) [ L(M 2 ) is regular. Construct an FA M such that L(M) = L(M 1 ) [ L(M 2 ). [Section 3.5]

16
Operations on Finite Automata Let M 1 = (Q 1, ,q 1,A 1, 1 ) and M 2 = (Q 2, ,q 2,A 2, 2 ) be two FA’s. Intersection: Is L(M 1 ) Å L(M 2 ) is regular ? Construct an FA M such that L(M) = L(M 1 ) Å L(M 2 ). [Section 3.5]

17
Operations on Finite Automata Let M 1 = (Q 1, ,q 1,A 1, 1 ) be an FA. Complement: Is L(M 1 )’ regular ? Construct an FA M such that L(M) = L(M 1 )’. [Section 3.5]

18
Operations on Finite Automata Let M 1 = (Q 1, ,q 1,A 1, 1 ) and M 2 = (Q 2, ,q 2,A 2, 2 ) be two FA’s. Difference: Construct an FA M such that L(M) = L(M 1 ) - L(M 2 ). [Section 3.5]

19
Closure Properties We just saw that the class of regular languages is closed under union, intersection, complement, and difference. Let L = { x 2 {a,b} * | x has the same number of a’s and b’s }. Is L regular ? [Section 3.5]

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google