Table of Contents

1. Deterministic Finite Automata

2.1. DFA practice

  • Double-circle = final state
  • Hanging arrow entering state = initial 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

Click to display ⇲

Click to hide ⇱

  • State 0: 3k [initial state and final state]
  • State 1: 3k + 1
  • State 2: 3k + 2
  • When we read a 0, the number we had so far is multiplied by 2:
    • $ 3k \overset{*2}{\longrightarrow} 3k $
    • $ 3k + 1 \overset{*2}{\longrightarrow} 3k + 2 $
    • $ 3k + 2 \overset{*2}{\longrightarrow} 3k + 1 $
  • When we read a 1, the number we had so far is multiplied by 2 and we also add 1:
    • $ 3k \overset{*2}{\longrightarrow} 3k \overset{+1}{\longrightarrow} 3k + 1 $
    • $ 3k + 1 \overset{*2}{\longrightarrow} 3k + 2 \overset{+1}{\longrightarrow} 3k $
    • $ 3k + 2 \overset{*2}{\longrightarrow} 3k + 1 \overset{+1}{\longrightarrow} 3k + 2 $

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} \} $

Click to display ⇲

Click to hide ⇱

  • 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)

2.1.7. The set of all binary strings having the substring 00101

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

All states are final

2.1.8. w1 = 10011110, w2 = 00110010

2.2. Describing the language of DFAs

Describe in natural speak the language accepted by these DFAs. Make sure your description is fit to the DFA and not too broad (covers all words accepted and no other word).

2.2.1

2.2.2

2.2.3

2.2.4

2.2.5

2.2.6