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)
31 views
TOC Lec2
Uploaded by
Mohammed Ahmed
AI-enhanced title
Copyright
© © All Rights Reserved
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)
31 views
TOC Lec2
Uploaded by
Mohammed Ahmed
AI-enhanced title
Copyright
© © All Rights Reserved
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
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6134)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (935)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8215)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2923)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4973)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Toibin
3.5/5 (2061)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1988)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1994)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2544)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
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
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)