Sie sind auf Seite 1von 19

Deterministic Finite

Automata
Basic Terminology

 What is Theory of Automata ?


The area of Computer Science that deals with the study of abstract machines
(mathematical models ) as will as the computational problems that can be solved
using them..

 It allows us to think systematically about what machine can do without going to


the hardware details
 Learning of languages of machine
 Designing of theoretical models for machine
Some basic definitions

 Letters:
Are symbols/ characters out of which we build language for machine.
For Example :
0,1,2,3,4………. or A,B,C,D…………..

 Alphabets:
A Set of letters , Denoted by Geek letter Sigma ∑
Example
∑ = {a,b} or ∑ = {1,2}
 String :
the concatenation of letters Or the sequence of letter/symbols
aa, ab, ba, bb …….
 Strings shown with no commas, e.g., abc
 ε stands for the empty string (string of length 0)
 Σ* denotes strings of all characters including ε
 Example Strings {0,1}* = {ε, 0, 1, 00, 01, 10, 11, 000, 001, . . . }
 Languages:
is set of strings with some rules
Or A language is a subset of Σ* for some alphabet Σ
 Example: The set of strings of 0ʼs and 1ʼs with no two consecutive 1ʼs.
L1 = {ε, 0, 1, 00, 01, 10, 000, 001, 010, 100, 101, 0000, 0001, 0010,, . . . }
 The set of strings containing pattern 010
L2 = { 010, 0010, 1010, 00010, 01010 . . . }
 A set of strings which starts and ends with a’s from alphabet {a,b}
L3 = {aa, aba, abba…………}

 Word: A string that is permissible in language


for example aa, aba are words for L3
What is a Finite Automaton?

 A formal system for defining a language.


 Remembers only a finite amount of information.
 Information represented by its state.
 State changes in response to input.
 Rules that governs the change in state based on input are called transition.
DFA Example
DFA Example

 The door can either be in one of the two states;


• OPEN
• CLOSED
 Input:
• FRONT : Indicating someone is at front pad.
• REAR : Indicating someone is at rear pad.
• BOTH : Indicating people standing both are rear and front pads
• NONE : Indicating no one is standing at front and rear pads
DFA Example

 Transition:
• Assume that door is CLOSED.
• A person steps on the front pad.
• Door OPENS.
• State changes from CLOSED to OPEN
DFA –Formal Definition

 A DFA can be represented by 5 tuples (Q, Σ, δ, q0, F);


 1. Q : A finite set of states.
 2. Σ : An input alphabet.
 3. δ: A transition function.
 4. q0 : A start state
 5. F : F from Q A set of final states.
“Final” and “accepting” states
The Transition Function

 Takes two arguments: a state and an input symbol.


 δ(q, a) = b
 If current state is “q” and input is “a” then go to state “b”
Graph Representation of DFAʼs

 Nodes = states.
 Arcs represent transition function.
 Arc from state p to state q labeled by all those input symbols that have
transitions from p to q.
 Arrow labeled “Start” to the start state.
 Final states indicated by double circles.
Example: String in a Language

 String 101 is in the language of the DFA below. Start at A.


DFA Applications

 Vending Machines
 Traffic Lights
 Video Games
Vending Machines

 DFA that describes the behavior of a vending machine which accepts


dollars and quarters, and charges $1.25 per bottle .
 Once the machine receives at least $1.25, corresponding to the blue-
colored states in the diagram, it will allow the user to select a bottle.
 Self-loops represent ignored input:
 the machine will not dispense a bottle until at least $1.25 has been
deposited, and it will not accept more money once it has already received
greater than or equal to $1.25.
DFA as a 5-tuple

 1. Q = {$0.00,$0.25,$0.50,$0.75,$1.00,$1.25,$1.50,$1.75,$2.00} are the states


 2. Σ = {$0.25,$1.00,select} is the alphabet
 3. δ, the transition function, is described by the state diagram.
 4. q0 = $0.00 is the start state
 5. F = is the set of accept states
Vending Machine State Diagram
The end

Das könnte Ihnen auch gefallen