1 / 17

CSE 105 Theory of Computation

CSE 105 Theory of Computation. Alexander Tsiatas Spring 2012. Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution- NonCommercial - ShareAlike 3.0 Unported License. Based on a work at http://peerinstruction4cs.org.

kolton
Télécharger la présentation

CSE 105 Theory of Computation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 105Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at http://peerinstruction4cs.org. Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org.

  2. If a language isn’t regular, it just might be one of the… Context-Free LanguagesPDA

  3. Understanding Pushdown Automata The edge from q0 to q1 does what? • Lets you go to q1 without reading any input (on ε) • Lets you go to q1 on εor ‘$’ • Lets you go to q1 on ‘$’

  4. Understanding Pushdown Automata In addition to what we said in the last question, the edge from q0 to q1 does what else? Pushes one entry onto the stack (ε) Pushes one entry onto the stack (‘$’) Pushes two entries onto the stack (ε and ‘$’) Pops two entries off the stack (ε and ‘$’)

  5. Tracing in a Pushdown Automaton b Input “aabb” into this PDA. After “aa” has been read, what is on the stack? top of stack bottom of stack 

  6. Language of a Pushdown Automaton b Which is the bestdescription of the language of the given PDA? • { w | number of b’s in w >= number of a’s in w} • {w | w = anbn+1for some n>=0} • { w | w = anbn+2 for some n>=0} • { w | w = anb2nfor some n>=0} • {w | w = 0anb2n0 for some n>=0}

  7. Tracing in a Pushdown Automaton e • Which string is NOT accepted by this PDA? • aabb • abbbc • abbccc • aabcc • None or more than one of the above

  8. Tracing in a Pushdown Automaton c • Which choice depicts a stack state that occurs at some point during the successful* processing of the string “aaabbbc” on the given PDA? top of stack bottom of stack  • None of the above * Ignore all nondeterministic paths that end in rejecting/getting stuck.

  9. Why did we push ‘#’ onto the stack? e • We didn’t have to, because we already “counted” the a’s by pushing them on the stack • It’s something we do because of convention, but it isn’t necessary to correctness • We did it to make sure that we didn’t cause a crash/error by trying to pop something off an empty stack • It is necessary for correctness • None or more than one of the above

  10. CFLs! The Class of Context-Free Languages

  11. Which Venn diagram best represents the classes of languages we have studied? (a) (b) CFLs CFLs RLs RLs (c) (d) (e) None of the above Note: CFLs = Context-Free Languages, RLs = Regular Languages CFLs = RLs RLs CFLs

  12. What methods can we use to prove/disprove each of these? (a) (b) CFLs CFLs RLs RLs (c) (d) Note: CFLs = Context-Free Languages, RLs = Regular Languages CFLs = RLs RLs CFLs

  13. Closure properties of context-free languages? • Remember the direction: • If L1 and L2 are context-free languages, thenL1 U L2 is a context-free language. • Are context-free languages closed under union? • Yes • No

  14. Closure under union: CFG’s Grammar for L1: Grammar for L2: S1 → Stuff S2 → Other stuff More stuff Even more stuff Construct a grammar for L1 U L2?

  15. Closure under union: PDA’s

  16. Closure under concatenation: CFG’s Grammar for L1: Grammar for L2: S1 → Stuff S2 → Other stuff More stuff Even more stuff Construct a grammar for L1 L2?

  17. Closure under intersection…? • Think about it for next class!

More Related