∑GATE DA Atlas

Predicate (First-Order) Logic

Why propositional logic is not enough, the syntax of first-order logic (constants, variables, predicates, functions, quantifiers), semantics over a domain, translating English sentences (and the classic ∀/→ and ∃/∧ pattern), quantifier negation and ordering, valid equivalences, prenex form and Skolemisation, unification and the most general unifier, and first-order resolution and chaining.

Section 79 practice questions

Why first-order logic?

Propositional logic needs a separate symbol for every fact: "Socrates is mortal", "Plato is mortal", … and cannot say "all men are mortal" in one sentence. First-order logic (FOL), also called predicate logic, talks about objects, their properties and relations, with quantifiers over all objects.

Syntax

ElementExamplesDenotes
ConstantsRavi, 2, Delhispecific objects
Variablesx,y,zx, y, zarbitrary objects
FunctionsFather(x)\text{Father}(x), x+1x + 1maps objects to objects (a term)
PredicatesStudent(x)\text{Student}(x), Loves(x,y)\text{Loves}(x, y), x>yx > yproperties/relations (true or false)
Connectives¬,∧,∨,→,↔\neg, \wedge, \vee, \to, \leftrightarrowas in propositional logic
Quantifiers∀x\forall x (for all), ∃x\exists x (there exists)
Equalityt1=t2t_1 = t_2

Terms (constants, variables, function applications) denote objects; atomic sentences apply a predicate to terms. A variable is bound if it is in the scope of a quantifier, otherwise free; a sentence has no free variables.

Semantics

An interpretation fixes a non-empty domain of objects and maps constants to objects, functions to functions, predicates to relations. Then:

  • ∀x φ\forall x\,\varphi is true iff φ\varphi is true for every object assigned to xx;
  • ∃x φ\exists x\,\varphi is true iff φ\varphi is true for at least one object.

Translating English

EnglishFOL
Everyone loves someone∀x ∃y Loves(x,y)\forall x\,\exists y\,\text{Loves}(x, y)
Someone is loved by everyone∃y ∀x Loves(x,y)\exists y\,\forall x\,\text{Loves}(x, y)
Every student takes at least one course∀x (Student(x)→∃c (Course(c)∧Takes(x,c)))\forall x\,(\text{Student}(x) \to \exists c\,(\text{Course}(c) \wedge \text{Takes}(x, c)))
There is exactly one president∃x (Pres(x)∧∀y (Pres(y)→y=x))\exists x\,(\text{Pres}(x) \wedge \forall y\,(\text{Pres}(y) \to y = x))
Not every bird flies¬∀x (Bird(x)→Flies(x))≡∃x (Bird(x)∧¬Flies(x))\neg\forall x\,(\text{Bird}(x) \to \text{Flies}(x)) \equiv \exists x\,(\text{Bird}(x) \wedge \neg\text{Flies}(x))

Equivalences

RuleEquivalence
Quantifier negation¬∀x φ≡∃x ¬φ\neg\forall x\,\varphi \equiv \exists x\,\neg\varphi; ¬∃x φ≡∀x ¬φ\neg\exists x\,\varphi \equiv \forall x\,\neg\varphi
Distribution∀x (φ∧ψ)≡∀x φ∧∀x ψ\forall x\,(\varphi \wedge \psi) \equiv \forall x\,\varphi \wedge \forall x\,\psi; ∃x (φ∨ψ)≡∃x φ∨∃x ψ\exists x\,(\varphi \vee \psi) \equiv \exists x\,\varphi \vee \exists x\,\psi
Not distributive∀x (φ∨ψ)≢∀x φ∨∀x ψ\forall x\,(\varphi \vee \psi) \not\equiv \forall x\,\varphi \vee \forall x\,\psi; ∃x (φ∧ψ)≢∃x φ∧∃x ψ\exists x\,(\varphi \wedge \psi) \not\equiv \exists x\,\varphi \wedge \exists x\,\psi
Same quantifiers commute∀x ∀y≡∀y ∀x\forall x\,\forall y \equiv \forall y\,\forall x; ∃x ∃y≡∃y ∃x\exists x\,\exists y \equiv \exists y\,\exists x
Scope (xx not free in ψ\psi)∀x (φ→ψ)≡(∃x φ)→ψ\forall x\,(\varphi \to \psi) \equiv (\exists x\,\varphi) \to \psi

