<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>阅微堂 &#187; 理论计算机初步</title>
	<atom:link href="http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5/feed" rel="self" type="application/rss+xml" />
	<link>http://zhiqiang.org/blog</link>
	<description>理工科背景的证券从业人员</description>
	<lastBuildDate>Sun, 05 Feb 2012 03:59:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>理论计算机初步：从hash函数到王小云的MD5破解</title>
		<link>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html</link>
		<comments>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html#comments</comments>
		<pubDate>Mon, 18 Sep 2006 12:51:01 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[计算机科学]]></category>
		<category><![CDATA[hash函数]]></category>
		<category><![CDATA[MD5]]></category>
		<category><![CDATA[SHA-1]]></category>
		<category><![CDATA[密码学]]></category>
		<category><![CDATA[王小云]]></category>
		<category><![CDATA[理论计算机初步]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/446.html</guid>
		<description><![CDATA[博客 » 计算机科学 » 理论计算机初步 » 系列：理论计算机初步 查看该系列所有文章 密码学是理论计算机的一个很大的方向。之前准备先写密码学概论再提在hash函数破解上做出重大贡献的王小云教授的工作，不过前两天王小云获得求是杰出科学家奖以及100万奖金，在媒体上又掀起了一轮宣传狂潮，但是有些报道极端弱智，错误百出，所以我趁机纠正一下，并介绍密码学的一...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science/computer-science">计算机科学</a> » <a href='http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5'>理论计算机初步</a>  » </p><div class="series"><span>系列：<b>理论计算机初步</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>密码学是理论计算机的一个很大的方向。之前准备先写密码学概论再提在hash函数破解上做出重大贡献的王小云教授的工作，不过前两天<a target="_blank" href="http://www.stdaily.com/404.htm">王小云获得求是杰出科学家奖以及100万奖金</a>，在媒体上又掀起了一轮宣传狂潮，但是有些报道极端弱智，错误百出，所以我趁机纠正一下，并介绍密码学的一个组成部分——hash函数，以及王小云在这上面的工作。</p>
<p>王小云的主要工作是关于hash函数的破解工作。她在2005一个密码学会议上宣布破解了SHA-1，震惊了全世界。所以要介绍和理解她的工作，先看一下hash函数具体是怎么回事。</p>
<p>简单的说，<strong>hash函数</strong>就是<font color="#ff0000">把任意长的输入字符串变化成固定长的输出字符串</font>的一种函数。通俗得说，hash函数用来生成信息的摘要。输出字符串的长度称为hash函数的<strong>位数</strong>。</p>
<p>目前应用最为广泛的hash函数是<strong><a href="http://en.wikipedia.org/wiki/SHA_hash_functions">SHA-1</a></strong>和<strong><a target="_blank" href="http://en.wikipedia.org/wiki/Md5">MD5</a></strong>，大多是128位和更长。</p>
<p>hash函数在现实生活中应用十分广泛。很多下载网站都提供下载文件的MD5码校验，可以用来判别文件是否完整。另外，比如在WordPress的数据库，所有密码都是保存的MD5码，这样即使数据库的管理员也无法知道用户的原始密码，避免隐私泄露（很多人在不同地方都是用的同一个密码）。</p>
<p>如果两个输入串的hash函数的值一样，则称这两个串是一个<strong>碰撞</strong>(<strong>Collision</strong>)。既然是把任意长度的字符串变成固定长度的字符串，所以，必有一个输出串对应无穷多个输入串，碰撞是必然存在的。</p>
<p>一个“优良”的hash函数 <em>f </em>应当满足以下三个条件：</p>
<ul>
<li>任意y，找x，使得f(x)=y，非常困难。</li>
<li>给定x1，找x2，使得f(x1)=f(x2)，非常困难。</li>
<li>找x1，x2，使得f(x1)=f(x2)，非常困难。</li>
</ul>
<p>上面的“非常困难”的意思是除了枚举外不可能有别的更快的方法。比如第3条，根据<a target="_blank" href="http://en.wikipedia.org/wiki/Birthday_paradox">生日定理</a>，要想找到这样的x1，x2，理论上需要大约2^(n/2)的枚举次数。</p>
<p>几乎所有的hash函数的破解，都是指的破坏上面的第三条性质，即找到一个碰撞（前两条都能被破坏的hash函数也太弱了点，早就被人抛弃了）。在密码学上还有一个概念是<strong>理论破解</strong>，指的是提出一个算法，使得可以用低于理论值得枚举次数找到碰撞。</p>
<p>王小云的主要工作是给出了MD5，<a target="_blank" href="http://en.wikipedia.org/wiki/SHA_hash_functions">SHA-0</a>的碰撞，以及SHA-1的理论破解，她证明了160位SHA-1，只需要大约2^69次计算就能找出来，而理论值是2^80次。她的寻找MD5碰撞的方法是极端高效的。传说王小云当时在会议上把碰撞写出来，结果被下面的人验证发现不对，原来她把MD5算法的一个步骤弄错了。但是她立马联系她的当时留在中国的学生，修正算法，并找到一个新的碰撞。这一个是对的。</p>
<p>看到这里，那些认为中国国安局应该将这些结果封存作为秘密武器甚至幻想用这些成果来袭击美国之徒可以停住你们的YY了。这种形式上的破解，在大多数情况下没有实际性的作用。更别提MD5早就被美国人抛弃了。</p>
<p>但是，说这种破解一点实际意义都没有，那就侮辱了广大密码学家的智商，密码学家不会无缘无故的弄出碰撞这么一个概念来。下面简单的介绍一下在特定情况下，怎么利用给定的碰撞来做坏事(翻译自<a target="_blank" href="http://th.informatik.uni-mannheim.de/people/lucks/HashCollisions/">Attacking Hash Functions</a>)：</p>
<p>Caesar给实习生Alice叫写了一封推荐信(letter)。同一天，Alice叫Caesar在推荐信上数字签名，并提供了一份推荐信的电子板。Caesar打开文件，发现和原件一模一样。所以他在文件上签了名。</p>
<p>几个月后，Caesar发现他的秘密文件被非法察看。这到底是怎么回事呢？</p>
<p align="center"><a href="http://www.cits.rub.de/imperia/md/content/magnus/letter_of_rec.ps"><img border="0" align="top" alt="letter" src="http://www.cits.rub.de/imperia/md/content/magnus/letter.png" /> </a><a href="http://www.cits.rub.de/imperia/md/content/magnus/order.ps"><img border="0" align="top" alt="order" src="http://www.cits.rub.de/imperia/md/content/magnus/order.png" /></a><br />
<img border="0" align="top" alt="(apply MD5 to both documents)" src="http://www.cits.rub.de/imperia/md/content/magnus/samehash.png" /><br />
a25f7f0b 29ee0b39 68c86073 8533a4b9</p>
<p>事实上，Alice要求Caesar签名的文件<a target="_blank" href="http://www.cits.rub.de/imperia/md/content/magnus/letter_of_rec.ps">letter</a>已经被Alice做了手脚，准确地说，Alice还准备了另外一个文件<a target="_blank" href="http://www.cits.rub.de/imperia/md/content/magnus/order.ps">order</a>，它们的MD5码完全一致。而Caesar的数字签名还依赖于MD5算法，所以Alice用order文件替换Letter文件之后，Caesar的数字签名依然有效。那封order给Alice提供了察看秘密文件的权限。</p>
<p>具体的实现方法可见<a target="_blank" href="http://www.cits.rub.de/imperia/md/content/magnus/rump_ec05.pdf">Hash Functions and the Blind Passenger Attack</a>。我在这里简单的解释一下(只是大致思路，具体实现方式，需要对文件结构信息有所了解)：</p>
<p>letter文件的内容是：</p>
<blockquote>
<p align="left">if(x1==x1) show "letter" else show "order"</p>
</blockquote>
<p>order文件的内容是：</p>
<blockquote>
<p align="left">if(x2==x1) show "letter" else show "order"</p>
</blockquote>
<p>其中字符串"letter"和"order"代表两封信实际显示的内容。x1，x2是一个MD5的碰撞。</p>
<p>上面的方法，只供参考和学术用途，实际使用所引起的后果概不负责。</p>
<p>参考：</p>
<ul>
<li><a target="_blank" href="http://th.informatik.uni-mannheim.de/people/lucks/HashCollisions/">Attacking Hash Functions by Poisoned Messages "The Story of Alice and her Boss"</a></li>
<li><a target="_blank" href="http://en.wikipedia.org/wiki/Hash_function">Hash function</a>, wikipedia</li>
<li><a target="_blank" href="http://en.wikipedia.org/wiki/SHA_hash_functions">SHA</a>, wikipedia</li>
<li>Interview with Yiqun Lisa Yin concerning the attack on SHA-1</li>
</ul>
<p>PS：我跟王小云老师的接触很少，上过俩次她的讨论班而已，亦感觉到王小云老师的严谨和耐心。在去年一个Turing奖获得者的演讲上，王小云提问的时候竟口而出“I ask who”的中式英语，在引起哄笑的同时，我也极端佩服她的勇气。也许只有这样才能做出非常好的工作吧。</p>
<p>PS2: wikipedia在国内可以通过<a target="_blank" href="http://sites.google.com/site/mathzqy/fd62.exe">free_door</a>浏览。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/tcs-one-time-password-and-application-of-a-one-time-password.html">TCS：One-Time Password 一次性密码及其应用</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/md5-collision-application.html">MD5碰撞的新玩意儿</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html">理论计算机初步：前言</a></li><li><a href="http://zhiqiang.org/blog/memopad/secureid-token-was-stolen.html">RSA的SecureID token数据被偷了？</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html">理论计算机初步：P vs NP - 问题概述</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html">理论计算机初步：P vs NP - 历史，现状和未来</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html">理论计算机初步：概率算法和近似算法</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html#comments">32 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>理论计算机初步：概率算法和近似算法</title>
		<link>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html</link>
		<comments>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html#comments</comments>
		<pubDate>Thu, 14 Sep 2006 01:32:32 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[计算机科学]]></category>
		<category><![CDATA[概率算法]]></category>
		<category><![CDATA[理论计算机初步]]></category>
		<category><![CDATA[近似算法]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/442.html</guid>
		<description><![CDATA[博客 » 计算机科学 » 理论计算机初步 » 系列：理论计算机初步 查看该系列所有文章 前面已经提到了显示中大多数难解问题问题最后都被证明是NP-完全问题。这意味着，除非NP=P，它们是不可能有多项式时间算法的（而且，在这篇文章提到即使NP=P，人们也可能找不到一个NP完全问题的“有效”算法）。 所以人们发展了各种工具来避开它们，最常用的两种方法是使用概率算法和...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science/computer-science">计算机科学</a> » <a href='http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5'>理论计算机初步</a>  » </p><div class="series"><span>系列：<b>理论计算机初步</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p><a rel="理论计算机初步：P vs NP - 问题概述" href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html">前面</a>已经提到了显示中大多数难解问题问题最后都被证明是NP-完全问题。这意味着，除非NP=P，它们是不可能有多项式时间算法的（而且，在<a rel="理论计算机初步：P vs NP - 历史，现状和未来" href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html">这篇文章</a>提到即使NP=P，人们也可能找不到一个NP完全问题的“有效”算法）。</p>
<p>所以人们发展了各种工具来避开它们，最常用的两种方法是使用概率算法和近似算法，这两种方法也符合实际需要：在解决实际问题中，我们<font color="#ff0000">不需要结果绝对正确</font>，也<font color="#ff0000">不需要结果绝对精确</font>。</p>
<p>所谓<strong>概率算法</strong>，就是在算法的过程中引入随机数，使得算法在执行的过程中随机选择下一个计算步骤。它最后可能导致结果也是不确定的。一个结果不确定的概率算法叫做Monte Carlo算法，而总是得到准确解的概率算法叫做Sherwood算法（一个例子是引进随机因子的快速排序算法）。</p>
<p>为何引入随机数能够提升计算性能（事实上，理论计算机学家还没能证实随机因子本质上更有效率——指具有指数级别的效率提升），主要有下面两个原因：</p>
<p>首先，通常一个算法，它对于很多种情况是比较快的，但对于某些“特别差”的输入，它要找到一个解则特别困难。引入随机数之后，使得算法的时间复杂度平均化了，然后算得更快（评价一个随机算法的复杂性通常是考虑其平均复杂性）。</p>
<p>其次，对于Monte Carlo算法，它的输出是不精确的，这种牺牲使得算法能够在较短时间内完成。</p>
<p>需要指出的是，下面这个定理，使得一个不那么精确的Monte Carlo算法亦有实际的效用的：</p>
<blockquote><p>如果一个判定问题的某个Monte Carlo算法有2/3的正确几率(这个2/3可以替换成任何一个大于1/2的数，当然小于等于1/2的随机算法一点意义都没有，因为还不如抛硬币)，重复这个算法k次，取出现次数更多的结果作为问题的答案，则这个答案的正确率大于1-1/2(8/9)^k。</p></blockquote>
<p>上面的结果由于k出现在指数上，所以只需要将一个Monte Carle算法重复很少的次数，便能得到很高的准确率。</p>
<p>近似算法从字面的意思来看似乎和上面的Monte Carle算法差不多，其实它们的考虑对象是不一样的，而且通常所指的近似算法是确定型算法。近似算法多用在组合优化的问题，而不是判定性问题上。组合优化问题，指的是那些需要求最优解的问题，比如下面这个</p>
<blockquote><p><strong>旅行商问题</strong></p>
<p>有n个城市，一个推销员要从其中某一个城市出发，不重复地走遍所有的城市，再回到他出发的城市。问这个推销员的最短路程。</p></blockquote>
<p>对于这种问题，如果最短路径是1000，而且我们能很快找到一个1000.1的路径，在实际运用中，我们还需要浪费巨大的计算资源去找那个1000的路径吗？近似算法便基于此思想而来。</p>
<p><strong>近似算法</strong>指在解决优化问题中，最后得到的结果能保证在一定的误差之内的算法。</p>
<p>从近似算法的角度来说，同为NP完全问题，它们也有不同的可近似度。在多项式时间内，有些问题可以无穷小误差的逼近，但有些问题却连常数倍数之内的结果都没法得到。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html">理论计算机初步：前言</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html">理论计算机初步：P vs NP - 问题概述</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html">理论计算机初步：P vs NP - 历史，现状和未来</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html">理论计算机初步：从hash函数到王小云的MD5破解</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html#comments">7 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>理论计算机初步：P vs NP - 历史，现状和未来</title>
		<link>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html</link>
		<comments>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html#comments</comments>
		<pubDate>Thu, 24 Aug 2006 00:08:51 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[计算机科学]]></category>
		<category><![CDATA[P vs NP]]></category>
		<category><![CDATA[复杂性理论]]></category>
		<category><![CDATA[理论计算机初步]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/413.html</guid>
		<description><![CDATA[博客 » 计算机科学 » 理论计算机初步 » 系列：理论计算机初步 查看该系列所有文章 上篇文章已经提到，P vs NP是理论计算机科学的核心问题。从数学的角度来说，它和其他历史上有名的数学问题一样，给与人们一个智力上重大的挑战。而更为重要的是，在无数与计算有关的的学术领域中，NP-完全问题以各种不同形式层出不穷。因此，这并不是一个纯粹的与世独立的智力游戏...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science/computer-science">计算机科学</a> » <a href='http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5'>理论计算机初步</a>  » </p><div class="series"><span>系列：<b>理论计算机初步</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html" title="P vs NP 问题概述">上篇文章</a>已经提到，P vs NP是理论计算机科学的核心问题。从数学的角度来说，它和其他历史上有名的数学问题一样，给与人们一个智力上重大的挑战。而更为重要的是，在无数与计算有关的的学术领域中，NP-完全问题以各种不同形式层出不穷。因此，这并不是一个纯粹的与世独立的智力游戏，而是对计算机科学有全面影响力的问题。</p>
<h4>历史上的进展</h4>
<p>从上个世界70年代初这个问题被Cook提出以来，人们发展了各种工具来试图解决它，下面引自堵丁柱&amp;葛可一的《计算复杂性导论》前言：</p>
<blockquote><p>人们在七十年代开始对NP-完全问题的研究主要是横向发展，也就是以许多不同的计算模型来分析难解问题的本质。这些新的计算模型包括了平行计算模型、概率计算模型、布尔线路、判断树、平均复杂性、交互证明系统以及程式长度复杂性等等。对这些新的计算模型的研究一方面使我们对难解问题有了更深一层的认识，一方面也产生了一些预想不到的应用。最显著的一个例子就是计算密码学的革命性突破：基于NP问题的公钥密码体系。另一个有名的例子是线性规划的多项式时间解的发现。</p>
<p>到了八十年代中，对NP-完全问题的研究有了纵向的突破，在许多表面看来并不相关的计算模型之间发现了深刻的刻划关系。这些刻划关系不但解决了几个令人困扰多年的未解问题，同时也刺激了其它相关领域的发展。其中之一是对线路复杂性的研究发现了一些问题在某种有限制的线路模型中必有指数下界。这些结果使用了组合数学与概率方法等新的数学工具，并且解决了一个有名的有关多项式分层的未解问题。另一个更重大的结果是以概率可验证明对NP类的刻划。由此得出了许多组合优化问题近似解的NP-完全性，从而刺激了算法界对近似算法研究的新热潮。这个结果来自于对交互证明系统这个概念的扩展，并且使用了线性代数与编码理论等数学证明技巧。</p></blockquote>
<p>但是，明显的，目前还没有一个看上去有希望的方向。相反的，1993年Razborov和Rudich证明的一个结果表明，给定一个特定的可信的假设，在某种意义下“自然”的证明不能解决<strong>P</strong> vs <strong>NP</strong>问题。这表明一些现在似乎最有希望的方法不太可能成功。随着更多这类的定理得到证明，该定理的可能证明有越来越多的陷阱要规避。</p>
<p>数学里最伟大的定理之一——费马大定理，用了数学家300多年时光。P vs NP问题，作为理论计算机领域最困难的问题，40年时间似乎太短了。</p>
<p>不过我还是相信，这个问题被拖这么长时间，是因为没有足够伟大的数学家来做这个问题。</p>
<h4>大牛们怎么看？</h4>
<p>对于NP是否等于P，大家看法不一。在<a rel="调查报告下载" target="_blank" href="http://sites.google.com/site/mathzqy/poll.pdf">2002年对于100个研究者的调查</a>中，61人相信答案是否定的，9个相信答案是肯定的，22个不确定，而8个相信该问题可能和现在所接受的公理独立，所以不可能证明或证否。同时，在被询问到这个问题可能在何时被解决时，79个人给出了确切的数字，统计结果如下：</p>
<blockquote><p>1. P=NP will be resolved between 2002-2009: 5<br />
2. P=NP will be resolved between 2010-2019: 12<br />
3. P=NP will be resolved between 2020-2029: 13<br />
4. P=NP will be resolved between 2030-2039: 10<br />
5. P=NP will be resolved between 2040-2049: 5<br />
6. P=NP will be resolved between 2050-2059: 12<br />
7. P=NP will be resolved between 2060-2069: 4<br />
8. P=NP will be resolved between 2070-2079: 0<br />
9. P=NP will be resolved between 2080-2089: 1<br />
10. P=NP will be resolved between 2090-2099: 0<br />
11. P=NP will be resolved between 2100-2110: 7<br />
12. P=NP will be resolved between 2100-2199: 0<br />
13. P=NP will be resolved between 2200-3000: 5<br />
14. P=NP will never be resolved : 5.</p></blockquote>
<p>在<a rel="调查报告下载" target="_blank" href="http://sites.google.com/site/mathzqy/poll.pdf">这份调查报告</a>中，还有国际上著名的计算机学家对这个问题的看法，比如：</p>
<blockquote><p><strong>Avi Wigderson</strong>: (Institute of Advanced Study) I think this project is a bit premature. I think we know too little of what is relevant to even guess answers to your questions, certainly if "we" s replaced by "I"</p>
<p>The only thing I can definitely say, is that it is one of the most important and interesting questions ever asked by humans, and more people and resources should participate in filling up the holes that would allow better guesses of answers to your questions.</p>
<p><strong>姚期智</strong>: (Princeton) It's hard to say when the question will be resolved. I don't have even an educated guess. Probably the resolution is that P is not equal to NP. I think the mathematical techniques used will be beautiful.</p></blockquote>
<h4>可能的极为诡异的结果</h4>
<p>从实际应用来说，人们都希望NP=P，因为这意味着很多问题都能有有效的算法，但有些极为诡异的结果也是可能的，人们从这个结果中什么都得不到。</p>
<p>比如某一天人们最终使用某种数学上的技巧证明了NP问题的多项式时间算法的存在性，但并不知道如何找到它——这在数学上是极为可能的，那最终会怎么样呢？</p>
<p><strike>这种情况不会发生，事实上，在NP=P的假设下，人们已经找到了NP完全问题的多项法解法，但这并没有好太多，因为这个算法是这样的：</strike> 此段有问题，还没想太明白。</p>
<blockquote><p>// 接受NP完全语言的一个算法。<br />
//<br />
// 这是一个多项式时间算法当且仅当P=NP。<br />
//<br />
// “多项式时间”表示它在多项式时间内返回“是”，若<br />
// 结果是“是”，否则永远运行。<br />
//<br />
// 输入：S = 一个自然数的有限集<br />
// 输出：是 如果某个S的子集加起来等于0。<br />
// 否则，它永远运行没有输出。<br />
// 注：上面这是一个NP完全问题<br />
//<br />
// 程序数P 是你将一个整数P写为二进制，然后<br />
// 将位串考虑为一个程序。<br />
// 每个可能的程序都可以这样产生，<br />
// 虽然多数什么也不做因为有语法错误。</p>
<p>FOR N = 1...infinity<br />
FOR P = 1...N<br />
以S为输入运行程序数P N步<br />
IF <strike>程序输出一个完整的数学证明</strike>（错误处在此）<br />
AND 证明的每一步合法<br />
AND 结论是S确实有（或者没有）一个和为0的子集<br />
THEN<br />
OUTPUT 是（或者不是）并停机</p></blockquote>
<p><strike>如果NP=P，上面这个算法便是一个NP完全问题的多项式时间算法。可是它一点价值都没有，更不用说来解决实际问题了。</strike></p>
<h4>另一种可能性：独立问题？</h4>
<p>自从Godel的开创性结果以来，我们知道某些问题，比如连续统假设，是不可能从目前的条件（公理系统）推导出来的。有人怀疑P vs NP问题也是这样。这样的话，如果不存在NP完全问题的有效算法，我们不可能证明这一点。同样，如果存在一个有效的算法，我们也不可能找到它。</p>
<h4>花絮</h4>
<p>中国民科一向喜欢做大问题，不知为何很少向P vs NP问题下手，但他们的外国同行可不会客气，<a href="http://www.win.tue.nl/~gwoegi/P-versus-NP.htm">这里</a>就有一大帮，而且这些国外的前辈们专业多了，好多解答还提供pdf文档下载呢。</p>
<h5>参考文献：</h5>
<ol>
<li><a href="http://www.claymath.org/millennium/P_vs_NP/Official_Problem_Description.pdf">P verse NP problem</a></li>
<li><a href="http://www.cs.princeton.edu/courses/archive/spr09/cos522/SipserNP.pdf">The history and status of P verse NP question</a></li>
<li>千禧年大奖难题（一）</li>
<li>堵丁柱, 葛可一, <em>计算复杂性导论</em> , 高等教育出版社, 2002</li>
</ol>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html">理论计算机初步：P vs NP - 问题概述</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/what-if-p-np.html">What if P = NP?</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/np-hard.html">TCS：NP-hard</a></li><li><a href="http://zhiqiang.org/blog/science/quantum-history-uncertainty-principle.html">测不准原理还是不确定性原理 - 谈量子物理史话一</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html">理论计算机初步：前言</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html">理论计算机初步：概率算法和近似算法</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html">理论计算机初步：从hash函数到王小云的MD5破解</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html#comments">15 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>理论计算机初步：P vs NP - 问题概述</title>
		<link>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html</link>
		<comments>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html#comments</comments>
		<pubDate>Wed, 23 Aug 2006 14:40:08 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[计算机科学]]></category>
		<category><![CDATA[NP]]></category>
		<category><![CDATA[NP完全]]></category>
		<category><![CDATA[P vs NP]]></category>
		<category><![CDATA[复杂性理论]]></category>
		<category><![CDATA[理论计算机初步]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/412.html</guid>
		<description><![CDATA[博客 » 计算机科学 » 理论计算机初步 » 系列：理论计算机初步 查看该系列所有文章 P = NP? 这个问题，作为理论计算机科学的核心问题，其声名早已经超越了这个领域。它是Clay研究所的七个百万美元大奖问题之一，在2006国际数学家大会上，它是某个1小时讲座的主题。 要说起P和NP是什么东西，得先从算法的多项式时间复杂度谈起，注意，这里面的两个P都是指Polynomial。 一个...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science/computer-science">计算机科学</a> » <a href='http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5'>理论计算机初步</a>  » </p><div class="series"><span>系列：<b>理论计算机初步</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5">查看该系列所有文章</a>
<div id='series'></div>
</div>  <blockquote><p>P = NP?</p></blockquote>
<p>这个问题，作为理论计算机科学的核心问题，其声名早已经超越了这个领域。它是<a href="http://www.claymath.org/millennium/P_vs_NP/">Clay研究所的七个百万美元大奖问题之一</a>，在<a href="http://icm2006.org/" target="_blank">2006国际数学家大会</a>上，它是<a href="http://icm2006.org/v_f/web_fr.php" target="_blank" rel="ICM 2006 一小时讲座列表">某个1小时讲座</a>的<a href="http://icm2006.org/v_f/AbsDef/Invited/wigderson.pdf" target="_blank" rel="讲座的摘要">主题</a>。</p>
<p>要说起P和NP是什么东西，得先从算法的多项式时间复杂度谈起，注意，这里面的两个P都是指Polynomial。</p>
<p>一个问题的规模指的是输入的总位数，比如一个n个数的排序问题，输入规模就是n。注意，在某些时候，输入规模是要值得注意的，比如判定一个数n是否是一个质数这个问题，它的输入规模并不是n，而是log(n)，因为一个数n用大约log(n)位就能表示出来了，这也是为何枚举因子判定素数的算法并不是多项式时间算法的原因。</p>
<p>如果一个算法，它能在以输入规模为参变量的某个多项式的时间内给出答案，则称它为<strong>多项式时间算法</strong>。注意：这里的多项式时间是指算法<font color="#ff0000">运行的步数</font>。一个算法是否是多项式算法，与计算模型的具体的物理实现没有关系，虽然大多数假想的计算模型不可能有任何物理的实现。</p>
<p><strong>P</strong>指确定型图灵机上的具有多项式算法的问题集合，<strong>NP</strong>指非确定型图灵机上具有多项式算法的问题集合，这里N是Non-Deterministic的意思（图灵机的概念见<a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-algorithms-and-calculation-model.html">理论计算机初步：算法和计算模型</a>）。</p>
<p>脱离图灵机的概念，就在普通的计算机上看，P问题是指能够<font color="#ff0000">在多项式时间求解</font>的判定问题（判定问题指只需要回答是和不是的问题），而NP问题则是指那些其肯定解能够<font color="#ff0000">在给定正确信息下在多项式时间内验证</font>的判定问题。比如，要判定一个数是合数，如果给我一个约数，我们就很快判定它就是合数。所以判定一个数是合数的问题属于NP。 下面是一些NP问题的例子：</p>
<blockquote>
<h5>零子集和问题</h5>
<p>给n个整数，判断是否可以从中找到若干个数，其和为0。</p>
<h5>旅行商问题</h5>
<p>有n个城市，一个推销员要从其中某一个城市出发，不重复地走遍所有的城市，再回到他出发的城市。问这个推销员的最短路程(是否小于指定的K)。</p></blockquote>
<p>从上面的定义知道，NP包含P。P vs NP问题指<font color="#ff0000">P是否完全等于NP</font>，即确定型图灵机和非确定图灵机的性能是否一样。</p>
<p>人们为何要提出NP问题？因为，大多数遇到的自然的难解问题，最后都发现它们是NP问题。如果我们能证明NP跟P的关系，则解决了无数问题的算法复杂度问题。</p>
<p>NP里面有无数个不同的问题，我们是否要一个一个地判定它们是否属于P呢？P vs NP问题的美妙和简洁之处便在于在NP中，有一个子类，<strong>NP完全</strong>(NP Complete，简记为<strong>NPC</strong>)问题，指的是那些NP中最难的那些问题：所有其它的NP问题都可以归约到这些NP完全问题。也就是说，只要这些NP完全问题的某一个得到解决，无论是证明其存在多项式算法，还是不存在，都意味着P vs NP问题的解决。</p>
<p>而几乎所有NP里面无法确定是否属于P的问题最后都被证明为NP完全。正因为如此，多数理论计算机学家都猜测P≠NP。目前已知的NP完全问题数以千计，上面引用中的例子都是完全问题，更多NP完全问题见<a href="http://www.nada.kth.se/~viggo/problemlist/compendium.html">NP完全问题的不完全列表</a>。</p>
<p>一个很自然的想法是如果NP≠P，则NP-P里面的问题都是完全问题。至少有两个自然的问题，一个是大数分解（给出一个数的质因数分解式），另一个是图同构问题（给出两个图，它们是否同构），它们既没有被证明是P的，也没有被证明是NP-完全。但是更惊人的是还有这个定理：</p>
<blockquote><p>如果NP≠P，那么NP-P中存在非NP完全问题。</p></blockquote>
<p>当然，这种问题具体是什么样子，是无法用直观的语言表示出来，它纯粹是一个数学上的构造性证明。</p>
<p><strong>参阅</strong>：</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Complexity_classes_P_and_NP">Complexity classes P and NP - Wikipedia, the free encyclopedia</a>, <a href="http://zh.wikipedia.org/wiki/P/NP%E9%97%AE%E9%A2%98">P/NP问题- Wikipedia</a></li>
<li><a href="http://en.wikipedia.org/wiki/Turing_machine">Turing machine - Wikipedia, the free encyclopedia</a>, <a href="http://zh.wikipedia.org/wiki/%E5%9B%BE%E7%81%B5%E6%9C%BA">图灵机- Wikipedia</a></li>
<li><a href="http://en.wikipedia.org/wiki/NP-hard">NP-hard - Wikipedia, the free encyclopedia</a>,</li>
</ul>
<p>备注：中国大陆可以通过<a href="http://browseatwork1.com">http://browseatwork1.com</a> <a href="http://www.doggystyleporn.org/sites/">访问wikipedia</a>.</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html">理论计算机初步：P vs NP - 历史，现状和未来</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/what-if-p-np.html">What if P = NP?</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/np-hard.html">TCS：NP-hard</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/computation-under-time-travel-machine-19.html">时间机器上的计算</a></li><li><a href="http://zhiqiang.org/blog/science/quantum-history-uncertainty-principle.html">测不准原理还是不确定性原理 - 谈量子物理史话一</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html">理论计算机初步：前言</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html">理论计算机初步：概率算法和近似算法</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html">理论计算机初步：从hash函数到王小云的MD5破解</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html#comments">10 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>理论计算机初步：前言</title>
		<link>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html</link>
		<comments>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html#comments</comments>
		<pubDate>Tue, 15 Aug 2006 08:26:13 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[计算机科学]]></category>
		<category><![CDATA[姚期智]]></category>
		<category><![CDATA[王小云]]></category>
		<category><![CDATA[理论计算机初步]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/389.html</guid>
		<description><![CDATA[博客 » 计算机科学 » 理论计算机初步 » 系列：理论计算机初步 查看该系列所有文章 这段时间Blog的更新频率大大降低，因为发现没啥好写的，也没有写文章的欲望。前段时间提到了我加入中国赛客联盟，而且给的说明语是"算机&#124;数学&#124;算法&#124;复杂理论"，翻了一下我这个blog，觉得有些名不副实。所以决定写一些我的专业的介绍性文章，顺便充实一下本blog的内容。 我...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/science/computer-science">计算机科学</a> » <a href='http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5'>理论计算机初步</a>  » </p><div class="series"><span>系列：<b>理论计算机初步</b></span><br/>
<a href="http://zhiqiang.org/blog/tag/%e7%90%86%e8%ae%ba%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%88%9d%e6%ad%a5">查看该系列所有文章</a>
<div id='series'></div>
</div>  <p>这段时间Blog的更新频率大大降低，因为发现没啥好写的，也没有写文章的欲望。<a href="http://zhiqiang.org/blog/science/chinas-passenger-union.html">前段时间提到</a>了我加入中国赛客联盟，而且给的说明语是"算机|数学|算法|复杂理论"，翻了一下我这个blog，觉得有些名不副实。所以决定写一些我的专业的介绍性文章，顺便充实一下本blog的内容。</p>
<p>我所学的专业英文名是Theoretical Computer Science，理论计算机科学，在这里我就简化成理论计算机了。具体研究些什么呢，下面是<a href="http://www.tsinghua.edu.cn">Andrew Yao</a>的研究方向</p>
<ul>
<li>Analysis of Algorithms - 算法 </li>
<li>Computational Complexity - 计算复杂性 </li>
<li>Communication Complexity - 通讯复杂性 </li>
<li>Cryptographic Protocols - 密码 </li>
<li>Quantum Computing - 量子计算 </li>
</ul>
<div>这些概括了理论计算机的大部分内容。</div>
<p>在后面的系列文章中，我会对其中一些方面写一些具体的东西。因为我也才刚入门，而且这样的类科普性的东西，无论怎么写，在专业人士看来，总有不够严密的地方。所以，我只写一些最简单的东西，让大家都能看得懂为止，但又能对于这一领域能有一些最基本的了解。如果还能引发一些人的兴趣，更为妙哉。</p>
<p>顺便做一下广告：我所在的<a href="http://www.tsinghua.edu.cn">理论计算机研究小组</a>，隶属于<a href="http://www.tsinghua.edu.cn">清华高等研究中心</a>，目前有<a href="http://www.tsinghua.edu.cn">姚期智</a>和<a href="http://www.tsinghua.edu.cn">王小云</a>两位老师坐镇，其中姚期智是2000年计算机界最高奖Turing奖获得者，而王小云教授在密码学界享有盛名，另外还有大帮讲席教授，师资力量世界上都排得上号。如果有对理论计算机感兴趣的同学，这个小组将是你的不贰选择哈。目前，此小组只接受<font color="#ff0000">保送直博生</font>，而且需要你在<font color="#ff0000">大三下学期</font>就提出申请。欢迎加入。</p>
<div><h4>相关文章</h4><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-xiao-yun-wang-from-the-hash-function-to-crack-md5.html">理论计算机初步：从hash函数到王小云的MD5破解</a></li><li><a href="http://zhiqiang.org/blog/memopad/the-establishment-of-the-institute-of-computer.html">理论计算机研究所成立</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/md5-collision-application.html">MD5碰撞的新玩意儿</a></li><li><a href="http://zhiqiang.org/blog/scribble/chinese-math-students-believe-destinity-is-in-numbers.html">Chinese math students believe destiny is in numbers</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-an-overview-of-the-problem.html">理论计算机初步：P vs NP - 问题概述</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-p-vs-np-past-present-and-future.html">理论计算机初步：P vs NP - 历史，现状和未来</a></li><li><a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-approximation-algorithms-and-probability-algorithm.html">理论计算机初步：概率算法和近似算法</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html#comments">8 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/computer-science/preliminary-computer-theory-preface.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

