# What is the efficiency of the algorithm which solves this word problem?

Word Problem:

Imagine there is a party with an infinite number of mathematicians at it, and I walk up to my friend with the following instructions:

"every 1 minute, find 1 person at the party who has not been told this message yet, and repeat this message to them"

It's clear that after $$N$$ minutes, provided these instructions are followed exactly, there will be $$2^N$$ people who have heard this message.

I will now describe an algorithm which can solve the boolean satisfiability in N variables in N minutes.

1 - find 2 people at the party, hand one of them a paper that says "True" and another a paper which says "False" and has a boolean expression on it

2 - tell them these instructions "in 1 minute, find 2 people at the party who have not been told this message yet, and repeat this message to them, give 1 of these people your paper but add True to the list, find a new piece of paper and copy over the list + expression from the paper I gave you, but add False to the list"

3 - after N minutes, whoever has a piece of paper in their hands has to compute the solution of the boolean expression (we are assuming since all the people at the party are mathematicians, they can all check this in less than 30 seconds) and if its solvable they have to shout out "ITS SOLVABLE EVERYONE"

Then given any boolean expression involving N variables, I can use this algorithm to solve the boolean satisfiability problem in N minutes and 30 seconds, giving an algorithmic efficiency of $$O(N)$$

QUESTION: Would it be wrong to claim the efficiency of this algorithm is in fact $$O(N)$$ and not $$O(2^N)$$?

(Note: I am experimenting with new ways to do exposition of algorithms for a pure math audience, this is my new word problem idea. Is this silly mathematicians at a party thing a good start for me to improve my exposition of algorithms and how they relate to pure mathematics and the theory of computation?)

• For those interested in the bounty - the so-called "new axiom" I want to add to generalize the theory of computation is to give Turing Machines a new axiomatic feature where they are allowed to self-replicate, and in this analogy the self-replication feature corresponds to "getting a new piece of paper" as described in the word problem of this question. Feel free to ask for clarification or links if this is unclear. Apr 7 '20 at 18:14

The proposed algorithm takes $$O(N)$$ time but $$O(2^N)$$ space. It essentially shows that SAT is in NP, but does not constitute a solution in P.

• I am not claiming to have solved the P vs NP problem, my main motivation is to find out if an algorithm of this type might be useful for that type of purpose. Do you think it will be impossible to make progress with this kind of approach since it essentially just demonstrates SAT is in NP, like you say? Apr 1 '20 at 18:57
• @MattCalhoun The heuristics SAT solvers use can be modelled in your protocol. The intermediates don't pass slips on if they can be immediately verified to be UNSAT regardless of remaining variables assignments. But they still branch. Apr 1 '20 at 19:00
• This sounds like a very helpful comment, thank you so much Parcly. I need to find out how many books I need to read to figure out what this says, and how long each one will take to grok, but I don't mind. I really admire the conciseness of your sentence structures. Is this a very well known algorithm which SAT solvers use all the time, or is this some kind of novel way I discovered of using a computer to write js programs that solve NP-Complete problems in P time, which I find quite useful in my research and was hoping might be new. Apr 1 '20 at 20:17
• @MattCalhoun You might want to read up on the Davis-Putnam and DPLL algorithms. They essentially implement what I said, but in a more systematic fashion. I'm taking CS3234 Logic for Proofs and Programs this semester, and one of the lectures covered these two algorithms. Apr 1 '20 at 20:26

Your algorithm consists of two phases. At the preprocessing phase it assigns to each of $$2^N$$ mathematicians a variable instance. This is done in linear time. Or even faster, if at each step each of already assigned mathematicians assigns the data to more and more mathematicians. But this phase is not so essential. It can be even skipped provided each mathematician has a predefined name equal to a given variable instance. For example, for $$N=2$$ we can have $$4$$ mathematicians named $$00$$, $$01$$, $$10$$, and $$11$$. At the processing phase each of the mathematician calculate the value of the expression for the given instance. This is done quickly, I guess, in polynomial time.

The proposed pattern is typical for solving NP-hard problems. I recall that NP means non-deterministic polynomial time and one of interpretation of an NP-hard problem is: given a feasible input instance, we can verify in polynomial time whether it solves the problem. In other words, a lucky non-deterministic machine can solve the problem in polynomial time.

But it is said that a problem has polynomial complexity provided a machine can solve in polynomial time. If a problem is in NP and has polynomially many feasible input instances then we can check them one-by-one and solve the problem in polynomial time. But if there are exponentially many feasible input instances then this approach clearly fails to solve a problem in polynomial time. Unfortunately, we cannot resolve this issue by data sharing, because in the proposed framework we have only one solving machine. It has a prescribed set of operations with data and machine states. But the machine is fixed and these operations do not include machine replications (and this restriction differs the classes NP and P, leading to the famous open problem). Even when an algorithm emulates machine cloning, there still is only one basic machine, so the emulated machines work not simultaneously, but consecutively.

• Thank you! This all makes sense to me. I came to my results from theoretical physics energy analysis of the work done by cells in the human body as a result of cell self-replication in the human nervous system, where this concept of "extra work" and "in the proposed framework we have only one solving machine" I invented a new theory of computation which is deterministic and you can find my analysis here: mathoverflow.net/questions/355921/… Apr 11 '20 at 12:06
• I will accept this answer before the bounty expires, because I really appreciate you taking the time to help me work through these ideas, and your answer is helpful. If you don't mind, I am still confused why adding a new axiom to the theory of computation is a bad idea. I specialize in the relationship of algorithms to classical parts of pure math, and I really need this axiom for my latest projects. This is why I put a 500 pt bounty on this question, it directly impacts my ability to make progress on my current research which I am working hard on. Apr 11 '20 at 12:08
• Please consider the following hypothetical "computer virus": first of all, this fake program "infects" computers over the internet for the purpose of solving the SAT problem. It will spread, by assumption, at an exponential rate in time, and each computer it infects will be an independent "machine" in the sense of your answer. Then at time t=0 we use a C&C server to send out instructions according to the algorithm in my question. QUESTION: What is the computational efficiency of this fake computer virus thought experiment? Is it not O(N)? (observe its no coincidence "virus" is a bio term) Apr 11 '20 at 16:56
• (I now think the efficiency of the algorithm I just described is $O(NlogN)$ and not $O(N)$. I guess a log savings will result from the exponential increase in computer power over time; I guess a $logN$ term will come from the random nature of checking the solution and "getting lucky sometimes" just like how this $logN$ term appears in the quick sort algorithmic efficiency. Note John Von Neumann invented quick sort and the theory of self reproducing machines. In the later theory, you clearly need a new axiom like this imo, which generalizes the previous theory of computation) Apr 11 '20 at 17:44

This answer is based on a discussion I had offsite but which clarified what I believe is the mistake in my previous thinking process

In Computer Science, Big O notation is used to classify algorithms according to how the running time or space requirements grow as the input size grows. It does not refer to the number of high-level execution frames, which appears to be what I was measuring

Consider that in Python:

   a = []
for i in range(500_000):
a.append(i)
a.reverse()


   a = []

takes about a minute, to produce the same result. That's a factor of 600, even though the first one actually executes more Python code. This is because the first uses an amortized $$O(N)$$ method, while the second uses an $$O(N^2)$$ method.
It's not necessary to even run my javascript implementation of this algorithm because even though "every possible set of values for the boolean variables will be in memory", which requires $$O(2^N)$$ values for the worst case, the algorithm done under the hood by the CPU will take $$O(2^N)$$ to touch each memory cell.