Skip to content
GATEiit

GATE DA · Artificial Intelligence

Logic: propositional and predicate

Propositional and first-order (predicate) logic for AI: syntax, truth tables, validity and entailment, normal forms, inference by resolution, quantifiers and translation of English, and unification. GATE asks tautology checks, entailment, quantifier negation and MGUs.

Before you start

This topic comes before: Relational model: relational algebra, tuple calculus and SQL

Concept notes

1. Propositional logic: truth, validity and entailment

A proposition is a statement that is true or false. Formulas are built with ¬, ∧, ∨, → and ↔. A model (interpretation) assigns T or F to every symbol; with n symbols there are 2n models.

  • p→q is false only when p is T and q is F.
  • p↔q is true when both sides have the same value.

A formula is a tautology (valid) if true in every model, a contradiction (unsatisfiable) if true in none, and satisfiable if true in at least one.

Entailment: KB⊨α means α is true in every model where KB is true. Two key equivalences:

KB⊨α  ⟺  (KB→α) is valid  ⟺  KB∧¬α is unsatisfiable

The second form is the basis of proof by refutation.

Law Equivalence
Implication p→q≡¬p∨q
Contrapositive p→q≡¬q→¬p
De Morgan ¬(p∧q)≡¬p∨¬q, ¬(p∨q)≡¬p∧¬q
Biconditional p↔q≡(p→q)∧(q→p)
Distribution p∨(q∧r)≡(p∨q)∧(p∨r)
Exportation (p∧q)→r≡p→(q→r)

The converse q→p and the inverse ¬p→¬q are not equivalent to p→q.

2. Normal forms and inference by resolution

A literal is a symbol or its negation. A clause is a disjunction of literals. A formula is in CNF if it is a conjunction of clauses and in DNF if it is a disjunction of conjunctions of literals. To reach CNF: remove ↔ and →, push ¬ inward (De Morgan), then distribute ∨ over ∧.

An inference procedure is sound if it derives only entailed formulas and complete if it can derive every entailed formula.

  • Modus ponens: from p and p→q, infer q.
  • Modus tollens: from ¬q and p→q, infer ¬p.
  • Resolution: from (A∨p) and (B∨¬p), infer (A∨B), called the resolvent.

Resolution is sound, and resolution refutation is complete for propositional logic: to show KB⊨α, convert KB∧¬α to CNF and resolve pairs of clauses until the empty clause appears (a contradiction). If no new clause can be added and the empty clause never appears, KB⊭α.

A Horn clause has at most one positive literal, for example ¬p∨¬q∨r, that is p∧q→r. For Horn knowledge bases, forward chaining (data-driven: fire rules whose premises are known) and backward chaining (goal-driven: work back from the query) decide entailment in time linear in the size of the KB.

¬R¬Q ∨ R ¬Q¬P ∨ Q ¬PP empty clause negated goaland KB clauses
Resolution refutation: adding the negated goal ¬R to the knowledge base derives the empty clause

3. First-order (predicate) logic: quantifiers and translation

First-order logic (FOL) adds objects, predicates (properties and relations, such as Likes(x,y)), functions (such as Mother(x)) and quantifiers over a domain.

  • ∀x P(x): P holds for every object in the domain.
  • ∃x P(x): P holds for at least one object.

The standard translation patterns:

English FOL
All students are clever ∀x (S(x)→C(x))
Some student is clever ∃x (S(x)∧C(x))
No student is clever ∀x (S(x)→¬C(x))
Not all students are clever ∃x (S(x)∧¬C(x))

Use → with ∀ and ∧ with ∃. ∀x (S(x)∧C(x)) says everything is a clever student, and ∃x (S(x)→C(x)) is true as soon as one non-student exists.

Negation flips the quantifier: ¬∀x P(x)≡∃x ¬P(x) and ¬∃x P(x)≡∀x ¬P(x). Apply it one quantifier at a time, left to right.

Order matters for mixed quantifiers: ∃y ∀x L(x,y) (one y liked by everyone) implies ∀x ∃y L(x,y) (everyone likes someone), but not the other way round. Quantifiers of the same kind commute: ∀x∀y≡∀y∀x. Also ∀ distributes over ∧ and ∃ over ∨, but not the reverse.

4. Inference in first-order logic: Skolemisation and unification

To run resolution in FOL, every sentence is turned into clausal form:

  1. Remove → and ↔; push ¬ inward (flipping quantifiers).
  2. Standardise apart: give each quantifier its own variable name.
  3. Skolemise: replace each existentially quantified variable by a new constant, or by a Skolem function of the universal variables in whose scope it lies. ∀x ∃y L(x,y) becomes ∀x L(x,F(x)).
  4. Drop the universal quantifiers and convert to CNF.

Universal instantiation lets us replace a ∀ variable by any ground term; existential instantiation introduces a new constant (once).

A substitution θ such as {x/John} replaces variables by terms. Two atoms unify if some θ makes them identical. The most general unifier (MGU) is the one that commits the least; every other unifier is an instance of it. Rules of thumb:

  • Predicate names and argument counts must match.
  • Different constants never unify; a function term never unifies with a constant or a different function.
  • Occurs check: x cannot be bound to a term containing x, such as f(x).

For example, Knows(John,x) and Knows(y,Mother(y)) have MGU {y/John, x/Mother(John)}.

First-order resolution resolves two clauses after applying the MGU of a complementary pair. It is sound and refutation-complete, but validity in FOL is only semi-decidable: if KB⊨α a proof will be found, otherwise the search may run forever.

Formulas to remember

Implication
p→q≡¬p∨q
Contrapositive
p→q≡¬q→¬p
Entailment by refutation
KB⊨α  ⟺  KB∧¬α is unsatisfiable
Resolution rule
A∨pB∨¬pA∨B
Quantifier negation
¬∀x P(x)≡∃x ¬P(x),¬∃x P(x)≡∀x ¬P(x)
Skolemisation
∀x ∃y P(x,y)  ⇝  ∀x P(x,f(x))
Number of modelsFor n propositional symbols
2n

Common mistakes

  • Treating p→q as equivalent to its converse q→p or its inverse ¬p→¬q.
  • Writing ∀x (S(x)∧C(x)) for "all students are clever"; ∀ pairs with →, ∃ pairs with ∧.
  • Swapping the order of ∀ and ∃; ∀x ∃y is weaker than ∃y ∀x.
  • In resolution, resolving on two complementary pairs at once; resolve on exactly one literal pair per step.
  • Forgetting the occurs check: x never unifies with a term like f(x).
  • Concluding KB⊨α from a model where both are true; entailment needs α true in every model of KB.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Entailment by truth table

numerical

Let KB={p→q, q→r}. Does KB⊨p→r? How many of the 8 models satisfy KB?

  1. Step 1: List when the KB is true.

    Try it on paper first.

Example 2: A resolution refutation

conceptual

From KB={P→Q, Q→R, P}, prove R by resolution.

  1. Step 1: Convert the KB and the negated goal to clauses.

    Try it on paper first.

Example 3: Translate and negate a quantified sentence

conceptual

Write "Every student has a friend who likes maths" in FOL, using S(x), F(x,y) for "y is a friend of x" and M(y). Then write its negation with ¬ only on atoms.

  1. Step 1: Translate from the outside in.

    Try it on paper first.

Example 4: Finding a most general unifier

conceptual

Find the MGU of P(x,f(y),z) and P(g(w),f(a),w), where a is a constant. Also say whether Q(x,f(x)) and Q(y,y) unify.

  1. Step 1: Match the first arguments.

    Try it on paper first.

Previous year questions

7 official GATE DA questions on this topic, newest first.

Practise these 7 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 DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.