# Propositional Logic, Equivalences, Implication Laws & Valid Inference
Exam: GATE Computer Science & Information Technology (GATE CS)
Subject: Engineering Mathematics & Discrete Math
Canonical URL: https://gateandnet.com/exams/gate-cs/engineering-mathematics/propositional-logic-and-inference

> Truth tables, contrapositive vs converse, functional completeness, quantifier negations, and Modus Ponens/Tollens.

## Implication ($p \to q$) & Its Variants

Given conditional statement $p \to q$ (*"if $p$, then $q$"*):
- **Contrapositive:** $\neg q \to \neg p$ — **Always logically equivalent** to $p \to q$!
- **Converse:** $q \to p$ — Equivalent to **Inverse** ($\neg p \to \neg q$), *not* equivalent to $p \to q$.
- **Negation of Implication:** $\neg(p \to q) \equiv p \land \neg q$ *(Notice there is NO implication arrow in the negation!)*.

| Expression | Equivalent English Phrasing | Symbolic Form |
| :--- | :--- | :--- |
| $p$ is **sufficient** for $q$ | If $p$ happens, $q$ is guaranteed | $p \to q$ |
| $p$ is **necessary** for $q$ | $q$ cannot happen without $p$ | $q \to p \equiv \neg p \to \neg q$ |
| $p$ **only if** $q$ | $p$ implies $q$ | $p \to q$ |
| $p$ **unless** $q$ | If not $q$, then $p$ | $\neg q \to p \equiv p \lor q$ |

> [!TRAP]
> **"p only if q" vs "p if q":**
> - "$p$ **if** $q$" means $q \to p$.
> - "$p$ **only if** $q$" means $p \to q$! Mixing these two up is the #1 logic trap in GATE & UGC NET.

## Counting Boolean Functions of $n$ Variables

For $n$ boolean variables, the truth table has $2^n$ rows:
- Total distinct Boolean functions $= 2^{2^n}$
- Self-dual functions $= 2^{2^{n-1}}$ *(cannot contain constants $0$ or $1$ alone)*


## Solved Practice Questions & PYQs

### [GATE CS Discrete Math | MCQ]
Which of the following propositional formulas is logically equivalent to the implication $p \to q$?
**Correct Answer:** C
**Solution:** An implication $p \to q \equiv \neg p \lor q$ is **always logically equivalent to its Contrapositive** $\neg q \to \neg p \equiv q \lor \neg p$.
