class_of_p_and_np

Upload: dhanashekar-manickam

Post on 03-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 CLASS_OF_P_AND_NP

    1/10

    P (complexity)

    Incomputational complexity theory,P, also known as PTIME orDTIME(nO(1)),

    is one of the most fundamentalcomplexity classes. It contains alldecisionproblemsthat can be solved by adeterministic Turing machineusing apolynomialamount ofcomputation time, orpolynomial time.

    Cobham's thesisholds that P is the class of computational problems that are"efficiently solvable" or "tractable"; in practice, some problems not known to be inP have practical solutions, and some that are in P do not, but this is a useful rule of

    thumb.

    Definition

    A languageL is in P if and only if there exists a deterministic Turing machineM,such that

    Mruns for polynomial time on all inputs For allx inL,Moutputs 1 For allx not inL,Moutputs 0

    P can also be viewed as a uniform family ofboolean circuits. A languageL is in Pif and only if there exists apolynomial-time uniformfamily of boolean circuits

    , such that

    For all , takes n bits as input and outputs 1 bit For allx inL, For allx not inL,

    The circuit definition can be weakened to use only alogspace uniformfamilywithout changing the complexity class.

    Notable problems in P

    P is known to contain many natural problems, including the decision versions of

    linear programming, calculating thegreatest common divisor, and finding a

    maximum matching. In 2002, it was shown that the problem of determining if anumber isprimeis in P.[1]The related class offunction problemsisFP.

    http://en.wikipedia.org/wiki/Computational_complexity_theoryhttp://en.wikipedia.org/wiki/Computational_complexity_theoryhttp://en.wikipedia.org/wiki/Computational_complexity_theoryhttp://en.wikipedia.org/wiki/DTIMEhttp://en.wikipedia.org/wiki/DTIMEhttp://en.wikipedia.org/wiki/DTIMEhttp://en.wikipedia.org/wiki/Complexity_classhttp://en.wikipedia.org/wiki/Complexity_classhttp://en.wikipedia.org/wiki/Complexity_classhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Polynomialhttp://en.wikipedia.org/wiki/Polynomialhttp://en.wikipedia.org/wiki/Polynomialhttp://en.wikipedia.org/wiki/Computation_timehttp://en.wikipedia.org/wiki/Computation_timehttp://en.wikipedia.org/wiki/Computation_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Cobham%27s_thesishttp://en.wikipedia.org/wiki/Cobham%27s_thesishttp://en.wikipedia.org/wiki/Boolean_circuithttp://en.wikipedia.org/wiki/Boolean_circuithttp://en.wikipedia.org/wiki/Boolean_circuithttp://en.wikipedia.org/wiki/Circuit_complexity#Polynomial-time_uniformhttp://en.wikipedia.org/wiki/Circuit_complexity#Polynomial-time_uniformhttp://en.wikipedia.org/wiki/Circuit_complexity#Polynomial-time_uniformhttp://en.wikipedia.org/wiki/Circuit_complexity#Logspace_uniformhttp://en.wikipedia.org/wiki/Circuit_complexity#Logspace_uniformhttp://en.wikipedia.org/wiki/Circuit_complexity#Logspace_uniformhttp://en.wikipedia.org/wiki/Linear_programminghttp://en.wikipedia.org/wiki/Linear_programminghttp://en.wikipedia.org/wiki/Greatest_common_divisorhttp://en.wikipedia.org/wiki/Greatest_common_divisorhttp://en.wikipedia.org/wiki/Greatest_common_divisorhttp://en.wikipedia.org/wiki/Maximum_matchinghttp://en.wikipedia.org/wiki/Maximum_matchinghttp://en.wikipedia.org/wiki/Prime_numberhttp://en.wikipedia.org/wiki/Prime_numberhttp://en.wikipedia.org/wiki/Prime_numberhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/Function_problemhttp://en.wikipedia.org/wiki/Function_problemhttp://en.wikipedia.org/wiki/Function_problemhttp://en.wikipedia.org/wiki/FP_%28complexity%29http://en.wikipedia.org/wiki/FP_%28complexity%29http://en.wikipedia.org/wiki/FP_%28complexity%29http://en.wikipedia.org/wiki/FP_%28complexity%29http://en.wikipedia.org/wiki/Function_problemhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/Prime_numberhttp://en.wikipedia.org/wiki/Maximum_matchinghttp://en.wikipedia.org/wiki/Greatest_common_divisorhttp://en.wikipedia.org/wiki/Linear_programminghttp://en.wikipedia.org/wiki/Circuit_complexity#Logspace_uniformhttp://en.wikipedia.org/wiki/Circuit_complexity#Polynomial-time_uniformhttp://en.wikipedia.org/wiki/Boolean_circuithttp://en.wikipedia.org/wiki/Cobham%27s_thesishttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Computation_timehttp://en.wikipedia.org/wiki/Polynomialhttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Complexity_classhttp://en.wikipedia.org/wiki/DTIMEhttp://en.wikipedia.org/wiki/Computational_complexity_theory
  • 7/28/2019 CLASS_OF_P_AND_NP

    2/10

    Several natural problems are complete forP, includingst-connectivity(or

    reachability) on alternating graphs.[2]The article onP-complete problemslistsfurther relevant problems in P.

    Relationships to other classes

    A generalization ofP isNP, which is the class ofdecision problemsdecidable by a

    non-deterministic Turing machinethat runs inpolynomial time. Equivalently, it isthe class of decision problems where each "yes" instance has a polynomial sizecertificate, and certificates can be checked by a polynomial time deterministic

    Turing machine. The class of problems for which this is true for the "no" instances

    is calledco-NP.P is trivially a subset ofNP and ofco-NP; most experts believe itis a strict subset,[3]although this (thePNP hypothesis) remains unproven.

    Another open problem is whetherNP = co-NP (a negative answer would imply

    PNP).

    P is also known to be at least as large asL, the class of problems decidable in a

    logarithmicamount ofmemory space. A decider using space cannot use

    more than time, because this is the total number of possible

    configurations; thus, L is a subset ofP. Another important problem is whetherL =P. We do know that P = AL, the set of problems solvable in logarithmic memory

    byalternating Turing machines.P is also known to be no larger thanPSPACE, theclass of problems decidable in polynomial space. Again, whetherP = PSPACE isan open problem. To summarize:

    Here,EXPTIMEis the class of problems solvable in exponential time. Of all theclasses shown above, only two strict containments are known:

    P is strictly contained in EXPTIME. Consequently, all EXPTIME-hardproblems lie outside P, and at least one of the containments to the right ofPabove is strict (in fact, it is widely believed that all three are strict).

    L is strictly contained in PSPACE.

    The most difficult problems in P areP-completeproblems.

    Another generalization ofP is P/poly, orNonuniform Polynomial-Time. If aproblem is in P/poly, then it can be solved in deterministic polynomial time

    provided that anadvice stringis given that depends only on the length of the input.

    http://en.wikipedia.org/wiki/St-connectivityhttp://en.wikipedia.org/wiki/St-connectivityhttp://en.wikipedia.org/wiki/St-connectivityhttp://en.wikipedia.org/wiki/St-connectivityhttp://en.wikipedia.org/wiki/Reachabilityhttp://en.wikipedia.org/wiki/Reachabilityhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-Immerman_Reachability-2http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-Immerman_Reachability-2http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-Immerman_Reachability-2http://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/NP_%28complexity%29http://en.wikipedia.org/wiki/NP_%28complexity%29http://en.wikipedia.org/wiki/NP_%28complexity%29http://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-3http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-3http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-3http://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/L_%28complexity%29http://en.wikipedia.org/wiki/L_%28complexity%29http://en.wikipedia.org/wiki/L_%28complexity%29http://en.wikipedia.org/wiki/Logarithmhttp://en.wikipedia.org/wiki/Logarithmhttp://en.wikipedia.org/wiki/Memory_spacehttp://en.wikipedia.org/wiki/Memory_spacehttp://en.wikipedia.org/wiki/Memory_spacehttp://en.wikipedia.org/wiki/Alternating_Turing_machinehttp://en.wikipedia.org/wiki/Alternating_Turing_machinehttp://en.wikipedia.org/wiki/Alternating_Turing_machinehttp://en.wikipedia.org/wiki/PSPACEhttp://en.wikipedia.org/wiki/PSPACEhttp://en.wikipedia.org/wiki/PSPACEhttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/Advice_%28complexity%29http://en.wikipedia.org/wiki/Advice_%28complexity%29http://en.wikipedia.org/wiki/Advice_%28complexity%29http://en.wikipedia.org/wiki/Advice_%28complexity%29http://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/PSPACEhttp://en.wikipedia.org/wiki/Alternating_Turing_machinehttp://en.wikipedia.org/wiki/Memory_spacehttp://en.wikipedia.org/wiki/Logarithmhttp://en.wikipedia.org/wiki/L_%28complexity%29http://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-3http://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/NP_%28complexity%29http://en.wikipedia.org/wiki/P-completehttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-Immerman_Reachability-2http://en.wikipedia.org/wiki/Reachabilityhttp://en.wikipedia.org/wiki/St-connectivity
  • 7/28/2019 CLASS_OF_P_AND_NP

    3/10

    Unlike forNP, however, the polynomial-time machine doesn't need to detect

    fraudulent advice strings; it is not a verifier. P/poly is a large class containingnearly all practical problems, including all ofBPP. If it contains NP, then the

    polynomial hierarchycollapses to the second level. On the other hand, it also

    contains some impractical problems, including someundecidable problemssuch asthe unary version of any undecidable problem.

    In 1999, Jin-Yi Cai and D. Sivakumar, building on work byMitsunori Ogihara,showed that if there exists asparse languagethat is P-complete, then L = P.[4]

    Properties

    Polynomial-time algorithms are closed under composition. Intuitively, this says

    that if one writes a function that is polynomial-time assuming that function calls

    are constant-time, and if those called functions themselves require polynomialtime, then the entire algorithm takes polynomial time. One consequence of this isthat P islowfor itself. This is also one of the main reasons that P is considered to

    be a machine-independent class; any machine "feature", such asrandom access,that can be simulated in polynomial time can simply be composed with the main

    polynomial-time algorithm to reduce it to a polynomial-time algorithm on a morebasic machine.

    Pure existence proofs of polynomial-time algorithms

    Some problems are known to be solvable in polynomial-time, but no concretealgorithm is known for solving them. For example, theRobertsonSeymour

    theoremguarantees that there is a finite list offorbidden minorsthat characterizes

    (for example) the set of graphs that can be embedded on a torus; moreover,Robertson and Seymour showed that there is an O(n3) algorithm for determiningwhether a graph has a given graph as a minor. This yields anonconstructive proof

    that there is a polynomial-time algorithm for determining if a given graph can beembedded on a torus, despite the fact that no concrete algorithm is known for this

    problem.

    Alternative characterizations

    Indescriptive complexity,P can be described as the problems expressible inFO

    (LFP), the class offirst-order logicwith aleast fixed pointoperator added to it. InImmerman's 1999 textbook on descriptive complexity,[5]Immerman ascribes this

    result to Vardi[6]and to Immerman.[7]

    http://en.wikipedia.org/wiki/Bounded-error_probabilistic_polynomialhttp://en.wikipedia.org/wiki/Bounded-error_probabilistic_polynomialhttp://en.wikipedia.org/wiki/Bounded-error_probabilistic_polynomialhttp://en.wikipedia.org/wiki/Polynomial_hierarchyhttp://en.wikipedia.org/wiki/Polynomial_hierarchyhttp://en.wikipedia.org/wiki/Undecidable_problemhttp://en.wikipedia.org/wiki/Undecidable_problemhttp://en.wikipedia.org/wiki/Undecidable_problemhttp://en.wikipedia.org/w/index.php?title=Mitsunori_Ogihara&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Mitsunori_Ogihara&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Mitsunori_Ogihara&action=edit&redlink=1http://en.wikipedia.org/wiki/Sparse_languagehttp://en.wikipedia.org/wiki/Sparse_languagehttp://en.wikipedia.org/wiki/Sparse_languagehttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/Low_%28complexity%29http://en.wikipedia.org/wiki/Low_%28complexity%29http://en.wikipedia.org/wiki/Low_%28complexity%29http://en.wikipedia.org/wiki/Random_accesshttp://en.wikipedia.org/wiki/Random_accesshttp://en.wikipedia.org/wiki/Random_accesshttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Forbidden_minorhttp://en.wikipedia.org/wiki/Forbidden_minorhttp://en.wikipedia.org/wiki/Forbidden_minorhttp://en.wikipedia.org/wiki/Nonconstructive_proofhttp://en.wikipedia.org/wiki/Nonconstructive_proofhttp://en.wikipedia.org/wiki/Nonconstructive_proofhttp://en.wikipedia.org/wiki/Descriptive_complexityhttp://en.wikipedia.org/wiki/Descriptive_complexityhttp://en.wikipedia.org/wiki/Descriptive_complexityhttp://en.wikipedia.org/w/index.php?title=FO_%28LFP%29&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=FO_%28LFP%29&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=FO_%28LFP%29&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=FO_%28LFP%29&action=edit&redlink=1http://en.wikipedia.org/wiki/First-order_logichttp://en.wikipedia.org/wiki/First-order_logichttp://en.wikipedia.org/wiki/First-order_logichttp://en.wikipedia.org/wiki/Least_fixed_pointhttp://en.wikipedia.org/wiki/Least_fixed_pointhttp://en.wikipedia.org/wiki/Least_fixed_pointhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-5http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-5http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-5http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-6http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-6http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-6http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-7http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-7http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-7http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-7http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-6http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-5http://en.wikipedia.org/wiki/Least_fixed_pointhttp://en.wikipedia.org/wiki/First-order_logichttp://en.wikipedia.org/w/index.php?title=FO_%28LFP%29&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=FO_%28LFP%29&action=edit&redlink=1http://en.wikipedia.org/wiki/Descriptive_complexityhttp://en.wikipedia.org/wiki/Nonconstructive_proofhttp://en.wikipedia.org/wiki/Forbidden_minorhttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Robertson%E2%80%93Seymour_theoremhttp://en.wikipedia.org/wiki/Random_accesshttp://en.wikipedia.org/wiki/Low_%28complexity%29http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/Sparse_languagehttp://en.wikipedia.org/w/index.php?title=Mitsunori_Ogihara&action=edit&redlink=1http://en.wikipedia.org/wiki/Undecidable_problemhttp://en.wikipedia.org/wiki/Polynomial_hierarchyhttp://en.wikipedia.org/wiki/Bounded-error_probabilistic_polynomial
  • 7/28/2019 CLASS_OF_P_AND_NP

    4/10

    History

    Kozen[8]states thatCobhamandEdmondsare "generally credited with the

    invention of the notion of polynomial time." Cobham invented the class as a robustway of characterizing efficient algorithms, leading toCobham's thesis. However,

    H. C. Pocklington, in a 1910 paper,[9][10]analyzed two algorithms for solvingquadratic congruences, and observed that one took time "proportional to a power of

    the logarithm of the modulus" and contrasted this with one that took time

    proportional "to the modulus itself or its square root", thus explicitly drawing adistinction between an algorithm that ran in polynomial time versus one that didnot.

    NP (complexity)

    From Wikipedia, the free encyclopedia

    Jump to:navigation,search

    List of unsolvedproblems in computer

    science

    Is P= NP?

    Euler diagramforP, NP,NP-complete, andNP-hardset of problems. Theexistence of problems within NP but outside both P and NP-complete, under this

    assumption, wasestablished by Ladner.[1]

    Incomputational complexity theory,NP is one of the most fundamental

    complexity classes. The abbreviation NP refers to "nondeterministicpolynomialtime."

    http://en.wikipedia.org/wiki/Dexter_Kozenhttp://en.wikipedia.org/wiki/Dexter_Kozenhttp://en.wikipedia.org/wiki/Dexter_Kozenhttp://en.wikipedia.org/w/index.php?title=Alan_Cobham_%28mathematician%29&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Alan_Cobham_%28mathematician%29&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Alan_Cobham_%28mathematician%29&action=edit&redlink=1http://en.wikipedia.org/wiki/Jack_Edmondshttp://en.wikipedia.org/wiki/Jack_Edmondshttp://en.wikipedia.org/wiki/Jack_Edmondshttp://en.wikipedia.org/wiki/Cobham%27s_thesishttp://en.wikipedia.org/wiki/Cobham%27s_thesishttp://en.wikipedia.org/wiki/Cobham%27s_thesishttp://en.wikipedia.org/wiki/Henry_Cabourn_Pocklingtonhttp://en.wikipedia.org/wiki/Henry_Cabourn_Pocklingtonhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-9http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-9http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-9http://en.wikipedia.org/wiki/NP_%28complexity%29#mw-navigationhttp://en.wikipedia.org/wiki/NP_%28complexity%29#mw-navigationhttp://en.wikipedia.org/wiki/NP_%28complexity%29#mw-navigationhttp://en.wikipedia.org/wiki/NP_%28complexity%29#p-searchhttp://en.wikipedia.org/wiki/NP_%28complexity%29#p-searchhttp://en.wikipedia.org/wiki/NP_%28complexity%29#p-searchhttp://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_sciencehttp://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_sciencehttp://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_sciencehttp://en.wikipedia.org/wiki/Euler_diagramhttp://en.wikipedia.org/wiki/Euler_diagramhttp://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/NP-hardhttp://en.wikipedia.org/wiki/NP-hardhttp://en.wikipedia.org/wiki/NP-hardhttp://en.wikipedia.org/wiki/Ladner%27s_theoremhttp://en.wikipedia.org/wiki/Ladner%27s_theoremhttp://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/Computational_complexity_theoryhttp://en.wikipedia.org/wiki/Computational_complexity_theoryhttp://en.wikipedia.org/wiki/Computational_complexity_theoryhttp://en.wikipedia.org/wiki/Complexity_classhttp://en.wikipedia.org/wiki/Complexity_classhttp://en.wikipedia.org/wiki/Nondeterministic_algorithmhttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/File:P_np_np-complete_np-hard.svghttp://en.wikipedia.org/wiki/File:P_np_np-complete_np-hard.svghttp://en.wikipedia.org/wiki/File:P_np_np-complete_np-hard.svghttp://en.wikipedia.org/wiki/File:P_np_np-complete_np-hard.svghttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Nondeterministic_algorithmhttp://en.wikipedia.org/wiki/Complexity_classhttp://en.wikipedia.org/wiki/Computational_complexity_theoryhttp://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-1http://en.wikipedia.org/wiki/Ladner%27s_theoremhttp://en.wikipedia.org/wiki/NP-hardhttp://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/Euler_diagramhttp://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_sciencehttp://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_sciencehttp://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_sciencehttp://en.wikipedia.org/wiki/NP_%28complexity%29#p-searchhttp://en.wikipedia.org/wiki/NP_%28complexity%29#mw-navigationhttp://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-9http://en.wikipedia.org/wiki/P_%28complexity%29#cite_note-9http://en.wikipedia.org/wiki/Henry_Cabourn_Pocklingtonhttp://en.wikipedia.org/wiki/Cobham%27s_thesishttp://en.wikipedia.org/wiki/Jack_Edmondshttp://en.wikipedia.org/w/index.php?title=Alan_Cobham_%28mathematician%29&action=edit&redlink=1http://en.wikipedia.org/wiki/Dexter_Kozenhttp://en.wikipedia.org/wiki/Dexter_Kozen
  • 7/28/2019 CLASS_OF_P_AND_NP

    5/10

    Intuitively, NP is the set of alldecision problemsfor which the instances where the

    answer is "yes" have efficiently verifiable proofs of the fact that the answer isindeed "yes". More precisely, these proofs have to be verifiable inpolynomial time

    by adeterministic Turing machine. In an equivalent formal definition, NP is the set

    ofdecision problemswhere the "yes"-instances can be accepted inpolynomial timeby anon-deterministic Turing machine. The equivalence of the two definitions

    follows from the fact that an algorithm on such a non-deterministic machineconsists of two phases, the first of which consists of a guess about the solution,

    which is generated in a non-deterministic way, while the second consists of adeterministic algorithm that verifies or rejects the guess as a valid solution to the

    problem.[2]

    The complexity classPis contained in NP, but NP contains many important

    problems, the hardest of which are calledNP-completeproblems, for which no

    polynomial-timealgorithmsare known for solving them (although they can beverifiedin polynomial time). The most important open question in complexitytheory, theP = NP problem, asks whether polynomial time algorithms actually

    exist forNP-complete, and by corollary, all NP problems. It is widely believed thatthis is not the case.[3]

    Formal definition

    The complexity class NP can be defined in terms ofNTIMEas follows:

    Alternatively, NP can be defined using deterministic Turing machines as verifiers.AlanguageL is in NP if and only if there exist polynomialsp and q, and adeterministic Turing machineM, such that

    For allx andy, the machineMruns in timep(|x|) on input (x,y) For allx inL, there exists a stringy of length q(|x|) such thatM(x,y) = 1 For allx not inL and all stringsy of length q(|x|),M(x,y) = 0

    Introduction

    http://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-2http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-2http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-2http://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/Algorithmshttp://en.wikipedia.org/wiki/Algorithmshttp://en.wikipedia.org/wiki/Algorithmshttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-poll-3http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-poll-3http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-poll-3http://en.wikipedia.org/wiki/NTIMEhttp://en.wikipedia.org/wiki/NTIMEhttp://en.wikipedia.org/wiki/NTIMEhttp://en.wikipedia.org/wiki/Formal_languagehttp://en.wikipedia.org/wiki/Formal_languagehttp://en.wikipedia.org/wiki/Formal_languagehttp://en.wikipedia.org/wiki/Formal_languagehttp://en.wikipedia.org/wiki/NTIMEhttp://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-poll-3http://en.wikipedia.org/wiki/P_%3D_NP_problemhttp://en.wikipedia.org/wiki/Algorithmshttp://en.wikipedia.org/wiki/NP-completehttp://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-2http://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Decision_problem
  • 7/28/2019 CLASS_OF_P_AND_NP

    6/10

    Many naturalcomputer scienceproblems are covered by the class NP. In

    particular, the decision versions of many interestingsearch problemsandoptimization problems are contained in NP.

    Verifier-based definition

    In order to explain the verifier-based definition ofNP, let us consider thesubset

    sum problem: Assume that we are given someintegers, such as {7, 3, 2, 5, 8},and we wish to know whether some of these integers sum up to zero. In this

    example, the answer is "yes", since the subset of integers {3, 2, 5} corresponds

    to the sum (3) + (2) + 5 = 0. The task of deciding whether such a subset withsum zero exists is called thesubset sum problem.

    As the number of integers that we feed into the algorithm becomes larger, the

    number of subsets grows exponentially, and in fact the subset sum problem is NP-complete. However, notice that, if we are given a particular subset (often called acertificate), we can easily check orverify whether the subset sum is zero, by just

    summing up the integers of the subset. So if the sum is indeed zero, that particularsubset is theprooforwitnessfor the fact that the answer is "yes". An algorithm

    that verifies whether a given subset has sum zero is called verifier. A problem is

    said to be in NP if there exists a verifier for the problem that executes inpolynomial time. In case of the subset sum problem, the verifier needs onlypolynomial time, for which reason the subset sum problem is in NP.

    The "no"-answer version of this problem is stated as: "given a finite set of integers,does every non-empty subset have a nonzero sum?". Note that the verifier-baseddefinition ofNP does notrequire an easy-to-verify certificate for the "no"-answers.

    The class of problems with such certificates for the "no"-answers is calledco-NP.In fact, it is an open question whether all problems in NP also have certificates for

    the "no"-answers and thus are in co-NP.

    Machine-definition

    Equivalent to the verifier-based definition is the following characterization: NP is

    the set ofdecision problemssolvable by anon-deterministic Turing machinethatruns inpolynomial time. (This means that there is an accepting computation path ifa word is in the languageco-NPis defined dually with rejecting paths.) This

    definition is equivalent to the verifier-based definition because a non-deterministicTuring machine could solve an NP problem in polynomial time by non-

    deterministically selecting a certificate and running the verifier on the certificate.

    http://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Computer_sciencehttp://en.wikipedia.org/wiki/Search_problemhttp://en.wikipedia.org/wiki/Search_problemhttp://en.wikipedia.org/wiki/Search_problemhttp://en.wikipedia.org/wiki/Subset_sum_problemhttp://en.wikipedia.org/wiki/Subset_sum_problemhttp://en.wikipedia.org/wiki/Subset_sum_problemhttp://en.wikipedia.org/wiki/Subset_sum_problemhttp://en.wikipedia.org/wiki/Integerhttp://en.wikipedia.org/wiki/Integerhttp://en.wikipedia.org/wiki/Integerhttp://en.wikipedia.org/wiki/Witness_%28mathematics%29http://en.wikipedia.org/wiki/Witness_%28mathematics%29http://en.wikipedia.org/wiki/Witness_%28mathematics%29http://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Polynomial_timehttp://en.wikipedia.org/wiki/Non-deterministic_Turing_machinehttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Witness_%28mathematics%29http://en.wikipedia.org/wiki/Integerhttp://en.wikipedia.org/wiki/Subset_sum_problemhttp://en.wikipedia.org/wiki/Subset_sum_problemhttp://en.wikipedia.org/wiki/Search_problemhttp://en.wikipedia.org/wiki/Computer_science
  • 7/28/2019 CLASS_OF_P_AND_NP

    7/10

    Similarly, if such a machine exists, then a polynomial time verifier can naturally beconstructed from it.

    Examples

    This is an incomplete list of problems that are in NP.

    All problems inP(For, given a certificate for a problem in P, we can ignorethe certificate and just solve the problem in polynomial time. Alternatively,note that a deterministic Turing machine is also trivially a non-deterministic

    Turing machine that just happens to not use any non-determinism.)

    The decision problem version of theinteger factorization problem: givenintegers n and k, is there a factorfwith 1

  • 7/28/2019 CLASS_OF_P_AND_NP

    8/10

    However, in practical uses, instead of spending computational resources looking

    for an optimal solution, a good enough (but potentially suboptimal) solution mayoften be found in polynomial time. Also, the real life applications of some

    problems are easier than their theoretical equivalents. For example, inputs to the

    generalTravelling salesman problemneed not obey thetriangle inequality, unlikereal road networks.

    Equivalence of definitions

    The two definitions ofNP as the class of problems solvable by a nondeterministic

    Turing machine(TM) in polynomial time and the class of problems verifiable by a

    deterministic Turing machine in polynomial time are equivalent. The proof isdescribed by many textbooks, for example Sipser'sIntroduction to the Theory ofComputation, section 7.3.

    To show this, first suppose we have a deterministic verifier. A nondeterministicmachine can simply nondeterministically run the verifier on all possible proof

    strings (this requires only polynomially many steps because it cannondeterministically choose the next character in the proof string in each step, and

    the length of the proof string must be polynomially bounded). If any proof is valid,

    some path will accept; if no proof is valid, the string is not in the language and itwill reject.

    Conversely, suppose we have a nondeterministic TM called A accepting a given

    language L. At each of its polynomially many steps, the machine'scomputationtreebranches in at most a constant number of directions. There must be at least oneaccepting path, and the string describing this path is the proof supplied to the

    verifier. The verifier can then deterministically simulate A, following only theaccepting path, and verifying that it accepts at the end. If A rejects the input, there

    is no accepting path, and the verifier will never accept.

    Relationship to other classes

    NP contains all problems inP, since one can verify any instance of the problem by

    simply ignoring the proof and solving it. NP is contained inPSPACEto showthis, it suffices to construct a PSPACE machine that loops over all proof stringsand feeds each one to a polynomial-time verifier. Since a polynomial-time machine

    can only read polynomially many bits, it cannot use more than polynomial space,nor can it read a proof string occupying more than polynomial space (so we don't

    have to consider proofs longer than this). NP is also contained inEXPTIME, sincethe same algorithm operates in exponential time.

    http://en.wikipedia.org/wiki/Travelling_salesman_problemhttp://en.wikipedia.org/wiki/Travelling_salesman_problemhttp://en.wikipedia.org/wiki/Travelling_salesman_problemhttp://en.wikipedia.org/wiki/Triangle_inequalityhttp://en.wikipedia.org/wiki/Triangle_inequalityhttp://en.wikipedia.org/wiki/Triangle_inequalityhttp://en.wikipedia.org/wiki/Turing_machinehttp://en.wikipedia.org/wiki/Turing_machinehttp://en.wikipedia.org/wiki/Computation_treehttp://en.wikipedia.org/wiki/Computation_treehttp://en.wikipedia.org/wiki/Computation_treehttp://en.wikipedia.org/wiki/Computation_treehttp://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/PSPACEhttp://en.wikipedia.org/wiki/PSPACEhttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/EXPTIMEhttp://en.wikipedia.org/wiki/PSPACEhttp://en.wikipedia.org/wiki/P_%28complexity%29http://en.wikipedia.org/wiki/Computation_treehttp://en.wikipedia.org/wiki/Computation_treehttp://en.wikipedia.org/wiki/Turing_machinehttp://en.wikipedia.org/wiki/Triangle_inequalityhttp://en.wikipedia.org/wiki/Travelling_salesman_problem
  • 7/28/2019 CLASS_OF_P_AND_NP

    9/10

    ThecomplementofNP,co-NP, contains those problems which have a simple

    proof forno instances, sometimes called counterexamples. For example,primalitytestingtrivially lies in co-NP, since one can refute the primality of an integer by

    merely supplying a nontrivial factor. NP and co-NP together form the first level inthepolynomial hierarchy, higher only than P.

    NP is defined using only deterministic machines. If we permit the verifier to be

    probabilistic (this however, is not necessarily a BPP machine[4]), we get the class

    MA solvable using anArthur-Merlin protocolwith no communication from Merlinto Arthur.

    NP is a class ofdecision problems; the analogous class of function problems isFNP.

    Other characterizations

    In terms ofdescriptive complexity theory,NP corresponds precisely to the set oflanguages definable by existentialsecond-order logic(Fagin's theorem).

    NP can be seen as a very simple type ofinteractive proof system, where the prover

    comes up with the proof certificate and the verifier is a deterministic polynomial-time machine that checks it. It is complete because the right proof string will make

    it accept if there is one, and it is sound because the verifier cannot accept if there isno acceptable proof string.

    A major result of complexity theory is that NP can be characterized as theproblems solvable byprobabilistically checkable proofswhere the verifier uses

    O(log n) random bits and examines only a constant number of bits of the proofstring (the class PCP(log n, 1)). More informally, this means that the NP verifier

    described above can be replaced with one that just "spot-checks" a few places in

    the proof string, and using a limited number of coin flips can determine the correctanswer with high probability. This allows several results about the hardness ofapproximation algorithmsto be proven.

    Example

    The decision version of thetraveling salesman problemis in NP. Given an input

    matrix of distances between n cities, the problem is to determine if there is a routevisiting all cities with total distance less than k.

    http://en.wikipedia.org/wiki/Complement_%28complexity%29http://en.wikipedia.org/wiki/Complement_%28complexity%29http://en.wikipedia.org/wiki/Complement_%28complexity%29http://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Primality_testhttp://en.wikipedia.org/wiki/Primality_testhttp://en.wikipedia.org/wiki/Primality_testhttp://en.wikipedia.org/wiki/Primality_testhttp://en.wikipedia.org/wiki/Polynomial_hierarchyhttp://en.wikipedia.org/wiki/Polynomial_hierarchyhttp://en.wikipedia.org/wiki/Polynomial_hierarchyhttp://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/Arthur-Merlin_protocolhttp://en.wikipedia.org/wiki/Arthur-Merlin_protocolhttp://en.wikipedia.org/wiki/Arthur-Merlin_protocolhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/FNP_%28complexity%29http://en.wikipedia.org/wiki/FNP_%28complexity%29http://en.wikipedia.org/wiki/Descriptive_complexity_theoryhttp://en.wikipedia.org/wiki/Descriptive_complexity_theoryhttp://en.wikipedia.org/wiki/Descriptive_complexity_theoryhttp://en.wikipedia.org/wiki/Second-order_logichttp://en.wikipedia.org/wiki/Second-order_logichttp://en.wikipedia.org/wiki/Second-order_logichttp://en.wikipedia.org/wiki/Fagin%27s_theoremhttp://en.wikipedia.org/wiki/Fagin%27s_theoremhttp://en.wikipedia.org/wiki/Fagin%27s_theoremhttp://en.wikipedia.org/wiki/Interactive_proof_systemhttp://en.wikipedia.org/wiki/Interactive_proof_systemhttp://en.wikipedia.org/wiki/Interactive_proof_systemhttp://en.wikipedia.org/wiki/Probabilistically_checkable_proofhttp://en.wikipedia.org/wiki/Probabilistically_checkable_proofhttp://en.wikipedia.org/wiki/Probabilistically_checkable_proofhttp://en.wikipedia.org/wiki/Approximation_algorithmhttp://en.wikipedia.org/wiki/Approximation_algorithmhttp://en.wikipedia.org/wiki/Traveling_salesman_problemhttp://en.wikipedia.org/wiki/Traveling_salesman_problemhttp://en.wikipedia.org/wiki/Traveling_salesman_problemhttp://en.wikipedia.org/wiki/Traveling_salesman_problemhttp://en.wikipedia.org/wiki/Approximation_algorithmhttp://en.wikipedia.org/wiki/Probabilistically_checkable_proofhttp://en.wikipedia.org/wiki/Interactive_proof_systemhttp://en.wikipedia.org/wiki/Fagin%27s_theoremhttp://en.wikipedia.org/wiki/Second-order_logichttp://en.wikipedia.org/wiki/Descriptive_complexity_theoryhttp://en.wikipedia.org/wiki/FNP_%28complexity%29http://en.wikipedia.org/wiki/Decision_problemhttp://en.wikipedia.org/wiki/Arthur-Merlin_protocolhttp://en.wikipedia.org/wiki/NP_%28complexity%29#cite_note-4http://en.wikipedia.org/wiki/Polynomial_hierarchyhttp://en.wikipedia.org/wiki/Primality_testhttp://en.wikipedia.org/wiki/Primality_testhttp://en.wikipedia.org/wiki/Co-NPhttp://en.wikipedia.org/wiki/Complement_%28complexity%29
  • 7/28/2019 CLASS_OF_P_AND_NP

    10/10

    A proof certificate can simply be a list of the cities. Then verification can clearly

    be done in polynomial time by a deterministic Turing machine. It simply adds thematrix entries corresponding to the paths between the cities.

    A nondeterministic Turing machine can find such a route as follows:

    At each city it visits it "guesses" the next city to visit, until it has visitedevery vertex. If it gets stuck, it stops immediately.

    At the end it verifies that the route it has taken has cost less than kinO(n)time.

    One can think of each guess as "forking" a new copy of the Turing machine tofollow each of the possible paths forward, and if at least one machine finds a route

    of distance less than k, that machine accepts the input. (Equivalently, this can be

    thought of as a single Turing machine that always guesses correctly)

    Binary searchon the range of possible distances can convert the decision version

    of Traveling Salesman to the optimization version, by calling the decision versionrepeatedly (a polynomial number of times).

    http://en.wikipedia.org/wiki/Big-O_notationhttp://en.wikipedia.org/wiki/Big-O_notationhttp://en.wikipedia.org/wiki/Binary_searchhttp://en.wikipedia.org/wiki/Binary_searchhttp://en.wikipedia.org/wiki/Binary_searchhttp://en.wikipedia.org/wiki/Big-O_notation