Kleene's Theorem
Statement
Kleene’s Theorem: A language is regular (recognised by a finite automaton) if and only if it is denoted by a regular expression.
Two Directions
Part (a): Regex Automaton
Every regular expression can be converted to an equivalent NFA-.
Part (b): Automaton Regex
Every finite automaton can be converted to an equivalent regular expression.
Part (a): Regex to NFA
Construction by Induction
Base cases:
: NFA with one state, start = accept, no transitions.
: NFA with one state, start state, no accepting states.
Symbol : NFA with two states.
Inductive Constructions
Union :
- New start state
- -transitions to starts of and
- Accepting:
Concatenation :
- -transitions from accept states of to start of
- Start: start of
- Accepting:
Star :
- New state (start and accepting)
- -transition to old start
- -transitions from old accepting states back to
Part (b): NFA to Regex
The State Elimination Method
For automaton , compute regular expression for each “region” of the automaton.
A region consists of:
- Start state
- End state
- Set of intermediate states allowed
The regional language contains strings taking to through only states in .
Recursive Definition
Base ():
This is a finite language, hence regular (expressible as finite union of regex).
Inductive step: Pick . Define .
Intuition
Paths through either:
- Don’t visit at all:
- Visit at least once: go to , loop zero or more times, go to
Final Expression
The language of is:
where is the start state and is all states.
Example
Simple Automaton
, ,
Start: , Accepting:
Computation
:
- Either go directly on : contributes
- Or go to , loop, and exit: contributes pattern
Result (simplified): or via careful analysis: language of strings with more ‘s than ‘s modulo some pattern.
Summary
- Kleene’s theorem: regular expressions finite automata
- Regex to NFA: inductive construction using -transitions
- NFA to regex: region decomposition, eliminate states
- Regular = automata-recognisable = regex-definable