Presentation is loading. Please wait.

Presentation is loading. Please wait.

February 8, 2016CS21 Lecture 151 CS21 Decidability and Tractability Lecture 15 February 8, 2016.

Similar presentations


Presentation on theme: "February 8, 2016CS21 Lecture 151 CS21 Decidability and Tractability Lecture 15 February 8, 2016."— Presentation transcript:

1 February 8, 2016CS21 Lecture 151 CS21 Decidability and Tractability Lecture 15 February 8, 2016

2 Administrivia Reminder: Midterm due Wednesday Clarification of collab policy for problem sets: Your solution should be based on your understanding February 8, 2016CS21 Lecture 152

3 February 8, 2016CS21 Lecture 153 Outline Gödel Incompleteness Theorem …On to Complexity The complexity class P Examples of problems in P

4 Gödel Incompleteness Theorem February 8, 2016CS21 Lecture 154

5 February 8, 2016CS21 Lecture 155 Number Theory A sentence is a formula with no un- quantified variables –every number has a successor:  x  y y = x + 1 –every number has a predecessor:  x  y x = y + 1 –not a sentence: x + y = 1 “number theory” = set of true sentences N –denoted Th(N) true false

6 February 8, 2016CS21 Lecture 156 Proof systems a proof is a sequence of formulas  1,  2,  3, …,  n such that each  i is either –an axiom, or –follows from formulas earlier in list from rules of inference A sentence is a theorem of the proof system if it has a proof

7 February 8, 2016CS21 Lecture 157 Proof systems A proof system is sound if all theorems in that proof system are true (better have this) Peano Arithmetic (PA) is sound. N true sentences = Th(N) N false sentences = co-Th(N) theorems of PA

8 February 8, 2016CS21 Lecture 158 Proof systems A proof system is complete if all true sentences are theorems in that proof system hope to have this (recall Hilbert’s program) N true sentences = Th(N) N false sentences = co-Th(N) theorems of a complete proof system

9 Proof systems Does there exist a proof system for number theory which is sound and complete? Technically, yes –Set of axioms = set of true sentences –No rules of inference –(This is not a useful proof system) February 8, 2016CS21 Lecture 159

10 February 8, 2016CS21 Lecture 1510 Incompleteness Theorem Theorem: Peano Arithmetic is not complete. (same holds for any reasonable proof system for number theory) Proof outline: –the set of theorems of PA is RE N –the set of true sentences (= Th(N)) is not RE

11 February 8, 2016CS21 Lecture 1511 Incompleteness Theorem Lemma: the set of theorems of PA is RE. Proof: –TM that recognizes the set of theorems of PA: –systematically try all possible ways of writing down sequences of formulas –accept if encounter a proof of input sentence (note: true for any reasonable proof system)

12 February 8, 2016CS21 Lecture 1512 Incompleteness Theorem NLemma: Th(N) is not RE Proof: N –reduce from co-HALT (show co-HALT ≤ m Th(N)) –recall co-HALT is not RE –what should f( ) produce? –construct  such that M loops on w   is true

13 February 8, 2016CS21 Lecture 1513 Incompleteness Theorem –we will define VALCOMP M,w (v)  … (details to come) so that it is true iff v is a (halting) computation history of M on input w –then define f( ) to be:     v VALCOMP M,w (v) –YES maps YES? N  co-HALT   is true    Th(N) –NO maps to NO? N  co-HALT   is false    Th(N)

14 February 8, 2016CS21 Lecture 1514 Expressing computation in the language of number theory Last time: basic building blocks –x < y   z x + z = y   (z = 0) –INTDIV(x, y, q, r)  x = qy + r  r < y –DIV(y, x)   q INTDIV(x,y,q,0) –PRIME(x)  x ≥ (1+1)   y (DIV(y, x)  (y = 1  y = x))

15 February 8, 2016CS21 Lecture 1515 Expressing computation in the language of number theory – we’ll write configurations over an alphabet of size p, where p is a prime that depends on M –d is a power of p: POWER p (d)   z (DIV(z, d)  PRIME(z))  z = p –d = p k and length of v as a p-ary string is k LENGTH(v, d)  POWER p (d)  v < d

