1. Describe in set-theoretic notation the language of the automaton in 3.1.2.4 . Independently, describe set-theoretically the complement {0 n 1 : n ≥ 0} and verify that your two answers are equivalent.

  2. Construct a FA M over A = {0, 1} such that L ( M ) = { images }

  3. Construct a FA M over A = {0, 1} such that L ( M ) = {0, 1} + , that is, L ( M ) = A * − { images }.

  4. Construct a FA that accepts L = {00, 11, 10} over A = {0, 1}.

  5. Let Σ = {0}. Which of the following languages over Σ is regular, and why ?

    (a) { x : | xx | is odd}

    (b) { x : | x | is odd}

    (c) { x : | xx | is not a prime}

    (d) { x : | x | is not a prime}

    (e) { x : | x | is a perfect cube}

  6. Find a finite automaton that accepts the language over A = {0, 1} that contains precisely the strings that have no three consecutive 0s.

  7. Find a finite automaton that accepts the language over A = {0, 1} that contains precisely the strings that end in precisely three consecutive 0s.

  8. Find a finite automaton that accepts the language over A = {0, 1} that contains precisely the strings that end in at least three consecutive 0s.

  9. Design a FA over {0, 1} that accepts exactly all the strings of length 3 k + 1 for some natural number k .
    E.g., 0, 0110, 0000 are all in. 00, 000, 01101 are not.

  10. Build a NFA that accepts precisely all the strings over {0, 1} of length ≥ 5 that contain at least one “1” among their last five symbols.

    You should argue the correctness of your design in general terms, not by example.

  11. Design a FA over {0, 1} that accepts exactly all the strings whose digits have sum equal to 3 k + 1 for some natural number k .

    For example, 1, 100, 1111 are in. 11, 0, 111 are not.

    You must prove that your automaton works!

  12. Convert to NFA (all are over {0, 1}) without comment:

    • 01*
    • (0+1)01
    • 00(0+1)*
  13. Convert the previous last two NFA to a FA.

  14. For any string x over Σ = {0, l}, let x R mean its reversal (i.e., x R reads right-to-left exactly as x does left-to-right), or, mathematically,

    images

    Is { xwx R : x ∈ Σ* ∧ w ∈ Σ*} regular?

    A proof should be provided in support of either of the two possible answers .

  15. This is a different question than the previous one!

    Let L over Σ {0, 1} be given by L = { xyx R : x ∈ Σ* ∧ y ∈ Σ}.
    Prove or disprove : L is regular.

  16. Prove that the language over {0, 1},

    L = { w : w contains an equal number of occurrences of the substrings 01 and 10} is regular.

    Overlaps are allowed in the occurrences of 01 and 10. E.g., 010 is in. 0110 is in too, but 1010 is not.

    images “Prove” is not fulfilled by just writing down a NFA (or FA or a regular expression). The question remains: Why does the proposed finite description represent L ?

    Put positively, you need first to prove that L , as given above, can be redefined by some much simpler description. Then it will be easy to give a NFA or FA or a regular expression that can readily be seen to “work”! Images

  17. Prove that the language A below, over the alphabet Σ = {0, 1, +, =},

    A = { x + y = z : x , y , z are binary integers, and z is the sum of x and y }

    is not regular.

  18. A counterexample to the Pumping Lemma : “We know that L = {00, 01} over A = {0, 1} is regular. Let then C > 0 be a pumping constant for L , and take a z ∈ L with | z | ≥ C . Then we can write z = uvw —where | v | ≠ 0—so that all the strings uv i w , for i ≥ 0, are in L . But this is impossible! L is finite!”

    The reasoning in quotes invalidates the pumping lemma! Do you believe this?

    (i)We said “We know that L = {00, 01} over Σ = {0, 1} is regular”. How do we know this? Explain precisely.

    (ii) Explain precisely where (and why) the counterexample argument is wrong.

  19. Is the language L = { a 2 n : n ≥ 3} over { a } regular? Why?

  20. Is the language L = { a 2 n : n ≥ 3} over { a } regular? Why?

  21. Is the language L = { a x b y c z : x ≥ y V y ≥ z } regular? Why?

  22. Is the language L = { a n ( b i a j ) k b n : i , j , k ≥ 0 ∧ n ≥ 1} regular? Why?

  23. Let M be a NFA. “To get a NFA that accepts the complement of L ( M ) it suffices to swap accepting and rejecting states”.

    If you believe this prove it. If not, find a counterexample, that is, a NFA M on which the above suggested swapping does not work: It produces a NFA that accepts something other than the complement of L ( M ).

  24. Define a new type of a nondeterministic automaton exactly as in Section 3.2 , except that the new model—in general—has more than one start state.

    A string x is accepted by this model iff there is a path with label x from some initial state to some state in F .

    Prove that this model still recognizes exactly the regular languages.

  25. For any regular expressions α and β over the alphabet Σ, we have ( α + β )* ~ ( α * β *)*

  26. Prove that every finite set of strings over some alphabet A can be named by a regular expression.

  27. There were a number of “pauses” in 3.3.1.5 posing questions to the reader. Provide all needed answers.

  28. Prove that { ab n c n : n ≥ 0} over Σ = { a , b , c } is not regular.

  29. Prove the result in Example 3.4.2.1 using the NFA, rather than regular expressions, as the formalism.

  30. Prove that regular languages are closed under reversal . This is understood as follows: The reversal of a string x over Σ, denoted by x R , is defined in Exercise 14 above.

    For any language L , its reversal , denoted by L R is defined as L R \= { x R : x ∈ L }.
    The exercise asks to prove that if L is regular, then so is L R .
    Hint . A technique similar to that used in 3.4.2.1 is recommended.

  31. Prove that a CFG G over Σ, whose rules are of the types A → B , A → a , and A → Ba —where a ∈ Σ ∪ { images }—is regular.
    Hint . This means that an α , or a FA M , or a regular grammar G′ exist, such that the generated language equals L ( α ) [or L ( M ), or L ( G′ )].

  32. Prove (by an appropriate example) that we cannot normally mix rules of the types A → Ba and A → aB and expect to generate a regular language. More precisely, find a CFG over Σ with rules of types A → a (where a ∈ Σ ∪ { images }), A → B , A → aB , and A → Ba that generates a language that we know is not regular.

  33. Provide an algorithm that checks whether or not

    (∃ x )( x ∉ L 1 ∪ L 2 )

    for any given regular languages L 1 , L 2 and string x , all over some fixed Σ.

  34. We know that if L and L′ are regular languages over Σ then so is L ∪ L′ . By induction on n prove that this extends to any number of regular languages L 1 , . . . , L n .

  35. Does the above extend to infinitely many regular languages L i ? Will images L i be regular?

    Thoroughly justify your answer (a proof, if you said “yes” a counterexample if you say “no”).

  36. Prove that the equivalence problem of regular expressions, that is the question, “ α ~ β ?”, for any two α and β over some Σ, is decidable (algorithmically solvable).
    Hint . Start by thinking set-theoretically.

  37. Prove that universal FA do not exist . Let us make the preceding statement precise.

    We can easily see that all possible FA with tape alphabet {0, 1} can be coded as strings over a fixed alphabet to be specified below:

    Indeed, let us code a FA M : Each instruction δ ( q i , a ) = q j is represented by the string images where a ∈ {0, 1} and images is the decimal representation of the number i . Thus, adding “;” to the alphabet as a new symbol, we represent the automaton by “gluing” the instruction-representations, one after the other, using “;” as inter-instruction glue, and appending at the end of the sequence the string “ images ” which indicates that q m is the initial state and q n , . . . , q k are the accepting states.

    Any automaton, such as M , has more than one string representation (due to the fact that permutations of states and/or instructions are possible) over the alphabet Σ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, q , *,;}.

    R ( M ) will denote all the representations of M . End of the description of how to code a FA.

    Thus, you are asked to prove that the language

    L = { x; y : ∃ M )( M is a FA and x ∈ R ( M ) Λ y ∈ L ( M ))}

    is not regular, or, in plain English, “there is no FA U that can faithfully simulate an arbitrary FA M (the latter coded as x ) on arbitrary input y over {0, 1}”.

