Finite Automata, or Finite State Machine
- See section 6.2
- A finite automata can be used to determine if words are in a language.
- A Finite Automata consists of
- a finite set of states. Q
- a start state, s, s∈ Q
- a set of accepting states A, A⊆ Q
- an input alphabet Σ
- a function δ from Q×Σ to Q
- The automata takes a letter and transisitions from one state to
another based on the function δ
- It starts in the start state.
- When it is in an accepting state, that is one of the words in the language.
- We can picture an automata
- Each state is a circle.
- The start state generally has an arrow pointing to it.
- The accepting states are generally marked with a double circle.
- The transisiton function are arrows from one state to another
- An example from the book
- Q = { 1,2,3,4,}
- s = 1
- A = {4}
- Σ = {a,b}
- δ =
Input\State | 1 | 2 | 3 | 4 |
---|
a | 2 | 1 | 4 | 3 |
b | 3 | 4 | 1 | 2 |
-
- If we trace the action of this machine via the use of an ordered
pair.
- (state, remaining string)
- Consider the trace of ababba
- (1, ababba)
- (2, babba)
- (4, abba)
- (3, bba)
- (1, ba)
- (3, a)
- (4, ∅)
- So ababba is in the language accepted by this FA.
- But so is ab, and ba too!
- Consdier the string abba
- (1, abba)
- (2, bba)
- (4, ba)
- (2, a)
- (1, ∅)
- In this case, the string was rejected.
- Thus abba is not in the language accepted by this FA.
- The transition function can be implemented as a table lookup.
- newState = TransitionTable[input][currentState]