Presentation is loading. Please wait.

Presentation is loading. Please wait.

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Similar presentations


Presentation on theme: "INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011."— Presentation transcript:

1

2 INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

3 QUIZ 6 B is NP-Complete if: (a) B ∈ NP (b) ∀ A ∈ NP, A ≤ P B Reduction from HAMPATH to KPATH: ƒ( 〈 G,s,t 〉 ) = 〈 G,s,t,|V|-1 〉 nifty proof that 〈 [14, 24, 13, 5, 1, 23, 29, 11], 42 〉 ∈ SSUM: Many, e.g. 14+23+5 = 42; 13+29 = 42 Nifty Proof that 〈 G 〉 ∈ 3COLOR:

4 SPACE COMPLEXITY

5 Definition: Let M be a deterministic TM that halts on all inputs. The space complexity of M is the function f : N  N, where f(n) is the rightmost tape position that M reaches on any input of length n. Definition: SPACE(t(n)) = { L | L is a language decided by a O(t(n)) space deterministic Turing Machine }

6 PSPACE = SPACE(n k )  k  N 3SAT  PSPACE PSPACE = NPSPACE P  NP  PSPACE  EXPTIME

7 Definition: Language B is PSPACE-complete if: 1. B  PSPACE 2. Every A in PSPACE is poly-time reducible to B (i.e. B is PSPACE-hard) HARDEST PROBLEMS IN PSPACE

8 QUANTIFIED BOOLEAN FORMULAS x   y  x  y [ ]  x [ x   x ]  x [ x ]  x  y [ (x  y)  (  x   y) ]

9 Definition: A fully quantified Boolean formula (or a sentence) is a Boolean formula in which every variable is quantified x   y  x  y [ ]  x [ x   x ]  x [ x ]  x  y [ (x  y)  (  x   y) ]

10 TQBF = {  |  is a true fully quantified Boolean formula} Theorem: TQBF is PSPACE-complete

11 TQBF  PSPACE is_true(  ): 1. If  contains no quantifiers, then it is an expression with only constants, so simply evaluate  2. If  =  x , recursively call isTrue on , first with x = 0 and then with x = 1. Accept if either one of them is true. 3. If  =  x , recursively call isTrue on , first with x = 0 and then with x = 1. Accept if both of them are true.

12 Claim: Every language A in PSPACE is polynomial time reducible to TQBF We build a poly-time reduction from A to TQBF The reduction turns a string w into a fully quantified Boolean formula  that is true iff M has an accepting computation on w. Let M be a deterministic TM that decides A in space n k

13 We now design  so that a satisfying assignment to the variables corresponds to M accepting w Given two collections of variables denoted c and d representing two configurations of M and a number t > 0, we construct a formula  c,d,t If we assign c and d to actual configurations,  c,d,t will be true if and only if M can go from c to d in t steps We let  =  c, c, h, where h = 2 n k+1 startaccept

14 If t = 1, we can easily construct  c,d,t :  c,d,t = “c equals d” or “d follows from c in a single step of M” “c equals d” says that each for each i, c i = d i. “d follows from c in a single step of M” can be expressed as we did with SAT

15 If t > 1, we can build  c,d,t recursively:  c,d,t =  m [  c,m,t/2   m,d,t/2 ]  m 1  m 2 … 9m l How long is this formula? O(t) = 2 O(n k )  c,d,t =  m  a,b[ [(a,b)=(c,m)  (a,b)=(m,d)]  [  a,b,t/2 ] ] Since O(t) is too long, we modify the formula to be:

16 PSPACE is frequently called the class of games because many popular games are PSPACE-Complete

17 THE FORMULA GAME …is played between two players, E and A Given a fully quantified Boolean formula E chooses values for variables quantified by  A chooses values for variables quantified by  Start at the leftmost quantifier E wins if the resulting formula is true A wins otherwise  y  x [ (x  y)  (  x   y) ]

18 FG = {  | Player E can force a win in  } Theorem: FG is PSPACE-Complete Proof: FG = TQBF  x  y [ (x  y)  (  x   y) ] x   y  x  y [ ]

19 GEOGRAPHY Two players take turns naming cities from anywhere in the world Each city chosen must begin with the same letter that the previous city ended with Austin  Nashua  Albany  York Cities cannot be repeated Whoever cannot name any more cities loses

20 GENERALIZED GEOGRAPHY b a e c d f g i h

21 GG = { 〈 G,b 〉 | Player I has a winning strategy for the generalized geography game played on graph G starting at node b } Theorem: GG is PSPACE-Complete

22 GG  PSPACE def current_player_wins(G, s): G’ = remove_node(s,G) for t ∈ neighbors(s,G): else: return False if neighbors(s,G) = Ø: return if not(current_player_wins(G’,t)): return True. False Maximum recursion depth: |G| Space complexity: O(|G|²)

23 We show that FG  P GG GG IS PSPACE-HARD We convert a formula  into 〈 G,b 〉 such that: Player E has winning strategy in  if and only if Player I has winning strategy in 〈 G,b 〉 For simplicity we assume  is of the form:  =  x 1  x 2  x 3 …  x k [  ] where  is in cnf

24 b c TRUEFALSE x1x1 x2x2 xkxk c1c1 c2c2 cncn x1x1 (x 1  x 1  x 2 )  (  x 1   x 2   x 2 )  … x2x2 x2x2 x1x1 x1x1 x2x2

25 b TRUEFALSE x1x1 c1c1 x1x1 x1x1 x1x1 c  x 1 [ (x 1  x 1  x 1 ) ]

26 n x n GO, chess and checkers can be shown to be PSPACE-hard Question: Is Chess PSPACE complete? No, because determining whether Player I has a winning strategy takes constant time and space


Download ppt "INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011."

Similar presentations


Ads by Google