Homework 4 Solutions - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Homework 4 Solutions

Description:

Assume that L is enumerable in lexicographic order by E. Construct decider M for input w: ... Combined with 1 and 2, this implies L1 m L2 using the same fn f ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 14
Provided by: petersg
Category:

less

Transcript and Presenter's Notes

Title: Homework 4 Solutions


1
Homework 4Solutions
1. Are the following languages (i) decidable?
(ii) recognizable? (iii) co-recognizable? A) L
i Mi-1(i) 0 j ltj-1gt does not accept
j I and II) Assume Mk accepts L. Then k1
is in L Mk accepts k1 Mk(k1) 1 k1 is
not in L Also k1 is not in L Mk accepts k1
Mk(k1) 1 k1 is not in L This contradiction
implies that L can not be recognizable and hence
not decidable
2
A III) L j ltj-1gt does accept j is
recognizable by algorithm simulate ltj-1gt on j
and accept iff ltj-1gt accepts j B) L (M,?) M
a T.M. and ? a letter in Ms tape alphabet such
that there exists input w s.t. M ever writes ? on
the tape while computing on w I) not decidable
(see III) II) L (M,?) ? w,n M writes?? on
the tape within n steps while computing on w
This is a ?1 description of L. Therefore L is
recognizable. III) We show ATM ltm L and describe
f TMs x 0,1 TM x 0,1 f
computable for all (M,j), (M,j) in ATM iff f(M,j)
in L
3
For all (M,j), let f(M,j) (M,?) where M a
machine on input w, M does 1) simulate M on
j 2) If M accepts j, write ??on the tape.
Otherwise, dont write ? on the tape ? any
symbol not in Ms tape alphabet C) L (M,w)
M ever attempts to move its tape head to the left
when it is in the left-most square of the tape
while computing on w I) L is not decidable (see
III) II) L (M,w) ? n s.t. M attempts to move
its tape head to the left when it is in the
left-most square of the tape while computing on w
and does this within the first n steps So L is
recognizable (in ?1)
4
III) We show ATM ltm L and describe f TMs x
0,1 TM x 0,1 f computable for all
(M,j), (M,j) in ATM iff f(M,j) in L For all
(M,j), let f(M,j) (M,w) where M a machine
on any input x, M does 1) simulate M on j 2) If
M accepts j, keep moving to the left forever.
Otherwise, make certain to avoid moving too far
to the left w 0
5
D) L (M1,M2) there exists a string w s.t.
T.M.s M1 and M2 both halt on w I) No, see
III II) L (M1,M2) ? w,n M1 halts on w
within n steps and M2 halts on w within n steps
So L is recognizable (in ?1) III) We show LHalt
ltm L (where (M,j) M halts on j) ) f TMs x
0,1 TMs x TMs f computable for all M, M in
LHalt iff f(M) in L For all M let f(M) (M,M)
where M a machine on any input x, M does on
input w, M simulates M on j
6
E) L Ldrift (M,w) T.M. M never halts
and never enters the same configuration twice on
input w I) not decidable -- see II II) We show
LU ltm L and describe f Z TM x 0,1 f
computable and for all j, j in LU iff f(j) in
L For all j, let f(j) (M,w) where M a machine
on any input x, M does 1) simulate ltjgt on j,
keeping track of every configuration ltjgt enters
on input j 2) a) If ltjgt accepts j, M halts and
accepts b) If ltjgt rejects j, M drifts
(moves head to the right forever) c) If ltjgt
loops (enters the same configuration twice), M
drifts d) Otherwise, the simulation
continues (and implicitly M drifts) w 0
7
2. Prove that L is decidable iff there is an
enumerator E that outputs the elements of L in
lexicographic order.
  • Proof
  • Assume that L is decidable by M. Construct
    enumerator E
  • Go through inputs w in lexicographic order. Run
    M on w. Output w iff M accepts w.
  • Claim ?w, M accepts w ? E outputs w
  • Proof In the enumerators run, each input w
    will be fed to M eventually and output by E if M
    accepts it

8
  • Assume that L is enumerable in lexicographic
    order by E. Construct decider M for input w
  • Note that if L is finite, then L is automatically
    decidable.
  • If L is infinite, run E until a string x is
    output such that x occurs lexicographically after
    w. If w has been output, accept. Otherwise,
    reject.
  • Claim If L is infinite, then ?w, M accepts w
    ? E outputs w
  • Proof In the enumerators run, eventually some
    input that occurs lexicographically after w will
    be output. If w has not been output before this
    occurs, then it will not be output later and M is
    correct in rejecting w. If w is output by E,
    then M is correct in accepting w.

9
3. Two sets have the same cardinality iff there
is a 1-to-1, onto map f between the two. Show
that the integers (Z) and the rationals (Q) have
the same cardinality Notice that we can view Q
as a subset of ZxZ. Lay out ZxZ on the x-y plane
and with (x,y) y lt 0 or y lt 0 or GCD(x,y) gt
1 crossed out Define f Z Q by
dove-tailing f(i) the ith element in the
dove-tailing sequence Define f Z Q such
that f(x) -f(-x) Define f(0) 0
10
4.a Prove that ? L1 , L2 , if L1 ltm L2 then
L2 is recognizable ? L1 is recognizable and
state the contrapositive If L1 ltm L2 by f and L2
is recognizable by M2, then the following
algorithm accepts any input w iff w ? L1
(recognizes L1) run Mf on w to get f(w). Then
simulate M2 on w. ? L1 , L2 , if L1 ltm L2 then
L1 is not recognizable ? L2 is not recognizable
11
4b Prove the above statement replacing
recognizable with co- recognizable Note
that, by problem 6, if L1 ltm L2 then L1 ltm L2.
Therefore, if ? L1 , L2 , if L1 ltm L2 then L2 is
recognizable ? L1 is recognizable ? L1 , L2 ,
if L1 ltm L2 then L1 is not co-recognizable ? L2
is not co-recognizable
12
5. Prove that S0 S1 ? P1 i.e. ? L, L
decidable ? L recog. And L co-rec Pf. (?) if L
is recog. by M1 and co-rec., by M2, then one
can decide L by running M1 and M2 in parallel.
If M1 accepts, then the decider accepts if M2
accepts, then the decider rejects. Note that
exactly one of M1 and M2 will accept. Claim ?
w, our decider acc w iff M1 acc w. (?) if L is
decided by M, then it is recognized by M and
co-recognized by M, a version of M with the
accept and reject states switched. Claim L(M)
L(M)
13
6. Prove that if L1 ltm L2 then L1 ltm L2 Pf Let
f be a mapping reduction from L1 to L2 . This
implies that 1. F domain(L1 ) ? domain(L2) 2.
F is computable 3. ? w, w ? L1 ? f(w) ? L2 Note
that 3 ? w, w ? L1 ? f(w) ? L2 follows from 3.
Combined with 1 and 2, this implies L1 ltm L2
using the same fn f
Write a Comment
User Comments (0)
About PowerShow.com