comp_midterm_Jun_Chen.pdf

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Foundations of Computer Science Midterm Problem set Jun Chen October 23, 2016 1 Chapter 2 Exercise 2.2.1 (a)Model this toy by a finite automaton,0 means the marble fall to left and 1 means the marble fall to right, string a means marble fall into D and string means reject state since the marble fall into C. A B > 000r 100r 011r 100r 010r 111r 011r 111r 010a 010r 110r 001a 111r 001a 110a 001a 101r 00a 010a 110r 001a 110a 010r 111r 100a 010r 111r 110r 000a 101a 101a 011r 100a 010r 110r 001a 100a 010r 111r 101a 011r 001a Here we have { 001 a, 010 a, 110 a, 000 a, 100 a, 101 a } are accept states (b) Informally describe the language of the automaton 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
L= { w | w=xb, where x=0 * 1 * 0 * and b=a } (c) Suppose that instead the levers switched before allowing the marble to pass. How would you answers to parts(a) and (b) change.? Since the string r and a mean previous state, when the levers switched before allowing the marble to pass, we will have same symbol with opposite state for last symbol. That is r change to a, and a change to r. Exercise 2.2.2 Show that in fact, ˆ δ ( q, xy ) = ˆ δ ( ˆ δ ( q, x ) , y ) we start from y= ε , when y= ε , we have ˆ δ ( q, x ) = p , and ˆ δ ( ˆ δ ( q, x ) , ε ) = ˆ δ ( p, ε ) = p , there for we have ˆ δ ( q, x ) = ˆ δ ( ˆ δ ( q, x ) , y ) For y 6 = ε , that is letting y = za . ˆ δ ( ˆ δ ( q, x ) , za ) = δ ( ˆ δ ( ˆ δ ( q, x ) , z ) , a ) δ ( ˆ δ ( q, xz ) .a ) = δ ( q, xza ) = ˆ δ ( q, xy ) Exercise 2.2.3 Show that for any state q, string x, and input symbol a, ˆ δ ( q, ax ) = ˆ δ ( δ ( q, a ) , x ) For a= ε , we have ˆ δ ( q, x ) = ˆ δ ( δ ( q, a ) , x ) by δ ( q, a ) = q For a 6 = ε , ˆ δ ( q, ax ) = δ ( ˆ δ ( q, a ) , x ) by considering ˆ δ ( q, a ) is a state From Exercise 2.2.2 we have δ ( ˆ δ ( q, a ) , x ) = ˆ δ ( q, ax ) (Also see Example 2.4) Exercise 2.2.4 Gives DFA’s accepting the following languages over the alphabet { 0 , 1 } : (a) The set of all strings ending in 00. ANS: (1 + 0) * 00 (b)The set of all strings with three consecutive. ANS: (1 + 0) * (000) * (1 + 0) * 2
Image of page 2
(c)The set of strings with 011 as a substring. ANS: (1 + 0) * (011)(1 + 0) * Exercise 2.2.5 (a) SKIP (b)The set of all string whose tenth symbol from the right end is a 1. 3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
(c)The set of string that either begin or end with 01. Exercise 2.2.6 skip Exercise 2.2.7 We have δ ( q, a ) = qforalla . basis, if w= ε , we have ˆ δ ( q, ε ) = q. induction, let w=ax, we have ˆ δ ( q, ax ) = ˆ δ ( δ ( q, a ) , x ) = ˆ δ ( q, x ) = q Exercise 2.2.8 (a) basis: n=0, we have ˆ δ ( q, ε ) = q , by definition. induction: assume that ˆ δ ( q, a k ) = q. then ˆ δ ( q, a k +1 ) = ˆ δ ( ˆ δ ( q, a k ) , a ) = ˆ δ ( q, a ) = q Therefore, we have ˆ δ ( q, a n ) = q for all n 0. (b)Show that either { a * } ⊆ L ( A ) or { a * } ∩ L ( A ) = φ From part (a), we know that for all n 0 we have ˆ δ ( q, a n ) = q .which is true for the initial state q. if q is also a accepting state, then we have { a * } ⊆ L ( A ). 4
Image of page 4
if q is not a accepting state, then we reject { a * } , we have { a * } ∩ L ( A ) = φ Exercise 2.2.9 (a) basis: | w | = 1, then we have ˆ δ ( q 0 , w ) = ˆ δ ( q f , w ) since w is a single symbol by definition.
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern