Regular Languages - PowerPoint PPT Presentation

About This Presentation
Title:

Regular Languages

Description:

Title: Slide 1 Author. Last modified by: ib Created Date: 9/5/2006 1:57:48 AM Document presentation format: On-screen Show Company. Other titles – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 20
Provided by: 2498
Learn more at: https://www.cs.rit.edu
Category:

less

Transcript and Presenter's Notes

Title: Regular Languages


1
Section 3.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 )
2
Section 3.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 ) Simplify as
3
Section 3.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 ( ). Recursive definition of
regular languages over ?
4
Section 3.1
Regular Expressions
Recursive definition of regular expressions over
? 1) , ? , and a for every a 2 ? are
regular languages represented by regular
expressions __, __, __, respectively. 2) If
L1, L2 are regular languages represented by
regular Expressions r1 and r2, then L1 L2,
L1L2, and L1 are regular languages represented
by regular expressions _____, _____, _____,
respectively. 3) No other expressions are
regular expressions.
5
Section 3.1
Regular Expressions
  • Comments
  • For convenience, we will also use r and ri for
    i 2 N.
  • The priority of operators in decreasing order
    Kleenes star, concatenation, union.
  • Parenthesize
  • a bc
  • a bc

6
Section 3.1
Regular Expressions
  • Simplify the following regular expressions
  • a(a?)
  • aa
  • (ab)
  • (ab)ab(ab) ab

7
Section 3.1
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 as precede all bs,
  • 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 akbk k 2 N regular ?

8
Sections 3.2, 3.3
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

9
Sections 3.2, 3.3
Finite Automata
Example the language of all strings over a,b
with an even number of as.
10
Sections 3.2, 3.3
Finite Automata
  • More examples
  • Language of strings over a,b with at least 3
    as.
  • 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 as and odd number of bs.

11
Sections 3.2, 3.3
Finite Automata
  • A (deterministic) finite automaton (FA, in some
    books also abbreviated as DFA) is a 5-tuple
    (Q,?,q0,A,?) where
  • Q is a finite set of states
  • ? is a finite alphabet (input symbols)
  • qo 2 Q is the initial state
  • A µ Q is a set of accepting states
  • ? Q? ? Q is the transition function

12
Sections 3.2, 3.3
Finite Automata
Comment We saw that we can represent a finite
automaton by a transition diagram. Draw the
transition diagram for ( qa,qb, a,b, qa,
qb, ? ) where ? is given by the following
table (qa,a) ? qa (qa,b) ? qb
(qb,a) ? qa (qb,b) ? qb Which strings
does this FA accept ?
13
Sections 3.2, 3.3
Finite Automata
Defining the computation of an FA
M(Q,?,q0,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.
14
Section 3.4
Finite Automata
Kleenes Thm A language L over ? is regular iff
there exists a finite automaton that accepts
L. Recall L akbk k 0 . Is it regular
?
15
Section 3.5
Operations on Finite Automata
Let M1 (Q1,?,q1,A1,?1) and M2
(Q2,?,q2,A2,?2) be two FAs. Union We know
that L(M1) L(M2) is regular.
Construct an FA M such that L(M)
L(M1) L(M2).
16
Section 3.5
Operations on Finite Automata
Let M1 (Q1,?,q1,A1,?1) and M2
(Q2,?,q2,A2,?2) be two FAs. Intersection Is
L(M1) Ã… L(M2) is regular ?
Construct an FA M such that
L(M) L(M1) Ã… L(M2).
17
Section 3.5
Operations on Finite Automata
Let M1 (Q1,?,q1,A1,?1) be an
FA. Complement Is L(M1) regular ?

Construct an FA M such that L(M) L(M1).
18
Section 3.5
Operations on Finite Automata
Let M1 (Q1,?,q1,A1,?1) and M2
(Q2,?,q2,A2,?2) be two FAs. Difference Constru
ct an FA M such that L(M) L(M1) - L(M2).
19
Section 3.5
Closure Properties
We just saw that the class of regular languages
is closed under union, intersection, complement,
and difference. Let L x2a,b x has
the same number of as and bs . Is L regular ?
Write a Comment
User Comments (0)
About PowerShow.com