Presentation is loading. Please wait.

Presentation is loading. Please wait.

Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3

Similar presentations


Presentation on theme: "Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3"— Presentation transcript:

1 Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3 teruyama@kuis.kyoto-u.ac.jp

2 Notification This course is a reading seminar. You should give a presentation and submit resume on your presentation. After your presentation, send me the datafile of your presentation and resume. I will upload the web page of this course.

3 Notification Michael Sipser: Introduction to the Theory of Computation. Course Technology. Part 1 : Automata and Language Part 2 : Computability Theory Part 3 : Complexity Theory Please use examples and figures.

4 Today's Outline Chapter 3 : Definition of Turing Machines Definition of Variants of Turing Machines Chapter 7 : Time Complexity Big-O, small-o notation Class P Class NP

5 Today's Outline Chapter 3 : Definition of Turing Machines Definition of Variants of Turing Machines Chapter 7 : Time Complexity Big-O, small-o notation Class P Class NP

6 3.1 Turing Machines Turing Machine (TM) : computation model Infinite tape (unlimited memory), tape head, state Initially the tape contains the input string and is blank everywhere else Tape head : read, write and move Next state and a behavior of tape head is depending on the current state and the character which read by head Outputs accept and reject are obtained by entering their states It may go on forever, never halting TM M Infinitely long blank Input String Output Accept

7 3.1 Turing Machines Turing Machine (TM): TM M Outputs Accept Outputs Reject Never Halting Input

8 Formal definition of a Turing machine Definition 3.3 A Turing machine is a 7-taples :, where are all finite set and

9 Formal definition of a Turing machine Example TM M =, TM M Input : 00

10 Formal definition of a Turing machine Example TM M =, TM M Input : 00

11 Formal definition of a Turing machine Example TM M =, TM M Input : 00

12 Formal definition of a Turing machine Example TM M =, TM M Output Accept Input : 00

13 Formal definition of a Turing machine Example TM M =, TM M Input : 01

14 Formal definition of a Turing machine Example TM M =, TM M Input : 01

15 Formal definition of a Turing machine Example TM M =, TM M Input : 01

16 Formal definition of a Turing machine Example TM M =, TM M Input : 01 Never Halting

17 Language of Turing machine For a Turing machine M, the collection of strings that M accepts is the language of M, or the language recognized by M, denoted L(M) TM M Outputs Accept Outputs Reject Never Halting Input

18 Language of Turing machine For each TM M, we can consider the set of strings which M accepts. We call this set the language of M, or the language recognized by M, denoted by L(M). If TM M halts for all input strings, we call M decides the language L(M). Definition 3.5 Call a language Turing-recognized if some Turing machine recognizes it. Definition 3.6 Call a language Turing-decidable if some Turing machine decides it.

19 3.2 Variants of Turing Machines Multitape Turing machines : Theorem 3.13 Every multitape Turing machine has an equivalent single-tape Turing machine. The languages which each machine recognizes are same Idea of Proof. Simulate a multitape TM D by a single-tape TM M. Proof is omitted. TM D

20 3.2 Variants of Turing Machines Nondeterministic Turing machine : Branching computation A string is accepted by a nondeterministic TM M iff there is a path to accept state in the computation of TM M accept reject deterministicnondeterministic

21 3.2 Variants of Turing Machines Nondeterministic Turing machine : accept reject deterministicnondeterministic Theorem 3.13 Every nondeterministic Turing machine has an equivalent deterministic Turing machine. Idea of Proof. Simulate a nondeterministic TM N by three-tape TM M

22 Language and Problem Problem : Consider only [yes/no] problem. ex1) PRIME : input -> integer N question -> N is prime? ex2) CON : input -> undirected graph G question -> G is connected?

23 Language and Problem Problem Language [yes/no] [element /not element] Prime Number TM M Outputs Accept Solving a Problem -> Constructing TM that decides a Language Composite Number Outputs Reject

24 Language and Problem ex1) PRIME : input -> integer N question -> N is prime? Binary code of Prime Number Binary code of Composite Number Need to encode input Number Prime Number TM M Outputs Accept Composite Number Outputs Reject

