Kentucky Classes

Published on February 2017 | Categories: Documents | Downloads: 27 | Comments: 0 | Views: 192
of 10
Download PDF   Embed   Report

Comments

Content

 

Com plexit y Class lasses es All of our computing devices now possess two additional attributes: time and space bound bounds. s. We shall ttake ake adva advantage ntage of thi this s and classif classify ya all ll of the re recursi cursive ve sets se ts ba base sed d upon the their ir comput computational ational complexity. T his allows us to exa xamin mine e these coll colle ection ctions s w wit ith h re respec spectt to resource limit li mitations. ations. T his, hi s, in tur turn, n, might lea lead d to the discovery of special properties common to some groups of problems that inf in f lu lue ence their complexity. In this thi s m manne annerr we may lea learn rn more about the intrinsi intr insic c na nature ture of computation. We be begin, gin, a as s usual, with the for forma mall d de ef ini initions. tions. D e f i n i t i o n .  T he class class of all set setss computabl computable e in time ti me t(n) f or some r ec ecur ur si sive ve

 fu nction  functi on t(n t(n),), DTIME(t(n))  contains every set whose membership problem can be decided by a Turing machine which halts within O(t(n)) steps on any input i nput of of leng leng th n. The class of all sets computable in space s(n) for some recursive function s(n), DSPACE(s(n))   contains every set whose membership problem can be decided by a Turing machine which uses at  most mo st O(s(n)) tap tape e squar squar es on any in input put of of le leng ng th n. D e f i n i t i o n . 

We must note that we defined the classes with bounds of order  t(n) and order  s(n) f or a rea reason. son. T his hi s is be beca cause use of tthe he li linea nearr space compression and ti time me speedu spee dup p theorems pr prese esent nte ed in the section on mea measur sures. es. Be Bein ing g able to use orde ord er notation bri brings ngs be benefi nefits ts a alo long ng wit with h it. We no lon longe gerr hav have e to me menti ntion on 2 2 constants. cons tants. We may j ust say n  time, rather than 3n   + 2n --17 17 ti time. me. A nd the bases base s of our lloga ogari rithms thms nee need d appea appearr no llonge onger. r. We may now spea speak k of nlogn nl ogn time ti me or logn spac space e. T his hi s is quite conve conveni nie ent! Some of the automata theoretic classes examined in the study of automata fit ni nice cely ly into thi this s sc scheme heme of compl comple exity classe classes. s. T he smallest spa space ce class, DSPACE(1), is the class of regular sets and DSPACE(n) is the class of sets acce ac cepted pted by dete determi rmini nisti stic c lin line ear bounded a automata. utomata. A nd, reme remembe mberr that the smallest time class, DTIME(n), is the class of sets decidable in linear  time, not reall ti rea time me.. Our first theorem, which follows almost immediately from the definitions of  complexity classes, assures us that we shall be able to find all of the recursive sets se ts within our ne new w frame framework. work. It also provides the f irst chara characte cteri riz z ation of the class of recursive sets we have seen. T e o rCeE(s(n)) m 1 .  cl Thes union ofy the all cl the classes or all of the D hSPA classe asses i s exactl is exactly class ass of oDTIME(t(n)) f r ecur sive set sets. s.

 

Complexity Classes

2

P r o o f .   T his is quite stratighforward. From the original defini definitions, tions, we

