CS2490 Session 4 - Slides
Definition of Deterministic Finite Automata (DFA)
Formal definition: Let be an alphabet. A deterministic finite automaton (DFA) over is defined by a 5-tuple containing four essential mathematical components:
A finite set : where each element represents the name of a state.
An initial state : the starting state in which all computations begin.
A subset : where each element is an accepting state (also called a final state).
A transition function : defining the state transition such that when in state and reading symbol , the automaton transitions to state .
DFA Example Structure:
Finite set of states:
Initial state:
Set of transitions over alphabet :
Computation and Acceptance
Computation Definition:
Let be a DFA.
The computation (or run) of automaton on an input word is defined as the sequence of states satisfying:
for all
Procedurally, computation means following the sequence of state transitions generated while reading symbols from sequentially from left to right until reaching the end of the word.
Acceptance Condition:
A computation run is successful when the final state belongs to the accepting set ().
When , automaton is said to accept the word .
Step-by-Step Computation Example
Input string
Full trace of state transitions step by step:
Step 0 (Start): Start in initial state . Sequence:
Step 1 (Read ): . Sequence:
Step 2 (Read ): . Sequence:
Step 3 (Read ): . Sequence:
Step 4 (Read ): . Sequence:
Step 5 (Read ): . Sequence:
Step 6 (Read ): . Sequence:
Step 7 (Read ): . Sequence:
Step 8 (Read ): . Sequence:
Step 9 (Read ): . Sequence:
Step 10 (Read ): . Sequence:
Step 11 (Read ): . Sequence:
Step 12 (Read ): . Sequence:
Step 13 (Read ): . Sequence:
Step 14 (Read ): . Sequence:
Step 15 (Read ): . Sequence:
Step 16 (Read ): . Sequence:
Step 17 (Read ): . Sequence:
Step 18 (Read ): . Sequence:
Ending state of computation: .
Extended Transition Function
Definition and Intuition:
Let be a DFA, and let be a word over .
denotes the final state reached at the end of the run of on input word .
Generalizing to any state , represents the last state reached in the run of on word assuming were the starting state.
Inductive Mathematical Definition:
The extended transition function is defined recursively as follows:
Base case: for all , where is the empty string.
Recursive step: for all , , and
Languages Accepted by DFAs
Definition of Accepted Language:
Let be a DFA.
The language accepted by , denoted , is the formal set of all words accepted by :
Terminology variants: is also called the language recognized by , or simply the language of
Parity Automaton Example
Automaton Definition:
State Set:
Alphabet:
Initial State:
Accepting State Set:
Transition Function Rules:
Target Language Claim:
Hypothesis:
Rigorous Mathematical Proof for Parity Automaton
Proof Structure:
To prove equality , two inclusions must be proven:
Direction 1: Every word accepted by has an even number of 's ().
Direction 2: Every word with an even number of 's is accepted by ($\ authorization {w \in {0, 1}^* \mid w \text{ has an even number of 1's}} \subseteq L(A)).\n- Key Lemma (Inductive Property):\n - Claim: For all n \in \mathbb{N}Awnp \text{ # of 1's}p1w\n - Proof of Key Lemma by Induction on n = |w|:\n - Base Case (n = 0):\n - |w| = 0 \implies w = \varepsilon\n - The count of 1\varepsilon0p = \text{even}).\n - The run on \varepsilon\text{even # of 1's}.\n - Base case holds trivially.\n - Induction Step:\n - Induction Hypothesis: Assume the statement holds for all words of length n \in \mathbb{N}.\n - Let w = w_1 w_2 \dots w_n w_{n+1}n + 1$.
Applying the induction hypothesis to prefix of length , the run on ends in state "", where is the parity of the count of 's in
The run on is one step longer than the run on , determined by symbol :
If , the ending state remains unchanged (""), and is also the parity of the number of 's in
If , the ending state switches to the opposite state, and the parity of the count of 's in is the opposite of
In both cases, the parity of the total number of 's in matches the ending state of the run.
Proof of Direction 1 (Soundness):
If accepts word , then by definition the run of on ends in accepting state .
By the key lemma, the parity of the number of 's in must be even.
Proof of Direction 2 (Completeness):
If word contains an even number of 's, then by the key lemma, the run of on ends in state .
Since , automaton accepts
Language Analysis Challenge
Deterministic Finite Automaton Details:
Initial state:
States:
Transitions:
,
,
,
,
Language Question:
Formally analyze and determine for this four-state automaton.