Theory
A promise, and a puzzle
Your friend promises: "If it rains, I will pick you up."
It does not rain. He shows up anyway.
Did he break his promise? Hold that thought. By the end of this topic you will answer it like a logician, and it is the exact question exams love to ask.
Think first
Think about it first. He promised something about rainy days only. On a dry day, is there anything he can do that breaks the promise?
Show the answer
No. The promise only says what happens if it rains. On a dry day the promise cannot be broken, whatever he does. Logicians therefore count it as kept. Remember this feeling, it becomes one exact row of a table in a minute.
Theory
What a truth table is
A truth table is a list of every possible situation for a logical statement, one row per situation, with the statement's value (T or F) in each.
With 1 proposition there are 2 rows. With 2 propositions, 4 rows. With n propositions, 2ⁿ rows. That is the whole idea: check every case, and no case can surprise you.
Theory
AND: the strict one
P ∧ Q ("P and Q") is true only when both are true.
P Q P ∧ Q
T T T
T F F
F T F
F F F
Think of a job ad: "must know C and SQL". Miss either one, and you do not qualify.
Quiz
Out of the 4 rows for two propositions, in how many is P ∧ Q true?
- Exactly one row
- Two rows
- Three rows
- All four rows
Show the answer
Exactly one row
AND is strict: only the T, T row survives. A quick way to remember the tables: AND has one T row, OR has one F row.
Theory
OR: the generous one
P ∨ Q ("P or Q") is true when at least one is true. In logic, "or" includes the case where both are true.
P Q P ∨ Q
T T T
T F T
F T T
F F F
A college notice saying "bring your ID card or your fee receipt" is satisfied if you bring either, and certainly if you bring both.
Theory
Implication: back to the promise
P → Q means "if P then Q". It is the promise from the start: P is "it rains", Q is "I pick you up".
P Q P → Q
T T T
T F F
F T T
F F T
Only one row breaks the promise: it rained, and he did not come. Both F rows are true, exactly like the dry day where nothing he does can break it.
Quiz
P → Q is false in exactly one situation. Which one?
- P is true and Q is false
- P is false and Q is true
- Both are false
- Both are true
Show the answer
P is true and Q is false
An implication fails only when the condition happened but the promised result did not: T → F. Every other row, including the strange looking F rows, is true.
Watch out
The classic exam trap
Most students mark F → T as false because it "feels wrong". It is true. A promise about rain cannot be broken on a sunny day. Second trap: with 3 variables you need 8 rows. List them systematically (TTT, TTF, TFT, ...) so you never miss one.
Theory
Where you will meet this again
Every if condition you will ever write in C or Java is one row of a truth table being checked. Digital circuits in later semesters are truth tables built from wires. And the Boolean Algebra unit next is truth tables wearing algebra clothes: same rows, new notation.
Summary
Key takeaways
- A truth table lists all 2ⁿ possible T/F combinations for n propositions, one row each.
- AND is stingy: true in exactly one row (both true).
- OR is generous: false in exactly one row (both false).
- P → Q is false only for T → F, the broken promise row.
- Memory hook: one T row for AND, one F row for OR, one broken promise for IF.