Lecture 26 - Notes
Goals
- Be able to prove that regular languages are closed under regular
operations including union, concatenation, and star.
- Know the definition of regular expressions
- Be able to construct regular expressions for a given language, and
be able to describe the language represented by a regular
expression.
Announcements
- Week 6 Survey due tonight
- A6 due Friday night
- Midterm wrapper also due Friday night
- If you haven’t gotten your exam back, you can collect it after class
or in office hours.
Closure
of Regular Languages under Regular Operations
We’re finally ready to do the (actually quite straightforward, now!)
proof of the closure of regular operations.
Theorem: The set of regular languages is closed
under the regular operations.
Regular Operations
- The union of two languages and is defined as .
- The concatenation or product of
two languages and is defined as .
- The closure or star (or Kleene
closure) of a language is defined
as:
- In other words, it’s the language containing all possible
concatenations of any choice of 0 or more strings over . Notice that 0 is an option here, so
for any language
.
- Another equivalent recursive definition is:
Proof:
Case: - proof by
construction:
Let be a DFA accepting
and be a DFA accepting .
Construct an NFA as follows:
- Let be a set
containing ’s elements, but
renamed to ensure that ; also let be
a new state that is not a member of or .
- The NFA’s set of states is .
- The NFA’s alphabet is .
- The NFA’s transition function .
- The NFA’s start state is .
- The NFA’s accept states are .
This machine accepts
because at the start of processing, it may nondeterministically decide
to make an -transition to
either ’s start state or ’s start state, then proceed to process
the string exactly as or would. Therefore, if the string is in
or , then there is a way that can process the string and end in an
accept state.
- Remaining cases: Exercises!
Regular Expressions
Regular expressions are a
meta-language for describing regular languages. They
are defined based on the properties of regular languages that we’ve now
explored thoroughly, so a lot of what follows will probably be
unsurprising.
Definition: A regular expression over an alphabet
is defined as follows:
- is a regular
expression, describing the language
- is a regular
expression describing the language
- For each , is a regular expression describing the
language
- If and are regular expressions, then is a regular expression
describing the language
- If and are regular expressions, then is a regular expression describing
the language
- If is a regular expression,
then is a regular expression
describing the language
Examples:
What language does describe?
What regular expression describes ?