ShaughanLavine - 09 Mar 2010 - 19:26 - 1.26 " class="twikiLink">TWiki> Courses Web>HomeworkReview (08 Nov 2009, TWikiGuest)EditAttach

Homework

First of all, a set of strings is decidable if you can tell whether or not a string is in the set. The way we implemented that is by having a machine that takes any string as input and halts with a yes (%$\fbox{\vspace*{0.2ex}}$%) or no (anything else) as output.

A set of strings is enumerable if there is a machine that eventually prints every member of the set and nothing else.

Given an enumeration of a set, we can tell if a string is in the set: It will eventually get enumerated, at which point the answer is yes. However, we cannot tell if a string is not inally prints every member of the set and nothing else.

Given an enumeration of a set, we can tell if a string is in the set: It will eventually get enumerated, at which point the answer is yes. However, we cannot tell if a string is not in the set: All we know is that it hasn't been listed yet, we have no computable way to know that it won't eventually be listed. R.e. sets are occasionally called "semi-decidable."

Enumerating a set: Lots of you forgot the empty string. No one exhibited a register machine that does the job, and it isn't that hard, so let's do it. Arbitrarily, pick the alphabet 0–9.

0 PRINT
1 IF %$R_{0}$% is empty THEN 2 ELSE 4 7 10 13 16 19 22 25 28 31 34
2 LET %$R_{0}=R_{0}+0$%
3 IF %$R_{1}$% is empty THEN 0 ELSE 37 37 37 37 37 37 37 37 37
4 LET %$R_{0}=R_{0}-0$%
5 LET %$R_{0}=R_{0}+1$%
6 IF %$R_{1}$% is empty THEN 0 ELSE 37 37 37 37 37 37 37 37 37
.
.
.
34 LET %$R_{0}=R_{0}-9$%
35 LET %$R_{1}=R_{1}+0$%
36 GOTO 1
37 LET %$R_{1}=R_{1}-0$%
38 LET %$R_{0}=R_{0}+0$%
39 IF %$R_{1}$% is empty THEN 0 ELSE 37 37 37 37 37 37 37 37 37 37
40 HALT

Homework: We have two alphabets, %$\mathcal{A}$% and %$\mathcal{B}$% and a function %$f$% from %$ \mathcal{A}^{*} $% to %$\mathcal{B}^*$%. # is a symbol not in either alphabet.

Prove that the following are equivalent:

  1. %$f$% is computable.
  2. %$\{w\#w':f(w)=w'\}$% is enumerable.
  3. %$\{w\#w':f(w)=w'\}$% is decidable.

Proof: To show three things equivalent, we show %$a \Rightarrow b$%, %$b\Rightarrow c$%, and %$c\Rightarrow a$%.

%$a \Rightarrow b$%: We are given that %$f$% is computable. We show how to enumerate the set:
We take a machine that enumerates %$ \mathcal{A} ^ {*} $% and do the following: for each output %$w$%, we compute %$ f(w) $%, form %$w\#f(w)$%, and print it. We then go to the next member of %$ \mathcal{A}^{*} $%.

%$b\Rightarrow c$%:
Given an enumeration of the set, we must show how to decide if a word in %$(\mathcal{A}\cup\mathcal{B}\cup\{\#\})^*$% is in the set.

Step 1. See if the word is of the form %$w\#w'$%, where %$w\in\mathcal{A}^*$% and %$w'\in\mathcal{B}^*$%. If not, the word is not in the set.
Step 2. Start listing members of the set. For each one, check to see if the part before the # is the same as the part before the # in the word we are testing. If it is, check to see if the two words are the same. If yes, our word is in; if no, it is not. Since %$f$% is a function, the enumeration includes exactly one word that begins with each possible %$w\in\mathcal{A}^*$%, and so this procedure always terminates.

%$c\Rightarrow a$%: We have that the set is decidable. We must show that %$f$% is computable. Given a word %$w\in\mathcal{A}^*$%, list all words of the form %$w\#w'$% for all %$w'\in\mathcal{B}^*$%, and test each one for membership in the set. When you find one that is in, print the corresponding %$ w' $% and halt.


Show that a set %$\mathcal{W}$% is r.e. if and only if there is a program %$P$% such that for %$w\in\mathcal{W}$%, %$P:w\longrightarrow\mbox{halt}$% and for %$w\notin\mathcal{W}$%, %$P:w\longrightarrow\infty$% One direction is "easy." For the other direction, we need to "simultaneously" run the machine on all inputs. We do that by running it on the first input for one step, then the first two inputs for two steps, and so forth.

To do that, we are making use of the idea that one machine can simulate another. That is, we are using an intuitive version of something like the following theorem:

(There is a universal Turing machine.) -- ProfessorShaughanLavine - 14 Feb 2005

Topic revision: r6 - 08 Nov 2009 - 11:44:09 - TWikiGuest
  • ShaughanLavine - 18 Jan 2010 - 19:22 - 1.19 " class="twikiCurrentWebHomeLink twikiLink">web-bg-small Courses


 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback