Truth Table Method: Online VAL Prover For Propositional Logic
Enter a formula to get its truth table. Use keyboard keys ~ & | -> <-> ( ) pqrstuvwxyz.
The Truth table method is an algorithm that aims to explore all possible combinations of values for
individual atoms of given formula. It lists true (⊤) and false (⊥) values for
every combination's atoms and also the result value of given formula if we use the selected atom values.
The given formula is then called a tautology only if every combination of inputs
yielded true as a result. That is to say, if there are only true values in the right
side of the obtained table, the given formula is considered true.
In essence, the algorithm draws a table, laying out very possible scenario, so you can see
how the truth value of a complex expression given derives from the truth values of its parts.
This is the most simple way to prove that a formula is true (valid), no matter what values its atoms have.
Here are some sample formulas to try. They all evaluate to true:
,
,
,
,
.
Implemented Algorithm Description: How It Works?
This page uses the following procedure to create the truth table.
Identify atomic propositions. All basic propositions (p, q, r, etc.) that are parts of the provided compound proposition,
are listed in the head of table.
List possible combinations of atom values. Since each atomic proposition can be either true of false,
you create a table where each row represents one possible assignment of truth values.
There are 2n assignments in total, where n is the number of distinct atoms in formula. For example,
if you have 3 atoms: p, q, r, then the table will have 23 = 8 rows.
Convert formula to its prefix form. Prefix form is easier for machine to deal with.
Like humans "see" the parts of the formula in regular, infix form — machine can
calculate values of prefix form of the formula faster and with less effort.
For each row — a combination of atom values, calculate the given formula value.
This is done by replacing atom values in the given formula with true or false
and then simplifying the expression of the formula.
Analyze the given formula. The last column that contains true (⊤) or false (⊥)
for every indivudual assignment of atoms, provides an insight of the properties of the given formula.
There are 3 possibilities:
The given formula is true (⊤, tautology) if and only if all the rows have formula value true.
The given formula is false (⊥, contradiction) if and only if all the rows have formula value false.
The given formula is true in some cases but false in others (contingency).
Uses
Truth tables can be used for the following applications.
In computer programming, if you are about to detect a bug in a code. The code often contains
if conditions that are difficult to understand by heart. To prove the condition that
contains logical connectives (like and, or, not), does what it
is supposed to, or contains a defect, you may draw truth table of the condition. Then
you can analyze every line of truth table separately and mark if the behavior is expected.
Identify logical equivalences. If you are about to prove or disprove that two formulas
are logical equivalences, a simple way to do it is to construct truth tables for both.
If the truth tables match, this means the formulas are equivalent. If the tables don't match,
the formulas are not equivalent. As a corner case, all tautologies are equivalent between themselves.
Prove errors in conclusions. If you see a strange logical statement that causes concerns about
its truth, drawing truth table could be a good way to go. If the statement in question is false,
truth table will detect it.