Study questions
Automata, formal languages,
and computational complexity
CSC 341 · Spring, 2011 ·
Department of Computer Science
·
Grinnell College
| q | a | b |
| c | d | b |
| # | s | # |
| # | t | # |
({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?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.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(x, x)
for every natural number x -- except that,
if f(x, x) 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.)apply
receives as its second input is does not match the valence of the function
that it is given as its first input?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.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.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.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.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.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.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.)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.double 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.)| 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 | ∅ | ∅ | ∅ |
Do exercises 8 through 13 of the lab on LATEX and submit the resulting .tex files to me.
Do exercises 1 through 9 of the lab on LATEX and submit the resulting .tex files to me.
·
· 
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
created January 4, 2011 · last revised
May 13, 2011