Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
37 views
TOC Lec2
Uploaded by
Mohammed Ahmed
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save TOC lec2 For Later
Download
Save
Save TOC lec2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
37 views
TOC Lec2
Uploaded by
Mohammed Ahmed
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save TOC lec2 For Later
Carousel Previous
Carousel Next
Save
Save TOC lec2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 48
Search
Fullscreen
AUTOMATA + An automaton is an abstract model of a di; | computer. + It can read input. + Itmay have a temporary storage device. + Itcan produce output. + Ithas a control unit + Itcan be in any ofa finite number of internal states. + It can also change the state in some defined configuration. Input file ptt rey trol unit k—J Storage ee Ourpuemw ° Categories J * Automata can be divided into the following categories based on the availability of temporary memory * Finite Automata No temporary memory + Pushdown Automata Stack + Turing Machine Random access memory * Automata can be divided into the following categories based on the output generated. * Accepter: An automaton whose output response is limited to a simple “yes” or “no” is known as an accepter. * Transducer: An automaton capable of producing strings of symbols as output, is known as a transducer. Accept/Allowed String Input {ata * Reject/Rejected String | \ Loop forever ww tcc heCategories * Determi ic Automata * A deterministic automaton is one in which each move is uniquely determined by the current configuration. * Current configuration- Internal state + Current input Symbol +Storages’ content * Non-deterministic automata * Anon-deterministic automaton is one in which each move is not uniquely determined by the current configuration.FINITE AUTOMATA * Finite automata are automata with * No temporary memory * Accepter/Transducer * Deterministic/Non-deterministic * A finite automaton has a finite number of states and can remember only a limited number of things. Input Stri *Accepter “DFA “NEA Output Finite lame String Transducer Automaton *Moore M/c +*Mealy M/cDeterministic Finite Accepter (DFA) * It is a simple model of computation. * It has no temporary storage. * It consists of a finite number of states. + It is deterministic. + Next move is uniquely determined by the current configuration. * It is an accepter. + The output response is limited to a simple “yes” or “no”. A DFA is a quintuple ™) = (0, > , 0, G,, / ), where: + Qisa finite set of internal states, + Disa finite set of symbols (input alphabet, without empty string), + 8:QxZ-—Q is the transition function of M + g) - initial state (9, © ©) + F is a subset of © and represents the set of final or accepting states of ™. What do you mean by 5?Finite Automata Representation + Representation 1: Transition graph/bubble diagram + Good for visualization + Representation 2: Transition table * Good for computer simulation M = (Q, 2, 5, qo, F) % N N % + The circles represent states, with a double circle being an accepting state. + The arcs represent the transitions of the transition function. * The state with an incoming edge (not originating from any state) is an initial state. M = (Q, E, 8, dor F) = ({c40r ai}: {9b}, 5, or {Ao})DFA-Deterministic ? * The transition function makes the automaton deterministic * At each moment in time, the automaton has exact instructions as to what will happen next. * Current configuration- Internal state + Current input Symbol a b Gu) 0 N N U1 rHDFA FINITE INFORMATION . HOW? DFA M = (Q,£, 8, qo F) 0:0xzx>0 O={40,91,42543544,95} a, b 3=fa,b) F={g,} initial accepting state state state transitionHOW TO IDENTIFY A DFA? M= (Q, &, &, dor FY _¢ b/ a am bY’ +Go)-2 qi) 6 .@2) b .@3) 4 initial accepting state state transition state Complete, incomplete, and NFA?DFA-OPERATIONS ACCEPT/REJECT (A/R) The machine always starts in th ial state looking at the leftmost symbol. The transition function specifies, for each state and symbol, the next state the automaton will enter. * &(q), b) = qa, refers that if the automaton is in state q, and the next symbol is b, then the state of the automaton becomes state q.. The automaton stops after reading the rightmost symbol (i.e. Reading all symbols in the string). * If it stops in a non-final state, the string is REJECTED. * If it stops ina final state, the string is ACCEPTED.(DFA)-INITIAL CONFIGURATION 1 a|b|b\a Input StringREADING THE INPUT 9 leNEXT TRANSITION ao <+—NEXT TRANSITION oeLAST TRANSITIONwT * Input finishedDFA-EXAMPLE (ACCEPT /REJECT) a,b Strings abba -A aaaaa -R abbaabb -R initial state transition state accepting stateDFA-Example-(Accept/Reject)} 2 woe Lh {PF A-Example (Accept/Reject) _) alalbDETERMINISTIC FINITE AUTOMATA/ACCEPTER ( Finite set of states CONTROL eS Tis TAPE Move to the right one cell at HEAD. atime Input of the DFA Can be of any lengthEXTENDED TRANSITION FUNCTION(ETF) MRQncd > Q So (qw)=q' It describes the resulting state after scanning string Ww starting from state q. For any state q, o (g.4) = q ForallqeQ,wed*,aed 6 (gq, wa) = 5(6 * (q,w), a) 5: QxZ— Q is the transition function of M 5(q,a)=q' acka ETF EXAMPLE - — — 5°@.A)=4 6 (9,ab) = 9, 5 (g,wa )= 6(5 * (q,w), a) 5 (q,ab) = 5(6* (qy,a),b) = 5(5(5 * (qo,A),a),b) = 6(5(qo,4),b) = 5(4,,b) = qs Example- abba ran — aabbb b/ So 4 < / ay a b/ bb 4 YY a o 190-2 (45)-P 043-b 095.4 ——poy = ta7 ° ETF Observation Observation: If there is a walk from q to q’ with label W, then 5*(qw)=q' W=0107°*:O; o Oy ® O o* (40 s abbbaa) = 45 b ay if au b/ —90}-2-(9)-© 42) 43)-4 + Ga)ETF Example (Caution(A/R))... 5 (g,,bba) = 4, YS Does DFA acceptor reject string bba? Reject _ ww an 7LANGUAGE OF A DFA Let M = (Q, 2, 6, qo, F) be a DFA. The language of M is the set of all strings accepted by M. L(M) = {@E2Z*iqg, @) Ly (qs. &) for some gy € F } or LOM) = {@eX*| 8*(qy, @) € F} L(M )= {abba}LANGUAGE OF A DFA-EXAMPLES L(M )= {A, ab, abba} yo There is no transition with A , but it accepts A as a string.OBSERVATION!!! M =(0,3,6,q9,F) L(M)={wed*:d5*(qo,w)e F} L(M) is set of strings accepted by the DFA. OR L(M) is the set of all strings w such that there exists a walk from qo to q’ with label w, q' € F. Ww (G , u @) qeF —E a,b Observation: q is a useful state if a ; *There exists a path from initial state qo to state q a oe and b a a pf “> sThere exists a path from state q to. q, EF +(40)-9-(41-6 ¥(q2)-» 143)-9.( Ga) or Gir Gar 43 and q, are useful states.OBSERVATION LANGUAGE REJECTED BY DFAM: T(M) = {we Xl*:5*(qo,w)¢ F} L(M)is set of strings rejected by the DFA. OR L[M)is the set of all strings w such that there exists a walk from qq to q’ with label w such that 7’ # F, (4o) "4 @) aca M M —(90)-2-.(9))-b (43) 193)-4.(@S))DESIGNING DFA DFA can be constructed for all finite languages but not necessarily for all infinite languages. Determine what a DFA needs to memorize to recognize strings in the language. * Use the property of the strings in the language. * Find the regular pattern in the strings of the language. Determine how many states are required to memorize what we want. * Final state(s) memorizes the property of the strings in the language. Find out how the pattern DFA memorizes changes once the next input symbol is read. * From this change, we get the transition function. What about languages having “no common pattern” or “multiple patterns” ?poy lw ° Designing DFA L(M)= { all strings with any number of a followed by b } L(M)={a"b:n20} y= {a,b} Step-1 Step-2 40) +) 4) *(4,) 6: Qx Z— Q is the transition function of M ~ N44} = — © Designing DFA Pa o) L(M)= { all strings with any number of a followed by b } 2={a, b} L(M)={a"b:n=0} Step-3 fa\\a,b > iy 42) siti 6: Qx Z— Q is the transition function of M -aw ° Designing DFA Draw DFAs ==fa, b, ch L1= fato"c :n 2 1, m2 1} = fabe, aabbe, abbe, aabe, } L2= {arb™c :1n 2 1, m 2 O} L3= {atb%c :n 20, m2 1} oO L4= {anb™c : n 2 O, m 2 O}Ss aw ° Designing DFA Draw DFAs, >=fa, b, c, d} L1=falb"ord :12 1,m21,n2 1} L2= faloond 112 1, m2 1,n20} L3= falbond 112 1, m20,n2 1} L4= falbmond 112 1, m20,n20} L5= falbmond 112.0, m21,n2 1} L6= falbo'd 12.0, m2 1,n20} L7= {alb™end $12.0, m20,n2 1} L8= falb™ond 112 0, m20,n 20} eineDESIGNING DFA L(M)= { any number a followed by single b } L(M)={a"b:n>0} ( 0) X= {a,b} L(M) = {all strings with prefix ab } 2 = {a,b} a,bDesigning DFA > = {0,1}, l= { ALL STRINGS CONTAINING SUBSTRING 001}DESIGNING DFA L(M) = {x © {0,1}*| The number of 1’s in x is odd} = {1, 001, 11100, 111000,...} S-even state, F-odd state L={awa: we {a,b}*} Se o_t935 ae a) € dae\ 7° DFA: Typical Examples d= {a,b} 5 ={a,b} X= {a,b} C) a,b a,b —(4o) | (4) a,b d L(M)={} L(M) =>" L(M) = {4} Language of the Empty, String y a comet ALDESIGNING DFA.... * Construct a DFA that accepts the language = {010, B = {0 1} ) SG ©) Note: DFA exists for all finite languages.DESIGNING DFA... Construct a DFA over alphabet {0, 1} that accepts all strings with at most three 1s. {0*} U {0*10*} U {0*10*10*} U {0*10*10*10*} 0 0 0 0 0,1 gg g§-g-8 mw) YF Construct a DFA over alphabet {0, 1} that accepts all strings with exactly three 1s.DESIGNING DFAS * We cannot construct DFA for the language L = {a’b": n20}, because * Itneeds an infinite number of states * But {a"b’: 1
w mod 4 = 0 . multiple of 4 +1 > wmod 4=1 1 2. 3. multiple of 4 + 2 > w mod 4 = 2 4. multiple of 4 + 3 > w mod 4=3 000002Designing DFAs DFA M1 accepts (ab)"e MI M1 is incomplete DFA. The string abec is rejected since M1 is unable to process the final ¢ from state q, M2 accepts the same language as M1. M2 is complete DFA. The state q, is the trap state.DESIGNING DFAS Strings over {a, b} with at least 3 a’s Strings over {a, b} with length mod 3 = 0 Strings over {a, b} with length not multiple of 3DESIGNING DFAS Strings over {a, b} without 3 consecutive a’s b Strings over {a, b} that contain the substring bbwT ¢ ; Design DFAs ‘+ For ® = {0, 1}, deign DFAs for the following languages- “~~ Allstrings ending in 00. = _Allstrings with three consecutive 0's (not necessarily at the end), Al strings that contain exactly 4 “0's. = Allstrings ending in “1101”, = Allstrings containing exactly 4"0"s and at least 2 “1's. = _Allstrings whose fourth symbol from the left end is a 1. All strings that contain the substring 0101 = Allstrings that start with 0 and have an odd length or start with 1 and have an even length. ~ _Allstrings that don't contain the substring 110. = _Allstrings of length at most five. = Allstrings where every odd position is a 1. = _Allstrings that contain an even number of 1’s (Maximum 2 states), = Allstrings which do not contain the substring 10 (Maximum 3 states), = The set of strings that either begin or end (or both) with 01. + For each of the following languages L,, lz, L, and L, give a deterministic finite accepter (DFA), Consider the following languages over the alphabet 5 = {a,b}. = Ly: All strings that contain at least three a's. = I All strings that contain at most one b. = Ig: All strings that contain at least three a's but at most one b. Lg: All strings that contain no b's.l= {a by Find Languages? @) Pate ' «0@) @))e bC(a WO
You might also like
FLAT - Ch-2
PDF
No ratings yet
FLAT - Ch-2
50 pages
Finite Automata and Formal Language (19CS3501) : Department of Computer Science
PDF
No ratings yet
Finite Automata and Formal Language (19CS3501) : Department of Computer Science
37 pages
Finite Automata
PDF
No ratings yet
Finite Automata
46 pages
Theory of Automata
PDF
No ratings yet
Theory of Automata
44 pages
CMP3008 LN2 FiniteAutomata
PDF
No ratings yet
CMP3008 LN2 FiniteAutomata
35 pages
1 1 1 FiniteAutomata
PDF
No ratings yet
1 1 1 FiniteAutomata
50 pages
LN2_FiniteAutomata
PDF
No ratings yet
LN2_FiniteAutomata
43 pages
1 DFA
PDF
No ratings yet
1 DFA
58 pages
Chapter 2 Finite State Automata Part 1
PDF
No ratings yet
Chapter 2 Finite State Automata Part 1
97 pages
Lecture 2
PDF
No ratings yet
Lecture 2
39 pages
Automata Thoery
PDF
No ratings yet
Automata Thoery
24 pages
SMTA1404
PDF
No ratings yet
SMTA1404
63 pages
Deterministic Finite Automata
PDF
No ratings yet
Deterministic Finite Automata
3 pages
Automation RAC
PDF
No ratings yet
Automation RAC
28 pages
Slide#02 Week # 04, 05 TAFL
PDF
No ratings yet
Slide#02 Week # 04, 05 TAFL
48 pages
4 Dfa
PDF
No ratings yet
4 Dfa
54 pages
CD Final File Compiler Design Lab File
PDF
No ratings yet
CD Final File Compiler Design Lab File
61 pages
Phases of Compiler PDF
PDF
No ratings yet
Phases of Compiler PDF
63 pages
Chap2-Fa 9
PDF
No ratings yet
Chap2-Fa 9
11 pages
3 Fa
PDF
No ratings yet
3 Fa
64 pages
TOC UNIT I.2
PDF
No ratings yet
TOC UNIT I.2
13 pages
Finite Automata Examples
PDF
No ratings yet
Finite Automata Examples
68 pages
L3 DFA Introduction
PDF
No ratings yet
L3 DFA Introduction
17 pages
Lecture 3
PDF
No ratings yet
Lecture 3
30 pages
Chapter 2 - DFA
PDF
No ratings yet
Chapter 2 - DFA
13 pages
Deterministic Finite Automata Module
PDF
No ratings yet
Deterministic Finite Automata Module
5 pages
Week 4 Notes
PDF
No ratings yet
Week 4 Notes
18 pages
Chap 2 FiniteAutomata
PDF
No ratings yet
Chap 2 FiniteAutomata
100 pages
3. Section 2.1
PDF
No ratings yet
3. Section 2.1
57 pages
Chapter 2 Finite Automata PDF
PDF
No ratings yet
Chapter 2 Finite Automata PDF
146 pages
Finite Automata: Anab Batool Kazmi
PDF
No ratings yet
Finite Automata: Anab Batool Kazmi
54 pages
Flat All Units
PDF
No ratings yet
Flat All Units
82 pages
Introduction To Automata & DFA: Definitions & Examples Definitions & Examples
PDF
No ratings yet
Introduction To Automata & DFA: Definitions & Examples Definitions & Examples
26 pages
Lec-3 (Finite Automata)
PDF
No ratings yet
Lec-3 (Finite Automata)
14 pages
Finite Automata:: Two Categories of Finite Automata: Deterministic Finite Automata (DFA)
PDF
No ratings yet
Finite Automata:: Two Categories of Finite Automata: Deterministic Finite Automata (DFA)
13 pages
l5 Updated Dfa MSK
PDF
No ratings yet
l5 Updated Dfa MSK
13 pages
Unit-II (Introduction To Finite Automata)
PDF
No ratings yet
Unit-II (Introduction To Finite Automata)
80 pages
Automata Paradigm
PDF
No ratings yet
Automata Paradigm
27 pages
Finite Automata - Recognizer For "Regular Languages" - Deterministic Finite Automata (DFA) - Non-Deterministic Finite Automata (NFA)
PDF
No ratings yet
Finite Automata - Recognizer For "Regular Languages" - Deterministic Finite Automata (DFA) - Non-Deterministic Finite Automata (NFA)
43 pages
Slides Regular
PDF
No ratings yet
Slides Regular
312 pages
CS372 Formal Languages & The Theory of Computation
PDF
No ratings yet
CS372 Formal Languages & The Theory of Computation
31 pages
Dfa Nfa
PDF
No ratings yet
Dfa Nfa
56 pages
Week 2
PDF
No ratings yet
Week 2
14 pages
mod2-2
PDF
No ratings yet
mod2-2
15 pages
Act CH 1
PDF
No ratings yet
Act CH 1
23 pages
3-Lexical Analysis Part2
PDF
No ratings yet
3-Lexical Analysis Part2
39 pages
3-Finite Automata
PDF
No ratings yet
3-Finite Automata
33 pages
lecture 3
PDF
No ratings yet
lecture 3
29 pages
States, Transitions and Finite-State Transition System
PDF
No ratings yet
States, Transitions and Finite-State Transition System
30 pages
Automata an Complexity Theory - Ch01
PDF
No ratings yet
Automata an Complexity Theory - Ch01
28 pages
Automata - Chap2+finiteautomata
PDF
No ratings yet
Automata - Chap2+finiteautomata
47 pages
Unit 5
PDF
No ratings yet
Unit 5
25 pages
FALLSEM2020-21 CSI1003 TH VL2020210103426 Reference Material I 17-Jul-2020 TOC-Chapter2
PDF
No ratings yet
FALLSEM2020-21 CSI1003 TH VL2020210103426 Reference Material I 17-Jul-2020 TOC-Chapter2
38 pages
CH 2 - Finite Automata
PDF
No ratings yet
CH 2 - Finite Automata
72 pages
Deterministic Finite State Automata: Sipser Pages 31-46
PDF
No ratings yet
Deterministic Finite State Automata: Sipser Pages 31-46
19 pages
Unit - 1
PDF
No ratings yet
Unit - 1
36 pages
Chapter No.2
PDF
No ratings yet
Chapter No.2
43 pages
TOC Lec3
PDF
No ratings yet
TOC Lec3
51 pages
Pythonupdate
PDF
No ratings yet
Pythonupdate
45 pages
MCA 2022 Prev Yr Papers (Sem 3)
PDF
No ratings yet
MCA 2022 Prev Yr Papers (Sem 3)
15 pages
TOC Lec1
PDF
No ratings yet
TOC Lec1
39 pages