Study guide: Propositional Logic
Overview
Propositional logic studies statements that are either true or false, and the ways they can be combined. “7 is prime” is a proposition; a question or a command is not. Everything else in the subject is built from a handful of connectives: not, and, or, implies, and if-and-only-if.
What makes it powerful is that questions about any formula can be settled mechanically. With n distinct variables there are exactly 2ⁿ possible assignments, so a truth table decides whether a formula is always true, never true, or sometimes true, and whether two formulas mean the same thing. The same ideas sit underneath program conditions, database filters, and digital hardware.
Key ideas explained
The connectives and when each is true
¬P flips a value. P ∧ Q is true only when both parts are true. P ∨ Q is true when at least one part is true (an inclusive or). P → Q is false in exactly one case: P true and Q false. P ↔ Q is true when both sides have the same value. XOR (P ⊕ Q) is true when exactly one side is true.
Why implication feels strange
In everyday speech “if P then Q” suggests a cause. In logic it only promises that you will never see P true while Q is false. When P is false the promise is never tested, so the implication counts as true (a vacuous truth). “If 2 > 3 then the moon is made of cheese” is a true statement for exactly this reason.
Equivalence laws you can use instead of a table
De Morgan: ¬(P ∧ Q) ≡ ¬P ∨ ¬Q and ¬(P ∨ Q) ≡ ¬P ∧ ¬Q. Implication: P → Q ≡ ¬P ∨ Q. Double negation: ¬¬P ≡ P. Absorption: P ∨ (P ∧ Q) ≡ P. Applying these step by step simplifies a formula, and each step is a justification you can write in a proof.
Converse, inverse, and contrapositive
For P → Q, the converse is Q → P, the inverse is ¬P → ¬Q, and the contrapositive is ¬Q → ¬P. Only the contrapositive is equivalent to the original statement. The converse and inverse are equivalent to each other, but not to the original.
Worked examples
Verify De Morgan's law with a truth table
Problem. Show that ¬(P ∧ Q) is equivalent to ¬P ∨ ¬Q.
- List the four rows for (P, Q): TT, TF, FT, FF.
- Compute P ∧ Q: T, F, F, F. Negate it: F, T, T, T.
- Compute ¬P: F, F, T, T and ¬Q: F, T, F, T. Then ¬P ∨ ¬Q: F, T, T, T.
Answer. Both columns read F, T, T, T, so the two formulas agree in every row and are equivalent.
Classify a three-variable formula without writing 8 rows
Problem. Is (P → Q) ∧ (Q → R) → (P → R) a tautology?
- For the whole implication to be false, the left side must be true and P → R must be false.
- P → R is false only when P is true and R is false.
- With P true, (P → Q) forces Q true. Then Q → R has Q true and R false, so it is false, which contradicts the left side being true.
Answer. No row can make the formula false, so it is a tautology. This is the rule called hypothetical syllogism.
Enter these same values in the calculator above and compare each step with the working shown here.
Common mistakes to avoid
- Reading P → Q as “P causes Q”, or believing it is false whenever P is false.
- Treating the converse as equivalent to the original statement.
- Pushing a negation through without flipping the connective:
¬(P ∧ Q)is not¬P ∧ ¬Q. - Forgetting that logical “or” is inclusive. Use XOR when exactly one must hold.
- Dropping parentheses.
¬P ∨ Qand¬(P ∨ Q)are different formulas; ¬ binds tightest, then ∧, ∨, →, ↔.
Where this shows up in computer science
- Digital hardware: every gate implements a connective, and simplifying a formula means fewer gates.
- Programming: rewriting
!(a && b)as!a || !bis De Morgan's law, and short-circuit evaluation follows the truth conditions of ∧ and ∨. - Satisfiability (SAT) solvers decide whether some assignment makes a formula true; they are used in hardware verification, planning, and package dependency resolution.
Test yourself
Try each question before opening the answer.
How many rows does the truth table of a formula with 5 distinct variables have?
2⁵ = 32.
Write the contrapositive of “If a number is divisible by 6, then it is divisible by 3.”
If a number is not divisible by 3, then it is not divisible by 6.
Is ((P ∨ Q) ∧ ¬P) → Q a tautology?
Yes. If ¬P is true then P is false, so P ∨ Q can only be true because Q is true (disjunctive syllogism).