News for hackers. Stuff that matters.
Re:NP-Complete isn't (always) Hard by Animats on Tuesday February 21, 2023 @01:00PM (#34884399)
Right. Both the traveling salesman problem and linear programming are problems that are worst-case NP-hard, but far easier for almost all cases.

The halting problem is an extreme case of this. While there are programs for which halting is either undecidable (with infinite memory) or NP-hard, for most useful programs, it's decidable.

The Microsoft Static Driver Verifier is a proof of correctness system used by Microsoft to eliminate crash-type bugs from Windows drivers. It's the main reason that kernel drivers don't crash Windows any more. It decides the halting problem for drivers. If it can't reach a decision in some fixed length of time, the driver is rejected. If it's that difficult to decide if a kernel driver finishes, you're doing it wrong.

Re:NP-Complete isn't (always) Hard by aleph_minus_one on Tuesday February 21, 2023 @01:14PM (#34884600)
> linear programming are problems that are worst-case NP-hard

Linear Programming (with rational coefficients; to avoid sophism) can be solved in polynomial time.

Re:NP-Complete isn't (always) Hard by dragontamer on Tuesday February 21, 2023 @01:16PM (#34884635)
Hmm, the above poster probably meant "linear programming with integers" being NP-hard (because it is).

When its "smooth", its actually solvable in polynomial time.

Re:NP-Complete isn't (always) Hard by Animats on Tuesday February 21, 2023 @04:18PM (#34887518)
Right, see [1]. Same concept, though - worst case far harder than the average case, and the worse case is rare.

[1] https://en.wikipedia.org/wiki/Simplex_algorithm#Efficiency_i...

Re:NP-Complete isn't (always) Hard by OkayPhysicist on Tuesday February 21, 2023 @02:33PM (#34885821)
A problem I've thought about lately has been making a programming language that optimizes for being expressive up to, but not including, being Turing complete (specifically, making non-terminating programs unexpressible).
Re:NP-Complete isn't (always) Hard by Kranar on Tuesday February 21, 2023 @02:46PM (#34886018)
Yeah you can definitely make a language that is not Turing complete but your goal of "up-to" is not possible.

For any complexity class C that is not Turing complete, there is a complexity class C' that is a strict super-set of C and is also not Turing complete.

Re:NP-Complete isn't (always) Hard by convolvatron on Tuesday February 21, 2023 @04:19PM (#34887524)
sorry, really genuinely interested in the structure here, reference?
Re:NP-Complete isn't (always) Hard by Kranar on Tuesday February 21, 2023 @04:34PM (#34887764)
Sure, the insight/intuition comes from diagonalization, or perhaps more directly from Cantor's theorem.

For any complexity class O(F(N)), there must exist a complexity class O(2^F(N)) that is strictly a superset of O(F(N)). If F(N) is decidable then so too is 2^F(N).

https://en.wikipedia.org/wiki/Cantor%27s_theorem

Re:NP-Complete isn't (always) Hard by chaosite on Tuesday February 21, 2023 @03:42PM (#34886872)
The go-to example for something like that is Datalog.
Re:NP-Complete isn't (always) Hard by lapinot on Tuesday February 21, 2023 @04:57PM (#34888103)
Basically you disallow general recursion (while loops, etc) and just allow structural/well-founded/inductive recursion (for loops, finite structure walking, etc).

https://en.wikipedia.org/wiki/Total_functional_programming

Type-theory based proof assistants (coq, agda, lean, idris, ..) are like this.

Re:NP-Complete isn't (always) Hard by nyrikki on Wednesday February 22, 2023 @04:50PM (#34903411)
The problem being that if you can reduce a problem to being well ordered on the naturals it is already in the computable set.

Note how the limits on recursion as given by the original paper apply to the fibonacci sequence, but restricted to the Natural numbers to avoid the -2 -1 1 0 1,1 2 portion that would break total ordering.

Any problem that you can map to von Neumann ordinals will be computable. Same thing with the Cantor diagonalization example below.

Basically if you can reduce your problem to a monoid, you can typically compute it easily.

But as a group has to be a magma with inverse, the recursive example provided couldn't be used in a case that function needed to be applied to algebras, rings, fields etc....

Note that as Cantor diagonalization was used as a counterexample to Laplacian causal determinism, showing that no two computational device can completely predict each other when defined by external behavior, there are further constraints.

For me, an easier lens to see if there is a P solution to a typically NP problem is looking at Schaefer's dichotomy theorem. Total Functional Programing is exactly equivalent to #3,

1) all relations which are not constantly false are true when all its arguments are true; 2) all relations which are not constantly false are true when all its arguments are false; 3) all relations are equivalent to a conjunction of binary clauses; 4) all relations are equivalent to a conjunction of Horn clauses; 5) all relations are equivalent to a conjunction of dual-Horn clauses; 6) all relations are equivalent to a conjunction of affine formulae.

The mapping to the Natural numbers is a leaky abstraction, as the Natural numbers are a non-empty totally ordered set with no upper bound.

Any function that takes finitely many natural numbers as arguments and produce a value which is a single natural number are by definition computable. That restricted problem will always be computable no matter if the more generalized problem is in NP or not.

https://ncatlab.org/ufias2012/files/turner.pdf

Re:NP-Complete isn't (always) Hard by Animats on Tuesday February 21, 2023 @05:40PM (#34888725)
Decision tables [1] have that property. They have a finite number of states and you can test all of them.

If "smart contracts" in crypto land were written as decision tables, it might have helped a bit.

[1] https://en.wikipedia.org/wiki/Decision_table

Re:NP-Complete isn't (always) Hard by deterministic on Wednesday February 22, 2023 @08:55PM (#34905766)
This already exists: Coq, Idris, Agda, LEAN etc.
Re:NP-Complete isn't (always) Hard by Ar-Curunir on Tuesday February 21, 2023 @02:53PM (#34886110)
linear programming is not NP-hard. Integer linear programming is, but that's a different problem