Skip to content
GATEiit

GATE CSE · Engineering Mathematics

Propositional and first-order logic

Propositions, connectives, truth tables, tautologies, logical equivalence and rules of inference, then predicates, quantifiers, negation and nesting of quantifiers, and translating English sentences into first-order logic.

Before you start

  • Boolean algebra →

    Connectives behave like AND, OR and NOT; most equivalences are Boolean identities.

  • Sets →

    A predicate is true on a subset of the domain; quantifiers ask whether that subset is everything or non-empty.

This topic comes before: Boolean algebra and minimization: algebraic technique, Karnaugh map and tabular method, Relational model: relational algebra, tuple calculus and SQL, Sets, relations, functions, partial orders and lattices, Logic: propositional and predicate

Concept notes

1. Propositions and connectives

A proposition is a statement that is either true (T) or false (F). Compound propositions are built with connectives:

p q ¬p p∧q p∨q p→q p↔q p⊕q
T T F T T T T F
T F F F T F F T
F T T F T T F T
F F T F F T T F

The implication p→q is false only when p is true and q is false. So a false premise makes it vacuously true. Read it as "if p then q", "p only if q", "q is necessary for p", "p is sufficient for q".

For p→q:

  • Converse q→p and inverse ¬p→¬q are equivalent to each other, but not to p→q.
  • Contrapositive ¬q→¬p is equivalent to p→q.

Precedence (highest first): ¬, ∧, ∨, →, ↔. Implication is right-associative: p→q→r means p→(q→r).

A formula with n variables has 2n truth-table rows, so there are 22n different Boolean functions of n variables.

2. Tautology, satisfiability and equivalence

  • A tautology (valid formula) is true in every row. A contradiction is false in every row.
  • A formula is satisfiable if at least one row makes it true. F is valid exactly when ¬F is unsatisfiable.
  • F≡G (logically equivalent) when F↔G is a tautology.

Equivalences you must know:

Name Equivalence
Implication p→q≡¬p∨q
De Morgan ¬(p∧q)≡¬p∨¬q, ¬(p∨q)≡¬p∧¬q
Absorption p∨(p∧q)≡p, p∧(p∨q)≡p
Distribution p∨(q∧r)≡(p∨q)∧(p∨r)
Exportation (p∧q)→r≡p→(q→r)
Cases (p→r)∧(q→r)≡(p∨q)→r
Biconditional p↔q≡(p→q)∧(q→p)

Quick tautology test: assume the formula is false and try to build a row. For an implication A→B that means A true and B false. If you reach a contradiction, it is a tautology.

A set of connectives is functionally complete if it can express every Boolean function: {¬,∧}, {¬,∨}, {¬,→}, {NAND}, {NOR} are complete; {∧,∨} and {∧,∨,→} are not (they cannot produce F when every input is T).

3. Rules of inference

An argument with premises P1,…,Pk and conclusion C is valid if (P1∧⋯∧Pk)→C is a tautology, that is, no row makes all premises true and the conclusion false.

Rule Premises Conclusion
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
Simplification p∧q p
Addition p p∨q

Two fallacies appear often as wrong options:

  • Affirming the consequent: from p→q and q, concluding p.
  • Denying the antecedent: from p→q and ¬p, concluding ¬q.

Both fail on the row p= F, q= T.

To test validity fast: set the conclusion false, force every premise true, and see if a consistent assignment exists. If it does, the argument is invalid and that assignment is a counterexample.

4. Predicates and quantifiers

A predicate P(x) becomes a proposition once x is given a value from the domain (universe of discourse).

  • Universal quantifier: ∀x P(x) is true if P(x) holds for every x in the domain.
  • Existential quantifier: ∃x P(x) is true if P(x) holds for at least one x.

A variable is bound if it lies in the scope of a quantifier on it, otherwise free. A formula with free variables is not a proposition.

Negation (generalised De Morgan): ¬∀x P(x)≡∃x ¬P(x),¬∃x P(x)≡∀x ¬P(x) To negate a long formula, flip every quantifier and push ¬ inward; ¬(P→Q)≡P∧¬Q.

Translating English (the most tested skill):

