Study questions
Automata, formal languages, and computational complexity
CSC 341 · Spring, 2011 · Department of Computer Science · Grinnell College

For Friday, May 13

  1. Assess the strengths and weaknesses of this course.
  2. Suggest ways in which the course or the instructor's approach to it could be improved.
  3. Do problem 5.16 (page 212). You may find it helpful to use the recursion theorem; in this case, you may do so even though Sipser does not prove the recursion theorem until chapter 6.

For Wednesday, May 11

  1. What is the space complexity of a regular language on a deterministic Turing machine of the type introduced in section 8.4 (two tapes, with the input tape being read-only)?
  2. Show that the “properly nested parentheses” language of example 2.3 (page 103) is a member of the space-complexity class L.
  3. Suppose that there is a natural ordering of the symbols in an alphabet Σ (or that we can impose such an ordering). Then the sorting function s: Σ* → Σ* rearranges the symbols in a given string so that they are in monotonically nondescending order. For instance, if the alphabet is {a, b, c}, in that order, then s(cabccabcb) = aabbbcccc. Show that s is a log space computable function.

For Monday, May 9

  1. Describe a Turing machine that decides SUBSET-SUM using O(n) space, where n is the length of the input.
  2. Show that, for any language L, if L ∈ PSPACE, then L* ∈ PSPACE.
  3. The universal Turing machine U, which recognizes ATM (as described on page 174 of our textbook), does not have a well-defined space complexity. Explain why not.

For Friday, May 6

  1. Let CYCLE-FREE = {⟨Gk⟩ | in graph G there is a path of length k along which no vertices occur twice}. Show that CYCLE-FREE is NP-complete.
  2. Given a finite collection C of finite sets S1, S2, ..., Sn of natural numbers, a selection for C is a set of natural numbers that shares at least one element with each of the sets in C. (For instance, if C is {{1, 3, 5}, {3, 10, 17, 24, 31}, {7, 8, 9, 10}}, then {1, 9, 31} and {3, 10} are both selections for C.) Let SELECTION = {⟨Ck⟩ | there is a selection of cardinality k for C}. Show that SELECTION is NP-complete.
  3. Show that if P = NP, then every member of NP is NP-complete.

For Wednesday, May 4

  1. Could a window of the form
    q a b
    c d b
    ever be legal in a Cook-Levin tableau? If so, what conditions would have be met by the transition function in the Turing machine whose computation the tableau models?
  2. To accommodate cases in which the input string in the computation that a tableau models is the null string, is it necessary to provide legal windows of the form
    # s #
    # t #
    where st ∈ Q ∪ Γ?
  3. Show that if 3SAT is polynomial-time mapping reducible to a language A, then A is NP-complete.

For Monday, May 2

  1. If the nondeterministic Turing machine N that decides a language A ∈ NP has 248 states and a tape alphabet containing seven symbols, and always halts in fewer than 232 − 3 steps, how many cells will the tableau that Sipser's proof constructs have? How many occurrences of variables will φcell contain?
  2. Explain why it is impossible for any row of a tableau constructed in the manner described in Sipser's proof of Theorem 7.37 to represent a Turing machine configuration in which the head moves so far to the right that additional blank tape cells would have to be provided to accommodate it.
  3. Suppose that A is a language in NP that a nondeterministic Turing machine can decide in polynomial time, but the polynomial has a coefficient greater than 1 on its leading term or has positive non-leading terms. Strictly speaking, Sipser's proof of Theorem 7.37 does not cover such a case. How would you adapt the proof to accommodate it?

For Friday, April 29

  1. Two graphs G and H are said to be isomorphic when there is a one-to-one correspondence f between the vertices of G and the vertices of H such that, for any vertices u and v of G, there is an edge between u and v in G if and only if there is an edge between f(u) and f(v) in H. Show that the language {⟨GH⟩ | G and H are isomorphic} is in NP by identifying a certificate and showing that it can be verified in polynomial time, as a function of the size of ⟨GH⟩.
  2. Show that every language that is polynomial-time mapping reducible to {0n1n | n ≥ 0} is a member of P.
  3. A Boolean formula is tautologous if every assignment of 0s and 1s to its variables makes the formula evaluate to 1. Show that the language {⟨φ⟩ | φ is a tautologous Boolean formula} is polynomial-time mapping reducible to SAT, the language of satisfiable Boolean formulas. Check carefully -- the mapping is slightly subtler than one might think at first glance.

