The class P Section 7.2 CSC 4170 Theory of Computation.

Slides:



Advertisements
Similar presentations
Variants of Turing machines
Advertisements

MATH 224 – Discrete Mathematics
1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
The class NP Section 7.3 Giorgi Japaridze Theory of Computability.
The diagonalization method The halting problem is undecidable Decidability.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Measuring Time Complexity Sipser 7.1 (pages )
P and NP Sipser (pages ). CS 311 Fall Polynomial time P = ∪ k TIME(n k ) … P = ∪ k TIME(n k ) … TIME(n 3 ) TIME(n 2 ) TIME(n)
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
CHAPTER 3 The Church-Turing Thesis
Foundations of (Theoretical) Computer Science
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 8+9 Time complexity 1 Jan Maluszynski, IDA, 2007
Applied Computer Science II Chapter 7: Time Complexity Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany.
CS 310 – Fall 2006 Pacific University CS310 P vs NP the steel cage death match Section 7.2 November 29, 2006.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
CS 310 – Fall 2006 Pacific University CS310 Complexity Section 7.1 November 27, 2006.
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
חישוביות וסיבוכיות Computability and Complexity Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
Approximation Algorithms Pages ADVANCED TOPICS IN COMPLEXITY THEORY.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Analysis of Algorithms
Computer Language Theory
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
Interactive proof systems Section 10.4 Giorgi Japaridze Theory of Computability.
Umans Complexity Theory Lectures Lecture 1a: Problems and Languages.
Measuring complexity Section 7.1 Giorgi Japaridze Theory of Computability.
Decidable languages Section 4.1 CSC 4170 Theory of Computation.
Algorithms 1.Notion of an algorithm 2.Properties of an algorithm 3.The GCD algorithm 4.Correctness of the GCD algorithm 5.Termination of the GCD algorithm.
The Church-Turing Thesis Chapter 3 Giorgi Japaridze Theory of Computability.
Computability Heap exercise. The class P. The class NP. Verifiers. Homework: Review RELPRIME proof. Find examples of problems in NP.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 7 Time complexity Contents Measuring Complexity Big-O and small-o notation.
CSCI 2670 Introduction to Theory of Computing November 17, 2005.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 7 Time Complexity Some slides are in courtesy.
The Classes L and NL Section 8.4 Giorgi Japaridze Theory of Computability.
Alternation Section 10.3 Giorgi Japaridze Theory of Computability.
Chapter 15 P, NP, and Cook’s Theorem. 2 Computability Theory n Establishes whether decision problems are (only) theoretically decidable, i.e., decides.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
 2004 SDU 1 Algorithm Informally speaking, an algorithm is a collection of simple instructions for carrying out a task. Example:  Elementary arithmetic.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
Discrete Mathematics Chapter 2 The Fundamentals : Algorithms, the Integers, and Matrices. 大葉大學 資訊工程系 黃鈴玲.
 2005 SDU Lecture14 Mapping Reducibility, Complexity.
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
Probabilistic Algorithms
CSC 4170 Theory of Computation The class P Section 7.2.
Time complexity Here we will consider elements of computational complexity theory – an investigation of the time (or other resources) required for solving.
Computability and Complexity
CSC 4170 Theory of Computation The class P Section 7.2.
CSCI 2670 Introduction to Theory of Computing
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Intro to Theory of Computation
CSC 4170 Theory of Computation Time complexity Section 7.1.
Theory of Computability
CS21 Decidability and Tractability
Time Complexity Classes
Variants of Turing machines
CSE 105 theory of computation
CSC 4170 Theory of Computation Time complexity Section 7.1.
Theory of Computability
Theory of Computability
Intro to Theory of Computation
Presentation transcript:

The class P Section 7.2 CSC 4170 Theory of Computation

The definition and importance of P 7.2.a Definition 7.12 P is the class of languages that are decidable in polynomial time on a deterministic (single-tape) TM. In other words, P = TIME(n 1 )  TIME(n 2 )  TIME(n 3 )  TIME(n 4 )  … Importance 1. P is invariant for all models of computation that are polynomially equivalent to the deterministic single-tape TM. Here polynomial equivalence means equivalence with only a polynomial difference in running time. Thus, P is a mathematically robust class, not affected by the particulars of the model of computation that we are using. 2. P roughly corresponds to the class of problems that are realistically solvable on a computer. Thus, P is relevant from a practical standpoint.

Analyzing polynomial-time algorithms 7.2.b 1. When we only care about polynomiality, algorithms can be described at high level without reference to features of a particular implementation model. Doing so avoids tedious details of tapes and head motions. 2. We describe algorithms with numbered stages. The notion of a stage is analogous to a step of a TM, though of course, implementing one stage will usually require many TM steps. Asymptotic analysis allows us to ignore this difference. 3. To show that an algorithm runs in polynomial time, it is sufficient to show that: a) There is a polynomial upper bound (usually in big-O notation) on the number of stages that the algorithm uses when it runs on an input of length n, and that b) Each stage takes a polynomial number of (actual TM) steps on a reasonable deterministic model. 4. The underlying (and usually non-specified) encoding of objects should be reasonable, and polynomially equivalent to other reasonable encodings. E.g., encoding 12 as is unreasonable as it is exponentially bigger than the binary (or decimal) encoding. 5. Among the reasonable encodings for graphs are encodings of their adjacency matrices. Since the size of such a matrix only polynomially differs from the number of nodes, it is OK if we show the polynomiality of an algorithm in the number of its nodes rather than in the size of its adjacency matrix.

The PATH problem 7.2.c s PATH = { | G is a directed graph that has a directed path from s to t} t

The RELPRIME problem 7.2.e Two numbers are said to be relatively prime iff 1 is the largest integer that evenly divides both of them. Are the following numbers relatively prime? 15 and 27 8 and 9 11 and 19 No, - both divisible by 3 RELPRIME = { | x and y are relatively prime} Is RELPRIME decidable? What is the time complexity of an ad hoc decision algorithm (TM)? But there is a smarter algorithm that runs in polynomial time. It is based on the Euclidean algorithm for finding the greatest common divisor. Yes Yes: two different prime numbers are always relatively prime

A polynomial-time algorithm for the RELPRIME problem 7.2.f The Euclidean algorithm: E = “On input, where x and y are natural numbers, x>y: 1. Repeat until y=0. 2. Assign x  x mod y. 3. Exchange x and y. 4. Output x.” Testing on : x = 3 y = 0 Output: 3 What is the time complexity of this algorithm? --- It can be shown to be polynomial because on every iteration of Step 1, the value of x is at most half of the previous value. Now, the following algorithm R solves RELPRIME in polynomial time: R = “On input, where x and y are natural numbers: 1. Swap x and y if necessary so that x>y. 2. Run E on. 3. If the result is 1, accept. Otherwise reject.

The time complexity of context-free languages 7.2.g Theorem 7.16 Every context-free language is a member of P. Specifically, is of complexity O(n 3 ). Proof omitted (and will not be asked).