110 However, the pumping lemma, 3.1.3.1 , exposes a limitation of the model of computation discussed in this chapter.

111 In 2.1.1.3 we explained why explicit read instructions are theoretically as redundant as explicit write instructions are.

112 Base 16 notation.

113 “M” is generic; for “machine”.

114 I.e., not necessarily meeting eof.

115 Sets of strings over an alphabet; cf. 1.1.3.2 .

116 You see why C is not unique, since for any S that is an L ( M ) we can have infinitely many different M that accept S. Can we not?

117 By determinism.

118 Employed to define form or structure.

119 If there is just one q k in the figure, then this is captured by the ( images ) 0 in the ( images )* = images ( images ); cf. Subsection 1.1.3 .

120 “Educated guesses” usually hide a lot of preliminary work and trial and error attempts; this kind of “preprocessing” is almost always omitted from proofs so that the argument is not obscured. They are not “guesses” at all.

121 A variable that, intuitively, assumes only the values true or false , the so-called Boolean values. Cf. also 1.1.1.26 .

122 BNF also allows multi-character mnemonics for terminals, using a variety of notations. For example, the terminal “then” of Algol might be denoted by then , or then , or then .

123 Cf. 1.6.0.20 and 1.6.0.23 .

124 The set of prefixes of members of { a } is { images , a}. But { images } is given by the name images *—cf. 3.3.0.11 .