Here are questions and answers on HW#1, due 24 September 2003. Questions are in black, answers in blue.
For questions 3 and 4, if I can show a procedure to convert the 17-letter PDA and 17-letter Turing Machine into DFAs, would this prove that L(PDA-17) and L(TM-17) are regular? Or would there be additional things that need to be proved?
If you can design a DFA that successfully, for all strings, predicts what the PDA-17 or the TM-17 will do, then you may conclude that the languages are regular, yes.
In question 5, we must prove that A is r.e. iff there exists a machine M such that A=H(M), where H(M) is defined as the set of strings such that M hangs on w. From this, is it true that H(M) is equal to complement of L(M), where L(M) is the set of strings w that M accepts and halts on?
No. A particular machine on a particular string might accept, reject,
hang, or loop. Looping is running forever without doing any of the other
things. So H(M) is a subset of the complement of L(M), but not
necessarily equal to the complement of L(M).
One half of this proof will be to take the machine N, such that A=L(N)
(known to exist because A is r.e.) and design a _new_ machine M so that
A = H(M). The other will be to assume that M exists with A = H(M) and
then design a suitable N such that A = L(N).
This is a general question not directly related to Homework 1.
Can you please suggest which relevant sections of Papadimitriou, Sipser, or some other book, we should be reading before/after each lecture to gain additional understanding of the material to be able to better complete homework assignments?
What are the corresponding chapter / page numbers that we are expected to read for a given lecture number, if any?
The Spring 2003 syllabus includes section numbers of [P] and/or [BE] for every lecture.
Maybe some suggested reading assignments, or a reading schedule. There is a lot of material in the books, and sometimes it is not clear to me what material in the books is most relevant for a particular lecture or homework assignment.
I have some questions on Homework 1.
1. In question 5, I don't believe that it is *always* necessary for the machine M such that A=H(M) to exist. A counter-example to this would simply be to have a Turing machine M that accepted all strings. In other words, every state is an accepting state, and the Turing machine doesn't hang on or reject any string. This Turing machine that accepts all strings could probably just accept without bothering to look at its input. In this case, machine M such that A=H(M) does not exist unless we just want to have it accept the empty string. Is this counter-example valid?
If M accepts all strings, then H(M) is the empty language. Since the empty language is r.e., you have to include this possibility but it doesn't pose any problem. The empty language is r.e. because it is L(N) where N is a machine that never accepts any string.
2. This is related to question 6. When a Turing machine reads the empty string, does the tape head move just as if it read a regular letter, or does it just stay put? Is the empty string represented by a letter on the tape? I flipped through the book (Sipser, Papadimitriou, etc.) and could find examples of a Turing machine reading a "blank", but not reading an "empty string". Is a "blank" the same thing as an "empty string"?
A blank is a kind of letter that is in the tape alphabet of the TM but
not in the input alphabet. When we "start the TM M on input w", this
means that the head of M starts on the leftmost square of the tape, which
contains a blank. To the right of this square are the letters of w in
order, then another blank. In the case that w is the empty string, there
_are_ no letters in w and the entire tape is blank.
Sipser carefully defines what it means for a TM to accept a string --
look at what his definition becomes if the input string is empty.
Would using nondeterministic or multitape Turing machines in question 6a be
helpful?
Possibly, though the point of the question is the definition of
"recursive" and "r.e." in terms of deterministic machines and I would
answer the problem only referring to deterministic machines.
3. Questions 3 and 4 seem to be similar to Homework Assignment 1, questions 2 and 3 from the Summer 2003 semester. Is this a valid observation?
They are similar in that you're proving languages to be regular, but the proofs this time are rather different, and in fact are somewhat easier.
4. In question 1, is proving that A is regular enough to prove that it is DFA-recognizable? Do I also have to prove the reverse direction of the if-and-only-if statement, or is it enough to prove that A is regular?
Yes, you may quote Kleene's Theorem for this direction of the proof. The hard direction is to show that if the language is DFA-recognizable, it has a regular expression of the specified form.
Question 6 of HW#1 states thats "if u and v are any two strings of the same length that differ in exactly one position, then exactly one of u and v is in A."
It's obvious from the condition that the two strings of the same length will differ by a single symbol, a : a is in {0,1}. Therefore can we arbitarily set a condition and decide as to whether u or v is in A ?
It depends what you're trying to prove, because that will
determine what, if anything, you know about u and v. If you
are trying to prove part (a) and you have an idea about how
to design M, then you may break into cases to show that your
M works if w is in A and also works if w is not in A. But
of course M doesn't know which case it's in unless it can
find out itself.
Remember that because A is r.e., you are given that there
exists a machine N such that L(N) = A. N will probably be
useful in constructing M.
For question 3 and 4 of HW#1, to prove that L(M), where M is a PDA in Question 3 and M is a Turing Machine in Question 4, is regular:
You must show that for any M meeting the conditions of the problem, L(M) is a regular language. So assuming a particular L(M) will not do. But you may be able to find a specific condition such that (1) if M has the given property, then L(M) has the condition, and (2) every language with the condition is regular.
For Q(2) in HW#1, can we assume the following:
Since A is subset of {a}*, then L(a*) = {a^i : i in N} Therefore proof that A = {a^i : i belongs to N} is a CFL ?
It is true that the language a* is context-free, as it has the grammar "S goes to aS; S goes to emptystring". If A is a subset of a*, then the set X = {i: ai is in A} might be any subset of N. Your job here is to explain for what possible X the language A is or isn't context-free.
Also is it possible that a non-regular language be a CFL ?
Yes, the language {a^nb^n: n in N} is context-free, because it has the grammar "S goes to aSb; S goes to emptystring". But this language is not regular. Any unary context-free language is regular, but that is what you are trying to prove here.
If A is a CFL, then according to the CFL Pumping Lemma, when we say z=uvwxy, then is it always true that |z| = |uvwxy| ?
Yes, because if z and uvwxy are the same string then they have to have the same length.
If not then if |z| < 5 assuming each of u,v,w,x,y are of atleast length 1, then how can we break it up in u,v,w,x and y ? Do we use the empty string ? If so how ?
Only v and x are guaranteed to be no-empty -- u, w, and y might be the empty string. But remember that the conclusion of the CFL Pumping Lemma only holds for sufficiently long strings z. Remember the proof -- we need z to be long enough so that its parse tree must contain a path with a repeated nonterminal.
I attended your CMPSCI 601 (Fall 2003) Lecture 1(in video) and have a question on DFA and Regular Expression which I think is also part related to the first question in the HW#1.
Welcome to the class!
Question:
If A is a language over only a single-letter alphabet sigma = {a}, then is it not always true that there will always exists a DFA D, that will accept a non-empty strings of any format ?
Since a belongs to sigma, then a belongs to Regular Expression(sigma). Also since a* is a regular expression , so is a^n. Then from this is it not possible to have a DFA which will accept a string of any format created out of any combination of the symbol a ?
You are confusing strings with languages, I think.
It is true that for any string w, there exists a DFA
that will accept w. But it is not true that any _language_,
even on a one-letter alphabet, is the language of some
DFA. For example, consider the language {a^n: n is a perfect
square}. This language does not obey the regular-language
Pumping Lemma, so it cannot be regular. Also, it has an
infinite number of Myhill-Nerode classes so it is not regular.
Let me prove the latter fact as I'm going to post this. It's
a good example of how to use the M-N Theorem.
So I need to find a number k such that i+k is a perfect square
and j+k isn't. This takes a little thought, but here is one
of many possible answers. Let k be j^2 - i. Then i+k is j^2
which is a perfect square. And j+k is j^2 + (j-i), which
cannot be a perfect square because the next perfect square
after j^2 is (j+1)^2 = j^2 + 2j + 1, and j^2 + (j-1) is clearly
less than that.
Last modified 23 September 2003