16 February 8, 2016CS21 Lecture 1516 Expressing computation in the language of number theory –the p-ary digit of v at position y is b (assuming y is a power of p): DIGIT(v, y, b)   u  a (v = a + by + upy  a < y  b < p) –the three p-ary digits of v at position y are b,c, and d (assuming y is a power of p): 3DIGIT(v, y, b, c, d)   u  a (v = a + by + cpy + dppy + upppy  a < y  b < p  c < p  d < p)

17 February 8, 2016CS21 Lecture 1517 Expressing computation in the language of number theory –the three p-ary digits of v at position y “match” the three p-ary digits of v at position z according to M’s transition function (assuming y and z are powers of p): MATCH(v, y, z)   (a,b,c,d,e,f)  C 3DIGIT(v, y, a, b, c)  3DIGIT(v, z, d, e, f) where C = {(a,b,c,d,e,f) : abc in config. C i can legally change to def in config. C i+1 }

18 February 8, 2016CS21 Lecture 1518 Expressing computation in the language of number theory –all pairs of 3-digit sequences in v up to d that are exactly c apart “match” according to M’s transition function (assuming c, d powers of p) MOVE(v, c, d)   y ( POWER p (y)  yppc < d)  MATCH(v, y, yc)

19 February 8, 2016CS21 Lecture 1519 Expressing computation in the language of number theory –the string v starts with the start configuration of M on input w = w 1 …w n padded with blanks out to length c (assuming c is a power of p): START(v, c)   i = 0,1,2,…, n DIGIT(v, p i, k i )  p n < c   y (POWER p (y)  p n < y < c  DIGIT(v, y, k)) where k 0 k 1 k 2 k 3 …k n is the p-ary encoding of the start configuration, and k is the p-ary encoding of a blank symbol.

20 February 8, 2016CS21 Lecture 1520 Expressing computation in the language of number theory –string v has a halt state in it somewhere before position d (assuming d is power of p): HALT(v, d)   y (POWER p (y)  y < d   a  H DIGIT(v,y,a)) where H is the set of p-ary digits “containing” states q accept or q reject.

21 February 8, 2016CS21 Lecture 1521 Expressing computation in the language of number theory –string v is a valid (halting) computation history of machine M on string w: VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d)) –M does not halt on input w:  v VALCOMP M,w (v)

22 Gödel Incompleteness Theorem (an example) February 8, 2016CS21 Lecture 1522

23 February 8, 2016CS21 Lecture 1523 Incompleteness Theorem v = 036320363205332035320314203124 VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d))

24 February 8, 2016CS21 Lecture 1524 Incompleteness Theorem v = 036320363205332035320314203124 d = 1000000000000000000000000000000 VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d)) d = p k and length of v as a p-ary string is k LENGTH(v, d)  POWER p (d)  v < d

25 February 8, 2016CS21 Lecture 1525 Incompleteness Theorem v = 036320363205332035320314203124 c = 100000 VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d)) v starts with the start configuration of M on input w padded with blanks out to length c: START(v, c)   i = 0,…, n DIGIT(v, p i, k i )  p n < c   y (POWER p (y)  p n < y < c  DIGIT(v, y, k)) kk n …k 2 k 1 k 0 p n =1000

26 February 8, 2016CS21 Lecture 1526 Incompleteness Theorem v = 036320363205332035320314203124 yc = 100000 VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d)) all pairs of 3-digit sequences in v up to d exactly c apart “match” according to M’s transition function MOVE(v, c, d)   y ( POWER p (y)  yppc < d)  MATCH(v, y, yc) y =1

27 February 8, 2016CS21 Lecture 1527 Incompleteness Theorem v = 036320363205332035320314203124 yc = 1000000 VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d)) all pairs of 3-digit sequences in v up to d exactly c apart “match” according to M’s transition function MOVE(v, c, d)   y ( POWER p (y)  yppc < d)  MATCH(v, y, yc) y =10

28 February 8, 2016CS21 Lecture 1528 Incompleteness Theorem v = 036320363205332035320314203124 yc = 10000000 VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d)) all pairs of 3-digit sequences in v up to d exactly c apart “match” according to M’s transition function MOVE(v, c, d)   y ( POWER p (y)  yppc < d)  MATCH(v, y, yc) y =100

29 February 8, 2016CS21 Lecture 1529 Incompleteness Theorem v = 036320363205332035320314203124 y = 1000000000000000000000000000 VALCOMP M,w (v)   c  d (POWER p (c)  c < d  LENGTH(v, d)  START(v, c)  MOVE(v, c, d)  HALT(v, d)) string v has a halt state in it before pos’n d: HALT(v, d)   y (POWER p (y)  y < d   a  H DIGIT(v,y,a)) halt state

