Download presentation

Presentation is loading. Please wait.

Published byLuke Spencer Modified over 2 years ago

2
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

3
TIME COMPLEXITY Definition: Let M be a TM that halts on all inputs. The running time or time-complexity of M is the function f : N N, where f(n) is the maximum number of steps that M uses on any input of length n. Definition: TIME(t(n)) = { L | L is a language decided by a O(t(n)) time Turing Machine }

4
P = TIME(n c ) c N IMPORTANT COMPLEXITY CLASSES NP = NTIME(n c ) c N Problems where it is easy to find the answer. Problems where it’s easy to check the answer. If P = NP then generation is as easy as recognition.

5
Definition: A language B is NP-complete if: 1. B NP 2. Every A in NP is poly-time reducible to B (i.e. B is NP-hard) HARDEST PROBLEMS IN NP 2. A is NP-complete and A ≤ P B If B is NP-Complete and P NP, then There is no fast algorithm for B. Theorem: A language B is NP-complete if:

6
SPACE COMPLEXITY

7
WHEN A COMPUTER IS USEFUL…

8
ENCODING CHESS A 8£8 chess board has 64 squares and 32 pieces: Each square can have one of 13 values: 4 bits CHESS = { 〈 B 〉 | B is a chess board and white can force a win. } +1 bit encodes turn information.

9
HOW MUCH DISK DOES HARRY NEED ? How many moves at any level? ≤ 376 W ≤ 9Q + 1K + 2B + 2R + 2N = 376 How many levels? D ≤ (64) 32 2 = 2 193 ≈ 10 51 ≤10 51 So, at most, W D ≤ 10 positions 10 52 By remembering whether each board B ∈ CHESS, we can explore “only” D ≈ 10 51 positions. HOW MUCH SPACE?

10
Definition: Let M be a deterministic TM that halts on all inputs. The space complexity of M is the function ƒ: N N, where ƒ(n) is the rightmost tape position that M reaches on any input of length n. Definition: Let M be a non-deterministic TM that halts on all inputs. The space complexity of M is the function ƒ : N N, where ƒ(n) is the rightmost tape position that M reaches on any branch of its computation on any input of length n.

11
{ L | L is a language decided by a O(t(n)) space non-deterministic Turing Machine } Definition: SPACE(t(n)) = Definition: NSPACE(t(n)) = { L | L is a language decided by a O(t(n)) space deterministic Turing Machine }

12
3SAT SPACE(n) (x y x) xy (x y x) # 00 xy (x y x) # 01

13
SAVITCH’S THEOREM Theorem: For any function f where f(n) n, NSPACE(f(n)) SPACE(f(n) 2 ) Proof: Let N be a non-deterministic TM with space complexity f(n) Construct a deterministic machine M that simply tries each branch of N Since each branch of N uses space at most f(n), then M uses space at most f(n)

14
Assume a branch of a non-looping non- deterministic computation uses space k How many time steps can this branch have? k|Q||Γ| k = 2 O(k)

15
We need to simulate a non- deterministic computation while saving as much space as possible

16
Idea: Given two configurations c 1 and c 2 together with a number t, test whether N can get from c 1 to c 2 in t steps and space f(n) def can_yield(N,c 1, c 2, t, f): if t = 1: else: for c m ∈ { f-cell configurations }: if can_yield(c 1,c m,t/2,f) and can_yield(c m,c 2,t/2,f): return True else: return False if (c 1 = c 2 ) or (c 2 ∈ next_conf(N,c 1 )): return True else: return False

17
SAVITCH’S THEOREM Theorem: For any function f where f(n) n NSPACE(f(n)) SPACE(f(n) 2 ) Proof: Let N be a non-deterministic TM with space complexity f(n) We modify N so that when it accepts, it clears its tape and moves the head to the leftmost cell Construct a deterministic machine M that on input w, simply returns can_yield(N,q 0 w,c accept, 2 df(n), f(n))

18
PSPACE = SPACE(n k ) k N NPSPACE = NSPACE(n k ) k N PSPACE = NPSPACE

19
EXAMPLE Prove that OTHELLO ∈ PSPACE. Let OTHELLO = { 〈 B 〉 | B is an othello position with a winning move for the current player. }

20
PSPACE is frequently called the class of games because many popular games belong to PSPACE.

21
P PSPACE? YES

22
NP PSPACE? YES

23
PNPPSPACE

24
Assume a deterministic Turing machine that halts on all inputs runs in space f(n) Question: At most how many time steps can this machine run for? f(n)|Q||Γ| f(n) = 2 O(f(n)) EXPTIME = TIME(2 ) k ℕ nknk PSPACE EXPTIME

25
P NP PSPACE EXPTIME P ≠ EXPTIME

Similar presentations

OK

Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M is the function f:N N, where f(n) is the maximum.

Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M is the function f:N N, where f(n) is the maximum.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on nuclear family and joint family band Ppt on chemical reaction Topics for ppt on environmental education Ppt on nature and history of democracy in nepal Ppt on statistics and probability examples Ppt on metro bridge construction Procure to pay ppt online Latest ppt on cybercrime and security Ppt on importance of sports in our life Ppt on paintings and photographs related to colonial period dates