Unit 1 - Notes
Unit 1: FINITE AUTOMATA
1. Basics of Strings and Alphabets
Before defining automata, it is essential to understand the mathematical notations regarding data representation.
Key Definitions
- Symbol: An atomic unit of data (e.g., a character, a digit).
- Alphabet (): A finite, non-empty set of symbols.
- Examples: (binary), (letters).
- String (or Word): A finite sequence of symbols chosen from some alphabet.
- Example: If , then $01101$ is a string.
- Length of a String (): The number of symbols in the string.
- If , then .
- Empty String ( or ): A string with zero occurrences of symbols.
- .
- Identity property: .
Powers of an Alphabet
- : The set of all strings of length over .
- .
- .
Kleene Star and Positive Closure
- Kleene Star (): The set of all possible strings over an alphabet , including .
- Positive Closure (): The set of all possible strings over , excluding (unless is explicitly in ).
Language ()
A Language is a subset of . It is a set of strings chosen from .
- Finite Language: .
- Infinite Language: .
2. Definition and Description of a Finite Automaton
A Finite Automaton (FA) is the simplest abstract computational model. It has a limited amount of memory (states). It processes an input string symbol by symbol and changes its state accordingly.
Components of an FA
- Input Tape: A linear tape containing the input string.
- Read Head: Reads one symbol at a time from left to right.
- Finite Control: Determines the next state based on the current state and the input symbol.
Types of Finite Automata
- Deterministic Finite Automaton (DFA)
- Non-deterministic Finite Automaton (NDFA / NFA)
- NFA with -moves (-NFA)
3. Transition Systems and Transition Graphs
A Transition System (or Transition Graph) is a diagrammatic representation of an FA.
Graph Components
- Vertices (Nodes): Represent the States.
- Start State: Indicated by an incoming arrow from nowhere.
- Final (Accepting) State: Indicated by double circles.
- Non-final State: Single circle.
- Edges (Arcs): Represent Transitions.
- Directed edges labeled with input symbols.
- An edge from state to labeled means: "If in state and input is , go to ."
4. Deterministic Finite Automata (DFA)
A DFA is "deterministic" because for every state and every input symbol, there is exactly one specific next state.
Formal Definition
A DFA is a 5-tuple where:
- : A finite set of states.
- : A finite set of input symbols (alphabet).
- : A transition function (mapping).
- : The initial (start) state ().
- : A set of accepting (final) states ().
Properties of Transition Functions in DFA
The transition function is defined as:
- Total Function: must be defined for every pair where and .
- Single Value: The result is exactly one state.
Extended Transition Function ()
To describe the processing of a string rather than a single symbol, we define recursively:
- Base Case: (Processing an empty string leaves the state unchanged).
- Recursive Step: For string (where is a string and is a symbol):
Acceptability of a String by DFA
A string is accepted by a DFA if and only if:
Meaning: After processing the entire string starting from , the automaton halts in a final state. If it halts in a non-final state, the string is rejected.
5. Non-deterministic Finite Automata (NDFA/NFA)
An NFA allows flexibility in transitions. From a specific state on a specific input, the machine may go to multiple states, one state, or no state at all.
Formal Definition
An NFA is a 5-tuple where:
- are defined exactly as in a DFA.
- (Transition Function): (Power set of Q).
Properties of Transition Functions in NFA
- The output of is a set of states (subset of ).
- It allows "guessing" the correct path.
Acceptability of a String by NFA
A string is accepted by an NFA if there exists at least one sequence of transitions (path) corresponding to that leads from to some state in .
6. The Equivalence of DFA and NDFA
Despite NFA appearing more powerful due to non-determinism, DFA and NFA are equivalent in computational power. Both accept the class of Regular Languages.
Theorem
For every NFA , there exists a DFA such that .
Subset Construction Algorithm (Conversion NFA DFA)
To convert an NFA to a DFA, we simulate the NFA by tracking the set of states the NFA could be in at any moment.
- DFA States (): The power set of the NFA states (). If NFA has states, DFA can have up to states.
- DFA Start State: .
- DFA Transitions:
For a set of NFA states and input :
- DFA Final States (): Any subset of NFA states that contains at least one final state from the NFA.
7. Regular Languages
A language is called a Regular Language if there exists a Finite Automaton (DFA or NFA) that accepts it.
Properties
- Regular languages are closed under:
- Union
- Intersection
- Concatenation
- Kleene Star
- Complementation
8. Finite Automata with Output: Mealy and Moore Machines
Standard FAs are "acceptors" (output is Yes/No). Mealy and Moore machines are "transducers"—they generate an output string based on the input string.
Similarities
- Both have states (), inputs (), outputs (), transition function (), and start state ().
- No Final States: They run as long as there is input.
Moore Machine
- Output depends only on the current state.
- Definition: 6-tuple .
- Output Function: .
- For every state entered, a character is printed.
- Note: If input length is , output length is usually (includes output for initial state).
Mealy Machine
- Output depends on the current state AND the current input symbol.
- Definition: 6-tuple .
- Output Function: .
- Output is generated during the transition.
- If input length is , output length is .
Equivalence
Moore and Mealy machines are equivalent. Any problem solvable by one is solvable by the other.
- Mealy Moore: Split states to accommodate outputs associated with incoming transitions.
- Moore Mealy: Associate the state's output with the incoming transition.
9. Minimization of Finite Automata
Minimization creates a unique DFA with the fewest possible states for a given regular language.
Distinguishable vs. Indistinguishable States
Two states and are indistinguishable (equivalent) if, for every possible string :
- is a final state AND is a final state
- OR
- is NOT final AND is NOT final.
If there exists even one string that drives to a final state and to a non-final state (or vice versa), and are distinguishable.
Minimization Algorithm (Table Filling Method / Myhill-Nerode)
- Remove Unreachable States: Delete states that cannot be reached from .
- Initialize Table: Create a table of all pairs of states .
- Mark Distinguishable Pairs:
- Mark pair if and (or vice versa).
- Propagate Marks:
- For every unmarked pair and every input symbol :
- If the pair of next states is already marked, then mark .
- Repeat this step until no new changes occur.
- Merge:
- All pairs that remain unmarked are equivalent. Merge them into a single state in the minimized DFA.