CSE396, Spring 2016 Problem Set 1 Due Thu. 2/11 in class

advertisement
CSE396, Spring 2016
Problem Set 1
Due Thu. 2/11 in class
Reading is the same as before: we are in pages 1–69 having covered much of section 1.1 and a
little from the start of section 1.3. Tuesday’s lecture will introduce NFAs from section 1.2 but
then revert to section 1.1 to cover closure under complements—explaining why the “switch
accepting and nonaccepting states” idea works for DFAs but not for NFAs. Recitations will
be covering closure under union and intersection via Cartesian products of DFAs—actually
the text on pages 45–46 emphasizes union but the “light bulbs” example from the Thu. 2/4
lecture makes more sense with intersection (per footnote on p46), and I will tie up in lecture
how the Cartesian idea applies for other binary Boolean ops like XOR as well. (Incidentally,
my example had similar motivation to the text’s automatic-door example, which however
has 2 states and 4 atomic inputs compared to my example’s 4 states and 3 atomic inputs.
A larger difference is that mine described an asynchronous system—it doesn’t matter when
light switches are flipped—whereas the automatic-door example polls the front and rear pads
at regular time intervals in a synchronous system. That’s why “Neither” counts as an input
char and “Both” is separate from having “Front” and “Rear” in sequence.)
Thursday’s lecture will include the equivalence of NFAs and DFAs—this is on-purpose one
lecture ahead of the 2015 pace. To update the syllabus information:
Office Hours:
• K.W. Regan: Tuesdays 1–2pm and 5–6pm; Wed. 1–3pm, in 326 Davis.
• James Clay: Mondays 5–6pm, Fridays 3–4pm, in-or-near 302 Davis.
• Jingyuan Fan: Wednesdays 3–5pm, in-or-near 302 Davis.
Recitations: (note correct R3 time; no changes were made to recitations)
(R1) Mondays 8:00–8:50am, in Cooke 127A (Clay)
(R2) Mondays 4:00–4:50pm, in Cooke 127A (Fan)
(R3) Mondays 3:00–3:50pm, in Cooke 127A (Fan)
(R4) Tuesdays 10:00–10:50am, in Hochstetter 139 (Clay)
Assignment 1, due in hardcopy; please staple any multiple-sheet submission
(1) Let G be the graph with vertices V = {2, 3, 4, 5, 6, 8, 9} and edge set E consisting of all
pairs (u, v) such that the numbers u and v share a factor other than 1. (That is, u and v are
not relatively prime.) Please answer the following short questions:
(a) Is the edge relation E reflexive?
(b) Is E symmetric?
(c) Is E transitive? If you say no, please give a counterexample involving three different
vertices.
(d) Draw a picture of the graph G without including any self-loops. Is it an undirected
graph?
(e) Is G connected? If not, is there a completely isolated vertex?
(f) Does G—again without the self-loops—have a triangle?
(g) Does the complement of G have a triangle—which is the same as G having an independent
set of size at least 3? Can you find such a set without using vertex 5? (2+2+5+4+3+3+5
= 24 pts.)
(2) Take Σ = {0, 1}. Write regular expressions that express the following logical conditions
on strings x ∈ Σ∗ :
(a) x begins with a 0.
(b) x ends with a 0.
(c) x begins with a 0 and ends with a 0.
(d) x begins and ends with the same symbol (0 or 1).
Then answer: which of these conditions is most analogous to the language of the text’s
automatic-door example? Note that the text’s language has 4 inputs which could be labeled
0,1,2,3 with 3 meaning “Both,” say, and the text’s desired final state is that the door ends
up being closed. (3+3+3+3+3 = 15 pts.)
(3) Text, exercise 1.5, parts (d) and (g) only. That is:
(d) Design a DFA M that accepts all and only those strings that don’t consist of zero-or-more
a’s followed by zero-or-more b’s.
(g) Design a DFA M that accepts all and only the strings that don’t have exactly two a’s
in them.
In both cases the alphabet is Σ = {a, b}. The text suggests that you first design a DFA
M for the complements of these languages—that is, changing “don’t” to “do” in the stated
conditions—then make M by swapping accepting and rejecting states. But you can also
treat this as a case of rewriting the definitions to “Acc-Centuate the Positive, E-Liminate the
Negative. . . ” (incidentally I was wrong about it being written for Disney; it was by Johnny
Mercer and Buffalo’s own Harold Arlen). Doing this for (d) is like the Tue. 2/2 lecture example
but a little different; for (g) think of categories “zero,” “one,” “two,” and “three-or-more.”
(12+12 = 24 pts., for 63 total on the problem set)
0
Download