Problem Set 1 [PDF] is now posted, and is due at the beginning of class (2:00pm) on Tuesday, 2 February. The LaTeX template for PS1 is here: ps1template.tex. [Note: Problem 4 has been removed from PS1, see comment below for details.]


Problem Set 1Problem Set 1 [PDF] is now posted, and is due at the beginning of class (2:00pm) on Tuesday, 2 February. The LaTeX template for PS1 is here: ps1template.tex. [Note: Problem 4 has been removed from PS1, see comment below for details.] 11 comments to Problem Set 1 

This work is licensed under a Creative Commons AttributionNoncommercialShare Alike 3.0 United States License. 
In Sipser, a graph G is a subgraph of a graph H if:
1.) The nodes of G are a subset of the nodes of H
2.) The edges of G are the edges of H on the corresponding nodes
Unless I’m misreading something, this means that ALL of the edges in H that connect nodes in G must be present in G. This idea is also mimicked in the example (Figure 0.14). In other references, I’ve seen condition 2 to be more relaxed, in that the subgraph can have any SUBSET of the edges of H on the corresponding nodes.
Does this mean that, according to Sipser, a subgraph is entirely determined by the choice of nodes from the original graph?
Yes, that is correct. The way Sipser defines the subgraph, the subgraph is completed determined by the subset of nodes. All edges involving just nodes in the subgraph are included in the subgraph. You’re right that there could be other ways to define subgraph that could make sense, but the way it is defined as a subset of nodes and all edges among those nodes is the standard way it is defined.
Navid Hosseini pointed out that Problem 4 is seriously broken! The text of the question suggests that the alternative rule to “Rock crushes Scissors” is “Scissors is dulled by Rock”. In both cases, the implied beats relation is “Rock beats Scissors”. This makes the question stupid since the beats relation is obviously the same as the one Sipser defined.
I misread the RPS Society’s question as implying instead that “Scissors beats Rock”, which would make this a more interesting question.
So, Problem 4 is removed from PS1. If you want to try and answer the question I meant to ask, you are welcome to do so, but there is no credit for Problem 4, which now seems like an even sillier question than what it was intended to be!
Sorry for the confusion if you’ve been confused by this question.
Using LaTeX, what is the best/easiest way to draw DFA’s for the homework problem set, for example problem 8?
The easiest way is to just handdraw the DFA on the paper after you print it out with the other answers. This is fine, but has the drawback that you don’t have the DFA electronically.
Another approach is to draw it using some other drawing program like xfig, Visio, or PowerPoint, and generate a png image using that program. Then, you can include the image in your .tex document using the graphics package. Add this line to the preamble of the .tex file (where the other \usepackage commands are):
\usepackage{graphics}
Then, where you want the image to appear use:
\begin{center}
\includegraphics{imagefile.png}
\end{center}
You can add an optional scaling parameter if the image size is too big, e.g.,
\includegraphics[0.3]{imagefile.png}
If you’re a real LaTeX hacker, you can use LaTeX commands to draw the DFA directly. The VauCanSonG package (http://wwwigm.univmlv.fr/~lombardy/VaucansonG/) defines some LaTeX commands for drawing DFAs. I don’t recommend using this though, its more trouble than its worth for this.
These are all small details of the problems and it’s entirely possible I’m reading too much into things but…
for all of problem 8, I stated that l is an element of letters and d is an element of digits. Is this okay to use for my DFA instead of writing out the values?
Also, for problem 8d, should we assume that once we see ‘/*’ it is a comment? Or should we go further and wait until we see ‘/* some combination of numbers and letters */’ with the closing ‘*/’?
> for all of problem 8, I stated that l is an element of letters and d is an element of digits.
> Is this okay to use for my DFA instead of writing out the values?
(I think you mean problem 9 as numbered originally, even though problem 4 is dropped.)
Yes, it is fine to use notations you introduce to represent sets of symbols in your DFA.
> Also, for problem 8d, should we assume that once we see ‘/*’ it is a comment?
> Or should we go further and wait until we see ‘/* some combination of numbers and letters */’ with the closing ‘*/’?
The way a traditional comment is defined, /* marks the start of the comment, and the first */ after it ends the comment. Your DFA should accept exactly the language of strings that do not contain either type of comment. For example,
“this is /* not a valid comment”
is in the language since the open comment is never closed in this string.
Regarding Problem 3b:
On page 11 of Sipser a subgraph is defined as: “We say that a graph G is a subgraph of H if the nodes of G are a subset of the nodes of H…”
I was wondering if G contained no nodes, could it still be a subgraph of H? In other words, can a subgraph have zero nodes in general? Since the empty set is a subset of all sets, I was wondering if an empty graph would also be a subgraph of all graphs.
I think you’ve already answered your own question! The empty set is indeed a subset of all sets, and there’s nothing in the definition of a graph that says it has to have at least one node.
Regarding Problem 8:
Does a DFA have to have an exit path for every element of the language. For example is the elements in the language are a,b can a state have an arrow leading away or looping back for a but no arrow for b. If so would the machine simply exit if it came to this state and read in a b from the input string.
The transition (delta) function for a DFA should be completely defined. That means the transition function provides a mapping from every input pair to an output state. When we draw DFAs, though, it is not necessary to draw the full transition function. When there is no arrow from a given state on a particular symbol, that means the DFA is stuck if it sees that symbol in that state. In the transition function, this would be a transition to a permanent rejecting state (that is, a nonaccepting state with an arrow back to itself on every input symbol). To keep the DFA diagrams more readable, though, we often do not draw the permanent rejecting state or the transitions to it, but instead assume if there is no transition for a symbol that the input is rejected.
For the PS, it is better to be explicit and show the full transition function (putting in the permanent reject state), since this way you know your DFA is completely defined. But, it is acceptable for full credit to leave them out since this is done by convention and in many of the diagrams in the Sipser book.