Skip to content

Regular Languages

Summarized notes from Introduction to Theory of Computation, Chapter 1

  • recognized equivalently by: DFA, NFA, regular expressions
  • closed under union, concatenation, star operation:
    • union: AB={x|xA or xB}
    • concatenation: AB={xy|xA and yB}
    • star: A={x1x2...xk|k0 and each xiA}
  • satisfy pumping lemma → otherwise nonregular
  • finite automaton is the simplest computational model => limited memory but can recognize patterns in data

Deterministic finite automaton (DFA)

5-tuple (Q,Σ,δ,q0,F)

Q states (finite set)
Σ alphabet (finite set)
δ:Q×ΣQ transition function
q0Q start state
FQ set of accept (or final) states

Nondeterministic finite automaton (NFA)

5-tuple (Q,Σ,δ,q0,F)

Q states (finite set)
Σ alphabet (finite set)
δ:Q×ΣϵP(Q) transition function
q0Q start state
FQ set of accept (or final) states

where Σϵ is Σ{ϵ} and P(Q) is the power set of Q.

Regular expression

R is a regular expression if R is:

#
1. a for some a in alphabet Σ,
2. ϵ (empty string),
3. (empty set),
4. (R1R2), where R1 and R2 are regular expressions,
5. (R1R2), where R1 and R2 are regular expressions, or
6. (R1) where R1 is a regular expression

Generalized nondeterministic finite automaton (GNFA)

  • reads blocks symbols from input
  • may have any regular expressions as transition labels (or ϵ, members of Σ)
  • start state: transition arrows to every other state, no incoming arrows
  • single accept state: has incoming arrows from every other state, no outgoing arrows
  • all other states (except start and accept): one arrow to every other state and to itself

5-tuple (Q,Σ,δ,qstart,qaccept):

Q states (finite set)
Σ input alphabet
δ:(Q{qaccept}×Q{qstart})R transition function
qstart start state
qaccept accept state

Pumping lemma

If A is a regular language, then there is a number p (the pumping length) where if s is any string in A of length at least p, then s may be divided into three pieces, s=xyz, satisfying the following conditions:

  1. for each i0,xyizA,
  2. |y|>0, and
  3. |xy|p.