52 Things: Number 5: What is meant by the complexity class NP?

52 Things: Number 5: What is meant by the complexity class NP?

52件事:第5:复杂度类NP是什么意思?

 
This is the latest in a series of blog posts to address the list of '52 Things Every PhD Student Should Know' to do Cryptography: a set of questions compiled to give PhD candidates a sense of what they should know by the end of their first year. We continue the Complexity Theory section with NP...
这是一系列博客文章中的最新一篇,旨在解决“每个博士生都应该知道的52件事”做密码学:这是一组问题,旨在让博士生在第一年结束时了解他们应该知道什么。我们继续复杂性理论部分的NP。。。



Last week, Ryan introduced us to complexity classes, and in particular to P:
上周,Ryan向我们介绍了复杂性类,特别是P:
  •  is the class of languages decidable in polynomial time by a deterministic Turing machine.
    P是一类在多项式时间内可由确定性图灵机判定的语言。
 
This week, we introduce another complexity class:
本周,我们将介绍另一个复杂性类:
 
  • NP is the class of languages decidable in polynomial time by a nondeterministic Turing machine.
    NP是一类在多项式时间内可由不确定性图灵机判定的语言。


What is a Nondeterministic Turing Machine (NDTM)?
什么是非确定性图灵机(NDTM)?

Well, an NDTM is a Turing Machine for which the transition function can have multiple values for the same tape value/state pair (meaning it is not technically a function any more, so the correct thing would be to call it a transition relation). Thus evaluation of an NDTM on any particular input can be thought of as a tree, branching at each point the transition function provides more than one possible value. Now, an NDTM evaluates all of these possible branches at once, and accepts if at least one of these computations halts in the accept state. This definition generalizes from language membership to decision to computational problems in the same way as P did in last weeks blog.
好吧,NDTM是一个图灵机,对于它,转换函数可以为同一个带值/状态对具有多个值(这意味着它在技术上不再是一个函数,所以正确的做法是将其称为转换关系)。因此,对任何特定输入的NDTM的评估都可以被认为是一棵树,在每个点上分支,转换函数提供了一个以上的可能值。现在,NDTM一次评估所有这些可能的分支,如果这些计算中至少有一个停止在接受状态,则接受。这个定义从语言成员关系到决策再到计算问题,就像P在上周的博客中所做的那样。
 

Some Examples of NP problems
NP问题的几个例子

We begin with an easy example: path finding. Given a directed graph (on n vertices) is there a path from vertex A to vertex B. How do we know this is in NP? Well, there is an NDTM that solves it, which basically works by simply trying every route by branching each time there is a junction. If one of these branches (ie one of the trial routes) reaches B, then that branch terminates in the accept state. Any branch that does not reach B within n steps (ie after traversing n edges) terminates in the reject state. Since any path will involve at most n-1 edges, any valid route will be detected, and so this machine correctly decides whether the path exists.
我们从一个简单的例子开始:路径查找。给定一个有向图(在n个顶点上),从顶点a到顶点B有一条路径。我们怎么知道这在NP中?好吧,有一个NDTM可以解决这个问题,它基本上是通过每次有路口时分支来尝试每一条路线。如果这些分支中的一个(即试验路线之一)到达B,则该分支终止于接受状态。在n个步骤内(即遍历n条边之后)没有到达B的任何分支都终止于拒绝状态。由于任何路径最多包含n-1条边,因此将检测到任何有效的路径,因此该机器正确地决定该路径是否存在。


One of the key examples of an NP problem is the satisfiability problem:
NP问题的一个关键例子是可满足性问题:

  • SAT: Given an expression in n boolean variables, is there an assignment of the variables such that the expression evaluates to True?
    SAT:给定一个在n个布尔变量中的表达式,是否存在变量赋值,使得表达式的计算结果为True?
For example, the expression (AB)(A¬B) is satisfiable, with one valid assignment being A=B=True. Note that in it's standard form, SAT is a decision problem: it suffices to decide whether such an assignment exists, we don't have to find it.
例如,表达式 (AB)(A¬B) 是可满足的,其中一个有效赋值为A=B=True。请注意,在它的标准形式中,SAT是一个决策问题:只要决定是否存在这样的任务就足够了,我们不必找到它。


 

Ok, so there are problems in NP. What is interesting about it?
好的,NP中有一些问题。它有什么有趣的地方?

Firstly, we see that P⊆NP since a DTM is an NDTM that just happens not to ever branch (in fact, our first example can actually be solved by a DTM and so is within P). So, the real question is what sort of things can we do in NP that we couldn't do in P? Well, this is the root of the P=?NP millenium problem, which is a major open problem. There are certainly problems that we have found that are known to be in NP that we do not know to be in P, but perhaps future research will show that these are also in P.
首先,我们看到P⊆NP,因为DTM是一个NDTM,它恰好从不分支(事实上,我们的第一个例子实际上可以通过DTM来解决,因此在P内)。所以,真正的问题是,在NP中我们能做什么样的事情,而在P中我们不能做?这就是P =? NP千禧年问题的根源,这是一个主要的开放问题。当然,我们已经发现了一些已知存在于NP中的问题,而我们不知道这些问题存在于P中,但也许未来的研究会表明这些问题也存在于P。
 
Lots of interesting cryptographic systems (particularly in the public key setting) are secure based on the assumption that a computational problem is "hard", which generally means "at least as hard as any problem in NP". That is, many schemes are based on problems which we think are difficult to solve, and that if you can create an algorithm that solves them you could also use this algorithm to solve lots of other problems that we currently believe to be difficult.
许多有趣的密码系统(特别是在公钥设置中)都是基于计算问题“难”的假设而安全的,这通常意味着“至少和NP中的任何问题一样难”。也就是说,许多方案都是基于我们认为难以解决的问题,如果你能创建一个解决这些问题的算法,你也可以使用这个算法来解决我们目前认为困难的许多其他问题。


The Cook-Levin theorem provides an interesting result in this direction: No problem in NP is any harder than SAT. What his means is that if I had an oracle (basically an algorithm that I can see the input/output of but none of the workings) that solved SAT, by asking it to solve cleverly constructed queries I could use it to solve any other NP problem. This made SAT the first example of an NP-complete problem. So, to show that a problem X is at least as hard as solving an NP problem (it is NP-hard), it suffices to show that if I could solve X, I could use it to solve SAT.
Cook-Levin定理在这个方向上提供了一个有趣的结果:NP中没有任何问题比SAT更难。他的意思是,如果我有一个解决SAT的预言机(基本上是一种算法,我可以看到它的输入/输出,但没有任何工作),通过让它解决巧妙构建的查询,我可以用它来解决任何其他NP问题。这使得SAT成为NP完全问题的第一个例子。因此,为了证明问题X至少和求解NP问题一样难(它是NP难的),就足以证明如果我能求解X,我就能用它来求解SAT。
posted @ 2024-04-11 12:47  3cH0_Nu1L  阅读(31)  评论(0)    收藏  举报