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 〈 [20, 46, 43, 50, 36, 45, 14, 52], 99 〉 ∈ SSUM: e.g. 20+43+36= 99 Nifty Proof that 〈 G 〉 ∈ 3COLOR:

4 Extended Office Hours posted at: http://cs4011.org/ FINAL EXAM THURSDAY, DECEMBER 18 10:30AM – 12:30PM. Reminder: one page (8.5×11”) “cheat sheet”

5 1*(0 ∪ 01) 0 q0q0 q2q2 1 q1q1 0 1 {0 k 1 k | k ≥ 0} R → LRL | b L → a | b S → R | ε { ww | w ∈ {0,1}* } MODELS

6 0 → 0, R readwritemove  → , R q accept 0 → 0, R  → , R 0 → 0, R  → , L TURING MACHINES UNBOUNDED TAPE 0 q0q0 q0q0 q1q1 q2q2 q1q1 q2q2 0

7 A TM = {  M,w  | M is a TM that accepts string w } A TM is undecidable:(proof by contradiction) Assume there is a program accepts to decide A TM. accepts(  M ,w) = true if M(w) accepts false if M(w) does not. Construct a new TM LLPF that on input  M , runs accepts(  M ,  M  ) and “does the opposite”: LLPF(PROG ) =if (accepts( PROG, PROG )) then reject; else accept. LLPF

8 REDUCTIONS A  m B if there is a computable ƒ so that w  A  ƒ(w)  B ƒ is called a reduction from A to B A  P B if there is a poly-time computable ƒ so that w  A  ƒ(w)  B

9 COMPLEXITY THEORY P = Problems where it is easy to find the answer. NP = Problems where it’s easy to check the answer. If P = NP then generation is as easy as recognition. Is there a fast program for this problem? PSPACE = Problems that can be solved in polynomial space. If P = PSPACE then TIME is as powerful as SPACE.

10 COMPLETE PROBLEMS NP:3SAT,SUBSET-SUM,HAMPATH, VERTEX COVER, 3-COLOR,CLIQUE,… PSPACE:TQBF,FG,GEOGRAPHY,… If C is a class of languages and B is a language, then B is C-Complete if: 1. B ∈ C. 2. ∀ A ∈ C, A ≤ P B (i.e. B is C-Hard)

11 SPACE COMPLEXITY

12 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(s(n)) = { L | L is a language decided by a O(s(n)) space deterministic Turing Machine }

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

14 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

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

16 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) ]

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

18 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.

19 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

20 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

21 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

22 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 … ∃ m 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:

23 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) ]

24 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 [ ]

25 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

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

27 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

28 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|²)

29 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

30 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

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

32 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