know that membership in any recursive set can be decided by some  Turing  Turi ng ma machine chine tha thatt halts ffor or ev eve ery input. The time a and nd spac space e functions for these machines name the complexity classes that contain these sets. In other words, if Ma decides membership in the recursive set A, then A is obviously a member of DTIME(Ta(n)) and DSPAC DSPACE( E(L La(n)). On the other hand, if a set is in some complexity class then there must be some Turing machine that decides its membership within some recursive ti time me or space bound bound.. T hus a mac machi hine ne whi which ch a always lways halts dec decid ide es membe me mbershi rship p in the se set. t. T his hi s ma makes kes all of th the e se sets ts withi within n a complexity class re r ecursi cursive ve.. We now introduce another concept in computation: nondeterminism. It might seem a bit strange at first, but examining it in the context of complexity is going to provide us with some very important intuition concerning the complexity of  computation. computa tion. We shall provide two de defi finiti nitions ons of thi this s phe phenome nomenon. non.  The first is the historica historical definiti definition. on. Ea Early rly in the s study tudy of the theore oretica ticall computing machines, the following question was posed.

 Suppose a T ur i ng machi ne is allowed sever several al choices of of acti on for an inputin put-symbo symboll pair pair . D oe oess this incr i ncr ease its computa computational tional po power?  wer?  Here is a simple e exa xample. mple. Consider the foll following owing Tur Turing ing ma machine chine instruction. 0 1 1 b

1 1 0  1

right left halt left

next same I75

When the machine reads a one, it may either print a one and move left or print a z ero a and nd halt. T his hi s is a choice. A nd the mac machi hine ne may choose eit ither her of the actions ac tions iin n the instr instruction. uction. If it iis s possible to re reac ach h a ha halti lting ng c conf onfiguration, iguration, the then n the machine accepts. We need to examine nondeterministic computation in more detail. Suppose that the above instruction is I35 and the machine containing it is in configuration: #0110(I35)110 rea readin ding g a one one.. A t this point the instr instruction uction allows it to ma make ke either c choice hoice and thus e ente nterr one of two dif difff erent confi configura gurations. tions. Th This is is pictured below as figure 1.

 

Complexity Classes

3

#0110(I35)110  

#011(I35)0110  

#0110010  

Fig ur e 1 - A C Com om put ation al C Choice hoice

We could now think of a computation for one of these new machines, not as a mystical, magic sequence of configurations, but as a tree of configurations that the mac machi hine ne coul could d pa pass ss thr through ough dur durin ing g its it s computati computation. on. T hen we consid conside er paths through the computation tree as possible computations for the machine.  Then if the there re is a pa path th ffrom rom the initial configura configuration tion to a halting c confi onfig gurat uration, ion, we say that th the e machin machine e halt halts. s. A mo more re intu intuit itive ive view of set a acce ccept ptance ance may be defined as follows. D e f i n i t i o n .  A nond nonde ete terr ministic Tur Tu r ing mac machine hine acce accept ptss the input x if and 

only if there is a path in its computation tree that leads from the initial confi co nfi g ur at ation ion to to a halting halting co confi nfi g ur atio ation. n. Here are the definitions of nondeterministic classes. D e f i n i t i o n .  For a recursive function t(n) is NTIME(t(n))   i s  the class of sets

whose members can be accepted by nondeterministic Turing machines that halt halt withi n O(t(n)) steps steps for every in input put of of leng leng th n. D e f i n i t i o n .  Fo Forr a r ecur cursive sive function function s(n), NSPACE(s(n))  is the class of sets

whose members can be accepted by nondeterministic Turing machines that use at most most O(s(n)) tape squar square es for any i nput of leng leng th n. (NB.context (NB . We shall see NSP NSPA A CE( CE(n) n) in the of f ormalby llang anguag uage es. It iis s the flinear amily of sensitive languages orcontext sets accepted nondeterministic bounde bound ed automata automata.) .) Now that we have a new group of computational devices, the first question to ask is whether whether or not the they y allo allow w us to compute anything ne new. w. Our next theorem assures us that we sti still ll hav have e the re recursi cursive ve se sets. ts. I t is give given n wi with th a bri brie ef  proof sketch since the details will be covered in other results below.

The union of all the NTIME(t(n)) classes or all of the NSPA C E(s(n)) cl classe assess is i s exactl exactlyy the ccla lass ss of r ecur sive sets. sets.

T h e o r e m 2 . 

 

Complexity Classes

4

Proof Sketch. T here are two parts to thi this. s. Fir First st we maintain that since the recursive sets are the union of the DTIME or DSPACE classes, then they are all contained in the union of the NTIME or NSPACE classes. Next we need to show that any set accepted by a nondeterministic Turing machi mac hine ne has a decidable me membe mbershi rship p pro problem. blem. Supp uppose ose that a se sett is acce ac cepted pted by a t(n) t(n)-time -time nondete nondetermi rminis nisti tic c ma machine. chine. Now rec recall all th that at the machine accepts if and only if there is a path in its computation tree that leads lea ds to a halti halting ng conf configurati iguration. on. T hus all one ne nee eds to do is to ge genera nerate te the computation tree to a depth of t(n) and check for halting configurations. Now let us e exa xamin mine e nond nonde etermini terministi stic c ac acce ceptance ptance f rom another viewpoint. A path through the computation tree could be represented by a sequence of rows in the instructions that the machine executes. Now consider the following algorithm that receives an input and a path through the computation tree of  some nondete nondetermini rministic stic Tu Turin ring g mac machine hine Mm.  Verify(m,  Verif y(m, x, p) Pre:

p[] = sequence of rows rows in instructions to to be executed by M   as it processes input x  m  Post: halts if p is a path through the computation tree

i = 1; config = (I1)#x; while config is not a halting configuration and i≤ k do i = i + 1; if row p(i) in config’s instruction can be executed by M     m  then set config to the new configuration else loop forever if config is a halting configuration then halt(true)

 Thi s alg  This algorithm orithm ve verif rifie ies s that p is inde indee ed a path throug through h the computa computation tion tr tre ee of  Mm  and if it leads to a halting configuration, the algorithm halts and accepts. Otherwise Othe rwise it e either ither loops fforev oreve er or terminate terminates s without halting. halti ng. In addi addition, tion, the algorithm is deterministic . T here are no choice  choices s to ffoll ollow ow dur during ing ex exe ecution. Now let us exa examin mine e paths thro through ugh the computatio computation n tree tree.. T hose that lea lead d to halting configurations show us that the input is a member of the set accepted by the machin machine e. We shal shalll say that th these ese paths certify  that  that the input is a member of the set and call the path a certificate of authenticity   for the input. Thi This s provides a clue to what nondeterministic operation is really about.

 

Complexity Classes

5

Certificates do not always have to be paths through computation trees. Examine the following algorithm for accepting nonprimes (composite numbers) in a nondeterministic manner.  NonPrime(x )  NonPrime(x) nondeterministically determine integers y and z; if y*z = x then halt(true)

Here the ce certi rtiff icate of authenticit authenticity y is the pair <y, z> sin since ce it demonstrates that x is not a pri prime me number. We could wr writ ite e a completely completely de determini terministi stic c algorit algorithm hm which whi ch when give given n tthe he tri tripl ple e <x, y, z > as inp input, ut, compares y* y*z z to x and certi certiff ies that x is not p pri rime me if x = y∗z .  Thi s lea  This leads ds to our se second cond de defi finition nition of nonde nondete terministic rministic opera operation. tion. We sa say y tha thatt the following deterministic Turing machine M uses certificates to verify 

membe me mberr ship i n the se sett A .  M(x, c) h halts alts if and only if i f c pr ovi ovides des a pr oo ooff of x ∈ A  The nondete nondeterministic portion of the co computa mputation tion is fi finding nding the ce certif rtifica icate te a and nd we nee need d not worr worry y about that. Here are our def defini initi tions ons in terms of veri veriff ication ication.. D e f i n i t i o n .  The class of all sets nondeterministicly acceptable in time t(n)

 for a r ecur si sive ve f un uncti ction on t(n t(n),), NTIME(t(n))   contains all of the sets whose members can be verified by a Turing machine in at most O(t(n)) steps for  any i nput of of leng leng th n and cer cer tif tificate icate of leng leng th ≤  t(n).  t(n). Note that certificates must be shorter in length than t(n) for the machine to be able to read them and use them to verify that the input is in the set. We should also recall that nondeterministic Turing machines and machines which verify from certificates do not decide membership in sets, but accept them. T his hi s is a an n impo important rtant poi point nt and we shall come bac back k to it ag again. ain. At this point we sadly note that the above wonderfully intuitive definition of  nondeterministic acceptance by time-bounded machines does not extend as easily to space since there seems to be no way to generate certificates in the worktape work tape spa space ce provided. We mentioned earlier that there is an important distinction between the two kinds of classes. In fact, important enough to repeat. Nondeterministic 

machines accept sets, while deterministic machines decide membership in sets.  Thi s is some  This somewha whatt reminisce reminiscent nt of the dif differe ference nce be betwe twee en re recursiv cursive e and recursively enumerable se sets ts and there are some parall paralle els. A t prese present nt the

 

Complexity Classes

6

di diff f erence rences s be betwee tween n the two kin kinds ds of classes is not we well ll u understood nderstood.. In ffac act, t, it is not known whether these methods of computation are equivalent. We do know that DSPACE(1) = NSPACE(1) DSPACE(s(n)) ⊆ NSPACE(s(n)) DTIME(t(n)) ⊆ NTIME(t(n))

for every recursive s(n) and t(n). Whether DSPACE(s(n)) = NSPACE(s(n)) or whether DTI DT I ME(t( ME(t(n)) n)) = NT NTII ME(t( ME(t(n)) n)) remain ffamous amous open prob problems. lems. T he best that anyone has achieved so far is the following result that is presented here without proof.

 log 2n is i s a space space fu function, nction, then T h e o r e m  3 .  If s(n) ≥  log   NSPACE(s(n)) ⊆  D  D SP SPA A CE(s( CE(s(n) n)2 ). Our next observation about complexity classes follows easily from the linear space compr compression ession and sp spee eedu dup p theorems. Since ti time me and space use c can an be made more efficient by a constant factor, we may state that: DTIME(t(n)) = DTIME(k∗t(n)) NTIME(t(n)) = NTIME(k∗t(n)) DSPACE(s(n)) = DSPACE(k∗s(n)) NSPACE(s(n)) = NSPACE(k∗s(n))

for every recursive s(n) and t(n), and constant k. (Remember that t(n) means max(n+1, t(n)) and that s(n) means max(1, s(n)) in each case.) While we are comparing complexity classes it would be nice to talk about the relationshi relation ship p be betwee tween n spac space e and time. Unf Unfort ortunately unately not much is known here either. it her. A bout all we ca can n say is rather obvious. Sin ince ce it takes one uni unitt of ttime ime to write upon one tape square we know that:  TIME(t(  TIME( t(n) n))) ⊆ SPACE(t(n))

because a machine cannot use more than t(n) tape squares if it runs for t(n) steps. Going the other wa way y is not so ti tidy. dy. We ca can n count the maximum maximum nu numbe mberr of steps a machine may go through before falling into an infinite loop on s(n) tape and decide that for some constant c: SPACE(s(n)) ⊆ TIME(2

cs(n)

)

f or both de dete termini rministic stic a and nd nondete nondetermin rministi istic c c complex omplexity ity cla classe sses. s. A nd, in ffa act, this counting of steps is the subject of our very next theorem.)

 

Complexity Classes

7

T h e o r e m   4 .  If an s(n) tape bounded Turing machine halts on an input of  leng le ng th n then then it i t will halt halt withi n O( 2cs(n) )steps for some constant c. P r o o f Sk Sk e t c h .  Consi Consider der a T uri uring ng mac machi hine ne that use uses s O( O(s(n) s(n))) tape tape.. T here is

an equivalent machine Mi that uses two worktape symbols and also needs no more than O(s(n)) tape. This means that there is a constant k such that ∗

Mi never uses more than k s(n) tape squares on inputs of length n. We now recall that a machine configuration consists of: a) the in instru struction ction be bein ing ge exe xecuted, cuted, b) the position of the head on the input tape, c) the position of the head on the work tape, and d) a work tape configuration. We also know that if a machine repeats a configuration then it will run forever. So, we almost have our proof. All we need do is count machine configurations. There are |Mi| s(n) instructions, n+2 input tape squares, k∗s(n) work tape squares, and 2k !s(n) work tape conf configur igurations. ations. Mul Multi tipl plying ying these toge together ther provi provides des the theorem's bound.