English First-order logic
All A are B ∀x (A(x)→B(x))
Some A are B ∃x (A(x)∧B(x))
No A is B ∀x (A(x)→¬B(x))
Not all A are B ∃x (A(x)∧¬B(x))

∀ pairs with →; ∃ pairs with ∧. The formula ∀x (A∧B) says everything is both A and B, and ∃x (A→B) is true as soon as one thing is not A, so both are almost always wrong translations.

5. Nested quantifiers and distribution

Quantifiers of the same kind commute: ∀x∀y≡∀y∀x and ∃x∃y≡∃y∃x. Quantifiers of different kinds do not.

∃x ∀y P(x,y)→∀y ∃x P(x,y) is valid: one x that works for all y certainly gives each y some x. The converse fails. Over the integers with P(x,y):x>y, ∀y ∃x (x>y) is true but ∃x ∀y (x>y) is false (no largest integer).

Distribution over connectives:

Equivalent (always) One way only
∀x (P∧Q)≡∀xP∧∀xQ ∀xP∨∀xQ→∀x (P∨Q)
∃x (P∨Q)≡∃xP∨∃xQ ∃x (P∧Q)→∃xP∧∃xQ

If x does not occur in Q: ∀x (P(x)→Q)≡∃x P(x)→Q and ∃x (P(x)→Q)≡∀x P(x)→Q. Note how the quantifier flips when it moves out of the premise of an implication.

For a finite domain {a1,…,an}: ∀x P(x)≡P(a1)∧⋯∧P(an) and ∃x P(x)≡P(a1)∨⋯∨P(an). This is the easiest way to check a claim.

∀x ∀y P(x, y)∃x ∀y P(x, y)∃y ∀x P(x, y)∀y ∃x P(x, y)∀x ∃y P(x, y)∃x ∃y P(x, y)
Valid implications among two-variable quantifier orders (non-empty domain). No arrow goes upward.

Formulas to remember

ImplicationThe contrapositive is equivalent; the converse is not.
p→q≡¬p∨q≡¬q→¬p
Negated implication
¬(p→q)≡p∧¬q
Biconditional
p↔q≡(p∧q)∨(¬p∧¬q)
Exportation
(p∧q)→r≡p→(q→r)
Quantifier negation
¬∀x P(x)≡∃x ¬P(x),¬∃x P(x)≡∀x ¬P(x)
Swapping different quantifiersValid one way only.
∃x ∀y P(x,y)⇒∀y ∃x P(x,y)
Number of Boolean functionsn propositional variables
22n

Common mistakes

  • Translating 'All A are B' as ∀x (A(x)∧B(x)) or 'Some A are B' as ∃x (A(x)→B(x)).
  • Treating the converse q→p as equivalent to p→q; only the contrapositive ¬q→¬p is.
  • Negating ∀x P(x) as ∀x ¬P(x) instead of ∃x ¬P(x).
  • Assuming ∀x ∃y and ∃y ∀x mean the same thing; only ∃∀⇒∀∃ holds.
  • Reading p→q→r as (p→q)→r; implication groups to the right.
  • Accepting affirming the consequent or denying the antecedent as valid inference.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Is hypothetical syllogism a tautology?

conceptual

Show that ((p→q)∧(q→r))→(p→r) is a tautology without writing all 8 rows.

  1. Step 1: Assume the whole formula is false. What must hold?

    Try it on paper first.

Example 2: Simplify with equivalence laws

conceptual

Simplify ¬(p∨(¬p∧q)).

  1. Step 1: Simplify the inside first using distribution.

    Try it on paper first.

Example 3: Negating a nested quantified statement

conceptual

Write the negation of ∀x ∃y (P(x,y)→Q(y)) with ¬ applied only to atomic predicates.

  1. Step 1: Push the negation past the quantifiers.

    Try it on paper first.

Example 4: Quantifier order on a finite domain

numerical

Domain {1,2,3} and P(x,y):x+y=4. Find the truth values of ∀x ∃y P(x,y) and ∃y ∀x P(x,y).

  1. Step 1: For each $x$, look for a $y$ in the domain with $x + y = 4$.

    Try it on paper first.

Previous year questions

14 official GATE CSE questions on this topic, newest first.

Practise these 14 PYQs →

Topic test

10 questions: up to 4 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.