CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science
Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t time. Cn we construct more powerful mchine? 1 / 14
Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t time. Cn we construct more powerful mchine? 1 0 2 3,, Only processing one- or two- chrcters t time 1 / 14
Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t time. Cn we construct more powerful mchine? 0 1 ll else, 2, Processing up to three chrcters t time 1 / 14
Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t time. Cn we construct more powerful mchine? 0 1 The most sic of possile FA-like mchines ccepting only But we hve prolem: wht hppens with? 1 / 14
A Blck-Hole Stte? Up until this point, we hd lwys specified trnsition for every single letter from every single stte Rules of FAs sttes we cnnot stop reding input until we hve no more letters Do we wnt to specify n imginry hell stte for every FA? Alterntively introduce new term to descrie wht hppens 2 / 14
A Blck-Hole Stte? Up until this point, we hd lwys specified trnsition for every single letter from every single stte Rules of FAs sttes we cnnot stop reding input until we hve no more letters Do we wnt to specify n imginry hell stte for every FA? Alterntively introduce new term to descrie wht hppens Definition When n input string tht hs not een completely red reches stte (finl or otherwise) tht cnnot leve ecuse there is no outgoing edge tht it my follow, we sy tht the input (or the mchine) crshes t tht stte. Execution termintes nd the input must e rejected. 2 / 14
Exmple: A Doule-Letter Accepting Mchine,, Prolem, 0 1 How mny letters should we red t time? Discussion 3 / 14
Exmple: A Doule-Letter Accepting Mchine,,, 0 1 Prolem How mny letters should we red t time? Discussion Given we cn tokenize it in the following wys: -- - - Only one of these yields dmission into the finl stte ( 1 ) 3 / 14
A Potentil Prolem A string is ccepted y mchine if there is some wy it could e processed so s to rrive t finl stte. 1 0 3 2 4 / 14
A Potentil Prolem A string is ccepted y mchine if there is some wy it could e processed so s to rrive t finl stte. 1 0 3 2 We cn ccept in two different wys! These re no longer Finite Automt We shll refer to these new mchines s trnsition grphs 4 / 14
Trnsition Grphs Definition A trnsition grph, revited TG, is collection of three things: 1 A finite set of sttes, t lest one of which is designted s the strt stte nd some (mye none) of which re designted s finl sttes. 2 An lphet Σ of possile input letters from which input strings re formed. 3 A finite set of trnsitions (edge lels) tht show how to go from some sttes to some others, sed on reding specified sustrings of input letters (possily even the null string ). TGs were invented y John Myhill in 1957 A successful pth through trnsition grph is series of edges forming pth eginning t some strt stte nd ending t finl stte. Conctenting the edges visited will yield the input string. 5 / 14
Exmple with trnsitions 1 0 2 3 Wht lnguge is ccepted y this TG? 6 / 14
Multiple Strt Sttes 1 0 2 4 3 7 / 14
Multiple Strt Sttes 1 2 4 3 lnguge-cceptor euivlent (the TG on the prior slide is functionlly euivlent s the TG on this slide) Importnt note: every FA is TG, however every TG is not n FA 7 / 14
Looking t Simple Trnsition Grphs 1 0 4 0 2 0 5 0 1 3 0 1 2 3 6 0 1 8 / 14
Looking t Simple Trnsition Grphs 1 ccepts nothing (no finl) 0 2 ccepts only 0 3 ccepts only,, 0 1 2 3 4 ccepts nothing (no strt) 0 5 ccepts only 0 1 6 ccepts only 0 1 8 / 14
Exmples Wht do they do? TG1: TG2: 0 1, TG3: 0 1 3 2 0 1 2, TG4:,,, 3 4 0 1, 9 / 14
Infinite Pths? Question Cn we construct TG which hs infinitely mny ccept pths for finite-length string? 0 1 2 Solution 10 / 14
Infinite Pths? Question Cn we construct TG which hs infinitely mny ccept pths for finite-length string? 0 1 2 Solution 0 1 2 10 / 14
Circuits Question How cn we remove -trnsitions? 0 1 2 3 11 / 14
Circuits Question How cn we remove -trnsitions? 0 1 2 3, 0 1 2 3, 11 / 14
Generlized Trnsition Grphs (GTGs) We wnt to lierte! stte-to-stte trnsitions Allow the input to progress from one stte to stte Not with seuences of chrcters But with lnguges! L 1, L 2,..., L n How do we wnt to represent the lnguges? Definition A generlized trnsition grph (GTG) is collection of 3 things: 1 A finite set of sttes, of which s lest one is strt stte nd some (mye none) re finl sttes. 2 An lphet Σ of input letters. 3 Directed edges connecting some pirs of sttes, ech leled with regulr expression. 12 / 14
Exmples of GTG Exmple 1 (demonstrtion): ( + ) ( + ) 0 1 2 Exmple 2 (conversion):,, 0 1 2 Loops == Kleene Str, == ( + ) 13 / 14
Exmples of GTG Exmple 1 (demonstrtion): ( + ) ( + ) 0 1 2 Exmple 2 (conversion):,, 0 1 2 Loops == Kleene Str, == ( + ) ( + ) ( + ) 0 1 2 3 13 / 14
Non-Determinism Or, how I lerned to stopped worrying nd love GTGs GTGs force us to fce deep, sutle, nd disturing fct: Just s nd + in regulr expression represent potentil multiplicity of choices, so does the possile multiplicity of pths to e selected from TG. In GTG, the choices re sttic nd dynmic We often hve choices of edges t ech stte, ech leled with n infinite lnguge of lterntives The numer of wys to trnsition from Q i to Q j might e We cn t forid it ( Dred It. Run From It. Destiny Still Arrives. ) GTGs re non-deterministic. Humn choice ecomes fctor in selecting the pth; the mchine doesn t mke ll its own determintions. 14 / 14