This is an old revision of the document!


2. Deterministic Finite Automata and Regular Expressions

  • Blue = final state
  • Orange = non-final state
  • Sink state = a state that is not final; once reached, there is no transition that leaves it, thus the DFA will reject; there is a transition that loops in this state for each possible character

Write DFAs for the following languages:

2.1.1. $ L=\{w \in \{0,1\}^* \text{ | w contains an odd number of ones} \} $

2.1.2. The language of binary words which contain exactly two ones

2.1.3. The language of binary words which encode odd numbers (the last digit is least significative)

2.1.4. (hard) The language of words which encode numbers divisible by 3

2.1.5. The language of words that encode a calendar date (DD/MM/YYYY) (do not overthink about the actual number of days in a month)

2.1.6. (HARD) $ L=\{w \in \{0,1,2,3\}^* \text{ | w follows the rule that every zero is immediately followed by a sequence of at least 2 consecutive threes and every one is immediately followed by a sequence of at most 2 consecutive twos} \} $

  • injuraturile redirectati-le catre AU :)) (si MP)
  • All missing transitions lead to a sink state (where there is a transition that loops in that state for any character)

</hidden> */

Describe the language of the following DFAs and simulate them on the given inputs:

2.1.7. w1 = 10011110, w2 = 00110010

For each of the exercises from DFA practice write a regex describing the same language.