# First-Order Logic Resolution, Bayesian Networks, D-Separation & Markov Blankets
Exam: GATE Data Science & Artificial Intelligence (DA) (GATE DA)
Subject: Artificial Intelligence, Reasoning & RL
Canonical URL: https://gateandnet.com/exams/gate-da/artificial-intelligence/first-order-logic-unification-and-bayesian-networks

> Skolemization, Most General Unifier (MGU) & Robinson Resolution Refutation in FOL, Bayesian Network parameter savings, V-structures (Explaining Away), D-separation rules, and Markov Blankets.

## 1. First-Order Predicate Logic: Skolemization, Unification & Resolution

To prove $KB \models \alpha$ by **Resolution Refutation**, convert $KB \land \lnot \alpha$ into Conjunctive Normal Form (CNF) and derive the empty clause $\square$:
1. **Skolemization Trap:** Existential quantifier $\exists y$ inside universal scope $\forall x \, \exists y \, P(x, y)$ must be replaced by a **Skolem function** $P(x, f(x))$ — *NOT* a Skolem constant $c$ (which would correspond to $\exists y \, \forall x \, P(x, y)$!).
2. **Unification (MGU) & Occurs Check:** Unifying $P(x, f(y))$ and $P(g(z), x)$ gives substitution $\theta = \{x / g(z), \; f(y) \dots\}$ — wait: $x$ unifies with $g(z)$ AND $f(y)$, which fails if $f \neq g$! And unifying $P(x)$ with $P(f(x))$ **fails the Occurs Check** ($x$ appears inside $f(x)$).
3. **Decidability:** Propositional Logic entailment is **Decidable** (co-NP-complete); First-Order Logic entailment is **Semi-Decidable** (Resolution is refutation-complete: halts iff $KB \models \alpha$, may loop forever if $KB \not\models \alpha$).

## 2. Bayesian Networks & The 3 Canonical D-Separation Triples

Whether path $X - Z - Y$ is **active** or **blocked** given observed evidence set $E$ is tested on every GATE DA & UGC NET AI paper:

| Canonical Motif | Structure | When $Z \notin E$ (Unobserved) | When $Z \in E$ (Observed) |
| :--- | :---: | :---: | :---: |
| **Causal Chain** | $X \to Z \to Y$ | Active ($X \not\perp Y$) | **Blocked** ($X \perp Y \mid Z$) |
| **Common Cause (Fork)** | $X \leftarrow Z \to Y$ | Active ($X \not\perp Y$) | **Blocked** ($X \perp Y \mid Z$) |
| **Common Effect (V-Structure / Collider)** | $X \to Z \leftarrow Y$ | **Blocked** ($X \perp Y$ marginally!) | **ACTIVE!** ($X \not\perp Y \mid Z$ or any descendant of $Z$ in $E$) |

> [!TRAP]
> **Explaining Away (V-Structure Reversal!):** Suppose $\text{Burglary} \to \text{Alarm} \leftarrow \text{Earthquake}$. Marginally, $\text{Burglary} \perp \text{Earthquake}$. The instant you observe $\text{Alarm} = \text{True}$ (or $\text{JohnCalls} = \text{True}$, a descendant of $\text{Alarm}$), $\text{Burglary}$ and $\text{Earthquake}$ become **conditionally dependent**! Observing an earthquake *explains away* the alarm and lowers $P(\text{Burglary} \mid \text{Alarm}, \text{Earthquake})$.

## Solved Practice Questions & PYQs

### [GATE DA Bayes Net | MCQ]
Consider a Bayesian Network over $5$ **binary** random variables with structure $A \to C \leftarrow B$ and $C \to D,\; C \to E$. How many **independent probability parameters** are required to specify all Conditional Probability Tables (CPTs)?
**Correct Answer:** B
**Solution:** - $P(A)$: $1$ param; $P(B)$: $1$ param.
- $P(C \mid A, B)$ ($2$ binary parents $\implies 2^2 = 4$ rows): $4$ params.
- $P(D \mid C)$ ($1$ binary parent): $2$ params; $P(E \mid C)$: $2$ params.
- Total $= 1 + 1 + 4 + 2 + 2 = \mathbf{10}$ parameters (vs $2^5 - 1 = 31$ in the full joint table!).

### [GATE DA Bayes Net | MCQ]
In the collider (V-structure) Bayesian Network $X \to Z \leftarrow Y$ with child $Z \to W$, under which conditioning set are $X$ and $Y$ **guaranteed conditionally independent**?
**Correct Answer:** C
**Solution:** A V-structure collider $X \to Z \leftarrow Y$ is **blocked when neither $Z$ nor any descendant ($W$) is observed** ($X \perp Y \mid \emptyset$). Conditioning on $Z$ or $W$ activates **explaining away**, making $X$ and $Y$ dependent!

### [UGC NET / GATE FOL | MCQ]
What is the **Most General Unifier (MGU)** of the two First-Order Logic atomic literals $P(f(x),\; y)$ and $P(f(g(z)),\; g(x))$?
**Correct Answer:** A
**Solution:** 1. Matching first argument $f(x)$ with $f(g(z))$ binds **$x / g(z)$**.
2. Applying $x / g(z)$ to second argument turns $g(x)$ into $g(g(z))$, so matching $y$ gives **$y / g(g(z))$**!
