Principles of Computing – UFCFA3-30-1 Week 3 Instructor : Mazhar H Malik Email : mazhar@gcet.edu.om Global College of Engineering and Technology
Deterministic Finite Automata (DFA)
Automata –What is it? The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract computing device which follows a predetermined sequence of operations automatically. An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).
Finite Automation Finite automata are finite collections of states with transition rules that take you from one state to another.
Finite Automation
How many states – Traffic Lights
Finite Automation
Formal definition of a Finite Automaton An automaton can be represented by a 5-tuple (Q, Σ, δ, q0, F) where: Q is a finite set of states. Σ (Sigma sign) is a finite set of symbols, called the alphabet of the automaton. δ (Delta sign) is the transition function. q0 (belongs/member to) is the initial state from where any input is processed (q0 ∈ Q). F is a subset of final state/states of Q (F ⊆ Q).
Principles of Computing – UFCFA3-30-1 Week 3 DFA Continue… Instructor : Mazhar H Malik Email : mazhar@gcet.edu.om Global College of Engineering and Technology
FA-Example
Symbols Used in FA
Symbols Used in FA…
Your Turn… Draw a FA on you note book which shows process of promoting from one grade/semester to other
Your Turn… Draw a FA on you note book which shows the process of change a number from odd to even and vice versa
Your Turn… Draw a FA on you note book which shows the searching of word in dictionary
Types of Finite Automata
Deterministic Finite Automata(DFA)
DFA…
DFA…
DFA…
Transition Function
Transition Function
DFA Definition
DFA Definition
DFA Definition
DFA Definition
Simple Notations for DFA’s
Transition Diagram
Transition Table
Transition Table
DFA Process String
DFA Process String
DFA Process String
Language Accepted by DFA…
Language Rejected by DFA…
DFA Examples
b a,b Transition Graph a,b q5 q3 q4 accepting state b q0 q1 initial
Alphabet {a,b } a,b q5 a,b q4 b q0 q1 q2 b q3 b b For every state, there is a transition for every symbol in the alphabet
Initial Configuration head Input Tape b Input String a,b q5 a,b q4 b q0 b q3 q1 b q2 b Initial state
Scanning the Input b a,b q5 a,b q4 b q0 b q3 q1 b q2 b
b a,b q5 a,b q4 b q0 b q3 q1 b q2 b
b a,b q5 a,b q4 b q0 b q3 q1 b q2 b
Input finished b a,b q5 a,b q4 b q0 b q3 q1 b q2 b accept
A Rejection Case b Input String a,b q5 a,b q4 b q0 b q3 q1 b q2 b
b a,b q5 a,b q4 b q0 b q3 q1 b q2 b
b a,b q5 a,b q4 b q0 b q3 q1 b q2 b 45
Input finished b a,b reject a,b q 5 b q0 b q3 q1 b q2 b q4
Another Rejection Case Tape is empty () Input Finished a,b q5 a,b q4 b q0 b q3 q1 b q2 b reject
L abba Language Accepted: a,b q5 a,b q4 b q0 b q3 q1 b q2 b
To accept a string: all the input string is scanned and the last state is accepting To reject a string: all the input string is scanned and the last state is non-accepting
Jflap
Jflap
Jflap
Jflap
JFlap
JFlap
JFlap
Jflap
Jflop
Jflop
Jflop
Jflop
Jflop
Jflop
Example 2.1 Construct a DFA that accept set of strings where every string end in 00 over alphabet ∑ = {0,1} Solution: Let FA be M = {Q, ∑ ,∂, q0, F} Q = {q0, q1, q2} F = {q2}
Example 2.1 Construct a DFA that accept set of strings where every string end in 00 over alphabet ∑ = {0,1} Solution: Let FA be M = {Q, ∑ ,∂, q0, F} Q = {q0, q1, q2} F = {q2}
Example 2.2 Construct a DFA that accept set of strings where the number of O’s in every string is multiple of three over alphabet ∑ = {0,1} Solution: Multiple of three means number of O’s in the string may be 0,3,6,9… in the number at any position. Let FA be M = {Q, ∑ ,∂, q0, F}
Sources Finite Automata and Formal Languages: A Simple Approach By A. M. Padma Reddy, Pearson Education India http://www.jflap.org/tutorial/ http://www.tutorialspoint.com/python/string_endswith.htm