5. Regular Expressions
Jan 20/25, 2022
Regular expressions
-
describe regular languages
-
primitive expressions:
-
given regular expressions
and , can compose to create other regular expressions
e.g. -
language of regular expression , for primitive expressions:
Regular expressions and regular languages
-
For any regular expression
the language is regular -
Proof steps: show that languages generated by REs
Regular languages-
languages generated by REs
Regular languages
=> proof by induction on the size-
base case primitive expressions:
are regular languages -
inductive step: suppose regular expressions
and and and are regular languages => prove that are regular -
by inductive hypothesis we know
and are regular, we also know union, concat, star of regular languages are closed, therefore these are regular: -
-
-
is trivially regular by induction hypothesis -
using the regular closure of operations we can construct recursively the NFA
that accepts
-
-
languages generated by REs
Regular languages
=> show that for any regular language L there is a regular expressions with => convert NFA that accepts to a regular expression-
since
is regular there is a NFA that accepts it; take it with a single accept state -
from
construct the equivalent generalized transition graph in which transition labels are regular expressions e.g. transition label becomes -
reduce the states recursively
2-state general case:
- repeat until two states are left to obtain the resulting regular expression
-
-
Standard representations of regular languages: DFAs, NFAs, regular expressions