For Wednesday, April 27

  1. Show that every polynomial function of n that is strictly increasing is of the order 2O(log n).
  2. On page 257 of our textbook, Sipser writes that “one way to factor a number into its constituent primes is to search through all potential divisors. The size of the search space is exponential, so this search uses exponential time.” Yet the number of potential divisors of n is n (since one need only consider positive integers less than or equal to n). Reconcile these observations by explaining the sense in which the size of the search space is exponential.
  3. Show that the complexity class P is closed under union -- that is, that for any two languages A and B, if A ∈ P and B ∈ P, then A ∪ B ∈ P.

For Monday, April 25

  1. For any natural number b, is there always a string sb that is compressible by b?
  2. For any natural number b, is there always a string sb whose minimal description d(sb) is compressible by b?
  3. Show that the Kolmogorov complexity function K(s) is not computable.

For Friday, April 22

  1. Here is a formal encoding, in mathematical notation, of the Turing machine that accepts any string of 0s and 1s (except the null string), interprets it as a binary numeral expressing some natural number n, and outputs a binary numeral for n + 1.
    ({q0,q1,q2,q3,q4,qa,qr},
     {0,1},
     { ,0,1},
     {(q0, ,qa, ,L)
      (q0,0,q1,0,R)
      (q0,1,q2,1,R)
      (q1, ,q3, ,L),
      (q1,0,q1,0,R),
      (q1,1,q1,1,R),
      (q2, ,q4,0,L),
      (q2,0,q1,0,R),
      (q2,1,q2,1,R),
      (q3, ,qr, ,L),
      (q3,0,qa,1,L),
      (q3,1,q3,0,L),
      (q4, ,qr, ,L),
      (q4,0,qa,1,L),
      (q4,1,q4,0,L)},
     q0,
     qa,
     qr)
    
    Suppose that we want to combine this encoding for a Turing machine (considered as a concatenation of seven-bit ASCII characters) with the input string 1011, as described on page 235 of the textbook. How long (in bits) would the resulting description be? What string would it describe?
  2. Devise the simplest Turing machine you can think of that halts as soon as it is started. Express it in the notation used in the preceding study question. Suppose that we wanted to combine that encoding with the null input string, again as described on page 235 of the textbook. How long would the resulting description be? What is the value of c in Theorem 6.24, relative to this system for encoding Turing machines?
  3. Show that there are only finitely many incompressible bitstrings that contain more that 51% 0s.

For Wednesday, April 20

  1. Show that the relation ≤T of Turing-reducibility is transitive.
  2. Do exercise 6.4 (page 242) in the textbook.
  3. Do problem 6.19 (page 243) in the textbook.

For Monday, April 18

  1. Suppose we construct a model in which the universe is the set E of even natural numbers, R1(abc) is true if and only if c is the sum of a and b, and R2(abc) is true if and only if c is half the product of a and b. Describe the theory Th(ER1R2) for this model.
  2. Is the set of unprovable sentences of Th(ℕ, +, ×) infinite?
  3. Theorem 6.17 gives us a particular sentence ψunprovable that is a member of Th(ℕ, +, ×) but is not provable. Suppose that we amend our system of proof to include this new sentence as an axiom. In this new proof system, ψunprovable will be trivially provable, and many other formerly unprovable sentences will also become provable (because they follow from ψunprovable and the older axioms by standard rules of inference). Will every member of Th(ℕ, +, ×) be provable in the new proof system?

For Friday, April 15

  1. Describe two different Turing machines, M and N, each of which ignores its input and outputs the encoding for the other.
  2. Prove that there is a natural number n that encodes a singulary, partial recursive function that takes any natural number x as input and returns as output the product of n and x.
  3. Prove that there is a Turing machine M that takes a binary numeral as input and returns as output an encoding ⟨M⟩ for M, repeated the number of times specified by the binary numeral.

