I understand the rule of $2^n$ rows for $n$ inputs but how do you show how many of those rows are T
Truth table $2^n$ rule rows
-
0A formula for what? The number of true rows lies between $0$ and $2^n$. – 2017-02-07
-
0AFAIK there is no closed formula for the number of true rows. Is there a specific statement you are asking about? – 2017-02-07
-
0@copper.hat so there is no way we can know a exact number just a range? – 2017-02-07
-
0@AK0101: this question is directly related to a Millennium Prize Problem. (https://en.wikipedia.org/wiki/Millennium_Prize_Problems) – 2017-02-07
-
0Are you asking if there is a map from a formula to the number of true rows? – 2017-02-07
-
0How are you provided the "rule" to make the truth table? Do you have an example in mind? – 2017-02-07
-
0But p1 and (~p1 or p2) and (~p2 or p3) and ... (~p89 or p90) is the same as p1 and p2 and p3 ... and p90. If such reductions are possible it becomes pretty easy. – 2017-02-07
-
0Not for all truth tables but some of them can be simplified. – 2017-02-07
-
0See http://math.stackexchange.com/q/279512/338756 – 2017-02-07
2 Answers
As far as we know, there is no good way in general to figure out how many of the rows will evaluate to true without writing out the table. The problem is known as #Sat and is NP-hard (since just Sat is NP-complete). While we do not have a proof that there is no good way to solve NP-hard problems like the one you are asking about, at least this tells us that no fast method is known, since it would solve one of the most famous open problems in mathematics: the P = NP problem.
If you are asking about a specific formula, or even a specific class of formulas, there might be good ways to figure it out; but in general, there is not, as far as anyone knows.
-
0No sure the OP has ever heard about complexity theory... – 2017-02-07
-
0@YvesDaoust, you're right. I've added a little more context. – 2017-02-07
-
0@MeesdeVries Yes, I am asking for a way to solve it doesnt have to be a efficient way. How about when n is smaller like 90? – 2017-02-07
-
1@AK0101, the nature of the problem is that (as far as anyone in the world knows) there is no way that is fundamentally better than writing down the entire truth table. When $n = 90$, the table will still have $2^{90} \approx 10^{27}$ rows, which is far more than feasible. There are probably some methods which work better for some of the formulas, but no (known) method works better for all formulas, and most experts think that no fast method that works for all formulas exists. – 2017-02-07
This is hard in general, but there are ways to find the solution for truth tables based on simple rules. In particular, if the rule to find the truth table is such that no variable appears more than once, we can find the number of true rows recursively.
Define $N(T)$ to be the number of rows of the truth table of $T$ which are true and $M(T)$ be the number of rows which are false.
If the rule is of the form $T = T_1 \& T_2$ where $T_1$ and $T_2$ are expressions which do not have any common variables, it is easy to see that $N(T) = N(T_1) N(T_2)$.
Similarly, if $T = T_1 | T_2$, we have $N(T) = \left[N(T_1)+M(T_1)\right]\left[N(T_2)+M(T_2)\right]-M(T_1)M(T_2)$
Hence try to see whether this kind of recursive splitting of the rule into subrules without overlap is possible. If so, you can find the final answer pretty efficiently with recursion.