Learning objectives
- Define logical equivalence and test it.
- Apply De Morgan's laws, the conditional identity and other standard laws.
- Write the converse, inverse and contrapositive of an implication.
- Prove equivalences by a chain of laws.
Roman Urdu. Do statements logically equivalent (≡) hotay hain jab un ki truth values har surat mein barabar hon. Hum De Morgan's laws aur dosray laws seekhte hain, aur dekhte hain ke implication ka contrapositive hamesha us ke barabar hota hai, jabke converse aur inverse nahi.
Core concepts
Definition. p ≡ q means p ↔ q is a tautology, i.e. p and q have identical truth values in every row.
Standard laws
| Law | Equivalence |
|---|---|
| Double negation | ¬¬p ≡ p |
| De Morgan | ¬(p ∧ q) ≡ ¬p ∨ ¬q ; ¬(p ∨ q) ≡ ¬p ∧ ¬q |
| Commutative | p ∧ q ≡ q ∧ p ; p ∨ q ≡ q ∨ p |
| Associative | (p ∧ q) ∧ r ≡ p ∧ (q ∧ r) ; same for ∨ |
| Distributive | p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) ; p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) |
| Absorption | p ∨ (p ∧ q) ≡ p ; p ∧ (p ∨ q) ≡ p |
| Conditional identity | p → q ≡ ¬p ∨ q |
| Contrapositive | p → q ≡ ¬q → ¬p |
| Biconditional | p ↔ q ≡ (p → q) ∧ (q → p) |
Related implications of p → q
| Name | Form | Equivalent to p → q? |
|---|---|---|
| Converse | q → p | No |
| Inverse | ¬p → ¬q | No |
| Contrapositive | ¬q → ¬p | Yes |
The converse and inverse are equivalent to each other but not to the original. Take p = F and q = T: p → q is T, but q → p is F.
Worked examples
Example 1 (basic). Prove ¬(p ∨ q) ≡ ¬p ∧ ¬q by a table.
| p | q | p∨q | ¬(p∨q) | ¬p | ¬q | ¬p ∧ ¬q |
|---|---|---|---|---|---|---|
| T | T | T | F | F | F | F |
| T | F | T | F | F | T | F |
| F | T | T | F | T | F | F |
| F | F | F | T | T | T | T |
Columns 4 and 7 agree in every row.
Example 2 (intermediate). Negate "The file is open and the user is logged in." By De Morgan: "The file is not open or the user is not logged in." Why: for a conjunction to fail, at least one part must fail.
Example 3 (advanced). Prove (p ∧ q) → r ≡ p → (q → r) using laws. 1. (p ∧ q) → r ≡ ¬(p ∧ q) ∨ r (conditional identity) 2. ≡ (¬p ∨ ¬q) ∨ r (De Morgan) 3. ≡ ¬p ∨ (¬q ∨ r) (associative) 4. ≡ ¬p ∨ (q → r) (conditional identity) 5. ≡ p → (q → r) (conditional identity)
The result says that a function taking two arguments is the same as one taking them one at a time (currying).
Example 4 (computing). Simplify if (!(a || b)) to if (!a && !b) by De Morgan. Both versions behave identically on every input.
Computer science connection
Simplifying conditions and circuits; compilers rewriting Boolean expressions; query optimisers rewriting WHERE clauses; the contrapositive underlies test design ("if the output is wrong, some input was invalid").
Key takeaways
- Equivalent statements have the same truth table.
- De Morgan swaps ∧ and ∨ when negating.
- p → q ≡ ¬p ∨ q ≡ ¬q → ¬p. The converse is not equivalent.
Roman Urdu. De Morgan: ¬(p ∧ q) = ¬p ∨ ¬q. Implication p → q ka contrapositive ¬q → ¬p us ke barabar hai, lekin converse (q → p) aur inverse (¬p → ¬q) barabar nahi hotay.
Five revision questions
- Write the converse, inverse and contrapositive of "If it rains, I stay home."
- Negate "x > 0 or y > 0."
- Prove p ∨ (p ∧ q) ≡ p.
- Show that p → q and q → p are not equivalent.
- Show p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q).
Homework. Prove the distributive law p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) with an 8-row table, then write two code conditions and simplify each using the laws.
Quiz
¬(p ∧ q) kis ke barabar hai? (De Morgan)
De Morgan: AND ka NOT = NOTs ka OR.
All lectures
- Lecture 0: Discrete vs Continuous
- Lecture 1: Propositions and Connectives
- Lecture 2: Truth Tables, Tautologies and Contradictions
- Lecture 3: Logical Equivalence and the Laws of Logic
- Lecture 4: Predicate Logic and Quantifiers
- Lecture 5: Rules of Inference
- Lecture 6: Logical Arguments and Puzzle Solving
- Lecture 7: Direct Proof and Proof by Implication
- Lecture 8: Proof by Contraposition
- Lecture 9: Proof by Contradiction
- Lecture 10: Mathematical Induction
- Lecture 11: Strong Induction
- Lecture 12: Applications of Proofs and Proof Strategy
START WELL TO END WELL