30 February 8, 2016CS21 Lecture 1530 Incompleteness Theorem NLemma: Th(N) is not RE Proof: N –reduce from co-HALT (show co-HALT ≤ m Th(N)) –recall co-HALT is not RE –constructed  such that M loops on w   is true

31 February 8, 2016CS21 Lecture 1531 Summary full-fledged model of computation: TM many equivalent models Church-Turing Thesis encoding of inputs Universal TM

32 February 8, 2016CS21 Lecture 1532 Summary classes of problems: –decidable (“solvable by algorithms”) –recursively enumerable (RE) –co-RE counting: –not all problems are decidable –not all problems are RE

33 February 8, 2016CS21 Lecture 1533 Summary diagonalization: HALT is undecidable reductions: other problems undecidable –many examples –Rice’s Theorem natural problems that are not RE Recursion Theorem: non-obvious capability of TMs: printing out own description Incompleteness Theorem

34 Summary Enjoyed CS21 so far? Consider Ma/CS 117abc (“Computability Theory”) February 8, 2016CS21 Lecture 1534

35 Complexity Central question of CS21: Which problems can we solve through computation? February 8, 2016CS21 Lecture 1535

36 February 8, 2016CS21 Lecture 1536 Complexity So far we have classified problems by whether they have an algorithm at all. In real world, we have limited resources with which to run an algorithm: –one resource: time –another: storage space need to further classify decidable problems according to resources they require

37 February 8, 2016CS21 Lecture 1537 Complexity Complexity Theory = study of what is computationally feasible (or tractable) with limited resources: –running time –storage space –number of random bits –degree of parallelism –rounds of interaction –others… main focus not in this course

38 February 8, 2016CS21 Lecture 1538 Worst-case analysis Always measure resource (e.g. running time) in the following way: –as a function of the input length –value of the fn. is the maximum quantity of resource used over all inputs of given length –called “worst-case analysis” “input length” is the length of input string, which might encode another object with a separate notion of size

39 February 8, 2016CS21 Lecture 1539 Time complexity Definition: the running time (“time complexity”) of a TM M is a function NN f:N → N where f(n) is the maximum number of steps M uses on any input of length n. “M runs in time f(n),” “M is a f(n) time TM”

40 February 8, 2016CS21 Lecture 1540 Time complexity Example: TM M deciding L = {0 k 1 k : k ≥ 0}. On input x: scan tape left-to-right, reject if 0 to right of 1 repeat while 0’s, 1’s on tape: scan, crossing off one 0, one 1 if only 0’s or only 1’s remain, reject; if neither 0’s nor 1’s remain, accept # steps?

41 February 8, 2016CS21 Lecture 1541 Time complexity We do not care about fine distinctions –e.g. how many additional steps M takes to check that it is at the left of tape We care about the behavior on large inputs –general-purpose algorithm should be “scalable” –overhead for e.g. initialization shouldn’t matter in big picture

42 February 8, 2016CS21 Lecture 1542 Time complexity Measure time complexity using asymptotic notation (“big-oh notation”) –disregard lower-order terms in running time –disregard coefficient on highest order term example: f(n) = 6n 3 + 2n 2 + 100n + 102781 –“f(n) is order n 3 ” –write f(n) = O(n 3 )

43 February 8, 2016CS21 Lecture 1543 Asymptotic notation NR + Definition: given functions f,g:N → R +, we say f(n) = O(g(n)) if there exist positive integers c, n 0 such that for all n ≥ n 0 f(n) ≤ cg(n). meaning: f(n) is (asymptotically) less than or equal to g(n) if g > 0 can assume n 0 = 0, by setting c’ = max 0≤n≤n 0 {c, f(n)/g(n)}

44 February 8, 2016CS21 Lecture 1544 Time complexity total = O(n) + n ¢ O(n) + O(n) = O(n 2 ) On input x: scan tape left-to-right, reject if 0 to right of 1 repeat while 0’s, 1’s on tape: scan, crossing off one 0, one 1 if only 0’s or only 1’s remain, reject; if neither 0’s nor 1’s remain, accept O(n) steps ≤ n repeats


Download ppt "February 8, 2016CS21 Lecture 151 CS21 Decidability and Tractability Lecture 15 February 8, 2016."

Similar presentations


Ads by Google