<- previous    index     next ->

Lecture 3 DFA and regular expressions

 Example of a Deterministic Finite Automata, DFA


 Machine Definition  M = (Q, Sigma, delta, q0, F)
 Q = { q0, q1, q2, q3, q4 } the set of states
 Sigma = { 0, 1 }           the input string alphabet
 q0 = q0                    the starting state
 F = { q2, q4 }             the set of final states (accepting)

                          inputs
   delta          |    0    |    1    |
         ---------+---------+---------+
              q0  |   q3    |   q1    |
              q1  |   q1    |   q2    |
    states    q2  |   q2    |   q2    |
              q3  |   q4    |   q3    |
              q4  |   q4    |   q4    |

  An exactly equivalent diagram description for the machine M.


 L(M) is the notation for a Formal Language defined by a machine M.
 Some of the shortest strings in L(M) = { 00, 11, 000, 001, 010, 101, 110, 111,
   0000, 00001, ... }

 In words, L is the set of strings over { 0, 1} that contain at least
 two 0's starting with 0, and that contain two 1's starting with 1.

 Every input sequence goes through a sequence of states, for example
  00   q0 q3 q4
  11   q0 q1 q2
  000  q0 q3 q4 q4
  001  q0 q3 q4 q4
  010  q0 q3 q3 q4


  More information on DFA


 Definition of a Regular Expression
                 ------------------

  A regular expression may be the null string,
     r = epsilon

  A regular expression may be an element of the input alphabet, sigma,
     r = a

  A regular expression may be the union of two regular expressions,
     r = r1 + r2

  A regular expression may be the concatenation (no symbol) of two
  regular expressions,
     r = r1 r2

  A regular expression may be the Kleene closure (star) of a regular expression
     r = r1*    (the asterisk should be a superscript, but this is plain text)

  A regular expression may be a regular expression in parenthesis
     r = (r1)

  Nothing is a regular expression unless it is constructed with only the
  rules given above.

  The language represented or generated by a regular expression is a
  Regular Language, denoted L(r).

  The regular expression for the machine M above is
    r = (1(0*)1(0+1)*)+(0(1*)0(0+1)*)

  Later we will give an algorithm for generating a regular expression from
  a machine definition.  For simple DFA's, start with each accepting
  state and work back to the start state writing the regular expression.
  The union of these regular expressions is the regular expression for
  the machine.

  For every DFA there is a regular language and for every regular language
  there is a regular expression. Thus a DFA can be converted to a
  regular expression and a regular expression can be converted to a DFA.

    <- previous    index     next ->

Other links

Go to top