For Wednesday, April 13

  1. Consider the binary function constantify-and-raise, which takes two natural numbers, m and n, as inputs and yields as output the encoding for a primitive recursive function of valence m that ignores its inputs and always outputs n.
  2. Using the parameter theorem, show that there is a singulary, primitive recursive function split-input that takes as its input an encoding for any binary, partial recursive function f and yields as output an encoding for a singulary, partial recursive function g such that g(x) = f(xx) for every natural number x -- except that, if f(xx) is undefined, so is g(x). (For instance, applying split-input to an encoding for the add function should yield an encoding for the double function.)
  3. What changes would one have to make in the proof of Theorem 21.2 if we made t ternary instead of binary and r binary instead of singulary? Can we extend the pattern to accommodate functions of any positive valence?

For Monday, April 11

  1. Show that any two decidable languages L1 and L2 are mapping-equivalent, in the sense defined in the first study question for April 8.
  2. Show that the set of all prime numbers is recursive.
  3. Let's say that a natural number n is omphalic if it encodes a singulary partial recursive function f such that f(n)↓. Show that the set of omphalic numbers is recursively enumerable.

For Friday, April 8

  1. Let's say that two languages are mapping-equivalent if each is mapping reducible to the other. Is it possible for a language to be mapping-equivalent to its complement? If so, give an example; if not, prove that this relationship cannot hold.
  2. Is ATM mapping reducible to ETM, to the complement of ETM, to both, or to neither?
  3. Prove that every Turing-decidable language is mapping reducible to {a}. To which languages is {a} mapping reducible?

For Wednesday, April 6

  1. The proof of Theorem 5.15 (pages 200-205) presupposes that, for any Turing machine M, there is an equivalent Turing machine M' that never attempts to move its read/write head off the left end of the tape. (M and M' are equivalent in the sense that they recognize the same language.) Show that this presupposition is warranted by proposing an algorithm for constructing M', given M.
  2. What is the instance of the Modified Post Correspondence Problem that corresponds to the statement that M2 (from example 3.7, pages 143 and 144) accepts the string 000? In other words, what are the dominoes in the instance of the MPCP that has a solution if, and only if, M2 accepts the string 000?
  3. Give an algorithm to solve any instance of the Post Correspondence Problem in which the string on each end of every domino consists entirely of repetitions of the symbol a.

