What is "NP-complete"? - Fortune [possible satire]

rindolfRashad: generalised Freecell was shown to be NP-complete
RashadNP-complete means?
rindolfRashad: here?
RashadYup.
RashadJust came back.
rindolfRashad: did you read about NP-completeness?
RashadNope.
RashadWhat is it?
rindolfRashad: see https://en.wikipedia.org/wiki/NP-completeness
RashadToo much math.
RashadOn wikipedia.
rindolfRashad: see http://www.shlomifish.org/humour/fortunes/show.cgi?id=memoir-from-a-Physics-lesson-in-the-9th-grade
Rashadrindolf: Sometimes formality can make things more complex than they really are.
rindolfRashad: true
Rashadrindolf: Can you give me a simple introduction?
rindolfRashad: well, do you know what polynomial time is?
RashadNo.
rindolfRashad: hmmm...
RashadI know what a polynomial is.
RashadIs this related to the BigO notation?
rindolfRashad: yes.
rindolfRashad: polynomial time is O(P(N)) where P(N) is a polynomial of N
RashadOK.
RashadI am trying to think of an example..
sbrgtwo nested loops
rindolfRashad: so it can be O(n^2) or O(n) or O(n*log(n)) or even O(n**100)
RashadAha.
RashadWhat is 'n'? Number of operations?
RashadUmm.
RashadProbably not.
rindolfRashad: the length of the input
RashadYeah that makes sense.
rindolfRashad: OK.
RashadI remember stuff about search algorithms.
Rashadn is the number of entries in an array, for example.
sbrgyep
rindolfRashad: now, some problems' *verification algorithm* is polynomial and these problems are called "NP"
RashadVerification algorithm?
rindolfRashad: verification means you verify that the solution is correct after given one.
RashadAha.
sbrgRashad: for example, if I give you a list and tell you that it's sorted, you can verify in polynomial time that it is correct
sbrgby simply checking each pair of elements
RashadA solution in freecell is a series of moves?
rindolfRashad: yes
Rashadsbrg: I see.
RashadOK so NP *complete* means?
rindolfRashad: now, some problems are NP-hard which means that each of them can be used to solve any problem in NP after a polynomial transformation.
sbrgand NP complete are problems which are both in NP and NP-hard
rindolfRashad: yes, what sbrg said,
sbrgso, NP: a problem that, when given a solution, you can verify that it is correct in polynomial time
sbrgNP-hard: a class of problems that can be converted to each other
RashadOK.
RashadOK.
RashadSo NP-hard does not imply NP?
rindolfRashad: no, not necessarily
kadobanNo, problems that are harder than NP are in NP-hard too
RashadAhhh
RashadNow that makes sense.
Rashad*at least NP hard*
rindolfRashad: for instance, the Halting Problem is NP hard.
RashadOK now everything is in place for me.
rindolfRashad: good
kadobanIt gets complicated because we don't know the actual hard relationships between many of the complexity classes, like we don't actually know if P = NP or if there are problems in NP that aren't in P. Which leads to the famous question you've likely heard of.
RashadBut I am interested by how you can map NP-hard problems from one to the other.
rindolfRashad: there's a 1 million USD prize for proving whether P is NP or not,
Rashadkadoban: It got pretty philosophical fast :P
RashadP = ?
rindolfRashad: P is the class of polynomial problems
kadobanP, the complexity class above, which is problems you can solve in polynomial time on a deterministic turing machine.
RashadI am a bit confused now..
kadobanNP, problems you can verify solutions to in polynomial time on a deterministic turing machine.
RashadOK so NP is about verification, P is about solving. Correct?
rindolfRashad: well yes, but you often want to find good solutions for NP problems
RashadWhat do you mean?
kadobanCorrect, though that's really just a definition used for picking which complexity class. In general we're still interested in getting the answer to problems in NP
RashadAh.
sbrgRashad: P is the class of problems that can be *solved* in polynomial time. NP is the class of problems *whose solution can be verified* in polynomial time.
RashadSo the concern is: Can you find a solution to NP problems faster than you can verify the given solution?
sbrgRashad: Assuming you mean "faster or as fast", well.. you just asked whether P = NP
RashadI see.
sbrgif you have an answer to that question, someone will give you a million dollars
RashadBut how is that not a philosophical question, though?
RashadLet me rephrase that.
kadobanIt depends, what's a "philosophical question"?
sbrgkadoban: that is ^
sbrglol
RashadWouldn't a solution imply a way to verify it?
kadobanBut if you're asking if it has practical consequences, it does, potentially.
sbrgRashad: Well, take sudoku as an example
RashadOK!
sbrgIf I give you a solved sudoku, how long would it take for you to verify it?
Rashadkadoban: What kind of consequences?
sbrgit's the same every time. you just make sure that 1 to 9 appears in all rows, columns and boxes
Rashadsbrg: OK
sbrghowever, does seeing the solution tell you how you solve it?
sbrgHow as in, which steps
RashadOK that's exactly what I am asking.
kadobanRashad: For example if P = NP, then quite a lot of cryptography isn't very well founded. That would mean there were "quick" (in one way of speaking) algorithms to solve hard problems that crypto relies on, such as discrete logarithm and integer factorization.
RashadHow do you get an answer that is not completely random that in the same process of figuring it out you are unable to replicate the same logic into how you verify it?
RashadAnd we're still talking about computers here so I am not sure if Newton's apple aha moment counts...
GamahRashad: sometimes it's easier to assert the validity a solution (P) than it is to explain it (NP)
Gamahor... those reversed
Gamahi forget.
sbrgRashad: well, how easy is it to verify a sudoku? it's very easy. it's the same steps every time. however, does that knowledge of the rules of the game allow you to also solve the puzzle in an equal number of moves it took you to verify it?
Rashadsbrg: The solution however is ultimately guided by the rules of verification.
Gamahsbrg: poorly formed... technically speaking it can be easier to solve some given sudoku puzzles than it is to verify they are solved
RashadUnless it is a complete shot in the dark.
sbrgGamah: and there are lists that are already sorted. that doesn't change the lower bound for sorting. what's your point?
sbrgRashad: Yes, it is. so one would think that it would be possible
sbrgand as Gamah pointed out, some sudokus are very easy to solve, while others are much harder
GamahRashad: no p
Gamah:P
sbrgthe question is whether you can give an algorithm that guarantees that you can solve every sudoku within some time limit(in terms of the size of the input) that performs no more steps than you would verifying a sudoku
Gamahsbrg: I'm saying you can't apply the act of solving and the act of verifying a "solved" sudoku to p=np because in the space of sudoku, either task could be on either side of the equation
Gamahdefine "steps"
Gamahbecause it always takes less steps to solve than verify... from some perspective
Rashadrindolf: So solitaire is O(n)?
sbrgGamah: you don't seem to understand complexity theory. we're talking about sudokus in general. I can verify *any* sudoku in some bounded polynomial time
RashadAh sorry, I meant verifying a solitaire solution is O(n)*.
Gamahyou can also solve any sudoku
sbrgthe question is whether I can somehow use the rules of verification to help me create a solution in at most as much time as it would take me to verify it. i.e. P vs NP
workmad3iirc, NP-complete problems are ones where verifying a solution is polynomial time, but calculating a solution is non-polynomial
rindolfRashad: there are many variants of card solitaire
Gamahsbrg: but the number of sudoku permutations and solutions is not unbound...
rindolfRashad: generalised Freecell is NP-complete
rindolfRashad: which assumes you have n ranks of cards instead of 13 (ace-to-king)
sbrgGamah: for a 9x9 sudoku, no, obviously not. but we are talking about sudoku in general
Gamahhmm.
sbrgRashad: at any rate, the point is that we just don't know whether we can use the information that lets us verify solutions in polynomial time to also construct solutions in polynomial time
Gamahi feel like sudoku is still a search problem (IE: rainbow table)
Gamahand not really applicable
workmad3Gamah: and how long would it take you to compute that rainbow table?
sbrgby your logic, I can solve any problem that way.
sbrgi can just create a database of all sorted lists.
Gamahsure...
sbrg.. just like i can create a database of all sudokus. if we fix n, then yes, it is bounded and you can just solve it in constant time.
kadobansbrg: Well, not really, you still have lookup time.
kadobanOh, for fixed n I guess that doesn't matter.
sbrgconstant time where a unit is defined to be the lookup time
sbrgthere you go!
Gamahworkmad3: that would depend on how well i could optimize the verification algo
sbrgit's all about context
workmad3sbrg: well, you can solve it in constant time, assuming the existence of an oracle :)
Gamahthe $1m question just says "a computer" and "in polynomial time"
Gamahit doesn't say i can't spend years precomputing the search space
Gamah:)
sbrgi don't think you understand what P vs NP means
workmad3Gamah: assuming the existence of an oracle is generally not classed as a solution to P vs NP
Gamahi thought the smiley implied i was being pedantic
workmad3Gamah: otherwise it would have been solved years ago :P
Gamahworkmad3: well i was just going to use oracle DB
Gamah:)
Channel##programming
NetworkFreenode
Published2016-11-25