Notes / Unit 4 · Module 3 · Pre-final
Formal Logic
Formal logic is the science of reasoning about statements that are either true or false. The exam asks you to build truth tables, classify formulas, turn conditionals around correctly, prove two formulas equivalent, and decide whether an argument is valid.
4.1Propositions
A proposition is a declarative sentence that is either true or false, but not both. Whether it is actually true doesn't matter: 12 + 9 = 3 − 2 is a proposition, a false one.
| Sentence | Proposition? | Why |
|---|---|---|
| Man is mortal. | Yes (T) | Declares a fact |
| Cebu City is the capital of the Philippines. | Yes (F) | Declarative, just false |
|{ }| = 0 | Yes (T) | The empty set has no elements |
| What time is it? | No | A question |
| Read this carefully. | No | A command |
x + 1 = 2 | No | An open sentence: true or false depends on x |
- Propositional variable
- A letter standing for a proposition: p, q, r (or A, B, C).
- Simple (primitive) statement
- A single propositional variable, with no connective.
- Compound statement
- Variables joined or modified by connectives, e.g.
p ∧ ¬q. - Truth value
- T (true, 1) or F (false, 0).
4.2The connectives
Five connectives build compound statements, plus negation, which flips one statement: ¬p is “it is not the case that p”.
| p | q | p ∧ q | p ∨ q | p ⊕ q | p → q | p ↔ q |
|---|---|---|---|---|---|---|
| T | T | T | T | F | T | T |
| T | F | F | T | T | F | F |
| F | T | F | T | T | T | F |
| F | F | F | F | F | T | T |
- Conjunction p ∧ q
- “p and q”: true only when both are true.
- Disjunction p ∨ q
- “p or q” (inclusive): false only when both are false.
- Exclusive or p ⊕ q
- True when exactly one of p and q is true.
- Conditional p → q
- “If p, then q”: false only when p is T and q is F.
- Biconditional p ↔ q
- “p if and only if q”: true when p and q have the same value.
Precedence, from tightest: ¬, ∧, ∨, →, ↔. So ¬p ∧ q is (¬p) ∧ q, and p ∧ q → r is (p ∧ q) → r. Brackets override it; when in doubt, write them.
In C the same ideas are &&, || and !, with 1 for true and 0 for false: if c = 5 and d = 2, (c == 5) || (d > 5) is 1.
4.3Truth tables
A truth table lists the value of a compound proposition for every combination of values of its variables. With n variables there are 2ⁿ rows: 4 for two, 8 for three. List them in the standard order, the first variable changing slowest: TT, TF, FT, FF.
Worked example
Truth table of (p ∨ ¬q) → (p ∧ q)
- 1Columns: p, q, ¬q, p ∨ ¬q, p ∧ q, then the whole conditional.
- 2Row TT: p ∨ ¬q = T, p ∧ q = T, so T → T = T.
- 3Row TF: p ∨ ¬q = T, p ∧ q = F, so T → F = F.
- 4Row FT: p ∨ ¬q = F, p ∧ q = F, so F → F = T.
- 5Row FF: p ∨ ¬q = T, p ∧ q = F, so T → F = F.
- 6Final column, top to bottom: T F T F.
- Tautology
- True in every row, e.g.
p ∨ ¬p,[(A → B) ∧ A] → B. - Contradiction
- False in every row, e.g.
p ∧ ¬p,(A ∨ B) ∧ (¬A ∧ ¬B). - Contingency
- Neither: true in some rows and false in others, e.g.
(A ∨ B) ∧ ¬A.
4.4Conditional statements
In p → q, p is the hypothesis (antecedent, premise) and q is the conclusion (consequence). The statement only promises something when p is true, so it is broken only by p true and q false. When p is false, p → q is true whatever q is.
Worked example
“If you try hard for your exam, then you will succeed.”
- 1Tried hard, succeeded: the promise was kept, so it is T.
- 2Tried hard, did not succeed: the promise was broken, so it is F.
- 3Did not try hard, succeeded: no promise was made, so it is T.
- 4Did not try hard, did not succeed: no promise was made, so it is T.
Turning a conditional around gives three relatives:
| Name | Form | “If it rains today, then I stay at home” | ≡ original? |
|---|---|---|---|
| Conditional | p → q | If it rains today, then I stay at home. | — |
| Converse | q → p | If I stay at home, then it rains today. | No |
| Inverse | ¬p → ¬q | If it does not rain today, then I do not stay at home. | No |
| Contrapositive | ¬q → ¬p | If I do not stay at home, then it does not rain today. | Yes |
A conditional and its contrapositive are equivalent. So are the converse and the inverse, since each is the other's contrapositive. Neither the converse nor the inverse is equivalent to the original.
| English | Symbols |
|---|---|
| if p, then q · p implies q · q whenever p · q if p | p → q |
| p only if q | p → q |
| p is sufficient for q · q is necessary for p | p → q |
| p unless q | ¬q → p (≡ p ∨ q) |
| p if and only if q | p ↔ q ≡ (p → q) ∧ (q → p) |
4.5Logical equivalence
Two compound propositions A and B are logically equivalent, written A ≡ B, when their truth tables have the same final column. Put another way, A ≡ B exactly when A ↔ B is a tautology. To show two formulas are not equivalent, one row where they differ is enough.
| Law | Equivalence |
|---|---|
| De Morgan's | ¬(p ∧ q) ≡ ¬p ∨ ¬q · ¬(p ∨ q) ≡ ¬p ∧ ¬q |
| Implication | p → q ≡ ¬p ∨ q |
| Contrapositive | p → q ≡ ¬q → ¬p |
| Biconditional | p ↔ q ≡ (p → q) ∧ (q → p) |
| Exclusive or | p ⊕ q ≡ ¬(p ↔ q) |
| Distributive | p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) · p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) |
| Absorption | p ∨ (p ∧ q) ≡ p · p ∧ (p ∨ q) ≡ p |
| Commutative, associative | p ∧ q ≡ q ∧ p · (p ∨ q) ∨ r ≡ p ∨ (q ∨ r) |
| Double negation | ¬(¬p) ≡ p |
Worked example
Show p → q ≡ ¬p ∨ q
- 1p → q, rows TT, TF, FT, FF: T F T T.
- 2¬p ∨ q, same rows: (F ∨ T) T, (F ∨ F) F, (T ∨ T) T, (T ∨ F) T, giving T F T T.
- 3The columns match, so (p → q) ↔ (¬p ∨ q) is T in every row: a tautology, and p → q ≡ ¬p ∨ q.
De Morgan's laws say the same thing for sets (complement of a union or an intersection) and for logic gates. “It is not true that Alice is smart and honest” means “Alice is not smart or not honest.”
4.6Valid and invalid arguments
An argument is a list of premises followed by a conclusion, written with ∴. It is valid when the conclusion is true in every row of the truth table where all the premises are true. Equivalently, (P₁ ∧ P₂ ∧ … ) → C is a tautology. Validity is about the argument's form, not about whether the premises are actually true.
- Make a truth table with a column for each premise and one for the conclusion.
- Mark the critical rows, where every premise is T.
- If the conclusion is T in every critical row, the argument is valid. A critical row with a false conclusion is a counterexample, and the argument is invalid.
| Rule of inference | Form | Example |
|---|---|---|
| Modus ponens | p → q, p ∴ q | If it rains, I stay home. It rains. ∴ I stay home. |
| Modus tollens | p → q, ¬q ∴ ¬p | If it rains, I stay home. I'm not home. ∴ It isn't raining. |
| Hypothetical syllogism | p → q, q → r ∴ p → r | Chains two conditionals. |
| Disjunctive syllogism | p ∨ q, ¬p ∴ q | It's p or q. Not p. ∴ q. |
| Addition | p ∴ p ∨ q | It is sunny. ∴ It is sunny or cold. |
| Simplification | p ∧ q ∴ p | It is sunny and cold. ∴ It is sunny. |
| Conjunction | p, q ∴ p ∧ q | Puts two premises together. |
| Resolution | p ∨ q, ¬p ∨ r ∴ q ∨ r | p cancels against ¬p. |
| Fallacy (invalid) | Form | Counterexample row |
|---|---|---|
| Affirming the consequent | p → q, q ∴ p | p = F, q = T |
| Denying the antecedent | p → q, ¬p ∴ ¬q | p = F, q = T |
Worked example
Is p → q, q ∴ p valid?
- 1Rows where p → q and q are both T: TT and FT.
- 2In row FT the conclusion p is F.
- 3That critical row is a counterexample, so the argument is invalid (affirming the consequent).
Check yourself
Answer these out loud, without scrolling up. Any you can't, reread that section — then let the drill mark you.
- 1.Why is “x + 1 = 2” not a proposition, while “12 + 9 = 3 − 2” is?
- 2.In which single row is p → q false, and what is its value when p is false?
- 3.Write the converse, inverse and contrapositive of “If n is divisible by 4, then n is even”. Which one is equivalent to the original?
- 4.Use a truth table to show ¬(p ∨ q) ≡ ¬p ∧ ¬q. What does it mean for ¬(p ∨ q) ↔ (¬p ∧ ¬q)?
- 5.Is (A ∨ B) ∧ ¬A a tautology, a contradiction or a contingency?
- 6.Name the form of p → q, ¬p ∴ ¬q and give the row that shows it is invalid.