# Chapter 1: Regular Languages

## For Your Enjoyment

## Chapter 1.3, Regular Expressions

### Definition

R is a **regular expression** if R is

*a* for some *a* in alphabet Σ,
- ε,
- ∅,
- (R
_{1} ∪ R_{2}) where each R_{i} is a regular expression,
- (R
_{1} ◦ R_{2}) where each R_{i} is a regular expression, or
- (R
_{1}^{*}) where R_{1} is a regular expression,

### Active Learning

- Construct an NFA for the regular expression
*a*.
- Construct an NFA for the regular expression ε
- Construct an NFA for the regular expression ∅
- What about NFAs for union, concatenation and star?

### Sundry Notes

- The precedence of the operators from highest to lowest: star, concatenation, union.
- R
^{+} = RR^{*}
- Σ
^{*} is the language consisting of all strings over the alphabet.
- R ∪ ∅ = R
- R ∪ ε ?= R
- R ◦ ε = R
- R ◦ ∅ ?= R

### Active Learning

- Write a regular expression over the binary alphabet that captures
{w | w contains a single 1}.
- Write a regular expression over any alphabet that captures
{w | w is a string of even length}.
- Write a regular expression over the binary alphabet that captures
{w | every 0 in w is followed by at least one 1}.

### Theorem

- A language is regular if and only if some regular expression
describes it.
- To prove this theorem, we need to show that (1) if a language is
described by a regular expression, then it is regular and (2) if a
language is regular, then it is described by a regular expression.
- We have already shown one of these two directions. Which one?

### Active Learning

- Convert regular expression (01)
^{*} ∪ 1 to an NFA using the
construction methodology in the proof above.