Prev: Meami.org releases 'Gibraltar' Code, Open Source community shockwave
Next: NEWSFLASH! Meami.org finds: As it turns out P.NP-complete problems are a set of problems which any other NP-problem can be reduced to in polynomial time, but which retain the ability to have their solution verified
From: sci.math on 6 Jul 2010 16:55 '''P'''. '''NP'''-complete <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"> <head> <title>P versus NP problem - Wikipedia, the free encyclopedia</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="generator" content="MediaWiki 1.16wmf4" /> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=P_versus_NP_problem&action=edit" /> <link rel="edit" title="Edit this page" href="/w/index.php? title=P_versus_NP_problem&action=edit" /> <link rel="apple-touch-icon" href="http://en.wikipedia.org/apple-touch- icon.png" /> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="search" type="application/opensearchdescription+xml" href="/ w/opensearch_desc.php" title="Wikipedia (en)" /> <link rel="copyright" href="http://creativecommons.org/licenses/by-sa/ 3.0/" /> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php? title=Special:RecentChanges&feed=atom" /> <link rel="stylesheet" href="http://bits.wikimedia.org/skins-1.5/ vector/main-ltr.css?283l" type="text/css" media="screen" /> <link rel="stylesheet" href="http://bits.wikimedia.org/skins-1.5/ common/shared.css?283l" type="text/css" media="screen" /> <link rel="stylesheet" href="http://bits.wikimedia.org/skins-1.5/ common/commonPrint.css?283l" type="text/css" media="print" /> <link rel="stylesheet" href="http://bits.wikimedia.org/w/extensions/ UsabilityInitiative/css/combined.min.css?112" type="text/css" media="all" /> <link rel="stylesheet" href="http://bits.wikimedia.org/w/extensions/ UsabilityInitiative/css/vector/jquery-ui-1.7.2.css?1.7.2y" type="text/ css" media="all" /> <link rel="stylesheet" href="/w/index.php? title=MediaWiki:Common.css&usemsgcache=yes&ctype=text %2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="all" /> <link rel="stylesheet" href="/w/index.php? title=MediaWiki:Print.css&usemsgcache=yes&ctype=text %2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="print" /> <link rel="stylesheet" href="/w/index.php? title=MediaWiki:Handheld.css&usemsgcache=yes&ctype=text %2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="handheld" /> <link rel="stylesheet" href="/w/index.php? title=MediaWiki:Vector.css&usemsgcache=yes&ctype=text %2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="all" /> <link rel="stylesheet" href="/w/index.php?title=- &action=raw&maxage=2678400&gen=css" type="text/css" media="all" /> <script type="text/javascript"> var skin="vector", stylepath="http://bits.wikimedia.org/skins-1.5", wgUrlProtocols="http\\:\\/\\/|https\\:\\/\\/|ftp\\:\\/\\/|irc\\:\\/\\/| gopher\\:\\/\\/|telnet\\:\\/\\/|nntp\\:\\/\\/|worldwind\\:\\/\\/|mailto \\:|news\\:|svn\\:\\/\\/", wgArticlePath="/wiki/$1", wgScriptPath="/w", wgScriptExtension=".php", wgScript="/w/index.php", wgVariantArticlePath=false, wgActionPaths={}, wgServer="http://en.wikipedia.org", wgCanonicalNamespace="", wgCanonicalSpecialPageName=false, wgNamespaceNumber=0, wgPageName="P_versus_NP_problem", wgTitle="P versus NP problem", wgAction="view", wgArticleId=6115, wgIsArticle=true, wgUserName=null, wgUserGroups=null, wgUserLanguage="en", wgContentLanguage="en", wgBreakFrames=false, wgCurRevisionId=372094967, wgVersion="1.16wmf4", wgEnableAPI=true, wgEnableWriteAPI=true, wgSeparatorTransformTable=["", ""], wgDigitTransformTable=["", ""], wgMainPageTitle="Main Page", wgFormattedNamespaces={"-2": "Media", "-1": "Special", "0": "", "1": "Talk", "2": "User", "3": "User talk", "4": "Wikipedia", "5": "Wikipedia talk", "6": "File", "7": "File talk", "8": "MediaWiki", "9": "MediaWiki talk", "10": "Template", "11": "Template talk", "12": "Help", "13": "Help talk", "14": "Category", "15": "Category talk", "100": "Portal", "101": "Portal talk", "108": "Book", "109": "Book talk"}, wgNamespaceIds={"media": -2, "special": -1, "": 0, "talk": 1, "user": 2, "user_talk": 3, "wikipedia": 4, "wikipedia_talk": 5, "file": 6, "file_talk": 7, "mediawiki": 8, "mediawiki_talk": 9, "template": 10, "template_talk": 11, "help": 12, "help_talk": 13, "category": 14, "category_talk": 15, "portal": 100, "portal_talk": 101, "book": 108, "book_talk": 109, "wp": 4, "wt": 5, "image": 6, "image_talk": 7}, wgSiteName="Wikipedia", wgCategories=["Structural complexity theory", "Mathematical optimization", "Conjectures", "Unsolved problems in mathematics", "Unsolved problems in computer science", "Millennium Prize Problems"], wgMWSuggestTemplate="http://en.wikipedia.org/w/api.php? action=opensearch\x26search={searchTerms}\x26namespace={namespaces} \x26suggest", wgDBname="enwiki", wgSearchNamespaces=[0], wgMWSuggestMessages=["with suggestions", "no suggestions"], wgRestrictionEdit=[], wgRestrictionMove=["sysop"], wgFlaggedRevsParams={"tags": {"status": {"levels": 1, "quality": 2, "pristine": 3}}}, wgStableRevisionId=0, wgWikimediaMobileUrl="http://en.m.wikipedia.org/wiki", wgCollapsibleNavBucketTest=false, wgCollapsibleNavForceNewVersion=false, wgVectorPreferences={"collapsiblenav": {"enable": 1}, "editwarning": {"enable": 1}, "simplesearch": {"enable": 1, "disablesuggest": 0}}, wgVectorEnabledModules={"collapsiblenav": true, "collapsibletabs": true, "editwarning": true, "expandablesearch": false, "footercleanup": false, "simplesearch": true}, wgNotice="", wgNoticeLocal=""; </script><script src="http://bits.wikimedia.org/skins-1.5/common/ wikibits.js?283l" type="text/javascript"></script> <script type="text/javascript" src="http://bits.wikimedia.org/ skins-1.5/common/jquery.min.js?283l"></script> <script src="http://bits.wikimedia.org/skins-1.5/common/ajax.js?283l" type="text/javascript"></script> <script src="http://bits.wikimedia.org/skins-1.5/common/mwsuggest.js? 283l" type="text/javascript"></script> <script src="http://bits.wikimedia.org/w/extensions/WikimediaMobile/ MobileRedirect.js?2" type="text/javascript"></script> <script src="http://bits.wikimedia.org/w/extensions/ UsabilityInitiative/js/plugins.combined.min.js?283l" type="text/ javascript"></script> <script src="http://bits.wikimedia.org/w/extensions/ UsabilityInitiative/Vector/Vector.combined.min.js?283l" type="text/ javascript"></script> <script type="text/javascript">mw.usability.addMessages({'vector- collapsiblenav-more':'More languages','vector-editwarning- warning':'Leaving this page may cause you to lose any changes you have made.\nIf you are logged in, you can disable this warning in the \"Editing\" section of your preferences.','vector-simplesearch- search':'Search','vector-simplesearch-containing':'containing...'});</ script> <script type="text/javascript" src="http://upload.wikimedia.org/ centralnotice/wikipedia/en/centralnotice.js?283l"></script> <!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/ skins-1.5/vector/csshover.htc")}</style><![endif]--> <script src="/w/index.php?title=- &action=raw&gen=js&useskin=vector&283l" type="text/ javascript"></script> </head> <body class="mediawiki ltr ns-0 ns-subject page-P_versus_NP_problem skin-vector"> <div id="mw-page-base" class="noprint"></div> <div id="mw-head-base" class="noprint"></div> <!-- content --> <div id="content"> <a id="top"></a> <div id="mw-js-message" style="display:none;"></div> <!-- sitenotice --> <div id="siteNotice"><script type='text/javascript'>if (wgNotice != '') document.writeln(wgNotice);</script></div> <!-- /sitenotice --> <!-- firstHeading --> <h1 id="firstHeading" class="firstHeading">P versus NP problem</h1> <!-- /firstHeading --> <!-- bodyContent --> <div id="bodyContent"> <!-- tagline --> <h3 id="siteSub">From Wikipedia, the free encyclopedia</h3> <!-- /tagline --> <!-- subtitle --> <div id="contentSub"></div> <!-- /subtitle --> <!-- jumpto --> <div id="jump-to-nav"> Jump to: <a href="#mw-head">navigation</a>, <a href="#p-search">search</a> </div> <!-- /jumpto --> <!-- bodytext --> <table class="infobox" style="text-align: center;"> <tr> <th style="background: #ccf; font-size: larger;"><b><a href="/wiki/ Millennium_Prize_Problems" title="Millennium Prize Problems">Millennium Prize Problems</a></b></th> </tr> <tr> <td><strong class="selflink">P versus NP problem</strong></td> </tr> <tr> <td><a href="/wiki/Hodge_conjecture" title="Hodge conjecture">Hodge conjecture</a></td> </tr> <tr> <td><a href="/wiki/Poincar%C3%A9_conjecture" title="Poincaré conjecture">Poincaré conjecture</a> (<a href="/wiki/ Solution_of_the_Poincar%C3%A9_conjecture" title="Solution of the Poincaré conjecture">solution</a>)</td> </tr> <tr> <td><a href="/wiki/Riemann_hypothesis" title="Riemann hypothesis">Riemann hypothesis</a></td> </tr> <tr> <td><a href="/wiki/Yang%E2%80%93Mills_existence_and_mass_gap" title="YangâMills existence and mass gap">YangâMills existence and mass gap</a></td> </tr> <tr> <td><a href="/wiki/Navier%E2%80%93Stokes_existence_and_smoothness" title="NavierâStokes existence and smoothness">NavierâStokes existence and smoothness</a></td> </tr> <tr> <td><a href="/wiki/Birch_and_Swinnerton-Dyer_conjecture" title="Birch and Swinnerton-Dyer conjecture">Birch and Swinnerton-Dyer conjecture</ a></td> </tr> </table> <div class="thumb tright"> <div class="thumbinner" style="width:252px;"><a href="/wiki/ File:Complexity_classes.svg" class="image"><img alt="" src="http:// upload.wikimedia.org/wikipedia/commons/thumb/b/bc/ Complexity_classes.svg/250px-Complexity_classes.svg.png" width="250" height="154" class="thumbimage" /></a> <div class="thumbcaption"> <div class="magnify"><a href="/wiki/File:Complexity_classes.svg" class="internal" title="Enlarge"><img src="http://bits.wikimedia.org/ skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> Diagram of complexity classes provided that <b>P</b> â <b>NP</b>. The existence of problems outside both <b>P</b> and <b>NP</b>-complete in this case was established by <a href="/wiki/NP-Intermediate" title="NP- Intermediate">Ladner's theorem</a>.<sup id="cite_ref-Ladner_0-0" class="reference"><a href="#cite_note-Ladner-0"><span>[</ span>1<span>]</span></a></sup></div> </div> </div> <p>Update: As it turns out <b>P</b>. <b>NP</b>-complete problems are a set of problems which any other NP-problem can be reduced to in polynomial time, but which retain the ability to have their solution verified in polynomial time. <a href="http://meami.org/gibraltar.htm" class="external autonumber" rel="nofollow">[1]</a></p> <p>The relationship between the <a href="/wiki/Complexity_class" title="Complexity class">complexity classes</a> <b><a href="/wiki/ P_(complexity)" title="P (complexity)">P</a></b> (Polynomial time) and <b><a href="/wiki/NP_(complexity)" title="NP (complexity)">NP</a></b> (Nondeterministic Polynomial time) is an unsolved problem in <a href="/ wiki/Theoretical_computer_science" title="Theoretical computer science">theoretical computer science</a>, and is considered by many <a href="/wiki/Theoretical_computer_science" title="Theoretical computer science">theoretical computer scientists</a> to be the most important problem in the field.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span>[</span>2<span>]</ span></a></sup> The <a href="/wiki/Clay_Mathematics_Institute" title="Clay Mathematics Institute">Clay Mathematics Institute</a>, which is dedicated to increasing and disseminating mathematical knowledge, has included it in its list of <a href="/wiki/ Millennium_Prize_Problems" title="Millennium Prize Problems">Millennium Prize Problems</a>; anyone who provides a satisfactory solution to the problem may be entitled to a million dollar prize.<sup id="cite_ref-CMI_Millennium_Prize_Problems_2-0" class="reference"><a href="#cite_note- CMI_Millennium_Prize_Problems-2"><span>[</span>3<span>]</span></a></ sup><sup id="cite_ref-Official_Problem_Description_3-0" class="reference"><a href="#cite_note- Official_Problem_Description-3"><span>[</span>4<span>]</span></a></ sup></p> <p>In essence, the question <b>P</b> = <b>NP</b>? asks: if 'yes'- answers to a <a href="/wiki/Decision_problem" title="Decision problem">'yes'-or-'no'-question</a> can be <i>verified</i> "quickly" can the answers themselves also be <i>computed</i> "quickly"? The theoretical notion of "quick" used here is that of an algorithm that runs in <a href="/wiki/Polynomial_time" title="Polynomial time" class="mw-redirect">polynomial time</a>, which usually but not always corresponds to an algorithm that is fast in practice.</p> <p>Consider the <a href="/wiki/Subset_sum_problem" title="Subset sum problem">subset sum problem</a>, an example of a problem which is easy to verify but whose answer is suspected to be theoretically difficult to compute. Given a set of <a href="/wiki/Integer" title="Integer">integers</a>, does some nonempty <a href="/wiki/ Subset" title="Subset">subset</a> of them sum to 0? For instance, does a subset of the set <span style="white-space:nowrap;">{â2, â3, 15, 14, 7, â10}</span> add up to 0? The answer "yes, because <span style="white-space:nowrap;">{â2, â3, â10, 15}</span> add up to zero", can be quickly verified with three additions. However, finding such a subset in the first place could take more time. The information needed to verify a positive answer is also called a <i>certificate</i>. Given the right certificates, "yes" answers to our problem can be verified in polynomial time, so this problem is in <b>NP</b>.</p> <p>An answer to the <b>P</b> = <b>NP</b> question would determine whether problems like the subset-sum problem that can be verified in polynomial time can also be solved in polynomial time. If it turned out that <b>P</b> does not equal <b>NP</b>, it would mean that some <b>NP</b> problems are harder to compute than to verify: they could not be solved in polynomial time, but the answer could be verified in polynomial time.</p> <p>The restriction to yes/no problems is unimportant; when more complicated answers are allowed the extension to <a href="/wiki/ Function_problems" title="Function problems" class="mw- redirect">function problems</a> becomes <b><a href="/wiki/ FP_(complexity)" title="FP (complexity)">FP</a></b> = <b><a href="/ wiki/FNP_(complexity)" title="FNP (complexity)">FNP</a></b>, which has been proven to be equivalent to <b>P</b> = <b>NP</b>.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span>[</ span>5<span>]</span></a></sup></p> <table id="toc" class="toc"> <tr> <td> <div id="toctitle"> <h2>Contents</h2> </div> <ul> <li class="toclevel-1 tocsection-1"><a href="#Context_of_the_problem"><span class="tocnumber">1</span> <span class="toctext">Context of the problem</span></a> <ul> <li class="toclevel-2 tocsection-2"><a href="#Example"><span class="tocnumber">1.1</span> <span class="toctext">Example</span></a></ li> </ul> </li> <li class="toclevel-1 tocsection-3"><a href="#NP-complete"><span class="tocnumber">2</span> <span class="toctext">NP-complete</span></ a></li> <li class="toclevel-1 tocsection-4"><a href="#Still_harder_problems"><span class="tocnumber">3</span> <span class="toctext">Still harder problems</span></a></li> <li class="toclevel-1 tocsection-5"><a href="#Does_P_mean_.22easy. 22.3F"><span class="tocnumber">4</span> <span class="toctext">Does P mean "easy"?</span></a></li> <li class="toclevel-1 tocsection-6"><a href="#Reasons_to_believe_P_.E2.89.A0_NP"><span class="tocnumber">5</ span> <span class="toctext">Reasons to believe P â NP</span></a></li> <li class="toclevel-1 tocsection-7"><a href="#Consequences_of_proof"><span class="tocnumber">6</span> <span class="toctext">Consequences of proof</span></a></li> <li class="toclevel-1 tocsection-8"><a href="#Results_about_difficulty_of_proof"><span class="tocnumber">7</ span> <span class="toctext">Results about difficulty of proof</span></ a></li> <li class="toclevel-1 tocsection-9"><a href="#Logical_characterizations"><span class="tocnumber">8</span> <span class="toctext">Logical characterizations</span></a></li> <li class="toclevel-1 tocsection-10"><a href="#Polynomial- time_algorithms"><span class="tocnumber">9</span> <span class="toctext">Polynomial-time algorithms</span></a></li> <li class="toclevel-1 tocsection-11"><a href="#Gibraltar_Code"><span class="tocnumber">10</span> <span class="toctext">Gibraltar Code</ span></a></li> <li class="toclevel-1 tocsection-12"><a href="#Formal_definitions_for_P_and_NP"><span class="tocnumber">11</ span> <span class="toctext">Formal definitions for P and NP</span></ a></li> <li class="toclevel-1 tocsection-13"><a href="#Formal_definition_for_NP-completeness"><span class="tocnumber">12</span> <span class="toctext">Formal definition for NP-completeness</span></a></li> <li class="toclevel-1 tocsection-14"><a href="#See_also"><span class="tocnumber">13</span> <span class="toctext">See also</span></a></ li> <li class="toclevel-1 tocsection-15"><a href="#Notes"><span class="tocnumber">14</span> <span class="toctext">Notes</span></a></ li> <li class="toclevel-1 tocsection-16"><a href="#Further_reading"><span class="tocnumber">15</span> <span class="toctext">Further reading</ span></a></li> <li class="toclevel-1 tocsection-17"><a href="#External_links"><span class="tocnumber">16</span> <span class="toctext">External links</ span></a></li> </ul> </td> </tr> </table> <script type="text/javascript"> //<![CDATA[ if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } //]]> </script> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=1" title="Edit section: Context of the problem">edit</a>]</span> <span class="mw- headline" id="Context_of_the_problem">Context of the problem</span></ h2> <p>The relation between the <a href="/wiki/Complexity_class" title="Complexity class">complexity classes</a> <b>P</b> and <b>NP</b> is studied in <a href="/wiki/Computational_complexity_theory" title="Computational complexity theory">computational complexity theory</a>, the part of the <a href="/wiki/Theory_of_computation" title="Theory of computation">theory of computation</a> dealing with the resources required during computation to solve a given problem. The most common resources are time (how many steps it takes to solve a problem) and space (how much memory it takes to solve a problem).</p> <p>In such analysis, a model of the computer for which time must be analyzed is required. Typically such models assume that the computer is <a href="/wiki/Deterministic_computation" title="Deterministic computation" class="mw-redirect"><i>deterministic</i></a> (given the computer's present state and any inputs, there is only one possible action that the computer might take) and <i>sequential</i> (it performs actions one after the other).</p> <p>In this theory, the class <b><a href="/wiki/P_(complexity)" title="P (complexity)">P</a></b> consists of all those <i><a href="/ wiki/Decision_problem" title="Decision problem">decision problems</a></ i> (defined <a href="#Formal_definitions_for_P_and_NP">below</a>) that can be solved on a deterministic sequential machine in an amount of time that is <a href="/wiki/Polynomial" title="Polynomial">polynomial</ a> in the size of the input; the class <b><a href="/wiki/ NP_(complexity)" title="NP (complexity)">NP</a></b> consists of all those decision problems whose positive solutions can be verified in <a href="/wiki/Polynomial_time" title="Polynomial time" class="mw- redirect">polynomial time</a> given the right information, or equivalently, whose solution can be found in polynomial time on a <a href="/wiki/Non-deterministic_Turing_machine" title="Non-deterministic Turing machine">non-deterministic</a> machine.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span>[</span>6<span>]</ span></a></sup> Arguably the biggest open question in <a href="/wiki/ Theoretical_computer_science" title="Theoretical computer science">theoretical computer science</a> concerns the relationship between those two classes:</p> <dl> <dd>Is <b>P</b> equal to <b>NP</b>?</dd> </dl> <p>In a 2002 poll of 100 researchers, 61 believed the answer to be no, 9 believed the answer is yes, and 22 were unsure; 8 believed the question may be independent of the currently accepted axioms and so impossible to prove or disprove.<sup id="cite_ref-poll_6-0" class="reference"><a href="#cite_note-poll-6"><span>[</span>7<span>]</ span></a></sup></p> <h3><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=2" title="Edit section: Example">edit</a>]</span> <span class="mw-headline" id="Example">Example</span></h3> <p>Let <img class="tex" alt="\mathit{COMPOSITE} = \{x\in N:x=pq \; \text{for integers}\; p, q > 1 \}" src="http://upload.wikimedia.org/ math/4/4/b/44ba246a84ec1cc45042e9e22ba5ea80.png" /> and <img class="tex" alt="R = \{(x,y)\in N\times N: 1<y \leq \sqrt x \; ; \;y\; \text{divides}\; x\}." src="http:// upload.wikimedia.org/math/0/b/4/0b40ea16ba74baa995bec5914cdd41f4.png" / ></p> <p>Clearly, the question of whether a given <span class="texhtml"><i>x</i></span> is a composite is equivalent to the question of whether <span class="texhtml"><i>x</i></span> is a member of <span class="texhtml"><i>C</i><i>O</i><i>M</i><i>P</i><i>O</i><i>S</ i><i>I</i><i>T</i><i>E</i></span>. It can be shown that <img class="tex" alt="\mathit{COMPOSITE}\in\mathbf{NP}" src="http:// upload.wikimedia.org/math/b/3/0/b307cc622fab34f5958b806f8b6b9c13.png" / > by verifying that <span class="texhtml"><i>C</i><i>O</i><i>M</ i><i>P</i><i>O</i><i>S</i><i>I</i><i>T</i><i>E</i></span> satisfies the above definition.</p> <p><span class="texhtml"><i>C</i><i>O</i><i>M</i><i>P</i><i>O</i><i>S</ i><i>I</i><i>T</i><i>E</i></span> also happens to be in <b>P</b>.<sup id="cite_ref-Agrawal_7-0" class="reference"><a href="#cite_note- Agrawal-7"><span>[</span>8<span>]</span></a></sup><sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span>[</span>9<span>]</ span></a></sup></p> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=3" title="Edit section: NP-complete">edit</a>]</span> <span class="mw-headline" id="NP-complete">NP-complete</span></h2> <div class="thumb tright"> <div class="thumbinner" style="width:302px;"><a href="/wiki/ File:P_np_np-complete_np-hard.svg" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/P_np_np- complete_np-hard.svg/300px-P_np_np-complete_np-hard.svg.png" width="300" height="212" class="thumbimage" /></a> <div class="thumbcaption"> <div class="magnify"><a href="/wiki/File:P_np_np-complete_np-hard.svg" class="internal" title="Enlarge"><img src="http://bits.wikimedia.org/ skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> <a href="/wiki/Euler_diagram" title="Euler diagram">Euler diagram</a> for <a href="/wiki/P_(complexity)" title="P (complexity)">P</a>, <a href="/wiki/NP_(complexity)" title="NP (complexity)">NP</a>, <a href="/ wiki/NP-complete" title="NP-complete">NP-complete</a>, and NP-hard set of problems</div> </div> </div> <p>To attack the <b>P</b> = <b>NP</b> question the concept of <a href="/wiki/NP-complete" title="NP-complete"><b>NP</b>-completeness</ a> is very useful. Informally the <b>NP</b>-complete problems are the "toughest" problems in <b>NP</b> in the sense that they are the ones most likely not to be in <b>P</b>. <b>NP</b>-complete problems are a set of problems which any other <b>NP</b>-problem can be reduced to in polynomial time, but which retain the ability to have their solution verified in polynomial time. In comparison, <a href="/wiki/NP-hard" title="NP-hard"><b>NP</b>-hard</a> problems are those which are at least as hard as <b>NP</b>-complete problems, meaning all <b>NP</b>- problems can be reduced to them, but not all <b>NP</b>-hard problems are in <b>NP</b>, meaning not all of them have solutions which can be verified in polynomial time.</p> <p>For instance, the decision problem version of the <a href="/wiki/ Travelling_salesman_problem" title="Travelling salesman problem">travelling salesman problem</a> is <b>NP</b>-complete, so <i>any</i> instance of <i>any</i> problem in <b>NP</b> can be transformed mechanically into an instance of the traveling salesman problem, in polynomial time. The traveling salesman problem is one of many such <b>NP</b>-complete problems. If any <b>NP</b>-complete problem is in <b>P</b>, then it would follow that <b>P</b> = <b>NP</ b>. Unfortunately, many important problems have been shown to be <b>NP</b>-complete and as of 2010, not a single fast algorithm for any of them is known.</p> <p>Based on the definition alone it's not obvious that <b>NP</b>- complete problems exist. A trivial and contrived <b>NP</b>-complete problem can be formulated as: given a description of a Turing machine M guaranteed to halt in polynomial time, does there exist a polynomial- size input that M will accept?<sup id="cite_ref-Scott_9-0" class="reference"><a href="#cite_note-Scott-9"><span>[</ span>10<span>]</span></a></sup> It is in <b>NP</b> because (given an input) it is simple to check whether or not M accepts the input by simulating M; it is <b>NP</b>-hard because the verifier for any particular instance of a problem in <b>NP</b> can be encoded as a polynomial-time machine M that takes the solution to be verified as input. Then the question of whether the instance is a yes or no instance is determined by whether a valid input exists.</p> <p>The first natural problem proven to be <b>NP</b>-complete was the <a href="/wiki/Boolean_satisfiability_problem" title="Boolean satisfiability problem">Boolean satisfiability problem</a>. This result came to be known as <a href="/wiki/Cook%E2%80%93Levin_theorem" title="CookâLevin theorem">CookâLevin theorem</a>; its proof that satisfiability is NP-complete contains technical details about Turing machines as they relate to the definition of <b>NP</b>. However, after this problem was proved to be NP-complete, <a href="/wiki/ Reduction_(complexity)" title="Reduction (complexity)">proof by reduction</a> provided a simpler way to show that many other problems are in this class. Thus, a vast class of seemingly unrelated problems are all reducible to one another, and are in a sense the "same problem".</p> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=4" title="Edit section: Still harder problems">edit</a>]</span> <span class="mw- headline" id="Still_harder_problems">Still harder problems</span></h2> <div class="rellink boilerplate seealso">See also: <a href="/wiki/ Complexity_class" title="Complexity class">Complexity class</a></div> <p>Although it is unknown whether <b>P</b> = <b>NP</b>, problems outside of <b>P</b> are known. A number of succinct problems (problems which operate not on normal input but on a computational description of the input) are known to be <a href="/wiki/EXPTIME#EXPTIME-complete" title="EXPTIME"><b>EXPTIME</b>-complete</a>. Because it can be shown that <b>P</b> <img class="tex" alt="\subsetneq" src="http:// upload.wikimedia.org/math/d/5/5/d5557175d90cbb263ae71f0dfebbf732.png" / > <b><a href="/wiki/EXPTIME" title="EXPTIME">EXPTIME</a></b>, these problems are outside <b>P</b>, and so require more than polynomial time. In fact, by the <a href="/wiki/Time_hierarchy_theorem" title="Time hierarchy theorem">time hierarchy theorem</a>, they cannot be solved in significantly less than exponential time. Examples include finding a perfect strategy for chess (on an NÃN board)<sup id="cite_ref-Fraenkel1981_10-0" class="reference"><a href="#cite_note- Fraenkel1981-10"><span>[</span>11<span>]</span></a></sup> and some other board games.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span>[</span>12<span>]</span></a></sup></p> <p>The problem of deciding the truth of a statement in <a href="/wiki/ Presburger_arithmetic" title="Presburger arithmetic">Presburger arithmetic</a> requires even more time. Fischer and <a href="/wiki/ Michael_O._Rabin" title="Michael O. Rabin">Rabin</a> proved in 1974 that every algorithm which decides the truth of Presburger statements has a runtime of at least <img class="tex" alt="2^{2^{cn}}" src="http://upload.wikimedia.org/math/8/9/b/ 89b762cb4c6792ffed3450e7351420de.png" /> for some constant <i>c</i>. Here, <i>n</i> is the length of the Presburger statement. Hence, the problem is known to need more than exponential run time. Even more difficult are the <a href="/wiki/List_of_undecidable_problems" title="List of undecidable problems">undecidable problems</a>, such as the <a href="/wiki/Halting_problem" title="Halting problem">halting problem</a>. They cannot be completely solved by any algorithm, in the sense that for any particular algorithm there is at least one input for which that algorithm will not produce the right answer; it will either produce the wrong answer, finish without giving a conclusive answer, or otherwise run forever without producing any answer at all.</ p> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=5" title="Edit section: Does P mean "easy"?">edit</a>]</span> <span class="mw-headline" id="Does_P_mean_.22easy.22.3F">Does P mean "easy"? </span></h2> <div class="thumb tright"> <div class="thumbinner" style="width:312px;"><a href="/wiki/ File:KnapsackEmpComplexity.GIF" class="image"><img alt="" src="http:// upload.wikimedia.org/wikipedia/commons/thumb/1/11/ KnapsackEmpComplexity.GIF/310px-KnapsackEmpComplexity.GIF" width="310" height="183" class="thumbimage" /></a> <div class="thumbcaption"> <div class="magnify"><a href="/wiki/File:KnapsackEmpComplexity.GIF" class="internal" title="Enlarge"><img src="http://bits.wikimedia.org/ skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> The graph shows time (average of 100 instances in msec using a 933 MHz Pentium III) vs.problem size for knapsack problems for a state-of-the- art specialized algorithm. Quadratic fit suggests that empirical algorithmic complexity for instances with 50â10,000 variables is O((log <i>n</i>)<sup>2</sup>).<sup id="cite_ref- Pisinger2003_12-0" class="reference"><a href="#cite_note- Pisinger2003-12"><span>[</span>13<span>]</span></a></sup></div> </div> </div> <p>All of the above discussion has assumed that <b>P</b> means "easy" and "not in <b>P</b>" means "hard". This assumption, known as <i><a href="/wiki/Cobham%27s_thesis" title="Cobham's thesis">Cobham's thesis</a></i>, though a common and reasonably accurate assumption in complexity theory, is not always true in practice; the size of constant factors or exponents may have practical importance, or there may be solutions that work for situations encountered in practice despite having poor worst-case performance in theory (this is the case for instance for the simplex algorithm in <a href="/wiki/ Linear_programming" title="Linear programming">linear programming</ a>). Other solutions violate the Turing machine model on which <b>P</ b> and <b>NP</b> are defined by introducing concepts like randomness and quantum computation.</p> <p>Because of these factors even if a problem is shown to be NP- complete, and even if <b>P</b> â <b>NP</b>, there may still be effective approaches to tackling the problem in practice. There are algorithms for many NP-complete problems, such as the <a href="/wiki/ Knapsack_problem" title="Knapsack problem">knapsack problem</a>, the <a href="/wiki/Travelling_salesman_problem" title="Travelling salesman problem">travelling salesman problem</a> and the <a href="/wiki/ Boolean_satisfiability_problem" title="Boolean satisfiability problem">boolean satisfiability problem</a>, that can solve to optimality many real-world instances in reasonable time. The empirical average complexity (time vs. problem size) of such algorithms can be surprisingly low.</p> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=6" title="Edit section: Reasons to believe P â NP">edit</a>]</span> <span class="mw- headline" id="Reasons_to_believe_P_.E2.89.A0_NP">Reasons to believe P â NP</span></h2> <p>According to a poll<sup id="cite_ref-poll_6-1" class="reference"><a href="#cite_note-poll-6"><span>[</span>7<span>]</span></a></sup> many computer scientists believe that <b>P</b> â  <b>NP</b>. A key reason for this belief is that after decades of studying these problems no one has been able to find a polynomial-time algorithm for any of more than 3000 important known <b>NP</b>-complete problems (see <a href="/wiki/List_of_NP-complete_problems" title="List of NP- complete problems">List of NP-complete problems</a>). These algorithms were sought long before the concept of <b>NP</b>-completeness was even defined (<a href="/wiki/Karp%27s_21_NP-complete_problems" title="Karp's 21 NP-complete problems">Karp's 21 NP-complete problems</ a>, among the first found, were all well-known existing problems at the time they were shown to be NP-complete). Furthermore, the result <b>P</b> = <b>NP</b> would imply many other startling results that are currently believed to be false, such as <b>NP</b> = <b><a href="/wiki/ Co-NP" title="Co-NP">co-NP</a></b> and <b>P</b> = <a href="/wiki/ PH_(complexity)" title="PH (complexity)"><b>PH</b></a>.</p> <p>It is also intuitively argued that the existence of problems that are hard to solve but for which the solutions are easy to verify matches real-world experience.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span>[</span>14<span>]</ span></a></sup></p> <blockquote class="templatequote"> <div>If P = NP, then the world would be a profoundly different place than we usually assume it to be. There would be no special value in âcreative leaps,â no fundamental gap between solving a problem and recognizing the solution once itâs found. Everyone who could appreciate a symphony would be Mozart; everyone who could follow a step-by-step argument would be Gauss...</div> <div class="templatequotecite">â <a href="/wiki/Scott_Aaronson" title="Scott Aaronson">Scott Aaronson</a>, <a href="/wiki/MIT" title="MIT" class="mw-redirect">MIT</a></div> </blockquote> <p>On the other hand, some researchers believe that we are overconfident in <b>P</b> â <b>NP</b> and should explore proofs of <b>P</b> = <b>NP</b> as well. For example, in 2002 these statements were made:<sup id="cite_ref-poll_6-2" class="reference"><a href="#cite_note-poll-6"><span>[</span>7<span>]</span></a></sup></p> <blockquote class="templatequote"> <div>The main argument in favor of <b>P</b> â  <b>NP</b> is the total lack of fundamental progress in the area of exhaustive search. This is, in my opinion, a very weak argument. The space of algorithms is very large and we are only at the beginning of its exploration. [. . .] The resolution of <a href="/wiki/Fermat %27s_Last_Theorem" title="Fermat's Last Theorem">Fermat's Last Theorem</a> also shows that very simple questions may be settled only by very deep theories.</div> <div class="templatequotecite">â<a href="/wiki/Moshe_Y._Vardi" title="Moshe Y. Vardi">Moshe Y. Vardi</a>, <a href="/wiki/ Rice_University" title="Rice University">Rice University</a></div> </blockquote> <blockquote class="templatequote"> <div>Being attached to a speculation is not a good guide to research planning. One should always try both directions of every problem. Prejudice has caused famous mathematicians to fail to solve famous problems whose solution was opposite to their expectations, even though they had developed all the methods required.</div> <div class="templatequotecite">â<a href="/wiki/Anil_Nerode" title="Anil Nerode">Anil Nerode</a>, <a href="/wiki/ Cornell_University" title="Cornell University">Cornell University</a></ div> </blockquote> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=7" title="Edit section: Consequences of proof">edit</a>]</span> <span class="mw- headline" id="Consequences_of_proof">Consequences of proof</span></h2> <p>One of the reasons the problem attracts so much attention is the consequences of the answer. A proof that <b>P</b> = <b>NP</b> could have stunning practical consequences, if the proof leads to efficient methods for solving some of the important problems in NP. It is also possible that a proof would not lead directly to efficient methods, perhaps if the proof is non-constructive, or the size of the bounding polynomial is too big to be efficient in practice. The consequences, both positive and negative, arise since various NP-complete problems are fundamental in many fields.</p> <p>Cryptography, for example, relies on certain problems being difficult. A constructive and efficient solution to the NP-complete problem 3-SAT would break many existing cryptosystems such as <a href="/wiki/Public-key_cryptography" title="Public-key cryptography">Public-key cryptography</a>, used for economic transactions over the internet, and <a href="/wiki/Triple_DES" title="Triple DES">Triple DES</a>, used for transactions between banks. These would need to be modified or replaced.</p> <p>On the other hand, there are enormous positive consequences that would follow from rendering tractable many currently mathematically intractable problems. For instance, many problems in <a href="/wiki/ Operations_research" title="Operations research">operations research</ a> are NP-complete, such as some types of <a href="/wiki/ Integer_programming" title="Integer programming">integer programming</ a>, and the <a href="/wiki/Travelling_salesman_problem" title="Travelling salesman problem">travelling salesman problem</a>, to name two of the most famous examples. Efficient solutions to these problems would have enormous implications for <a href="/wiki/ Logistics" title="Logistics">logistics</a>. Many other important problems, such as some problems in <a href="/wiki/ Protein_structure_prediction" title="Protein structure prediction">protein structure prediction</a> are also <b>NP</b>- complete;<sup id="cite_ref-Berger_14-0" class="reference"><a href="#cite_note-Berger-14"><span>[</span>15<span>]</span></a></sup> if these problems were efficiently solvable it could spur considerable advances in biology.</p> <p>But such changes may pale in significance compared to the revolution an efficient method for solving NP-complete problems would cause in mathematics itself. According to <a href="/wiki/Stephen_Cook" title="Stephen Cook">Stephen Cook</a>,<sup id="cite_ref- Official_Problem_Description_3-1" class="reference"><a href="#cite_note-Official_Problem_Description-3"><span>[</ span>4<span>]</span></a></sup></p> <blockquote class="templatequote"> <div>...it would transform mathematics by allowing a computer to find a formal proof of any theorem which has a proof of a reasonable length, since formal proofs can easily be recognized in polynomial time. Example problems may well include all of the <a href="/wiki/ Clay_Math_Institute#Millennium_Prize_Problems" title="Clay Math Institute" class="mw-redirect">CMI prize problems</a>.</div> </blockquote> <p>Research mathematicians spend their careers trying to prove theorems, and some proofs have taken decades or even centuries to find after problems have been stated â for instance, <a href="/wiki/Fermat %27s_Last_Theorem" title="Fermat's Last Theorem">Fermat's Last Theorem</a> took over three centuries to prove. A method that is guaranteed to find proofs to theorems, should one exist of a "reasonable" size, would essentially end this struggle.</p> <p>A proof that showed that <b>P</b> â <b>NP</b>, while lacking the practical computational benefits of a proof that <b>P</b> = <b>NP</b>, would also represent a very significant advance in computational complexity theory and provide guidance for future research. It would allow one to show in a formal way that many common problems cannot be solved efficiently, so that the attention of researchers can be focused on partial solutions or solutions to other problems. Due to widespread belief in <b>P</b> â <b>NP</b>, much of this focusing of research has already taken place.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span>[</span>16<span>]</ span></a></sup></p> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=8" title="Edit section: Results about difficulty of proof">edit</a>]</span> <span class="mw-headline" id="Results_about_difficulty_of_proof">Results about difficulty of proof</span></h2> <p>The Clay Mathematics Institute million-dollar prize and a huge amount of dedicated research with no substantial results suggest that the problem is difficult. Some of the most fruitful research related to the <b>P</b> = <b>NP</b> problem has been in showing that existing proof techniques are not powerful enough to answer the question, thus suggesting that novel technical approaches are required.</p> <p>As additional evidence for the difficulty of the problem, essentially all known proof techniques in <a href="/wiki/ Computational_complexity" title="Computational complexity" class="mw- redirect">computational complexity</a> theory fall into one of the following classifications, each of which is known to be insufficient to prove that <b>P</b> â <b>NP</b>:</p> <ul> <li><b>Relativizing proofs:</b> Imagine a world where every algorithm is allowed to make queries to some fixed subroutine called an <a href="/wiki/Oracle_machine" title="Oracle machine">oracle</a>, and the running time of the oracle is not counted against the running time of the algorithm. Most proofs (especially classical ones) apply uniformly in a world with oracles regardless of what the oracle does. These proofs are called <i>relativizing</i>. In 1975, Baker, Gill, and Solovay showed that <b>P</b> = <b>NP</b> with respect to some oracles, while <b>P</b> â <b>NP</b> for other oracles.<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span>[</span>17<span>]</ span></a></sup> Since relativizing proofs can only prove statements that are uniformly true with respect to all possible oracles, this showed that relativizing techniques cannot resolve <b>P</b> = <b>NP</ b>.</li> <li><b>Natural proofs:</b> In 1993, <a href="/wiki/Alexander_Razborov" title="Alexander Razborov">Alexander Razborov</a> and <a href="/wiki/ Steven_Rudich" title="Steven Rudich">Steven Rudich</a> defined a general class of proof techniques for circuit complexity lower bounds, called <i><a href="/wiki/Natural_proof" title="Natural proof">natural proofs</a></i>. At the time all previously known circuit lower bounds were natural, and circuit complexity was considered a very promising approach for resolving <b>P</b> = <b>NP</b>. However, Razborov and Rudich showed that in order to prove <b>P</b> â <b>NP</b> using a natural proof, one necessarily must also prove an even stronger statement, which is believed to be false. Thus it is unlikely that natural proofs alone can resolve <b>P</b> = <b>NP</b>.</li> <li><b>Algebrizing proofs:</b> After the Baker-Gill-Solovay result, new non-relativizing proof techniques were successfully used to prove that <a href="/wiki/IP_(complexity)" title="IP (complexity)">IP</a> = <a href="/wiki/PSPACE" title="PSPACE">PSPACE</a>. However, in 2008, <a href="/wiki/Scott_Aaronson" title="Scott Aaronson">Scott Aaronson</a> and <a href="/wiki/Avi_Wigderson" title="Avi Wigderson">Avi Wigderson</ a> showed that the main technical tool used in the <b>IP</b> = <b>PSPACE</b> proof, known as <i>arithmetization</i>, was also insufficient to resolve <b>P</b> = <b>NP</b>.<sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span>[</span>18<span>]</ span></a></sup></li> </ul> <p>These barriers are another reason why <b>NP</b>-complete problems are useful: if a polynomial-time algorithm can be demonstrated for an <b>NP</b>-complete problem, this would solve the <b>P</b> = <b>NP</b> problem in a way which is not excluded by the above results.</p> <p>These barriers have also led some computer scientists to suggest that the P versus NP problem may be <a href="/wiki/ Independence_(mathematical_logic)" title="Independence (mathematical logic)">independent</a> of standard axiom systems like <a href="/wiki/ ZFC" title="ZFC" class="mw-redirect">ZFC</a> (cannot be proved or disproved within them). The interpretation of an independence result could be that either no polynomial-time algorithm exists for any NP- complete problem, but such a proof cannot be constructed in (e.g.) ZFC, or that polynomial-time algorithms for NP-complete problems may exist, but it's impossible to prove in ZFC that such algorithms are correct.<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span>[</span>19<span>]</span></a></sup> However, if the problem cannot be decided even with much weaker assumptions extending the <a href="/wiki/Peano_axioms" title="Peano axioms">Peano axioms</a> (PA) for integer arithmetic, then there would necessarily exist nearly-polynomial-time algorithms for every problem in NP.<sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span>[</ span>20<span>]</span></a></sup> Therefore, if one believes (as most complexity theorists do) that problems in NP do not have efficient algorithms, it would follow that such notions of independence cannot be possible. Additionally, this result implies that proving independence from PA or ZFC using currently known techniques is no easier than proving the existence of efficient algorithms for all problems in NP.</p> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=9" title="Edit section: Logical characterizations">edit</a>]</span> <span class="mw- headline" id="Logical_characterizations">Logical characterizations</ span></h2> <p>The <b>P</b> = <b>NP</b> problem can be restated in terms of the expressibility of certain classes of logical statements, as a result of work in <a href="/wiki/Descriptive_complexity" title="Descriptive complexity" class="mw-redirect">descriptive complexity</a>. All languages (of finite structures with a fixed <a href="/wiki/ Signature_(logic)" title="Signature (logic)">signature</a> including a <a href="/wiki/Linear_order" title="Linear order" class="mw- redirect">linear order</a> relation) in <b>P</b> can be expressed in <a href="/wiki/First-order_logic" title="First-order logic">first- order logic</a> with the addition of a suitable <a href="/wiki/ Least_fixed_point" title="Least fixed point">least fixed point</a> operator (effectively, this, in combination with the order, allows the definition of recursive functions); indeed, (as long as the signature contains at least one predicate or function in addition to the distinguished order relation [so that the amount of space taken to store such finite structures is actually polynomial in the number of elements in the structure]), this precisely characterizes <b>P</b>. Similarly, <b>NP</b> is the set of languages expressible in existential <a href="/wiki/Second-order_logic" title="Second-order logic">second-order logic</a> â that is, second-order logic restricted to exclude <a href="/wiki/Universal_quantification" title="Universal quantification">universal quantification</a> over relations, functions, and subsets. The languages in the <a href="/wiki/ Polynomial_hierarchy" title="Polynomial hierarchy">polynomial hierarchy</a>, <b><a href="/wiki/PH_(complexity)" title="PH (complexity)">PH</a></b>, correspond to all of <a href="/wiki/Second- order_logic" title="Second-order logic">second-order logic</a>. Thus, the question "is <b>P</b> a proper subset of <b>NP</b>" can be reformulated as "is existential second-order logic able to describe languages (of finite linearly ordered structures with nontrivial signature) that first-order logic with least fixed point cannot?". The word "existential" can even be dropped from the previous characterization, since <b>P</b> = <b>NP</b> if and only if <b>P</b> = <b>PH</b> (as the former would establish that <b>NP</b> = <b>co-NP</ b>, which in turn would imply that <b>NP</b> = <b>PH</b>). <a href="/ wiki/PSPACE" title="PSPACE">PSPACE</a> = <a href="/wiki/NPSPACE" title="NPSPACE" class="mw-redirect">NPSPACE</a> as established <a href="/wiki/Savitch%27s_theorem" title="Savitch's theorem">Savitch's theorem</a>, this follows directly from the fact that the square of a polynomial function is still a polynomial function. However, it is believed, but not proven, a similar relationship may not exist between the polynomial time complexity classes, <a href="/wiki/P_(complexity)" title="P (complexity)">P</a> and <a href="/wiki/NP_(complexity)" title="NP (complexity)">NP</a> so the question is still open.</p> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=10" title="Edit section: Polynomial-time algorithms">edit</a>]</span> <span class="mw- headline" id="Polynomial-time_algorithms">Polynomial-time algorithms</ span></h2> <p>No algorithm for any <b>NP</b>-complete problem is known to run in polynomial time. However, there are algorithms for <b>NP</b>-complete problems with the property that if <b>P</b> = <b>NP</b>, then the algorithm runs in polynomial time (although with enormous constants, making the algorithm impractical). The following algorithm, due to Levin, is such an example. It correctly accepts the <b>NP</b>-complete language <a href="/wiki/Subset_sum_problem" title="Subset sum problem">SUBSET-SUM</a>, and runs in polynomial time if and only if <b>P</b> = <b>NP</b>:</p> <pre> // Algorithm that accepts the NP-complete language <a href="/wiki/ Subset_sum_problem" title="Subset sum problem">SUBSET-SUM</a>. // // This is a polynomial-time algorithm if and only if <b>P</ b>=<b>NP</b>. // // "Polynomial-time" means it returns "yes" in polynomial time when // the answer should be "yes", and runs forever when it is "no". // // Input: S = a finite set of integers // Output: "yes" if any subset of S adds up to 0. // Runs forever with no output otherwise. // Note: "Program number P" is the program obtained by // writing the integer P in binary, then // considering that string of bits to be a // program. Every possible program can be // generated this way, though most do nothing // because of syntax errors.<br /> FOR N = 1...infinity FOR P = 1...N Run program number P for N steps with input S IF the program outputs a list of distinct integers AND the integers are all in S AND the integers sum to 0<br /> THEN OUTPUT "yes" and HALT </pre> <p>If, and only if, <b>P</b> = <b>NP</b>, then this is a polynomial- time algorithm accepting an <b>NP</b>-complete language. "Accepting" means it gives "yes" answers in polynomial time, but is allowed to run forever when the answer is "no".</p> <p>Note that this is enormously impractical, even if <b>P</b> = <b>NP</ b>. If the shortest program that can solve SUBSET-SUM in polynomial time is <i>b</i> bits long, the above algorithm will try 2<sup>b</sup> â1 other programs first.</p> <p>Perhaps we want to "solve" the SUBSET-SUM problem, rather than just "accept" the SUBSET-SUM language. That means we want the algorithm to always halt and return a "yes" or "no" answer. If <b>P</b> = <b>NP</ b>, then there is an algorithm which does this in polynomial time, which uses some polynomial-time verification method that there is no subset sum in the algorithm above. Another algorithm that is obtained by replacing the IF statement in the above algorithm with this:</p> <pre> IF the program outputs a complete math proof AND each step of the proof is legal AND the conclusion is that S does (or does not) have a subset summing to 0 THEN OUTPUT "yes" (or "no") and HALT </pre> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=11" title="Edit section: Gibraltar Code">edit</a>]</span> <span class="mw-headline" id="Gibraltar_Code">Gibraltar Code</span></h2> <p>These are the codes for the sets P.NP.</p> <p><code>Copyright © 2010 www.meami.org<br /></code></p> <p><code>The information on this page may not be reproduced or republished on another web page or web site unless done so by M. M. Musatov (with the exception of Wikipedia). M. M. Musatov, Meami.org, released this code for private non-profit non-commercial use only - All Other Rights Reserved.</code></p> <pre> <code> //<br /> // #include <cassert><br /> // #include <climits><br /> </code> </pre> <pre> <code> // #include <cstdlib><br /> // #include <cstdio><br /> //<br /> // using namespace std;<br /> //<br /> // typedef struct node<br /> // {<br /> </code> </pre> <pre> <code> // int nElem;<br /> // struct node *pNextNode;<br /> // }Node;<br /> //<br /> //<br /> // int pushElem(Node **argpRoot, int argnElem)<br /> // {<br /> </code> </pre> <pre> <code> // Node *pNewNode;<br /> // pNewNode = (Node *)malloc(sizeof(Node));<br /> // if(!pNewNode)<br /> // {<br /> // fprintf(stderr,"\n\t ERR: Memory allocation failure </code> </pre> <p><code>for Node \n");<br /></code></p> <pre> <code> // return -1;<br /> </code> </pre> <pre> <code> // }<br /> //<br /> // pNewNode->nElem = argnElem;<br /> // pNewNode->pNextNode = NULL;<br /> // if(*argpRoot==NULL)<br /> // {<br /> </code> </pre> <pre> <code> // *argpRoot = pNewNode;<br /> // }<br /> // else<br /> // {<br /> // pNewNode->pNextNode = *argpRoot;<br /> // *argpRoot = pNewNode;<br /> </code> </pre> <pre> <code> // }<br /> // return 1;<br /> // }<br /> //<br /> //<br /> // int popElem(Node **argpRoot)<br /> // {<br /> </code> </pre> <pre> <code> // assert(*argpRoot!=NULL);<br /> // int nRetElem;<br /> // Node *pDeleteNode;<br /> // pDeleteNode = *argpRoot;<br /> // *argpRoot = (*argpRoot)->pNextNode;<br /> // nRetElem = pDeleteNode->nElem;<br /> </code> </pre> <pre> <code> // free(pDeleteNode);<br /> // return nRetElem;<br /> // }<br /> //<br /> // void deleteList(Node **argpRoot)<br /> // {<br /> </code> </pre> <pre> <code> // while(*argpRoot)<br /> // {<br /> // popElem(argpRoot);<br /> // }<br /> // }<br /> //<br /> // void printElems(Node *argpRoot)<br /> </code> </pre> <pre> <code> // {<br /> // //assert(argpRoot != NULL);<br /> // if(argpRoot!=NULL)<br /> // {<br /> // Node *pTempNode = argpRoot;<br /> // while(pTempNode->pNextNode)<br /> </code> </pre> <pre> <code> // {<br /> // fprintf(stdout,"%d->",pTempNode- >nElem);<br /> // pTempNode = pTempNode->pNextNode;<br / > // }<br /> // fprintf(stdout,"%d",pTempNode->nElem);<br /> // }<br /> </code> </pre> <pre> <code> // }<br /> //<br /> // int findElemFromListEnd(Node *argpRoot,int nTargetPos,int </code> </pre> <ul> <li><code>argpnElem)<br /></code></li> </ul> <pre> <code> // {<br /> // /*<br /> // assert(argpRoot!=NULL);<br /> </code> </pre> <pre> <code> // assert(nTargetPos <= INT_MAX && nTargetPos > 0);<br /> // assert(argpnElem!=NULL);<br /> // */<br /> //<br /> // if(argpRoot == NULL)<br /> </code> </pre> <pre> <code> // {<br /> // fprintf(stderr, "\n\t ERR: list is empty \n");<br /> // return -1;<br /> // }<br /> //<br /> // if((nTargetPos > INT_MAX) || (nTargetPos <= 0))<br /> </code> </pre> <pre> <code> // {<br /> // fprintf(stderr, "\n\t ERR: target position should be </code> </pre> <p><code><=INT_MAX and non-zero positive value\n");<br /></code></ p> <pre> <code> // return -1;<br /> // }<br /> //<br /> // if(argpnElem == NULL)<br /> </code> </pre> <pre> <code> // {<br /> // fprintf(stderr, "\n\t ERR: no memory allocated to </code> </pre> <p><code>store the element at target position in the input list \n");<br /></code></p> <pre> <code> // return -1;<br /> // }<br /> //<br /> // Node *pFwdNode,*pLagNode;<br /> </code> </pre> <pre> <code> // int nCurrentPos = 1;<br /> //<br /> // pFwdNode = argpRoot;<br /> // pLagNode = NULL;<br /> //<br /> // while(pFwdNode)<br /> // {<br /> </code> </pre> <pre> <code> // if(nCurrentPos == nTargetPos)<br /> // {<br /> // pLagNode = argpRoot;<br /> // break;<br /> // }<br /> // pFwdNode = pFwdNode->pNextNode;<br /> </code> </pre> <pre> <code> // nCurrentPos++;<br /> // }<br /> //<br /> // if(!pLagNode)<br /> // {<br /> // fprintf(stderr, "\n\t ERR: target position specified </code> </pre> <p><code>is non-existent for the current list\n");<br /></code></p> <pre> <code> // *argpnElem = -1;<br /> // return -1;<br /> // }<br /> //<br /> // while(pFwdNode->pNextNode)<br /> // {<br /> </code> </pre> <pre> <code> // pLagNode = pLagNode->pNextNode;<br /> // pFwdNode = pFwdNode->pNextNode;<br /> // }<br /> // *argpnElem = pLagNode->nElem;<br /> // return 1;<br /> // }<br /> </code> </pre> <pre> <code> // int main()<br /> // {<br /> // Node *pRoot = NULL;<br /> // int nNumElems = 0;<br /> // int nCurElem;<br /> // unsigned int unTestCaseId;<br /> </code> </pre> <pre> <code> // int nTargetPos;<br /> // int i;<br /> //<br /> // while(!feof(stdin))<br /> // {<br /> // fscanf(stdin,"---\n");<br /> </code> </pre> <pre> <code> // fprintf(stdout,"---\n");<br /> // fscanf(stdin,"NumOfElems :%d \n",&nNumElems);<br /> // fprintf(stdout,"NumOfElems :%d \n",nNumElems);<br /> // fflush(stdout);<br /> // for(i=0;i<nNumElems;i++)<br /> // {<br /> </code> </pre> <pre> <code> // fscanf(stdin,"%d,",&nCurElem);<br /> // pushElem(&pRoot,nCurElem);<br /> // }<br /> // printElems(pRoot);<br /> // fflush(stdout);<br /> </code> </pre> <pre> <code> // fscanf(stdin,"\nTarget Position :%d \n",&nTargetPos);</ </code> </pre> <pre> <code> // fprintf(stdout,"\nTarget Position :%d \n",nTargetPos);</ </code> </pre> <pre> <code> // fflush(stdout);<br /> // if(findElemFromListEnd(pRoot,nTargetPos,&nCurElem)<0)</ </code> </pre> <pre> <code> // {<br /> </code> </pre> <pre> <code> // fprintf(stdout,"ERROR\n");<br /> //<br /> // }<br /> // else<br /> // {<br /> // fprintf(stdout,"Element:%d \n",nCurElem);<br /> </code> </pre> <pre> <code> // }<br /> // fscanf(stdin,"---\n");<br /> // fprintf(stdout,"---\n");<br /> // fflush(stdout);<br /> //<br /> // deleteList(&pRoot);<br /> // }<br /> </code> </pre> <pre> <code> // return 0;<br /> // }<br /></code><a href="http://meami.org/gibraltar.htm" class="external autonumber" rel="nofollow">[2]</a> </pre> <h2><span class="editsection">[<a href="/w/index.php? title=P_versus_NP_problem&action=edit&section=12" title="Edit section: Formal definitions for P and NP">edit</a>]</span> <span class="mw-headline" id="Formal_definitions_for_P_and_NP">Formal definitions for P and NP</span></h2> <p>Conceptually a <i>decision problem</i> is a problem that takes as input some <a href="/wiki/String_(computer_science)" title="String (computer science)">string</a>, and outputs "yes" or "no". If there is an <a href="/wiki/Algorithm" title="Algorithm">algorithm</a> (say a <a href="/wiki/Turing_machine" title="Turing machine">Turing machine</a>, or a <a href="/wiki/Computer_programming" title="Computer programming">computer program</a> with unbounded memory) which is able to produce the correct answer for any input string of length <span class="texhtml"><i>n</i></span> in at most <img class="tex" alt="c \cdot n^k" src="http://upload.wikimedia.org/math/1/6/c/ 16c462a08b39445092909372ffc5355b.png" /> steps, where <span class="texhtml"><i>k</i></span> and <span class="texhtml"><i>c</i></ span> are constants independent of the input string, then we say that the problem can be solved in <i>polynomial time</i> and we place it in the class <b>P</b>. Formally, <b>P</b> is defined as the set of all languages which can be decided by a deterministic polynomial-time Turing machine. That is,</p> <p><b>P</b> = <span class="texhtml">{<i>L</i>:<i>L</i> = <i>L</ i>(<i>M</i>) for some deterministic polynomial-time Turing machine <i>M</i>}</span></p> <p>where <img class="tex" alt="L(M) = \{ w\in\Sigma^{*}: M \text{ accepts } w \}" src="http://upload.wikimedia.org/math/ 2/9/9/29923cd12c8e3f483b7307217f2faddb.png" /></p> <p>and a deterministic polynomial-time Turing machine is a deterministic Turing machine <span class="texhtml"><i>M</i></span> which satisfies the following two conditions:</p> <ol> <li><span class="texhtml"><i>M</i> halts on all input <i>w</i></span>; and</li> <li>there exists <img class="tex" alt="k \in N" src="http:// upload.wikimedia.org/math/0/6/d/06dfb1cc3c34f77feeb5622736ac1559.png" / > such that <img class="tex" alt="T_{M}(n)\in\; " src="http:// upload.wikimedia.org/math/c/c/4/cc451be9c433fe9d9b1665e02a1451ea.png" / ><a href="/wiki/Big_O_notation#Formal_definition" title="Big O notation"><i>O</i></a><span class="texhtml">(<i>n</i><sup><i>k</i></ sup>)</span>,</li> </ol> <dl> <dd> <dl> <dd>where <img class=
|
Pages: 1 Prev: Meami.org releases 'Gibraltar' Code, Open Source community shockwave Next: NEWSFLASH! Meami.org finds: As it turns out P.NP-complete problems are a set of problems which any other NP-problem can be reduced to in polynomial time, but which retain the ability to have their solution verified |