Normal forms for inference

To use resolution, convert sentences to clausal form:

  1. Eliminate ↔\leftrightarrow and →\to.
  2. Move ¬\neg inwards (including quantifier negation).
  3. Standardise variables apart (distinct names for distinct quantifiers).
  4. Skolemise: replace each existential variable by a new constant (if not inside any ∀\forall) or a new function of the enclosing universal variables.
  5. Drop the universal quantifiers (all remaining variables are implicitly universal).
  6. Distribute ∨\vee over ∧\wedge to get CNF clauses.

Unification

To apply inference rules, find a substitution θ\theta making two expressions identical. The most general unifier (MGU) commits as little as possible.

ExpressionsMGU
Knows(John,x)\text{Knows}(\text{John}, x), Knows(John,Jane)\text{Knows}(\text{John}, \text{Jane}){x/Jane}\{x/\text{Jane}\}
Knows(John,x)\text{Knows}(\text{John}, x), Knows(y,Bill)\text{Knows}(y, \text{Bill}){x/Bill,y/John}\{x/\text{Bill}, y/\text{John}\}
Knows(John,x)\text{Knows}(\text{John}, x), Knows(y,Mother(y))\text{Knows}(y, \text{Mother}(y)){y/John,x/Mother(John)}\{y/\text{John}, x/\text{Mother}(\text{John})\}
Knows(John,x)\text{Knows}(\text{John}, x), Knows(x,Elizabeth)\text{Knows}(x, \text{Elizabeth})fail (standardise apart first: then {x1/Elizabeth,x2/John}\{x_1/\text{Elizabeth}, x_2/\text{John}\})
P(x)P(x), P(f(x))P(f(x))fail — occurs check (xx cannot contain itself)

Inference in FOL

  • Generalised modus ponens: from p1′,…,pn′p_1', \dots, p_n' and (p1∧⋯∧pn→q)(p_1 \wedge \dots \wedge p_n \to q), with θ\theta unifying each pi′p_i' with pip_i, infer qθq\theta. Basis of forward and backward chaining over definite clauses (Prolog, production systems).
  • Resolution with unification: from (ℓ∨A)(\ell \vee A) and (¬m∨B)(\neg m \vee B) where θ=MGU(ℓ,m)\theta = \text{MGU}(\ell, m), infer (A∨B)θ(A \vee B)\theta. Refutation-complete: if KB ⊨α\models \alpha, resolution on KB ∧¬α\wedge \neg\alpha derives the empty clause.

Decidability: entailment in FOL is only semi-decidable — if KB ⊨α\models \alpha, a complete procedure eventually proves it, but if not, it may run forever.

Quick revision

Practice questions

GATE-style questions: 2 one-mark and 7 two-mark. Wrong MCQs cost ⅓ of their marks in the real exam; MSQ and NAT have no negative marking. Attempt each before opening the solution.

Q1MCQ2 marks

Which formula correctly expresses "Every student loves some course"?

Q2MCQ1 mark

¬∀x P(x)\neg\forall x\,P(x) is equivalent to

Q3MCQ2 marks

Which formula expresses "Some student is not happy"?

Q4MSQ2 marks

Which of the following are valid (true in every interpretation)?

One or more options are correct.

Q5MCQ2 marks

The most general unifier of P(x,f(y))P(x, f(y)) and P(a,f(b))P(a, f(b)), where aa and bb are constants, is

Q6MCQ2 marks

Skolemising ∀x ∃y Loves(x,y)\forall x\,\exists y\,\text{Loves}(x, y) gives

Q7NAT2 marks

Over the domain {1,2,3}\{1, 2, 3\} with the usual >>, for how many values of xx is ∃y (y>x)\exists y\,(y > x) true? ______

Q8MCQ1 mark

Can P(x,x)P(x, x) be unified with P(a,b)P(a, b), where aa and bb are distinct constants?

Q9MCQ2 marks

How are ∀x (P(x)∨Q(x))\forall x\,(P(x) \vee Q(x)) and ∀x P(x)∨∀x Q(x)\forall x\,P(x) \vee \forall x\,Q(x) related?