120 likes | 263 Vues
An Introduction to Finite Automata. By Andrew Milne Mentor: Professor Cindy Fry February 1, 2008. A Finite Automaton…. Has some number of states Has a start state and at least one end state Accepts input that advances it through its states
E N D
An Introduction to Finite Automata By Andrew Milne Mentor: Professor Cindy Fry February 1, 2008
A Finite Automaton… • Has some number of states • Has a start state and at least one end state • Accepts input that advances it through its states • Can be Deterministic (DFA) or Non-Deterministic (NFA)
Deterministic Finite Automata • A DFA can be written as a quintuple M = (Q, E, d, q0, F) • Q: A finite set of states • E: A finite set known as the alphabet • q0: The start state (an element of Q) • F: The final / accepting states (a subset of Q)
d • d is a total function from Q x E to Q called the transition function. • Total function: There exists a function f such that for each element of E, e, as input to f, there is an element of Q, q, such that [q, e] is an element of f. • From any state there is a path for each possible input.
Representing Finite Automata • Finite Automata can be represented visually by state diagrams • M: • Q = q0, q1 • E = {0, 1} • F = q2 d(q0, 0) = q1 d(q0, 1) = q0 d(q1, 0) = q0 d(q1, 1) = q1
DFA State Diagram • Consider as input ‘1001’ • [q0, ‘1001’] |- [q0, ‘001’] • [q0, ‘001’] |- [q1, ‘01’] • [q1, ‘01’] |- [q1, ‘1’] • [q1, ‘1’] |- [q0, ‘’] • The input is not accepted
Nondeterministic Finite Automata • An NFA can have several possible paths from a single node. • An NFA processes all possible paths to attempt to find an accepting state. • A string is accepted by an NFA if there is at least one possible path that • Processes the entire string, and • Ends in an accepting state
The d of the NFA • d(q0, ew) = { q0, q1, … qn }
Nondeterministic Finite Automata • Two NFA can be joined by using the lambda-arc. • Processing follows a lambda-arc no matter what its input is (even null input)
Reference: • Sudkamp, Thomas A • Languages and Machines, 3rd Edition