Upcoming SlideShare
×

# Finite automata

2,718 views
2,468 views

Published on

4 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
2,718
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
78
0
Likes
4
Embeds 0
No embeds

No notes for slide

### Finite automata

1. 1. Finite Automata Abhineet Anand Assistant Professor Dept. of Computer Science And Engineering, College of Engineering Studies. University of Petroleum and Energy Studies, Dehradun. March 1, 2013Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 1 / 19
2. 2. Outline1 Introduction2 Deﬁnition3 Processing of String by DFA4 Preferred Notation for FA Transition Diagram Transition Table5 Facts in Designing procedure of DFA6 Question from FA7 Why Nondeterminism8 Deﬁnition9 Transformation of NFA to DFA Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 2 / 19
3. 3. Introduction Finite Automata Finite - Finite Number of states and Alphabet, and Automata - change of state govern by input symbol.P0 , P1 , P2 , P3 , are the states.x,y are the symbols on input tape. Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 3 / 19
4. 4. Deﬁnition of Finite Automata A deterministic ﬁnite automata is a quintuple M=(Q, Σ, δ , q0 , F) 1 Q : Is a non-empty ﬁnite set of states presents in the ﬁnite control. (q0 , q1 , q2 , q3 , ...) 2 Σ : Is a non-empty ﬁnite set of input symbols which can be passed to the ﬁnite state machine. (a, b, c, d, ....) 3 q0 : Is a Starting state, One of the state in Q. 4 F : Is a non-empty set of ﬁnal states or accepting states, set of ﬁnal states belongs to Q. 5 δ : Is a Function called transition function that takes two argument : a state and input symbol, and it return a single state. that is Q x (Σ) → QLet ’q’ is the state and ’a’ be input symbol passed to the transition function as : δ (q,a)=q Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 4 / 19
5. 5. Finite AutomataLet ’q’ is the state and ’a’ be input symbol passed to the transition function as : δ (q,a)=q .q is the output of the function. Like Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 5 / 19
6. 6. Processing of String by DFA Suppose a1 , a2 , a3 , a4 , ........ an is a sequence of input symbols. DFA is having q0 , q1 , q2 , q3 , q4 , ........ qn states where q0 is the initial state and qn is the ﬁnal state and transition function processed as δ (q0 , a1 ) = q1 δ (q1 , a2 ) = q2 δ (q2 , a3 ) = q3 . . . . δ (qn−1 , an ) = qn Input a1 , a2 , a3 , a4 , ........ an is said to be ”accepted” ”So a string is said to be accepted by the given DFA only when it is processed by transition function δ in such a manner that it ends at the ﬁnal state”. Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 6 / 19
7. 7. Preferred Notation for FAThere are two Preferred Notation for describing auotmata: Transition Diagram Transition Table Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 7 / 19
8. 8. Transition DiagramA Transition diagram for a DFA M=(Q , Σ, δ, q0 , F ) is a graph deﬁned as : For each state in Q there is a node. For each state q in Q and each input Symbol a in Σ, let δ (q, a )=p. There is an arrow into the start state q0 . This arrow does not originate at any node. Final State(s) will be marked by a double circle. Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 8 / 19
9. 9. Transition Table A Transition table is a conventional, tabular representation of a function like δ that takes two arguments and return a state. The rows of the table correspond to the states, and the columns correspond to the input. The entry for one row corresponding to state q and the column corresponding to input a is the state δ (q, a ). For Example: Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 9 / 19
10. 10. Facts/observation for DFA 1 In the designing of the FA, ﬁrst of all it is to ﬁnd the language or strings which is accepted by the FA. 2 Make sure that no state must have two different output state for a signal input symbol. 3 Make sure, that there is one initial state and at least one ﬁnal state in transition diagram of FA. Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 10 / 19
11. 11. Question from FA 1 Design a FA that accept a word LION. 2 Design a FA that accept set of string such that every string ends in 00, over alphabet {0, 1}. 3 Design a FA that accept a substring aab over alphabet {a , b }. 4 Design a FA, which ends with b if it start with a and ends with a if start with b, over alphabet {a , b }. 5 Construct a FA that accepts set of strings where the number of 0’s in every string is multiple of three over alphabet Σ = {0, 1}. 6 Design a FA which accepts the set of string either start with 01 or end with 01. 7 Design a FA which accepts the language L = {w/w has both an even numbers of 0’s and an even number of 1’s over alphabet Σ = {0, 1}}.Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 11 / 19
12. 12. Nondeterministic Nondeterministic means a choice of moves for an auotmaton. Set of possible moves is given rather than unique move. Formally, it is achieved by deﬁning the transition function so that its range is a set of possible states. Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 12 / 19
13. 13. Why Nondeterministic A ”nondeterministic” ﬁnite automation(NFA) has the power to be in several states at once. Each NFA accepts a language that is also accepted by some DFA. NFA can be converted to DFA. Though nondeterministic is a feature which is normally not associated with real computers, it is an extension of the behaviour of DFA. Moreover, nondeterministic is an essential feature of FA, every NFA is equivalent to FA.Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 13 / 19
14. 14. DeﬁnitionA non deterministic ﬁnite automata is a quintupleM=(Q, Σ, δ , q0 , F) 1 Q : Is a non-empty ﬁnite set of states presents in the ﬁnite control. (q0 , q1 , q2 , q3 , ...) 2 Σ : Is a non-empty ﬁnite set of input symbols which can be passed to the ﬁnite state machine. (a, b, c, d, ....) 3 q0 : Is a Starting state, One of the state in Q. 4 F : Is a non-empty set of ﬁnal states or accepting states, set of ﬁnal states belongs to Q. 5 δ : Is a Function called transition function that takes two argument : a state and input symbol, and it return a a sub set of state Q. that is Q x (ΣU {ϸ }) → 2Q Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 14 / 19
15. 15. Non Deterministic Finite Automata The transition function is : Q x (ΣU {ϸ }) → 2Q .Transition Table for this automata: Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 15 / 19
16. 16. Transformation of NFA to DFA For every NFA there exist an equivalent DFA. NFA is ﬁnite automata in which zero, one or more transition on an input symbol is permitted. It is possible to create a FA which will simulate all moves of NFA on a particular input symbol in parallel and get the FA which will have only one move for an input symbol. Transition of NFA to DFA is called subset construction. Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 16 / 19
17. 17. NFA with ϸ −Transition If a FA is modiﬁed to permit transition without input symbols, along with zero, one or more transition on input symbols, then we get a NFA with ϸ −transition. The transition made without symbols are called as ϸ − transition. Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 17 / 19
18. 18. Acceptance of a string by NFA with ϸ −Transition A string w will be accepted by NFA with ϸ − transition, if there exist at least one path corresponding w, which start in an initial state, and ends in one of the ﬁnal states. The function ϸ − transition(q) is deﬁind is ϸ −closure(q) = set of all those states of the automata (NFA with ϸ −transition) which can be reached from q on a path labeled byϸ − i.e. without consuming any input symbol. ϸ −closure(q0 ) = {q0 , q1 , q2 } ϸ −closure(q1 ) = {q1 , q2 } ϸ −closure(q2 ) = {q2 } Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 18 / 19
19. 19. THANK YOUAbhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 19 / 19