Homework 1 Solution

Homework 1 Solution

<p> Homework 1 Solution </p><p>1. Problem 9 on page 27. Prove or disprove the following claims:</p><p>R R R (a) (L1L2) = L1 L2 for all language L1 and L2</p><p>R R R First prove all the strings in X = (L1L2) are in Y = L1 L2 . Assume R R R R w in X, then w in L1L2. If w in L1 then w in L1 – in Y, same to w in L2. So any string in X is in Y at the same time. Second prove all the string in Y are in X. Similar to above.</p><p>R R (b) (L )* = (L*) for all languages L.</p><p>From definition of the * operation we have: (LR)* = (LR)0  (LR)1  (LR)2  …, and (L*)R = (L0  L1  L2  …)R. By applying part (a) of the same problem many times we obtain: (L*)R = (L0  L1  L2  …)R = (L0)R  (L1)R  (L1)R  … Therefore, we only need to prove that (LR)k = (Lk)R, for any k  0.</p><p>Next, we prove by induction that (LR)k = (Lk)R, for any k  0. For the induction basis, when k = 0, (LR)k = {} and (L k) R = {} and thus (LR)k = (L k) R. For the induction hypothesis, assume when k  n that (LR)n = (L n) R. For the induction step, when k = n+1, R n+1 R n R n+1 R n R n R R (L ) = (L )  L and (L ) = (L  L ) = (L )  L . By the induction hypothesis it follows that (LR)n+1=(L n+1) R. Subsequently, the statement holds for any k.</p><p>2. Problem 2 on page 45 For  = {a,b}, construct DFA’s that accept the sets consisting of (a) all strings with exactly one a</p><p> b b a</p><p> a a</p><p> b (b) all strings with at least one a</p><p> b b</p><p> a a</p><p>(d)all strings with at least one a and exactly two b’s</p><p> a a a</p><p> b b a b a a a a b b b a b b a b</p><p>(e) all the strings with exactly two a’s and more than two b’s</p><p>The automaton is constructed with similar techniques as above.</p><p>3. Problem 6 on page 45 Give a set notation description of the language accepted by the automation depicted in the following diagram. Can you think of a simple verbal characterization of the language? a b b</p><p> b a q q 0 1 q 2</p><p> a L = {w: wb*a or w  b*a(a|b)*b}</p><p>The language is all the strings with exactly one a or more than one a but end with b.</p><p>4. Problem 9 on page 53 (a) Find an NFA with three states that accepts the language L = {an : n1}  {bmak : m0, k0}</p><p>Notice that L = {bmak : m0, k0}, since for n=1 and m=0 and k=1 an = bmak. Therefore an automaton with three states is the following.</p><p> b a</p><p>  q0 q1 q2</p><p>(b) Do you think the language in part (a) can be accepted by an NFA with fewer than three states?</p><p>Yes, it can be accepted by an NFA with two states. Simply remove </p><p> state q2 in the automaton of part (a):</p><p> b a</p><p> q0 q1</p><p>5. Convert the NFA you constructed in Problem 9(a), page 53, to an equivalent DFA. Show the intermediate steps of the conversion. Initial state: {q0}</p><p> a {q1, q2}</p><p>Transitions from {q0}: {q0} b</p><p>{q0, q1, q2}</p><p> a</p><p> a {q1, q2} b Transitions from {q1, q2}:</p><p>{q0} b </p><p>{q0, q1, q2}</p><p> a</p><p>Transitions from {q0, q1, q2}:</p><p> a {q1, q2} b</p><p>{q0}  b a</p><p>{q0, q1, q2}</p><p> b a</p><p> a, b Transitions from :</p><p> a {q1, q2} b</p><p>{q0} b a </p><p>{q0, q1, q2}</p><p> b</p><p>Final states (final DFA): a</p><p> a, b</p><p> a {q1, q2} b</p><p>{q0} a b </p><p>{q0, q1, q2}</p><p> b</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us