For Monday, April 4

  1. Prove that {⟨M⟩ | M is a Turing machine and L(M) is context-free} is undecidable.
  2. Read problem 5.28 (Rice's theorem, p. 213) and the solution that Sipser provides (p. 215). Use Rice's theorem to show that {⟨M⟩ | M is a Turing machine and L(M) includes infinitely many strings of even length and infinitely many strings of odd length} is undecidable.
  3. Is {⟨M⟩ | M is a Turing machine with eight or more states} decidable? Explain why Rice's theorem does not supply any answer to this question.

For Friday, March 18

  1. Can a Turing-decidable language have a subset that is not Turing-decidable?
  2. Prove that the Turing-decidable languages are closed with respect to complementation.
  3. Prove that {⟨M⟩ | L(M) is Turing-decidable} is not Turing-decidable.

For Wednesday, March 16

  1. Use a diagonalization argument to show that there are more sets of natural numbers than natural numbers.
  2. Suggest a way to construct a one-to-one correspondence between natural numbers and finite sets of natural numbers, thus showing that the set of finite sets of natural numbers is countable.
  3. Starting with a finite alphabet Σ, let's say that any finite sequence of symbols of Σ constitutes a word, any finite sequence of words constitutes a sentence, and any finite sequence of sentences constitutes a paragraph. Is the set of all paragraphs countable? Justify your answer.

For Monday, March 14

  1. What happens when the length of the list that apply receives as its second input is does not match the valence of the function that it is given as its first input?
  2. Consider a total function defined-at-zero? that inputs the encoding for a singularly partial recursive function f and outputs 1 if f(0)↑ and 0 if f(0)↓. Is defined-at-zero? a partial recursive function? If so, suggest a program for it; if not, show that it is not.
  3. Consider a total function quickly-defined? that inputs the encoding for a partial recursive function f and the encoding for a list (x0, ...,  xn - 1) of natural numbers, and outputs 1 if there is a short computation with f as its program and (x0, ...,  xn - 1) as its inputs, or 0 if there is no such computation; here a “short” computation is one that takes no more than 10100 steps (applications of primitive functions and composition, recursion, or minimization). Is quickly-defined? a partial recursive function? If so, suggest a program for it; if not, show that it is not.

For Friday, March 11

  1. Propose a way to represent each elementary function and each construction using composition, recursion, and unbounded minimization as a Scheme datum. Then write a procedure that takes such a datum as its argument and returns the natural number that encodes it, in the encoding system proposed in §11 of the handout on recursive function theory.
  2. Define a primitive recursive function codesize that inputs the encoding for a partial recursive function and outputs a measure of the complexity of the “program” that computes it, counting 1 for each reference to an elementary function, 1 plus the sum of the codesizes of all of the composed functions in a composition, 1 plus the sum of the codesizes of the functions that yield the base case and the recursive step in a recursion, and 1 plus the codesize of the operand predicate in an unbounded minimization.
  3. Define a primitive recursive function successor-applications that inputs the encoding for a computation and returns a tally of the number of times the successor function is applied to an argument in the course of that computation.

For Wednesday, March 9

  1. The partial function halve has one input. If that input is even, halve outputs the result of dividing the input by two; if the input is odd, halve does not output anything (i.e., it is undefined for odd inputs). Prove that halve is a partial recursive function by constructing a definition for it, using the notation introduced in section 10 of the handout on recursive function theory.
  2. In the previous study question, one might be tempted to define halve as [¿1 even? mist1 [∘21 quotient pr01 two1]]. But this construction results in a partial function that is everywhere undefined; it's mist1 under another name. Explain why.
  3. Show that, for every primitive recursive function f, there is a partial recursive function f' such that f'(x0, ..., xn - 1)↑ if f(x0, ..., xn - 1) = 0, and f'(x0, ..., xn - 1) = f(x0, ..., xn - 1) otherwise.

For Monday, March 7

  1. Prove that the function list-max, which inputs the encoding for a list and outputs the greatest element in that list (or 0, if the list is empty), is primitive recursive. (Hint: First define max, which takes two inputs and returns the greater one.)
  2. Define a list-generation operator ⋆⃑n so that, for any function f of valence n + 1 and any natural numbers x0, ..., xn, [⋆⃑n f](x0, ..., xn - 1, xn) is the encoding of the list (f(x0, ..., xn - 1, 0), f(x0, ..., xn - 1, 1), ..., f(x0, ..., xn - 1xn - 1)). Show that, if f is primitive recursive, so is [⋆⃑n f].
  3. Theorem 9.4 in the handout defines an analogue of Scheme's forall? procedure. How would you adapt the theorem and its proof to show that Scheme's exists? procedure also has an analogue in the theory of primitive recursive functions?

For Friday, March 4

  1. Is the function swap-sides, which takes the encoding for a pair as its input and outpus the encoding for a similar pair, but with car and cdr reversed, primitive recursive? Assume that we don't care what swap-sides(0) is.
  2. What function would one define by applying the iteration operator ⌾0 to the double function?
  3. Using iteration, define a primitive recursive function repl that takes three inputs -- the size of an alphabet, the encoding for a string on that alphabet, and a natural number used as a repetition factor -- and outputs the encoding for a string consisting of that many repetitions of the given string. (For instance, since the encoding for the string abbac on the alphabet {a, b, c} is 159, repl(3, 159, 4) should be 2290903800, which is the encoding for abbacabbacabbacabbac.)

For Wednesday, March 2

  1. Using the notation introduced in §3 of the handout on recursive function theory, name the projection function that outputs the next-to-last of its seven arguments.
  2. Define the factorial function on natural numbers in the style introduced in §3 of the handout, thus proving that this function is primitive recursive.
  3. Introduce a bounded existential quantifier into the notation developed in §§1-6 of the handout, analogous to the bounded universal quantifier introduced in §6. Show that, for any primitive recursive function p of valence n + 1, the predicate ∃p such that ∃p(x0, ..., xn - 1xn) is 1 if p(x0, ..., xn - 1x) > 0 for some x ≤ xn and 0 otherwise is also primitive recursive. (Hint: Existential quantification is definable in terms of universal quantification and negation, more or less as or is definable in terms of and and not.)

For Monday, February 28

  1. Explain why, in step 2 of the description of the operation of the Turing machine S in the proof of Theorem 4.7, Sipser makes an exception for the case in which n = 0.
  2. Show that the language {⟨AB⟩ | A and B are deterministic finite automata and A accepts every string that B accepts} is decidable.
  3. Show that the language {⟨AB⟩ | A and B are pushdown automata and A accepts every string that B accepts} is not decidable.

For Friday, February 25

  1. Design a semi-Thue process Π in which every string of the form w#w, where w ∈ {0, 1}*, can be derived from the initial string #.
  2. Show that, for any Turing machine M, every string that can be derived from a start string of the form #q0s# in the semi-Thue process ΠM constructed from M by the method described in the second section of the handout on semi-Thue processes contains exactly one symbol denoting a state of M.
  3. Every context-free grammar can be regarded as a semi-Thue process in which the productions have a certain restricted form. What does this show about the relationship between context-free and Turing-recognizable languages?

For Wednesday, February 23

  1. Suggest a search strategy for finding an integer root of a given polynomial that will always succeed if any such root exists. (Note that the supposed strategy envisioned in exercise 3.7 [page 160] is bogus; make sure that your proposal does not suffer from the same defect.) Explain what Matijasevič's theorem shows about your strategy.
  2. In discussing the need to encode any datum or collection of data as a string in order to provide it as input to a Turing machine, the author of our textbook says, "The encoding itself can be done in many reasonable ways. It doesn't matter which one we pick because a Turing machine can always translate one such encoding into another." What kinds of data values might be particularly difficult to encode as strings? Are there any systems of encoding that might not be interconvertible by Turing machine?
  3. Consider the language L = {s | s = 1 if Hesiod's birthday was May 12 and s = 0 if it was any other day} on the alphabet {0, 1}. On one hand, since Hesiod's birthday is unknown and there is no way for a Turing machine to discover it, it would appear that this set is not Turing-decidable. On the other hand, regardless of the date of Hesiod's birth, L is finite, and all finite sets are Turing-decidable, so it would appear that L is Turing-decidable. Resolve this paradox.

For Monday, February 21

  1. Prove that the class of Turing-decidable languages is closed under complementation.
  2. Suppose that, instead of adding more tapes to a classical Turing machine, we add a finite number read/write heads, so that in a single cycle of operation, we can read the contents of the tape cell under each head, write a new symbol into any or all of those tape cells, and move each head independently left or right. Show informally that machines that incorporate this mod recognize exactly the same languages that classical Turing machines recognize.
  3. In our textbook's discussion of enumerators (pages 152 and 153), the author does not specify whether an enumerator's print instruction transmits the entire contents of its work tape to the printer, or just the symbol currently under the head. Show informally that either kind of enumerator can simulate the other.

For Friday, February 18

  1. List the successive configurations of the Turing machine M1 (from example 3.9 in the textbook) as it processes the input string 01#00.
  2. Design and implement a deterministic Turing machine that decides the language {w | w contains more 0s than 1s} (on the alphabet {0, 1}).
  3. Show that every finite language is Turing-decidable.

For Wednesday, February 16

  1. Do exercise 2.32 from the textbook (page 131).
  2. Show that the union of any two context-free languages is context-free.
  3. Find two context-free languages whose intersection is not context free (thus proving context-free languages are not closed under intersection).

For Monday, February 14

  1. Construct a pushdown automaton that recognizes the language {w | w contains exactly twice as many occurrences of a as occurrences of b} (on the alphabet {a, b}).
  2. Using the construction described in the proof of lemma 2.21 in the textbook, construct a pushdown automaton corresponding to grammar G4 in example 2.4 of the text (page 103).
  3. Disemvoweling is the practice of removing all vowels from a string (typically a post in an Internet forum), obtaining a reduced string from which the original content can usually be recovered, at the cost of some time and thought. Show that, for any context-free language L, the language {w | w is a disemvoweling of v for some v ∈ L} is also context-free. (Hint: adapt a pushdown automaton that accepts L so that the adapted machine accepts the disemvoweled version instead.)

For Friday, February 11

  1. Prove that, for every regular language, there is a context-free grammar that generates it.
  2. Find a context-free grammar that generates the language {w | w has an equal number of 0s and 1s} (from example 1.74, page 80) on the alphabet {0, 1}.
  3. Do exercise 2.14 (page 129) in the textbook.

For Wednesday, February 9

  1. The set of binary numerals that denote multiples of 5 is a regular language. Show that, for this language, a pumping length of 5 is sufficient by providing a rule for partitioning any string s in this language into three pieces, s = xyz, such that (1) for each i ≥ 0, xyiz is a binary numeral denoting a multiple of 5; (2) |y| > 0; and (3) |xy| ≤ 5.
  2. A string is an even-length palindrome if, and only if, it is the concatenation of some string and its reverse. Use the pumping lemma to show that the set of even-length palindromes on the alphabet {a, b, c} is not a regular language.
  3. Use the result of the previous question and the closure properties of regular languages to show that the set of all non-palindromes on the alphabet {a, b, c} -- the set of all strings that are not identical to their own reversals -- is not a regular language.

For Monday, February 7

  1. Give a regular expression on the alphabet {a, b, c} whose value is the language comprising exactly those strings that begin with ab, end with bc, and contain at least one occurrence of the substring ca.
  2. Using the construction in lemma 1.55, construct a nondeterministic finite automaton that recognizes the language that is the value of the regular expression a(c ∪ bc)*(b ∪ ɛ).
  3. Using the construction in lemma 1.60, construct a regular expression whose value is the language recognized by the nondeterministic finite automaton shown in part (b) of exercise 1.16 (page 86). (You'll need to figure out how to convert a nondeterministic finite automaton into an equivalent GNFA; the lemma assumes that you're starting with a deterministic finite automaton.)

For Friday, February 4

  1. Construct a deterministic finite automaton with the alphabet {a, b, c} that accepts a string if, and only if, that string begins with ab, ends with bc, and contains at least one occurrence of the substring ca.
  2. Construct a deterministic finite automaton with the alphabet {0, 1} that accepts a string if, and only if, that string, if interpreted as a binary numeral, denotes a natural number that leaves a remainder of 1, 3, or 4 when divided by 5.
  3. Consider the nondeterministic finite automaton with states {q0, q1, q2, q3, q4, q5, q6}, alphabet {A, 2, 3}, the transition function defined by the table below, start state q0, and accept states {q6}. What language does this NFA recognize?
    A 2 3
    q0 {q1, q4} {q2} {q3}
    q1 {q2, q5} {q3} {q4}
    q2 {q3, q6} {q4} {q5}
    q3 {q4} {q5} {q6}
    q4 {q5} {q6}
    q5 {q6}
    q6
  4. Construct a deterministic finite automaton equivalent to the nondeterministic finite automaton in the preceding question.

For Monday, January 31

Do exercises 8 through 13 of the lab on LATEX and submit the resulting .tex files to me.

For Friday, January 28

Do exercises 1 through 9 of the lab on LATEX and submit the resulting .tex files to me.

For Wednesday, January 26

  1. The cardinality of a class is the number of members it has. Let A1, ..., Ak be any classes, and let a1, ..., ak be their respective cardinalities. What is the cardinality of A1 × ... × Ak? What is the cardinality of A16, the class of 6-tuples of members of A1?
  2. A binary relation R is asymmetric if, and only if, for every x and y in its domain, xRy ⇒ ¬yRx. Prove by contradiction that no reflexive relation on the domain of natural numbers is asymmetric.
  3. Prove by mathematical induction that, for every natural number n, the sum of the first n terms of the geometric series 50, 51, 52, ... is (5n - 1)/4.

For Monday, January 24

  1. In section 0.1 of our textbook, Sipser formulates two questions that are at the heart of this course:
    1. What are the fundamental capabilities and limitations of computers?
    2. What makes some problems computationally hard and others easy?
    What answers would you give to these questions as you enter the course? How would you justify your answers?
  2. Sipser proposes to address these questions by methods that are essentially mathematical. Is this a plausible approach? Are these questions mathematical in nature? Is the theory of computation a branch of applied mathematics?
  3. Define the term ‘problem’, as it appears in Sipser's second question.

· ·
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License.

This text is available on the World Wide Web as

http://www.cs.grinnell.edu/~stone/courses/automata/study-questions.html


John David Stone · stone@cs.grinnell.edu