



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solutions to a practice midterm for a course on Theory of Computation. It includes questions on Deterministic Finite Automata, Context Free Grammar, and binary palindromes. formal descriptions of DFAs, pumping lemmas, and grammars, as well as proofs and justifications for certain language properties. It also includes a PDA construction for recognizing binary palindromes.
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try to be precise in your answers in order to maximize your points. Also make sure that your answers to pumping lemma questions are sufficiently clear so that I can tell that your reasoning is correct. Good luck. Note: DFA = Deterministic Finite Automata NFA = Nondeterministic Finite Automata PDA = Push-Down Automata CFG=Context Free Grammar Here are the pumping lemmas: If A is a regular language, then there is a number p (the pumping length) where, if s is any string in A of length at least p , then s may be divided into 3 pieces, s = xyz , satisfying the following conditions:
q0 q q q
palindrome (note that it does not matter if x is even or odd). Note that if you chose 1 p 01 p then you cannot pump it.
b. 0 n 1 2n^ is context-free, n 1 Circle one: Prove (statement true) Disprove (statement false) Prove or disprove below: Proof by construction 1:
Proof by construction 2: Use a PDA and start in a state that pushes a 0 on the stack for each 0 read. Once the first 1 is seen then move into another state that pops a 0 from the stack for every second 1 read. If you run out of 1’s when the stack is not empty or if you see any more 0’s, then reject. Accept if you run out of input, are in the state where you just popped off a 0, and if the stack is empty.