25 Language and Problem ex2) CON : input -> undirected graph G question -> G is connected? TM M Outputs Accept Outputs Reject the encoding of G 12 3 5 4 00100 00111 11000 01001 01010 0010000111110000100101010

26 Today's Outline Chapter 3 : Definition of Turing Machines Definition of Variants of Turing Machines Chapter 7 : Time Complexity Big-O, small-O notation Class P Class NP

27 Chapter 7 : Time Complexity TM M : a deterministic TM that halts on all inputs Time complexity of TM M : the function f : N->N f(n) is the maximum number of steps that M uses on any input of length n If time complexity of TM M is f(n), we say that M is an f(n) time Turing machine

28 Big-O, small-o notation The exact time complexity of an algorithm is often a complex expression Asymptotic Analysis : To understand the time complexity when the algorithm is run for large inputs. Considering the highest order term of the expression ex) f(n) = 6n^3 + 2n^2 + 20n + 45 -> asymptotically at most n^3 -> Big-O notation : f(n) = O(n^3) Estimation

29 Big-O, small-o notation Big-O notation f ( n ) = O ( g ( n )) : g ( n ) is an upper bound for f ( n ) ex1) n 2 = O(n 3 ) ex2) n 3 + 4n 2 = O(n 3 ) ex3) n 2 logn + n 2 = O(n 2 logn) Definition 7.2 Let f and g be function Say that f ( n ) = O ( g ( n ) ) if c and n 0 exist s.t. for every n > n 0, f ( n ) ≦ cg ( n )

30 Big-O, small-o notation Small-o notation ex1) n 2 = o(n 3 ) ex2) n = o(nlogn) ex3) √n = o(n) Definition 7.5 Let f and g be function Say that f ( n ) = o ( g ( n ) ), if In other words, for any c, n 0 exists f ( n ) n 0

31 Time Complexity Class Using Big-O notation, let us set up for classifying languages according to their time requirement. Definition 7.7 Let be function. Define the time complexity class TIME(t(n)), to be the collection of all languages that are decided by O(t(n)) time Turing machine

32 Time Complexity Class Definition 7.7 Let be function. Define the time complexity class TIME(t(n)), to be the collection of all languages that are decided by O(t(n)) time Turing machine Classifing the language

33 7.2 The Class P Definition 7.11 Class P is the class of languages that are decidable in polynomial time on a deterministic single-tape Turing machine P

34 Problems in P ex1) PATH = { | a directed graph G that has a path from s to t} ex2) RELPRIME = { | x and y are relatively prime} s t

35 7.3 Class NP Hamilton path for directed graph : a directed path that goes through each node once HAMPATH = { | G is a directed graph that has a Hamilton path from s to t} There is no Hamilton path from v 4 to v 1

36 Class NP HAMPATH = { | G is a directed graph that has a Hamilton path from s to t} HAMPATH is difficult problem : No one knows whether HAMPATH is solvable in polynomial time Polynomial verifiability : If G has a Hamilton path and we are given this path, we can checking its existence in polynomial time

37 Class NP Definition 7.18 A verifier for a language A is an algorithm V, where A = {w | V accept for some string c} V Outputs Accept V Outputs Reject certificate proof

38 Class NP Definition 7.18 A verifier for a language A is an algorithm V, where A = {w | V accept for some string c} Measure the time of a verifier only on the length string w polynomial time verifier runs in polynomial time in the length of w A language A is polynomial time verifiable, if it has a polynomial time verifier Definition 7.19 Class NP is the class of languages that have polynomial time verifiers

39 Running Time of Nondeterministic TM accept reject f(n) Running time of an nondeterministic TM is the function f(n), where f(n) is the maximum number of steps for all branching of computation for any string of length n

40 Class NP Theorem 7.20 A language in NP iff it is decided by some nondeterministic polynomial time Turing machine VNTM

41 Class NP Definition 7.21 NTIME(t(n)) = { L | L is a language that are decided by O(t(n)) time nondeterministic Turing machine} Corollary 7.22 Theorem 7.20 A language in NP iff it is decided by some nondeterministic polynomial time Turing machine

42 Next day : Oct 15. I will send e-mail about the schedule of presentation.


Download ppt "Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3"

Similar presentations


Ads by Google