What a truth table is
A truth table lists every combination of values of the variables of a logical formula and the value of the formula for each. For n variables there are 2n rows: two variables give 4 rows, three give 8, four give 16. Values are written as 0 (false) and 1 (true), and the combinations are listed as binary numbers in ascending order: 000, 001, 010 and so on.
Logical operations
| Operation | Notation | Equals 1 when |
|---|---|---|
| Negation (NOT) | ¬A | A = 0 |
| Conjunction (AND) | A ∧ B | both are 1 |
| Disjunction (OR) | A ∨ B | at least one is 1 |
| Implication | A → B | always, except A = 1 and B = 0 |
| Equivalence | A ≡ B | the values are equal |
| Exclusive OR | A ⊕ B | the values differ |
To remember implication: truth never implies falsehood, so 1 → 0 = 0 and every other case gives 1. Useful identities: A → B = ¬A ∨ B, A ≡ B = (A → B) ∧ (B → A), A ⊕ B = ¬(A ≡ B).
Operator priority
Negation goes first, then AND, XOR, OR, implication and finally equivalence. Equal operations run left to right, but implication runs right to left: A → B → C means A → (B → C). When in doubt, add brackets: the calculator shows the formula in a normal form with the minimum of brackets.
Building a table by hand
- List the variables and count the rows: 2n.
- Split the formula into steps by priority and make a column for each.
- Fill the variable columns by binary counting: the last variable alternates 0 and 1, the previous one goes 00 11, and so on.
- Compute the columns from left to right using the ready ones.
- The last column is the value of the formula.
Canonical DNF and CNF
Any formula can be written in a standard form read off its truth table. For the DNF take the rows with F = 1: from each build the AND of all variables (negating those equal to 0) and join them with OR. For the CNF take the rows with F = 0: from each build the OR of all variables (negating those equal to 1) and join them with AND. These forms are unique for a given function, so they can be used to check whether two formulas are equivalent.
EGE informatics task 2
The task gives a formula and a table fragment in which it is unknown which column belongs to which variable. It is solved by trying rows: for example, if a row with F = 0 is given for an implication A → B, then A = 1 and B = 0, which pins down the column with a one and the column with a zero. Look at the most restrictive rows, where the function takes its rare value (1 for AND, 0 for OR and implication). The helper above tries all column orders and shows the fitting ones. It works when the number of columns equals the number of variables.
Common mistakes
- Mixing up A → B and B → A: they are not equivalent.
- Evaluating A → B → C left to right although implication goes right to left.
- Forgetting that without brackets AND binds tighter than OR: A ∨ B ∧ C is A ∨ (B ∧ C).
- Writing = instead of equivalence: formulas use ≡ or ↔.
- Changing the variable order midway and losing track of the row numbers.