One result of this step counting is a result relating nondeterministic and determi dete rmini nisti stic c time time.. Unf Unfortu ortunate nately ly it iis s nowhere nea nearr as sha sharp rp as the theorem orem 3, the best be st re relati lationshi onship p be betwee tween n de determini terministi stic c and nondete nondetermi rminis nistic tic space space.. Part of the reason is that our simulation techniques for time are not as good as those for space. C o r o l l a r y .   NTIME(t(n)) ⊆ DTIME( 2

ct(n)²

) ct(n)²

P r o o f . 

) NTIME(t(n)) NSPACE(t(n)) DSPACE(t(n)2) DSPACE(t(n)2 DTIME(2 because beca use of ttheore heorems ms 3 and 4. (W (We e could have pro prove ven n th this is ffrom rom scratch by simulating a nondeterministic machine in a deterministic manner, but the temptation to use our last two results was just too tempting!) ⊆ 

⊆ 

⊆ 

Our first theorem in this section stated that the union of all the complexity classes classe s re resul sults ts in the coll colle ection of all of tthe he recursive se sets. ts. A n obvious question is whether whether one class c can an pro provide vide the enti ntire re f amily of rre ecursi cursive ve sets. T he nex nextt result denies denies thi this. s. T h e o r e m  5 .  For any recursive function s(n), there is a recursive set that is

not a membe memberr of DSPA C E(s(n)).

 

Complexity Classes

8

P r o o f .   T he tec techni hnique que we shall use is diagonaliz ation ove overr DSPACE(s(n)) .

We shall examine every Turing machine that operates in s(n) space and define defi ne a se sett that t hat cannot be dec decid ide ed by any of them. First, we must talk about the machines that operate in O(s(n)) space. For each there is an equivalent machine which has one track and uses the alph alphabet abet {0,1,b}. T his hi s binary alphabe alphabet, t, one track Tur Turin ing g mac machi hine ne also operates in O(s(n)) O(s(n)) space. (Re (Recall call th the e resul resultt on usi using ng a bi binary nary alph alphabe abett to simulate machines with large alphabets that used blocks of standard size to represent represent symbols.) Le Let's t's now take an e enumeration numeration M", M2, ... of these one track, binary machines and consider the following algorithm. Examine(i, k, x) Pre: n = length of x

lay out k*s(n) tape squares on the work tape; run M  i(x) within the laid off tape area; if M  i(x) rejects then accept else reject

 Thi s is me  This mere rely ly a simulation of the binary T Turing uring ma machine chine Mi  on input x using k∗s(n) tape tape.. A nd, the simu simulati lation on lasts unti untill we kno know w whe whether ther or not the mac machi hine ne wil willl halt. T heore heorem m 4 tells us that we onl only y nee need d wait some c !s(n) s(n) constant times 2  steps.  ste ps. T his hi s is ea easy sy to c count ount tto o on a track of a tape of  length k∗s(n) s(n).. T hus the proce procedur dure e abov above e is rre ecursi cursive ve and a acts cts dif difff erently than Mi on input x if Li(n) ≤ k∗s(n). Our strategy is going to be to feed the Examine routine all combinations of k and i in hopes that we shall eventually knock out all s(n) tape bounded bounde d Tu Turin ring g ma machines chines..  Thus we ne nee ed a se seque quence nce of pairs <i, k> suc such h tha thatt e ea ach pa pair ir occurs in our sequence se quence inf in f init in ite ely often. Such se sequence quences s abound. A standard is: <1,1>, <1,2>, <2,1>, <1,3>, <2,2>, <3,1>, ... For each input x we take the xth  pair in the se sequence quence.. T he decision procedure for the set we claim is not s(n) space computable is now: Diagonal(x) select the x-th pair <i, k> from the sequence; Examine(i, k, x)

 

Complexity Classes

9

 Two things ne nee ed to be ve verif rifie ied. d. First, we nee need d to show tha thatt the abov above e decision procedure can be carried out by some Turing machine. We note that Mi  comes from an enumeration of two work tape symbol machines and then appeal to Church's thesis for the actual machine construction f or the decision pr proce ocedur dure e. Nex Nextt we nee need d to prove that this pr proce ocedur dure e cannot be carried out by an s(n) space bounded Turing machine. Suppose that the Diagonal procedure is indeed s(n) space computable.  Then the there re is some two workta worktape pe sy symbol, mbol, s(n) s(n) spa space ce bounde bounded d Tur Turing ing machine Mi which computes the above Diagonal procedure. And there is a constant k such that for all but a finite number of inputs, Mi uses no more than k∗s(n) tape squares on in inputs puts of length n. In p particul articular, ar, the there re is a an nx th such that <j, k> is the x   pair in our sequence of pairs and the act there are computation of Mi(x) requires no more than k ∗s(n) tape. (In ffact in inff in init ite ely many of tthese hese x since the pa pair ir <j , k> appe appears ars in inff in init ite ely of often ten in the sequence sequence.) .) I n this case M j(x) ≠Examine(j, k, x) = Diagonal(x)

which is a contradiction. T hus Mi  cannot be an s(n) bounded machine and the set defined by our Diagonal procedure cannot be a member of DSPACE(s(n)). It should come as no surprise that the same result holds for nondeterministic space as well as time classes. Thus we do have a hierarchy of classes since none of them ca can n hold all of tthe he rec recursive ursive se sets. ts. T his se see ems in li line ne with in intuiti tuition on since we believe that we can compute bigger and better things with more resources at our disposal. Our next results explore the amount of space or time needed to compute new thi things ngstape for  classes with h resource bound bounds s that a are rea tape time me unctions. ons. (Reca ll that or timewit   f uncti unctions ons are bound bounds s f or actual ctualorTti uri uring ngf uncti mac machi hines. nes.)(Re ) call We consider these resource bounds to be well behaved   and note in passing that there are strange functions about which are not tape or time functions. T h e o r e m  6   (S both th at le least O(n), s(n) (Space pace Hierarch erarchy). y). I f r (n) and s(n) ar e bo   is a space fu function, nction, and inf n →∞ r (n)/s(n) = 0, then then

 

D SP SPA A CE(s(n)) - D SP SPA A CE(r (n)) ≠  ∅ .

P r o o f S k e t c h .  Th The e proof is ve very ry similar to tha thatt of the last the theorem orem.. A ll

that is needed is to change the space laid off in the Examine routine to s(n). Since s(n) grows faster than a any ny const constant ant ti times mes r(n), the diag di agonali onaliz z ation pro proce cee eds as sche schedul dule ed. One note. Wha Whatt make makes s thi this s simulation and diagonalization possible is that s(n) is a space function.

 

Complexity Classes

10

 Thi s allows us to lay off s(n)  This s(n) ta tape pe squa square res s in s(n) s(n) spa space ce.. Thus the diagonalization does produce a decision procedure for a set which is s(n) space decidable but not r(n) space decidable.  The maj maj or rea reason the simulation worked was tha thatt we we were re a able ble to lla ay out s(n) s(n) tape squares. T his hi s is beca because use we could compute s( s(n) n) by takin taking g the mac machi hine ne it was a tape function for and run it on all inputs of length n to find the longest one. T his hi s requir require es O(n) space space.. If s(n) is e eve ven n mor more e well behaved   we can do better.

sive ve f un uncti ction on s(n s(n)) i s efficiently space computable  i f  D e f i n i t i o n .   A r ecur si and only if it can be computed computed wi withi thin n s(n) s(n ) space. space. If s(n) is efficiently space computable, then the space hierarchy theorem is true for s(n) down to O(log2n) because we can lay out the required space for the simulation simul ation and kee keep p tr trac ack k of which iinput nput symbol iis s be being ing rea read. d. Many functions are efficiently space computable, including such all time k favorites such as log2n and (log2n) . A n e exe xerci rcise se dea deali ling ng with e eff f ici icie ent spac space e computability will be to prove that all space functions that are at least O(n) are efficiently space computable. Combining the space hierarchy theorem with the linear space compression theorem the orem provides some good ne news ws a att last. If two function functions s dif differ fer only by a constant, then they they bound the sa same me class. But if one is large largerr than the other by more than a constant then one class is properly contained in the other. Sadly the result ffor or ti time me is not as sha sharp. rp. We shall nee need d one of o our ur ffuncti unctions ons to always be efficiently time computable and do our simulation with two tapes. Here is the theorem. T h e o r e m  7   (Ti (Time me Hi Hie erar rarchy). chy). I f r (n) and t(n) ar e bo both th at le least O(n), t(n) is is

effi ciently time ti me computabl computable, e, and  inf n→ ∞  

then the n D TI ME( ME(t( t(n)) n)) - DT IME(r (n)) ≠  ∅ .

r(n)log2 r(n) t(n)

=0

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close