Connectives, equivalences, normal forms, inference rules, quantifiers and the validity questions GATE asks about propositional and predicate logic.
GATE asks one or two questions from logic almost every year. They fall into four patterns: decide whether a formula is a tautology, find an equivalent formula, translate English into predicate logic, and decide which first order formulas are valid. All four reward a small set of identities used quickly and correctly.
Propositional logic
Connectives and truth tables
A proposition is a statement that is either true (T) or false (F). Formulas are built with ¬, ∧, ∨, → and ↔.
| p |
q |
p∧q |
p∨q |
p→q |
p↔q |
p⊕q |
| T |
T |
T |
T |
T |
T |
F |
| T |
F |
F |
T |
F |
F |
T |
| F |
T |
F |
T |
T |
F |
T |
| F |
F |
F |
F |
T |
T |
F |
The only row where p→q is false is p=T,q=F. Almost every tautology check uses this fact: to show A→B is a tautology, assume A true and B false and derive a contradiction.
- Tautology (valid): true in every row.
- Contradiction (unsatisfiable): false in every row.
- Satisfiable: true in at least one row.
- Contingency: satisfiable but not a tautology.
A is a tautology exactly when ¬A is unsatisfiable. A and B are logically equivalent (A≡B) exactly when A↔B is a tautology. A logically implies B exactly when A→B is a tautology.
Equivalences to know by heart
| Name |
Equivalence |
| Implication |
p→q≡¬p∨q |
| Contrapositive |
p→q≡¬q→¬p |
| De Morgan |
¬(p∧q)≡¬p∨¬q, ¬(p∨q)≡¬p∧¬q |
| Negated implication |
¬(p→q)≡p∧¬q |
| Exportation |
p→(q→r)≡(p∧q)→r |
| Distribution |
p∨(q∧r)≡(p∨q)∧(p∨r) |
| Absorption |
p∨(p∧q)≡p, p∧(p∨q)≡p |
| Biconditional |
p↔q≡(p→q)∧(q→p)≡(p∧q)∨(¬p∧¬q) |
| Case split |
(p→r)∧(q→r)≡(p∨q)→r |
|
(p→q)∧(p→r)≡p→(q∧r) |
Two non-equivalences show up as distractors: (p→q)→r is not the same as p→(q→r) (implication is not associative), and (p→r)∨(q→r)≡(p∧q)→r, not (p∨q)→r.
The converse q→p and the inverse ¬p→¬q are equivalent to each other but not to p→q.
Every formula has a CNF (AND of clauses, each an OR of literals) and a DNF (OR of terms, each an AND of literals). Read the DNF off the true rows of the truth table and the CNF off the false rows.
A set of connectives is functionally complete if it can express every Boolean function. {¬,∧}, {¬,∨}, {¬,→}, {NAND} and {NOR} are complete. {∧,∨}, {∧,∨,→,↔} and {⊕,↔} are not: the first two cannot produce F when all inputs are T, and the last can only produce affine (XOR-type) functions. Also, {→,F} is complete because ¬p≡p→F.
There are 22n distinct Boolean functions of n variables, so 22n pairwise non-equivalent formulas.
Rules of inference
An argument with premises P1,…,Pk and conclusion C is valid when (P1∧⋯∧Pk)→C is a tautology.
| Rule |
From |
Infer |
| Modus ponens |
p, p→q |
q |
| Modus tollens |
¬q, p→q |
¬p |
| Hypothetical syllogism |
p→q, q→r |
p→r |
| Disjunctive syllogism |
p∨q, ¬p |
q |
| Resolution |
p∨q, ¬p∨r |
q∨r |
| Constructive dilemma |
p→q, r→s, p∨r |
q∨s |
Two classical fallacies: affirming the consequent (q, p→q, so p) and denying the antecedent (¬p, p→q, so ¬q).
First order (predicate) logic
Quantifiers
∀xP(x) is true when P holds for every element of the domain; ∃xP(x) when it holds for at least one. On a finite domain {a1,…,an}, ∀ is a big AND and ∃ is a big OR. That view makes most validity questions mechanical.
Negation moves quantifiers across:
¬∀xP(x)≡∃x¬P(x),¬∃xP(x)≡∀x¬P(x).
Distribution laws
| Formula |
Status |
| ∀x(P∧Q)↔∀xP∧∀xQ |
valid |
| ∃x(P∨Q)↔∃xP∨∃xQ |
valid |
| ∀xP∨∀xQ→∀x(P∨Q) |
valid, converse not valid |
| ∃x(P∧Q)→∃xP∧∃xQ |
valid, converse not valid |
| ∃x∀yR(x,y)→∀y∃xR(x,y) |
valid, converse not valid |
| ∀x∀y↔∀y∀x, same for ∃∃ |
valid |
A quick memory aid: ∀ is AND-like, so it distributes over AND; ∃ is OR-like, so it distributes over OR.
When x does not occur free in Q: ∀x(P(x)→Q)≡∃xP(x)→Q and ∃x(P(x)→Q)≡∀xP(x)→Q. The quantifier flips when it moves out of the antecedent. This trips up many candidates.
Translating English
The standard patterns:
| English |
Formula |
| Every A is B |
∀x(A(x)→B(x)) |
| Some A is B |
∃x(A(x)∧B(x)) |
| No A is B |
∀x(A(x)→¬B(x)) |
| Not every A is B |
∃x(A(x)∧¬B(x)) |
| Only As are B |
∀x(B(x)→A(x)) |
Rule of thumb: ∀ pairs with →, and ∃ pairs with ∧. ∃x(A(x)→B(x)) is almost always wrong, because any x outside A makes it true.
Worked examples
Worked example 1: Tautology by contradiction
Is ((p∨q)∧(p→r)∧(q→r))→r a tautology?
- Assume it is false. Then r=F and the antecedent is true.
- p→r true with r=F forces p=F. Likewise q=F.
- Then p∨q=F, contradicting the antecedent being true.
No falsifying row exists, so it is a tautology (it is the case split rule).
Worked example 2: Counting satisfying assignments
How many assignments to a,b,c,d satisfy (a↔b)∧(c⊕d)?
The two conjuncts share no variables. a↔b is true for 2 of the 4 assignments to (a,b), and c⊕d for 2 of the 4 assignments to (c,d). Answer: 2×2=4 out of 16.
When conjuncts share no variables, multiply counts. When they share variables, split on a shared variable and count each branch.
Worked example 3: Negating a nested statement
Negate "for every ε>0 there is a δ>0 such that for all x, ∣x∣<δ→∣f(x)∣<ε".
Formula: ∀ε∃δ∀x(∣x∣<δ→∣f(x)∣<ε), with the domain restrictions on ε,δ understood.
Flip each quantifier and negate the matrix:
∃ε∀δ∃x(∣x∣<δ∧∣f(x)∣≥ε).
Worked example 4: Validity on a small domain
Is ∀x∃yR(x,y)→∃y∀xR(x,y) valid?
Try the domain {1,2} with R={(1,1),(2,2)}, which is equality. Every x has a partner (y=x), so the left side is true. No single y is related to both 1 and 2, so the right side is false. The formula is not valid. To refute validity, one small counter-model is enough. To prove validity, argue from the meaning of the quantifiers as in the distribution table.
Worked example 5: Which conclusion follows
Premises: "If it rains, the match is cancelled", "If the match is cancelled, tickets are refunded", "Tickets were not refunded". Let r,c,f be the three atoms. Premises: r→c, c→f, ¬f.
- Hypothetical syllogism: r→f.
- Modus tollens with ¬f: ¬r.
- Also ¬c by modus tollens on c→f.
Valid conclusions: ¬r, ¬c, and anything they imply, such as ¬r∨x for any x.
Common traps
- Treating p→q as false when p is false. A false antecedent makes the implication true (vacuous truth).
- Thinking → is associative. (p→q)→r and p→(q→r) differ at p=F,r=F.
- Writing ∃x(A(x)→B(x)) for "some A is B".
- Distributing ∀ over ∨ or ∃ over ∧.
- Swapping ∃x∀y and ∀y∃x. Only ∃∀→∀∃ is valid.
- Pulling a quantifier out of the antecedent of an implication without flipping it.
- In "only if" sentences: "p only if q" means p→q, not q→p.
- "p unless q" means ¬q→p, which is p∨q.
Quick revision
- p→q≡¬p∨q≡¬q→¬p. ¬(p→q)≡p∧¬q.
- Tautology check: assume the implication false, look for a contradiction.
- Exportation: p→(q→r)≡(p∧q)→r.
- (p→r)∧(q→r)≡(p∨q)→r; (p→r)∨(q→r)≡(p∧q)→r.
- 22n distinct Boolean functions of n variables.
- NAND and NOR alone are complete; {∧,∨} is not.
- ¬∀≡∃¬, ¬∃≡∀¬.
- ∀ distributes over ∧; ∃ distributes over ∨.
- ∃x∀y→∀y∃x is valid; the converse is not.
- ∀ goes with →, ∃ goes with ∧.
- One counter-model on a 2 element domain is enough to show a formula is not valid.