[next] [prev] [prev-tail] [tail] [up]

 Exercises

   
2.2.1
Let P be a program with k instruction segments and a domain of variables of cardinality m. Determine an upper bound on the number of states of P, and an upper bound on the number of possible transitions between these states.  
2.2.2
Determine the diagram representation of a finite-state transducer that models the computations of the program in Figure 2.E.1.
 
x := ?
do
    read y
until y/= x
do
    y := y + x
    write y
or
    if eof then accept
    reject
until false            
 
Figure 2.E.1

Assume that the domain of the variables is {0, 1}, and that 0 is the initial value in the domain. Denote each node in the transition diagram with the corresponding state of the program. 
2.2.3
For each of the following relations give a finite-state transducer that computes the relation.
  1.  { (x#y, aibj) | x and y are in {a, b}*, i = (number of a's in x), and j = (number of b's in y) }
  2.  { (x, ci) | x is in {a, b}*, and i = (number of appearances of the substring abb's in x) }
  3.  { (x, ci) | x is in {a, b}*, and i = (number of appearances of the substring aba's in x) }
  4.  { (1i, 1j) | i and j are natural numbers and i >= j }
  5.  { (x, a) | x is in {0, 1}*, a is in {0, 1}, and a appears at least twice in the string x }
  6.  { (xy, aibj) | x and y are in {a, b}*, i = (the number of a's in x), and j = (the number of b's in y) }
  7.  { (x, y) | x and y are in {a, b}*, and either x is a substring of y or y is a substring of x }
  8.  { (x, y) | x is in {a, b}*, y is a substring of x, and the first and last symbols in y are of distinct values }
  9.  { (x, y) | x and y are in {a, b}*, and the substring ab has the same number of appearances in x and y }
  10.  { (1i, 1j) | i = 2j or i = 3j }
  11.  { (1i, 1j) | i/= 2j }
  12.  { (x, y) | x and y are in {a, b}*, and the number of a's in x differs from the number of b's in y }
  13.  { (x, y) | x and y are in {0, 1}*, and (the natural number represented by y) = 3(the natural number represented by x) }
  14.  { ((x1)
y1 . . . (xn)
 yn , z1 . . . zn) | x1, . . . , xn, y1, . . . , yn, z1, . . . , zn are in {0, 1}, and (the natural number represented by x1 . . . xn) - (the natural number represented by y1 . . . yn) = (the natural number represented by z1 . . . zn) }
 
2.2.4
Let M = <Q, S, D, d, q0, F> be the deterministic finite-state transducer whose transition diagram is given in Figure 2.E.2.
   
[PICT]
Figure 2.E.2

For each of the following relations find a finite-state transducer that computes the relation.
  1.  { (x, y) | x is in L(M), and y is in D* }.
  2.  { (x, y) | x is in L(M), y is in D*, and (x, y) is not in R(M) }.
 
2.2.5
Show that if a deterministic finite-state transducer M accepts inputs x1 and x2 such that x1 is a prefix of x2, then on these inputs M outputs y1 and y2, respectively, such that y1 is a prefix of y2.  
2.2.6
Determine the sequence of configurations in the computation that the finite-state transducer <{q0, q1, q2}, {0, 1}, {a, b}, {(q0, 0, q1, a), (q1, 1, q0, a), (q1, 1, q2, e), (q2, e, q1, b)}, q0, {q2}> has on input 0101.  
2.2.7
Modify Example 2.2.16 for the case that M is the finite-state transducer whose transition diagram is given in Figure 2.2.2.   
2.3.1
For each of the following languages construct a finite-state automaton that accepts the language.
  1.  { x | x is in {0, 1}*, and no two 0's are adjacent in x }
  2.  { x | x is in {a, b, c}*, and none of the adjacent symbols in x are equal }
  3.  { x | x is in {0, 1}*, and each substring of length 3 in x contains at least two 1's }
  4.  { 1z | z = 3x + 5y for some natural numbers x and y }
  5.  { x | x is in {a, b}*, and x contains an even number of a's and an even number of b's }
  6.  { x | x is in {0, 1}*, and the number of 1's between every two 0's in x is even }
  7.  { x | x is in {0, 1}*, and the number of 1's between every two substrings of the form 00 in x is even }
  8.  { x | x is in {0, 1}*, but not in {10, 01}* }
  9.  { x | x is in {a, b, c}*, and a substring of x is accepted by the finite-state automaton of Figure 2.4.1 }
 
2.3.2
Find a deterministic finite-state automaton that is equivalent to the finite-state automaton whose transition diagram is given in Figure 2.E.3.
   
[PICT]
Figure 2.E.3

 
2.3.3
Find a Type 3 grammar that generates the language accepted by the finite-state automaton whose transition diagram is given in Figure 2.E.4.
   
[PICT]
Figure 2.E.4

 
2.3.4
Find a finite-state automaton that accepts the language L(G), for the case that G = <N, S, P, S> is the Type 3 grammar whose production rules are listed below.

  S  -->   aA
    -->   bB
    -->   b
 A  -->   aS
    -->   bC
B   -->   bS
    -->   aC
    -->   bA
C   -->   aB
 
2.3.5
Show that a language is generated by a Type 3 grammar if and only if it is generated by a right-linear grammar, and if and only if it is generated by a left-linear grammar.  
2.3.6
Prove that a set is regular if and only if it is accepted by a finite-state automaton.   
2.4.1
Let M be the finite-state automaton whose transition diagram is given in Figure 2.E.5.
   
[PICT]
Figure 2.E.5

Using the notation of the proof of the pumping lemma for regular languages (Theorem 2.4.1), what are the possible values of m, x, and y for each w in L(M)?  
2.4.2
Use the pumping lemma for regular languages to show that none of the following languages is regular.
  1.  { anbt | n > t }
  2.  { v | v is in {a, b}*, and v has fewer a's than b's }
  3.  { x | x is in {a, b}*, and x = xrev }
  4.  { vvrev | v is accepted by the finite-state automaton of Figure 2.E.6 }
       
    [PICT]
    Figure 2.E.6

  5.  { an2 | n >= 1 }
  6.  { anbt | n/= t }
  7.  { x | x is in {a, b}*, and x/= xrev }
 
2.4.3
Show that each relation R computable by a finite-state transducer has a fixed integer m such that the following holds for all (v, w) in R. If |w| > m . max(1, |v|), then w = xyz for some x, y, z such that (v, xykz) is in R for all k >= 0. Moreover, 0 < |y| <= m.  
2.4.4
Prove that the relation { (aibj, ck) | i and j are natural numbers and k = i . j } is not computable by a finite-state transducer.   
2.5.1
Let M1 be the finite-state automaton given in Figure 2.E.3, and M2 be the finite-state automaton given in Figure 2.E.6. Give a finite-state automaton that accepts the relation R(M1)  /~\ R(M2).  
2.5.2
For each of the following cases show that regular sets are closed under the operation Y.
  1.  Y(L) = { x | x is in L, and a proper prefix of L is in L }.
  2.  Y(L1, L2) = { xyzw | xz is in L1, and yw is in L2 }.
 
2.5.3
Let Y be a permutation operation on languages defined as Y(L) = { x | x is a permutation of some y in L }. Show that regular sets are not closed under Y.  
2.5.4
Show that the set of relations that finite-state transducers compute is closed under each of the following operations Y.
  1.  Inverse, that is, Y(R) = R-1 = { (y, x) | (x, y) is in R }.
  2.  Closure, that is, Y(R) =  U i>=0Ri.
  3.  Composition , that is, Y(R1, R2) = { (x, y) | x = x1x2 and y = y1y2 for some (x1, y1) in R1, and some (x2, y2) in R2 }.
  4.  Cascade composition, that is, Y(R1, R2) = { (x, z) | (x, y) is in R1 and (y, z) is in R2 for some y }.
 
2.5.5
Show that the set of the relations computed by deterministic finite-state transducers is not closed under composition.  
2.5.6
Let M be the finite-state automaton whose transition diagram is given in Figure 2.E.3. Give a finite-state automaton that accepts the complementation of L(M).  
2.5.7
Show that the complementation of a relation computable by a deterministic finite-state transducer, is computable by a finite-state transducer.   
2.6.1
Show that the problem defined by the following pair is decidable.
Domain:
{ M | M is a finite-state automaton }
Question:
Is L(M) a set of infinite cardinality for the given instance M?

[next] [prev] [prev-tail] [front] [up]