Artificial Intelligence · Unit IV

Predicate Logic & Probabilistic Reasoning

Representing facts with FOL, resolution, natural deduction, Bayesian networks, Dempster-Shafer theory, and fuzzy logic — with full worked examples

TextbookRussell & Norvig — Chapters 8, 9, 12, 13, 14
TopicsPredicate Logic · Resolution · Natural Deduction · Bayesian Networks · Dempster-Shafer · Fuzzy Logic
Section 01

Representing Facts in Predicate Logic

Natural language is full of ambiguity — "All that glitters is not gold" means different things to different readers. Predicate logic (First-Order Logic, FOL) eliminates ambiguity by providing a precise, formal language with well-defined syntax and semantics. Before we can reason about the world, we must encode what we know into this language — a process called knowledge representation in FOL.

This section covers the building blocks: terms, predicates, ground atoms, complex sentences, and how to translate natural-language facts into FOL one step at a time.

Syntax of First-Order Logic — Building Blocks

FOL sentences are built from these elements:

ElementDefinitionExamplesNotation
ConstantsName a specific object in the worldjohn, london, 42, amoxicillinLowercase first letter
VariablesPlaceholder for any objectx, y, person, diseaseLowercase, often x/y/z
PredicatesExpress properties of / relations between objectsLoves(x,y), Human(x), Father(tom,bob)Uppercase first letter
FunctionsMap objects to objects (object-valued)motherOf(x), plusOne(n)Lowercase first letter
ConnectivesCombine sentences¬ ∧ ∨ → ↔Standard logical symbols
QuantifiersScope of variables∀x Human(x)→Mortal(x)∀ (for all), ∃ (there exists)
Atomic sentencePredicate applied to termsFather(tom, bob)The smallest true/false unit
Running Example Family Knowledge Base — Used Throughout Sections 1–4

We use a family domain for predicate logic examples and a medical diagnosis domain for probabilistic reasoning. The family KB is compact enough to work by hand yet rich enough to illustrate all inference rules.

Fact (Natural Language)FOL Representation
Tom is a personPerson(tom)
Bob is a personPerson(bob)
Liz is a personPerson(liz)
Ann is a personPerson(ann)
Tom is the father of BobFather(tom, bob)
Tom is the father of LizFather(tom, liz)
Bob is the father of AnnFather(bob, ann)
Tom is maleMale(tom)
Bob is maleMale(bob)
Every person's father is also a person∀x ∀y (Person(x) ∧ Father(y,x) → Person(y))

Representing Simple Facts

The most basic FOL sentences are ground atomic sentences — predicates applied to constants only (no variables). These directly assert specific facts about named individuals.

Natural Language FactFOL Ground AtomPredicate ArityMeaning
"Tom is tall"Tall(tom)Unary (1)Property of one object
"Tom loves Ann"Loves(tom, ann)Binary (2)Relation between two objects
"Bob gave Ann a book"Gave(bob, ann, book1)Ternary (3)Relation among three objects
"The temperature is 38.5°C"Temperature(john, 38.5)Binary (2)Property with a numeric value
"Tom is NOT tall"¬Tall(tom)Unary negatedNegation of a property
"All humans are mortal"∀x (Human(x) → Mortal(x))Universal ruleQuantified implication

Computable Functions and Predicates

Computable Functions in FOL

A function in FOL maps one or more objects to another object. Unlike predicates (which return true/false), functions return an object. Functions allow us to refer to objects without naming them explicitly.

A function is computable if there exists an algorithm that, given input objects, terminates in finite time and returns the correct output object. In practice, all functions used in FOL knowledge bases are assumed computable.

FunctionNotationExampleResult
Mother ofmotherOf(x)motherOf(bob)The object that is Bob's mother
Age ofageOf(x)ageOf(john)45 (a number)
Father of fatherfatherOf(fatherOf(x))fatherOf(fatherOf(ann))tom (grandfather)
Plus onesucc(n)succ(succ(0))2 (Peano arithmetic)
Drug dose for weightdoseFor(drug, weight)doseFor(amoxicillin, 70)500mg (computed value)
Key Insight — Functions vs. Predicates

Predicates return true or false: Father(tom, bob) is either true or false.
Functions return objects: fatherOf(bob) returns the object tom.
The same relationship can often be expressed either way: Father(tom, bob)fatherOf(bob) = tom. Functions are more compact when used in complex nested expressions.

Translating Complex English to FOL — Step by Step

Worked Example English → FOL Translation for the Family KB
EnglishFOL TranslationKey Structure
"Bob is the grandfather of Ann"∃z (Father(bob,z) ∧ Father(z,ann))
or equivalently:
fatherOf(fatherOf(ann)) = bob
Existential — intermediate person z
"Everyone has a father"∀x Person(x) → ∃y Father(y,x)Universal + Existential
"No one is their own father"¬∃x Father(x,x)
equiv:
∀x ¬Father(x,x)
Negated existential
"Only males can be fathers"∀x ∀y Father(x,y) → Male(x)Universal implication
"Tom has at least one child"∃y Father(tom,y)Existential witness
"Tom has exactly two children"∃y ∃z (Father(tom,y) ∧ Father(tom,z) ∧ y≠z ∧ ∀w Father(tom,w) → (w=y ∨ w=z))Counting (complex)
Translation Strategy

"All/Every A is B"∀x A(x) → B(x) — use ∀ with →
"Some/There exists an A that is B"∃x A(x) ∧ B(x) — use ∃ with ∧
Common mistake: writing ∃x A(x) → B(x) — this is almost always wrong (it says "if there exists something satisfying A, then B holds," which is a completely different statement).

🎯 Quick Check: Which FOL sentence correctly translates "Every doctor has treated at least one patient"?
✅ Correct! The rule "every doctor… at least one patient" has universal scope (all doctors) and existential scope (some patient). This gives ∀x Doctor(x) → ∃y (Patient(y) ∧ Treated(x,y)). Note: the ∃ must use ∧ not →. Option A is wrong (∃ in the antecedent — says "if some doctor exists…"). Option C says every pair of doctor+patient has a treatment relation (much too strong). Option D only says some doctor treated some patient, not ALL doctors.
Section 02

ISA & Instance Relationships

Organising knowledge into hierarchies is one of the most natural human cognitive strategies. We classify things into categories, categories into super-categories, and so on. In FOL, these hierarchical relationships are captured through ISA (is-a) and instance relationships — the formal backbone of ontologies, class hierarchies, and inheritance-based reasoning.

ISA and Instance — Formal Definitions

Instance relationship (∈ / is-an-instance-of): Relates a specific individual to the class it belongs to. "John is a Person" — John is an instance of the class Person.

In FOL: Person(john) — the predicate Person represents the class, and applying it to the constant john asserts John is a member.

ISA / Subclass relationship (⊆ / is-a-subclass-of): Relates one class to a more general class. "Doctor is a subclass of Person" — every Doctor is also a Person. In FOL: ∀x Doctor(x) → Person(x)

AKO (A-Kind-Of): Synonym for ISA at the class level — used in semantic networks and frame systems.

ISA Hierarchy — Classes, Subclasses, and Instances with Inheritance Entity Person Animal Doctor Patient Student ISA ISA ISA ISA ISA john mary alice instance instance instance Inheritance Chain for john: john → instance-of → Doctor Doctor → ISA → Person Person → ISA → Entity ∴ john inherits: Entity, Person, Doctor properties without restating ISA (subclass) instance-of Individual Class
Figure 2.1 — ISA hierarchy. Green arrows show ISA (subclass) links; orange arrows show instance-of links. john inherits all properties of Doctor, Person, and Entity through the chain. This is inheritance through ISA transitivity.

FOL Representation of ISA and Instance

Worked Example Encoding the Medical Hierarchy in FOL

Class Hierarchy (ISA — subclass axioms)

-- ISA: Every Doctor is a Person --
∀x Doctor(x) → Person(x)

-- ISA: Every Person is an Entity --
∀x Person(x) → Entity(x)

-- ISA: Every Specialist is a Doctor --
∀x Specialist(x) → Doctor(x)

-- ISA: Pneumonia is a kind of LungDisease --
∀x Pneumonia(x) → LungDisease(x)

-- ISA: Pneumonia is a kind of InfectiousDisease --
∀x Pneumonia(x) → InfectiousDisease(x)

Instance Facts (individual membership)

-- john is an instance of Doctor --
Doctor(john)

-- mary is an instance of Patient --
Patient(mary)

-- pneumonia1 is a specific case of Pneumonia --
Pneumonia(pneumonia1)
DiagnosedIn(pneumonia1, mary)

Inheritance in Action — Derived Facts

Given FactApplied RuleDerived Fact
Doctor(john)∀x Doctor(x)→Person(x)Person(john)
Person(john)∀x Person(x)→Entity(x)Entity(john)
Pneumonia(pneumonia1)∀x Pneumonia(x)→LungDisease(x)LungDisease(pneumonia1)
Pneumonia(pneumonia1)∀x Pneumonia(x)→InfectiousDisease(x)InfectiousDisease(pneumonia1)

This is FOL forward chaining — applying universal rules to derive new ground facts. Each derived fact becomes available for further inference.

🎯 Quick Check: Given ISA axioms Doctor→Person→Entity, and the fact Specialist(alice), which facts can be derived using the ISA chain Specialist→Doctor→Person→Entity?
✅ Correct! ISA is transitive. Given: Specialist(alice), Specialist→Doctor, Doctor→Person, Person→Entity — by chaining the three universal implications: (1) Doctor(alice) from Specialist axiom; (2) Person(alice) from Doctor axiom; (3) Entity(alice) from Person axiom. All three are derivable. This transitivity of ISA is the formal basis of inheritance in OOP and ontology languages like OWL.
Section 03

Resolution

We now have a language for representing facts. The next question is: how do we prove new facts from what we know? Resolution is the most important inference rule in automated theorem proving — it is the foundation of Prolog and most FOL reasoning systems. It works by contradiction: to prove a goal, assume its negation and show that a contradiction results.

Resolution Principle (Robinson, 1965)

Given two clauses containing complementary literals (one positive, one negative, for the same predicate), we can resolve them to produce a new clause containing all other literals from both.

Resolution Rule — Propositional Form Clause 1: l₁ ∨ l₂ ∨ … ∨ lₖ ∨ P Clause 2: m₁ ∨ m₂ ∨ … ∨ mₙ ∨ ¬P ───────────────────────────────────────── Resolvent: l₁ ∨ l₂ ∨ … ∨ lₖ ∨ m₁ ∨ … ∨ mₙ P is the resolved literal (must appear positive in one, negative in the other) If the resolvent is the empty clause □ → CONTRADICTION → original goal proved

Step 1 — Convert to Clausal (CNF) Form

Resolution requires all sentences in Conjunctive Normal Form (CNF) — a conjunction of clauses, where each clause is a disjunction of literals. The conversion process has six steps:

ALGORITHM: Converting FOL Sentences to CNF (Clausal Form)
1

Eliminate implications: Replace α→β with ¬α∨β; replace α↔β with (¬α∨β)∧(¬β∨α).

2

Move negations inward (De Morgan's laws): ¬(α∧β) → ¬α∨¬β; ¬(α∨β) → ¬α∧¬β; ¬¬α → α; ¬∀x α → ∃x ¬α; ¬∃x α → ∀x ¬α.

3

Standardise variables: Rename variables so each quantifier uses a unique variable name. Prevents variable capture.

4

Skolemise (eliminate ∃): Replace each existentially quantified variable with a Skolem function of the universally quantified variables in scope. If no universal quantifiers: use a Skolem constant.

5

Drop universal quantifiers: All remaining variables are implicitly universally quantified. Remove ∀.

6

Distribute ∧ over ∨ (CNF): Use (α∨(β∧γ)) → (α∨β)∧(α∨γ) until each clause is a pure disjunction of literals.

Worked Example CNF Conversion — "Every person has a mother who is a person"

Original sentence: ∀x Person(x) → ∃y (Person(y) ∧ MotherOf(y,x))

StepActionResult
1Eliminate → : α→β becomes ¬α∨β∀x ¬Person(x) ∨ ∃y (Person(y) ∧ MotherOf(y,x))
2Move ¬ inward (nothing to push here)No change
3Standardise variables (already unique)No change
4Skolemise ∃y: y depends on x, so replace y with function m(x)∀x ¬Person(x) ∨ (Person(m(x)) ∧ MotherOf(m(x),x))
5Drop ∀x¬Person(x) ∨ (Person(m(x)) ∧ MotherOf(m(x),x))
6Distribute ∨ over ∧ to get two clausesClause 1: ¬Person(x) ∨ Person(m(x))
Clause 2: ¬Person(x) ∨ MotherOf(m(x),x)

The original single sentence becomes two clauses in CNF. The Skolem function m(x) represents "the mother of x" without explicitly quantifying over a new variable.

Step 2 — Unification

Unification

Unification is the process of finding a substitution σ (a mapping from variables to terms) that makes two literals identical. The result is called the Most General Unifier (MGU) — the least committed substitution that achieves unification.

Unification Examples Unify Father(tom, x) with Father(tom, bob): σ = {x/bob} (substitute bob for x) → UNIFIED as Father(tom,bob) ✓ Unify Father(x, bob) with Father(tom, y): σ = {x/tom, y/bob} → UNIFIED as Father(tom,bob) ✓ Unify Father(x, x) with Father(tom, bob): Cannot unify — x cannot be both tom and bob → FAIL ✗ Unify Person(x) with Person(fatherOf(x)): Cannot unify — "occur check" failure (x appears in fatherOf(x)) → FAIL ✗

Step 3 — Resolution Refutation Proof

Worked Example Resolution Proof — "Is Ann a Person?"

Knowledge Base (already in clause form)

-- C1: Tom is a person --
Person(tom)

-- C2: If x is a person and y is x's father, then y is a person --
Person(x) ∧ Father(y,x) → Person(y)
-- In CNF: two clauses --
-- C2a: ¬Person(x) ∨ ¬Father(y,x) ∨ Person(y) --

-- C3: Tom is the father of Bob --
Father(tom, bob)

-- C4: Bob is the father of Ann --
Father(bob, ann)

Goal: Prove Person(ann)

Resolution by refutation: negate the goal, add ¬Person(ann) to the KB, and derive the empty clause □.

StepClauses UsedUnifier σResolvent
1. Negate goalAdd ¬Person(ann) to KBC5: ¬Person(ann)
2. Resolve C5 with C2aC5: ¬Person(ann) · C2a: ¬Person(x)∨¬Father(y,x)∨Person(y)σ={y/ann}C6: ¬Person(x)∨¬Father(ann,x)
3. Resolve C6 with C4C6: ¬Person(x)∨¬Father(ann,x) · C4: Father(bob,ann)σ={x/bob}C7: ¬Person(bob)
4. Resolve C7 with C2aC7: ¬Person(bob) · C2a: ¬Person(x)∨¬Father(y,x)∨Person(y)σ={y/bob}C8: ¬Person(x)∨¬Father(bob,x)
5. Resolve C8 with C3C8: ¬Person(x)∨¬Father(bob,x) · C3: Father(tom,bob)σ={x/tom}C9: ¬Person(tom)
6. Resolve C9 with C1C9: ¬Person(tom) · C1: Person(tom)σ={}□ (empty clause!) ✓
Conclusion

The empty clause □ was derived — a contradiction. The assumption ¬Person(ann) is false. Therefore Person(ann) is proved. The resolution chain: ann←bob←tom, each step inheriting Person through Father relationships.

Resolution Refutation Tree — Proving Person(ann) Person(tom) [C1] Father(tom,bob) [C3] Father(bob,ann) [C4] ¬P(x)∨¬Father(y,x)∨P(y) [C2a] ¬Person(ann) [negated goal] ¬Person(x)∨¬Father(x,bob) resolve C1,C2a σ={y/bob} ¬Person(x)∨¬Father(ann,x) resolve C2a,¬goal σ={y/ann} ¬Person(bob) resolve C3 σ={x/tom} ¬Person(bob) resolve C4 σ={x/bob} EMPTY CLAUSE □ = CONTRADICTION ✓ → Person(ann) proved
Figure 3.1 — Resolution refutation tree. Starting from the negated goal ¬Person(ann), each resolution step eliminates a literal using unification. When two ¬Person(bob) clauses resolve with each other → empty clause □ → contradiction → goal proved.
🎯 Quick Check: In resolution refutation, we add the NEGATION of the goal to the KB and derive the empty clause □. Why does deriving □ prove the original goal?
✅ Correct! Resolution is a proof by contradiction (reductio ad absurdum). We assume ¬Goal is consistent with the KB. If we can derive □ (the empty clause — which is always false, with no literals to satisfy it), it means KB ∧ ¬Goal is unsatisfiable. By the soundness of resolution: if KB ∧ ¬Goal ⊨ false, then KB ⊨ Goal. This is the completeness theorem of resolution — if a goal follows from the KB, resolution will eventually find the proof. Resolution is both sound and complete for FOL.
Section 04

Natural Deduction

Resolution converts everything to clausal form and works mechanically. Natural Deduction (Gentzen, 1935) takes a different approach — it closely mirrors how humans actually reason. Rather than a single rule, natural deduction provides a system of rules, one for introducing and one for eliminating each logical connective. Proofs are structured derivations that look like mathematical proofs.

Natural Deduction System

A natural deduction proof is a tree of judgements of the form Γ ⊢ φ ("from assumptions Γ, we can derive φ"). Each node in the proof tree is justified by one of the inference rules. The root is the goal; the leaves are axioms or discharged assumptions.

Core Inference Rules

Rule NameFormal RuleMeaningExample
Modus Ponens (→E)α, α→β ⊢ βIf α and "if α then β", derive βHasFever, HasFever→Sick ⊢ Sick
Modus Tollens (MT)α→β, ¬β ⊢ ¬αIf "if α then β" and not β, then not αHuman→Mortal, ¬Mortal ⊢ ¬Human
And-Introduction (∧I)α, β ⊢ α∧βCombine two facts into a conjunctionFever, Cough ⊢ Fever∧Cough
And-Elimination (∧E)α∧β ⊢ α (or β)Extract either component of a conjunctionFever∧Cough ⊢ Fever
Or-Introduction (∨I)α ⊢ α∨βKnown fact can be disjuncted with anythingFever ⊢ Fever∨Cough
Or-Elimination (∨E)α∨β, α→γ, β→γ ⊢ γIf both disjuncts lead to γ, derive γCase analysis
Universal Instantiation (UI)∀x φ(x) ⊢ φ(c)Substitute any constant for the variable∀x Human(x)→Mortal(x), Human(tom) ⊢ Mortal(tom)
Existential Introduction (EI)φ(c) ⊢ ∃x φ(x)From a specific fact, assert existenceFather(tom,bob) ⊢ ∃y Father(tom,y)
Reductio (RAA)¬α ⊢ ⊥ → αProof by contradiction — assume ¬α, derive falseBasis of resolution refutation
Worked Example Natural Deduction Proof — "Tom is mortal"

Premises:
P1: ∀x Human(x) → Mortal(x) (All humans are mortal)
P2: Human(tom) (Tom is human)

Goal: Mortal(tom)

Natural Deduction Proof Tree — Mortal(tom) ∀x Human(x)→Mortal(x) P1 (premise) Human(tom)→Mortal(tom) UI: P1 with x=tom Human(tom) P2 (premise) Mortal(tom) →E (Modus Ponens) ✓ QED →E Proof in Sequent Style 1. ∀x H(x)→M(x) (P1) 2. Human(tom) (P2) 3. H(tom)→M(tom) (UI,1) 4. Mortal(tom) (MP,3,2) ∴ Mortal(tom) QED ■
Figure 4.1 — Natural deduction proof tree for Mortal(tom). Two rules applied: Universal Instantiation (UI) to specialise the general rule, then Modus Ponens (→E) to derive the conclusion.

Extended Example — Chain of Deductions

-- Additional Premises --
P3: ∀x Mortal(x) → WillDie(x)     -- all mortals will die
P4: ∀x WillDie(x) → HasFiniteLife(x) -- dying implies finite life

-- Proof of HasFiniteLife(tom) --
1. Human(tom)              (P2)
2. Human(tom)→Mortal(tom)  (UI from P1, x=tom)
3. Mortal(tom)             (→E from 2,1)
4. Mortal(tom)→WillDie(tom) (UI from P3, x=tom)
5. WillDie(tom)            (→E from 4,3)
6. WillDie(tom)→HasFiniteLife(tom) (UI from P4)
7. HasFiniteLife(tom)      (→E from 6,5) ■

Natural Deduction vs. Resolution — Comparison

FeatureNatural DeductionResolution
StyleHuman-readable; mirrors mathematical proofsMechanical; hard for humans to follow
Input formAny FOL sentenceMust be in CNF (clausal form)
RulesMany rules — one per connective (intro + elim)Single rule — resolution + unification
StrategyForward (from axioms) or backward (from goal)Refutation — always by contradiction
Completeness✅ Complete for FOL✅ Complete for FOL
AutomationHard to automate (many rule choices)Easy to automate (one rule, systematic)
Best forHuman understanding, textbook proofsAutomated theorem proving, Prolog
🎯 Quick Check: In natural deduction, Universal Instantiation (UI) allows deriving φ(c) from ∀x φ(x). Which of the following is a VALID application of UI?
✅ Correct! UI says: from ∀x φ(x), substitute any specific constant c for x to get φ(c). Option B: substituting john for x in ∀x (Doctor(x)→Person(x)) gives Doctor(john)→Person(john). Option A is backwards (Existential Introduction, not UI). Option C is invalid — from ∃x Person(x) you can only derive Person(c) for a NEW constant c (Existential Elimination), not for any specific named constant. Option D is backwards (you cannot generalise a specific fact to a universal).
Section 05

Probabilistic Reasoning & Bayesian Networks

The world is not black and white. A patient with fever might have pneumonia — but also flu, malaria, or a dozen other conditions. Classical logic forces every proposition to be true or false, which fails the moment our evidence is incomplete or noisy. Probabilistic reasoning replaces binary truth values with degrees of belief — numbers between 0 and 1 that quantify how strongly the evidence supports each hypothesis.

Probability Foundations for AI

Key Probability Rules
Fundamental Rules Product rule: P(A ∧ B) = P(A | B) · P(B) Sum rule: P(A ∨ B) = P(A) + P(B) − P(A ∧ B) Complement: P(¬A) = 1 − P(A) Marginalisation: P(A) = Σ_b P(A | B=b) · P(B=b) Bayes' Theorem (the most important rule in probabilistic AI): P(H | E) = P(E | H) · P(H) / P(E) ────────────────────────── Prior: P(H) — belief before seeing evidence Likelihood: P(E | H) — how likely is E given H is true? Posterior: P(H | E) — updated belief after seeing E Evidence: P(E) — normalising constant
Worked Example Bayes' Theorem — Medical Diagnosis

A patient tests positive for a rare disease (prevalence 1%). The test has 95% sensitivity (true positive rate) and 90% specificity (true negative rate = 10% false positive rate).

Calculation P(Disease) = 0.01 ← prior (prevalence) P(Test+ | Disease) = 0.95 ← sensitivity (likelihood) P(Test+ | ¬Disease) = 0.10 ← false positive rate P(Test+) = P(Test+|Disease)·P(Disease) + P(Test+|¬Disease)·P(¬Disease) = 0.95×0.01 + 0.10×0.99 = 0.0095 + 0.099 = 0.1085 P(Disease | Test+) = (0.95 × 0.01) / 0.1085 = 0.0095 / 0.1085 ≈ 0.0876 = 8.76%
Counterintuitive Result

Despite a 95% accurate test, a positive result means only an 8.76% chance of actually having the disease! This is the base rate fallacy — the low prior (1% prevalence) overwhelms the test sensitivity. Bayesian reasoning is essential to avoid medical overdiagnosis.

Bayesian Networks — Structure and Semantics

Bayesian Network (Belief Network)

A Bayesian Network is a directed acyclic graph (DAG) where:

  • Nodes represent random variables (X₁, X₂, …, Xₙ)
  • Directed edges represent direct causal/probabilistic dependencies (X → Y means X has a direct influence on Y)
  • Each node Xᵢ has a Conditional Probability Table (CPT) — P(Xᵢ | Parents(Xᵢ))
  • The joint distribution factors as: P(X₁,…,Xₙ) = ∏ᵢ P(Xᵢ | Parents(Xᵢ))

This factorisation exploits conditional independence — variables not connected don't affect each other — drastically reducing the number of probabilities needed.

Bayesian Network — Medical Diagnosis (Chest Clinic Example) Smoking (S) P(S=T)=0.30 Pollution (Po) P(Po=High)=0.10 Cancer (C) CPT on S, Po Bronchitis (B) CPT on S Dyspnoea (D) CPT on C, B X-Ray (X) CPT on C P(Cancer | Smoking, Pollution) S=T, Po=High: 0.05 S=T, Po=Low: 0.02 S=F, Po=High: 0.03 S=F, Po=Low: 0.001 P(B | Smoking) S=T: 0.60 S=F: 0.30 P(S,Po,C,B,D,X) = P(S)·P(Po)·P(C|S,Po)·P(B|S)·P(D|C,B)·P(X|C)
Figure 5.1 — Bayesian network for chest clinic diagnosis (based on Lauritzen & Spiegelhalter 1988). Five nodes; green = root variables (prior probabilities); red/yellow/blue = conditional variables (need CPTs). The joint distribution factorises into five local CPTs.

Conditional Probability Tables (CPTs)

Worked Example Full CPT Specification and Joint Probability Calculation

CPT for Dyspnoea (D | Cancer, Bronchitis)

Cancer (C)Bronchitis (B)P(D=True)P(D=False)
TrueTrue0.900.10
TrueFalse0.700.30
FalseTrue0.800.20
FalseFalse0.100.90

Computing a Joint Probability

What is P(S=T, Po=Low, C=T, B=T, D=T, X=T)?

Joint Probability Calculation P(S=T) = 0.30 P(Po=Low) = 0.90 P(C=T|S=T,Po=Low) = 0.02 P(B=T|S=T) = 0.60 P(D=T|C=T,B=T) = 0.90 P(X=T|C=T) = 0.90 (from CPT for X-Ray) Joint = 0.30 × 0.90 × 0.02 × 0.60 × 0.90 × 0.90 = 0.30 × 0.90 × 0.02 × 0.60 × 0.81 ≈ 0.00262

Probabilistic Inference — P(Cancer | Dyspnoea=True)

Using Bayes' theorem + marginalisation (summing over all other variables):

Posterior Probability P(C=T | D=T) = P(D=T | C=T) · P(C=T) / P(D=T) P(D=T | C=T) computed by marginalising over B: = P(D=T|C=T,B=T)·P(B=T) + P(D=T|C=T,B=F)·P(B=F) = 0.90 × P(B=T) + 0.70 × P(B=F) After full calculation (summing all configurations): P(C=T | D=T) ≈ 0.156 (15.6% chance of cancer given dyspnoea) P(C=F | D=T) ≈ 0.844

D-Separation — Conditional Independence in Bayesian Networks

D-Separation

Two sets of nodes X and Y are d-separated by a set Z if every path between X and Y is "blocked" by Z. D-separated nodes are conditionally independent given Z: P(X|Y,Z) = P(X|Z).

Three path types and their blocking rules:

  • Chain (A→B→C): Blocked if B is observed. Information flows A↔C unless B is known.
  • Fork (A←B→C): Blocked if B is observed. B is a common cause; knowing B blocks correlation between A and C.
  • Collider (A→B←C): Blocked if B is NOT observed. Observing B (or its descendant) OPENS the path — "explaining away."
Chain A→B→C
Block: observe B
Smoking→Cancer→XRay: knowing Cancer blocks the Smoking–XRay path. Given Cancer, XRay is independent of Smoking.
Fork A←B→C
Block: observe B
Cancer←Smoking→Bronchitis: knowing Smoking blocks Cancer–Bronchitis correlation. Smoking "explains" both.
Collider A→B←C
Opens: observe B
Cancer→Dyspnoea←Bronchitis: observing Dyspnoea creates dependence between Cancer and Bronchitis (explaining away).
Explaining Away
P(C|D,B) ≠ P(C|D)
Knowing Dyspnoea AND Bronchitis reduces the probability of Cancer — Bronchitis "explains away" the dyspnoea, making cancer less likely.
🎯 Quick Check: In a Bayesian network with 5 binary variables, a full joint probability table requires 2⁵−1 = 31 independent numbers. How many numbers does the Bayesian network in Figure 5.1 require (counting all CPT entries)?
✅ Correct reasoning! The Bayesian network needs far fewer numbers than the full joint table (31). Counting independent parameters: P(S)=1, P(Po)=1, P(C|S,Po)=4 (2×2 parent combinations, one row entry each), P(B|S)=2, P(D|C,B)=4, P(X|C)=2 — total = 14 table entries, but since each row sums to 1, only 7 independent values. The full joint table needs 31. This compression is why Bayesian networks are practical — they exploit conditional independence to reduce the representation from exponential to linear in the number of parents.
Section 06

Dempster-Shafer Theory

Bayesian probability requires a prior for every hypothesis — but what if we genuinely have no information about some possibilities? Bayesian methods cannot distinguish "I assign 50% probability because of equal evidence" from "I assign 50% because I have absolutely no idea." Dempster-Shafer Theory (DST) solves this by separating belief (what we positively know) from ignorance (what we simply don't know yet), using a richer mathematical structure than single probability values.

DST was developed by Arthur Dempster (1967) and formalised by Glenn Shafer (1976). It is used in sensor fusion, legal reasoning, and medical diagnosis where evidence may be incomplete or contradictory.

Frame of Discernment (Θ)

The frame of discernment Θ is the exhaustive, mutually exclusive set of all possible hypotheses for a problem. DST assigns basic probability assignments (bpa / mass functions) to subsets of Θ, not just individual elements.

Basic Probability Assignment m : 2^Θ → [0,1] m(∅) = 0 ← no mass on empty set Σ_{A⊆Θ} m(A) = 1 ← all mass sums to 1 m(A) = mass assigned to focal element A m({H}) = specific belief in exactly H m(Θ) = mass assigned to total ignorance (we know nothing)
Worked Example DST Medical Diagnosis — Three Possible Diseases

Frame of Discernment: Θ = {Pneumonia (P), Bronchitis (B), Flu (F)}

Subsets of Θ: ∅, {P}, {B}, {F}, {P,B}, {P,F}, {B,F}, {P,B,F}

Evidence Source 1: Symptom Analysis (fever + cough)

Focal ElementMass m₁Interpretation
{Pneumonia}0.60Strong evidence toward Pneumonia
{Flu}0.10Weak evidence toward Flu
{Pneumonia, Bronchitis}0.20Evidence points to lung condition
{P, B, F} = Θ (total ignorance)0.1010% of mass is unallocated — we simply don't know
Total1.00

Evidence Source 2: X-Ray Result (consolidation)

Focal ElementMass m₂Interpretation
{Pneumonia}0.80X-ray strongly supports Pneumonia
{Bronchitis}0.05Slight evidence for Bronchitis
Θ (ignorance)0.1515% unallocated — X-ray not conclusive
Total1.00

Dempster's Rule of Combination

Dempster's Combination Rule m₁₂(C) = [Σ_{A∩B=C} m₁(A)·m₂(B)] / (1 − K) where K = Σ_{A∩B=∅} m₁(A)·m₂(B) ← conflict factor Compute intersections (A from m₁, B from m₂): {P} ∩ {P} = {P}: 0.60×0.80 = 0.480 {P} ∩ {B} = ∅: 0.60×0.05 = 0.030 ← CONFLICT {P} ∩ Θ = {P}: 0.60×0.15 = 0.090 {F} ∩ {P} = ∅: 0.10×0.80 = 0.080 ← CONFLICT {F} ∩ {B} = ∅: 0.10×0.05 = 0.005 ← CONFLICT {F} ∩ Θ = {F}: 0.10×0.15 = 0.015 {P,B} ∩ {P} = {P}: 0.20×0.80 = 0.160 {P,B} ∩ {B} = {B}: 0.20×0.05 = 0.010 {P,B} ∩ Θ = {P,B}: 0.20×0.15 = 0.030 Θ ∩ {P} = {P}: 0.10×0.80 = 0.080 Θ ∩ {B} = {B}: 0.10×0.05 = 0.005 Θ ∩ Θ = Θ: 0.10×0.15 = 0.015 K (total conflict) = 0.030 + 0.080 + 0.005 = 0.115 Normalisation: 1/(1−K) = 1/(1−0.115) = 1/0.885 ≈ 1.130

Combined Mass (after normalisation)

Focal ElementRaw Summ₁₂ (normalised ÷0.885)
{Pneumonia}0.480+0.090+0.160+0.080 = 0.8100.810/0.885 ≈ 0.915
{Bronchitis}0.010+0.005 = 0.0150.015/0.885 ≈ 0.017
{Flu}0.0150.015/0.885 ≈ 0.017
{P,B}0.0300.030/0.885 ≈ 0.034
Θ0.0150.015/0.885 ≈ 0.017
Total0.885≈ 1.000

Belief and Plausibility Functions

Belief (Bel) and Plausibility (Pl)

From any mass function m, two derived measures bound a proposition A:

Belief and Plausibility — Bounds on Probability Bel(A) = Σ_{B⊆A} m(B) ← sum of mass of all subsets of A = lower bound on P(A) = "certainly committed to A" Pl(A) = Σ_{B∩A≠∅} m(B) ← sum of mass of all sets overlapping A = upper bound on P(A) = "not yet ruled out for A" Key relationship: Bel(A) ≤ P(A) ≤ Pl(A) Ignorance interval: [Bel(A), Pl(A)] — wider = more ignorance For our combined result on Pneumonia: Bel({P}) = m({P}) = 0.915 ← strong belief Pl({P}) = m({P})+m({P,B})+m(Θ) = 0.915+0.034+0.017 = 0.966 → P(Pneumonia) ∈ [0.915, 0.966] ← very confident interval
FeatureBayesian ProbabilityDempster-Shafer Theory
Mass assigned toIndividual hypotheses onlyAny subset of Θ (including sets of hypotheses)
IgnoranceMust be spread as a priorExplicit as m(Θ) — separate from belief
CombinationBayes' theorem requires likelihoodDempster's rule — purely multiplicative, no likelihood needed
OutputSingle probability P(H)Interval [Bel(H), Pl(H)] — richer representation
ConsistencyAlways consistent (axioms of probability)Conflict K must be <1 or combination fails
Best forWell-specified prior knowledgeSensor fusion, legal evidence, incomplete data
🎯 Quick Check: In Dempster-Shafer theory, assigning m(Θ) = 0.40 (where Θ is the full frame of discernment) means:
✅ Correct! m(Θ)=0.40 means 40% of the evidential mass is assigned to the entire frame — representing complete ignorance for that portion of the evidence. This is fundamentally different from a uniform Bayesian prior: a uniform prior distributes 40% equally among n hypotheses (each gets 40%/n), still committing to specific beliefs. In DST, m(Θ)=0.40 says "for 40% of the evidence, we simply cannot say anything — it could be any element of Θ." This honest representation of ignorance is DST's key advantage over Bayesian methods.
Section 07

Fuzzy Sets & Fuzzy Logic

Classical set theory is binary: an element either belongs to a set or it doesn't. Either a temperature is "high" or it isn't. But humans naturally think in gradations — 38°C is "slightly high", 40°C is "very high", 42°C is "dangerously high." Fuzzy set theory (Zadeh, 1965) formalises this by replacing the crisp membership function {0,1} with a continuous membership function μ: X → [0,1].

Fuzzy logic builds reasoning on top of fuzzy sets, capturing the vagueness inherent in natural language. It powers everything from washing machine sensors to aircraft autopilots to medical expert systems.

Fuzzy Set

A fuzzy set A in universe of discourse X is defined by a membership function μ_A : X → [0,1], where μ_A(x) = 1 means x fully belongs to A, μ_A(x) = 0 means x definitely does not belong, and 0 < μ_A(x) < 1 means x partially belongs with that degree of membership.

The set is written: A = {(x, μ_A(x)) | x ∈ X}

Fuzzy Membership Functions — Temperature as Linguistic Variable 0 0.5 1.0 μ(x) 35 36 37 37.5 38 39 40 41°C Normal Low Fever High Fever 38.5°C μ_LF=0.35 μ_HF=0.50 μ_N=0.00 Normal Low Fever High Fever
Figure 7.1 — Fuzzy membership functions for temperature. At 38.5°C: Normal=0.00, Low Fever=0.35, High Fever=0.50. A temperature simultaneously belongs to multiple sets with different degrees — this is the essence of fuzzy logic.

Fuzzy Set Operations

Fuzzy Set Operations (Zadeh's Definitions) Union (A OR B): μ_{A∪B}(x) = max(μ_A(x), μ_B(x)) Intersection (A AND B): μ_{A∩B}(x) = min(μ_A(x), μ_B(x)) Complement (NOT A): μ_{¬A}(x) = 1 − μ_A(x) Example at x = 38.5°C: μ_LowFever(38.5) = 0.35, μ_HighFever(38.5) = 0.50 LF OR HF: max(0.35, 0.50) = 0.50 LF AND HF: min(0.35, 0.50) = 0.35 NOT LF: 1 − 0.35 = 0.65
Worked Example Fuzzy Inference System — Medical Fever Treatment

A fuzzy inference system decides treatment urgency based on temperature and duration. We use Mamdani fuzzy inference — the most common type.

Step 1: Fuzzification (Crisp Input → Fuzzy Degrees)

Patient: Temperature = 38.5°C, Duration = 2 days

Input VariableLinguistic ValueMembership Degree
Temperature = 38.5°CLow Feverμ = 0.35
Temperature = 38.5°CHigh Feverμ = 0.50
Duration = 2 daysShortμ = 0.60
Duration = 2 daysMediumμ = 0.40

Step 2: Rule Evaluation (Fuzzy Rules)

Rule 1: IF temp is HighFever AND duration is Medium
        THEN urgency is High
        Activation: min(0.50, 0.40) = 0.40

Rule 2: IF temp is HighFever AND duration is Short
        THEN urgency is Medium
        Activation: min(0.50, 0.60) = 0.50

Rule 3: IF temp is LowFever AND duration is Short
        THEN urgency is Low
        Activation: min(0.35, 0.60) = 0.35

Step 3: Aggregation — Combine Rule Outputs

Each rule clips the output membership function at its activation level. The three clipped fuzzy sets (High=0.40, Medium=0.50, Low=0.35) are combined using max (union).

Step 4: Defuzzification (Fuzzy → Crisp Output)

The Centroid method (Centre of Gravity) computes the centroid of the aggregated output area:

Centroid Defuzzification Urgency* = Σ(μ_i × x_i) / Σ(μ_i) Approximating with rule centroids: High urgency centre ≈ 80, activation = 0.40 Medium urgency centre ≈ 50, activation = 0.50 Low urgency centre ≈ 20, activation = 0.35 Urgency* = (0.40×80 + 0.50×50 + 0.35×20) / (0.40+0.50+0.35) = (32 + 25 + 7) / 1.25 = 64 / 1.25 = 51.2 → Medium-High urgency
Result

Urgency score = 51.2 out of 100 → Moderate urgency. Recommend: antipyretics, monitor for 24 hours, return if fever rises above 39.5°C or duration exceeds 3 days. The fuzzy system gives a nuanced, graduated response rather than a binary "urgent / not urgent."

Linguistic Variables and Hedges

Linguistic Variable

A linguistic variable takes linguistic values (words) as its values, not numbers. Each linguistic value is defined by a membership function. For example, the linguistic variable "Temperature" may take values: {Very Low, Low, Normal, High, Very High}.

Linguistic hedges modify membership functions: very A = μ_A(x)², somewhat A = √μ_A(x), not A = 1 − μ_A(x). These allow nuanced expressions like "very high fever" or "somewhat short duration."

Linguistic Hedge Operations very A: μ_{very A}(x) = [μ_A(x)]² (concentration) somewhat A: μ_{somewhat A}(x) = √μ_A(x) (dilation) not A: μ_{not A}(x) = 1 − μ_A(x) (complement) Example: μ_HighFever(38.5°C) = 0.50 very HighFever: 0.50² = 0.25 (less membership — more extreme) somewhat HighFever: √0.50 = 0.71 (more membership — broader) not HighFever: 1−0.50 = 0.50

Comparison: Bayesian vs. Dempster-Shafer vs. Fuzzy Logic

AspectBayesian ProbabilityDempster-ShaferFuzzy Logic
ModelsUncertainty (random events)Ignorance + uncertaintyVagueness (linguistic imprecision)
ValuesSingle probability P(H)Interval [Bel, Pl]Membership degree μ ∈ [0,1]
ComplementP(¬A) = 1−P(A)Pl(¬A) = 1−Bel(A)μ_{¬A}(x) = 1−μ_A(x)
CombinationBayes' theoremDempster's ruleMin/Max operators
Prior requiredYes — must specify P(H)No — can assign mass to ΘNo — defines membership functions
OutputPosterior probabilityBelief + Plausibility intervalCrisp value via defuzzification
Best applicationMedical diagnosis, spam filterSensor fusion, legal evidenceControl systems, natural language
🎯 Quick Check: The "very" hedge in fuzzy logic is defined as μ_{very A}(x) = [μ_A(x)]². If μ_Tall(John) = 0.7, what is μ_{very Tall}(John), and what does squaring represent conceptually?
✅ Correct! μ_{very Tall}(John) = 0.7² = 0.49. Squaring a value in [0,1] always makes it smaller (or equal at 0 and 1) — this models the intuition that "very tall" is a more extreme, concentrated version of "tall." To score 0.7 on "very tall," you need 0.7=μ_Tall² → μ_Tall=√0.7≈0.84 — you must be 84% tall just to be 70% "very tall." This concentration effect is exactly how humans use the hedge "very." The dilation hedge "somewhat" (√μ) does the opposite — broadens the set.
Section 08

Exam Preparation Summary

This section consolidates every formula, rule, algorithm, and comparison from Unit IV. Work through all tables and the final challenge quiz before your exam.

★ Predicate Logic — All Key Rules

Rule / ConceptFormal StatementExample
Universal Instantiation∀x φ(x) ⊢ φ(c) for any constant c∀x Human(x)→Mortal(x), Human(tom) ⊢ Mortal(tom)
Existential Introductionφ(c) ⊢ ∃x φ(x)Father(tom,bob) ⊢ ∃y Father(tom,y)
Modus Ponensα, α→β ⊢ βHasFever, HasFever→Sick ⊢ Sick
Modus Tollensα→β, ¬β ⊢ ¬αHuman→Mortal, ¬Mortal ⊢ ¬Human
ISA Transitivity∀x A(x)→B(x), ∀x B(x)→C(x) ⊢ ∀x A(x)→C(x)Doctor→Person→Entity ⊢ Doctor→Entity
Resolution RuleP∨α, ¬P∨β ⊢ α∨β{¬Person(x)∨Mortal(x)}, {Person(tom)} ⊢ {Mortal(tom)}
FOL Translation"All A is B" → ∀x A(x)→B(x) · "Some A is B" → ∃x A(x)∧B(x)Universal uses →; Existential uses ∧

★ Resolution — CNF Steps

Step 1
Eliminate →
Replace α→β with ¬α∨β. Replace α↔β with (¬α∨β)∧(¬β∨α).
Step 2
Push ¬ Inward
De Morgan: ¬(A∧B)→¬A∨¬B; ¬(A∨B)→¬A∧¬B; ¬¬A→A; ¬∀→∃¬; ¬∃→∀¬.
Steps 3–4
Standardise + Skolemise
Rename variables (each quantifier unique). Replace ∃y with Skolem function f(x) where x are free universal variables.
Steps 5–6
Drop ∀ → CNF
Drop all remaining ∀ (variables implicitly universal). Distribute ∨ over ∧ to produce clauses.

★ Probabilistic Reasoning — Key Formulas

FormulaNameUse
P(H|E) = P(E|H)·P(H) / P(E)Bayes' TheoremUpdate belief after observing evidence E
P(A) = Σ_b P(A|B=b)·P(B=b)MarginalisationEliminate nuisance variable B
P(X₁…Xₙ) = ∏ᵢ P(Xᵢ|Parents(Xᵢ))Bayesian Net FactorisationJoint = product of local CPTs
Bel(A) = Σ_{B⊆A} m(B)Belief Function (DST)Lower bound on probability of A
Pl(A) = Σ_{B∩A≠∅} m(B)Plausibility (DST)Upper bound on probability of A
m₁₂(C) = Σ_{A∩B=C} m₁(A)m₂(B) / (1−K)Dempster's RuleCombine two independent evidence sources
μ_{A∪B}(x) = max(μ_A, μ_B)Fuzzy UnionOR operation in fuzzy logic
μ_{A∩B}(x) = min(μ_A, μ_B)Fuzzy IntersectionAND operation in fuzzy logic
μ_{¬A}(x) = 1 − μ_A(x)Fuzzy ComplementNOT operation in fuzzy logic
very A: [μ_A]² · somewhat A: √μ_ALinguistic HedgesConcentration (very) and dilation (somewhat)

★ Fuzzy Inference — Four Steps

1. Fuzzification
crisp → μ values
Map crisp inputs to membership degrees for each linguistic term using the membership functions. e.g., Temperature=38.5°C → μ_LowFever=0.35, μ_HighFever=0.50.
2. Rule Evaluation
IF-THEN with min/max
Apply fuzzy rules. For AND conditions: take minimum of antecedent membership degrees. For OR conditions: take maximum. Each rule fires with an activation level.
3. Aggregation
max over all rules
Combine outputs from all rules using max (union). Each rule's output is clipped at its activation level; all clipped sets are merged into one aggregate fuzzy output.
4. Defuzzification
Centroid: Σ(μ·x)/Σ(μ)
Convert fuzzy output to a crisp number. Most common method: Centre of Gravity (centroid). Others: Mean of Maximum, Largest of Maximum. Produces an actionable numeric output.

Common Exam Mistakes

Watch Out!

Mistake 1: Writing ∃x A(x)→B(x) when you mean "some A is B." Correct: ∃x A(x)∧B(x). The implication form is nearly always wrong for existential statements.

Mistake 2: Forgetting to negate the goal in resolution. Resolution proves P by assuming ¬P and deriving □ — always add ¬Goal to the KB first.

Mistake 3: Confusing Belief (Bel) and Plausibility (Pl) in DST. Bel(A) uses only subsets OF A; Pl(A) uses all sets that INTERSECT A. Bel ≤ Pl always.

Mistake 4: Saying fuzzy logic handles uncertainty — it handles vagueness (imprecise language). Bayesian probability handles uncertainty (random events). These are different problems.

Mistake 5: Using min for fuzzy OR and max for fuzzy AND. It's: AND=min, OR=max, NOT=1−μ.

Mistake 6: Confusing Skolem function with a constant. A Skolem function depends on ALL universally quantified variables in scope. If ∀x ∃y, replace y with f(x). If ∃y alone, replace with constant c.

One-Line Summaries

FOL Translation
∀ uses →, ∃ uses ∧
The single most tested rule. "All A is B" = ∀x A(x)→B(x). "Some A is B" = ∃x A(x)∧B(x).
ISA
∀x A(x)→B(x)
Every ISA link is a universal implication. Transitivity gives inheritance chains. Instance = ground atom.
Resolution
Negate goal → □
Convert to CNF → add ¬Goal → resolve until empty clause □ → QED. Unification matches variables.
Bayes' Theorem
P(H|E)=P(E|H)P(H)/P(E)
Low prior dominates even good tests (base rate fallacy). Always compute P(E) by marginalisation.
DST vs. Bayesian
Bel ≤ P ≤ Pl
DST separates belief from ignorance (m(Θ)). Bayesian forces all mass onto specific hypotheses.
Fuzzy Logic
Fuzz → Rules → Defuzz
4 steps: Fuzzify → Evaluate rules (min/max) → Aggregate → Defuzzify (centroid). Models vagueness.

Challenge Quiz

🎯 Challenge: A fire detection system uses three sensors. Sensor 1 (heat): m₁({Fire})=0.70, m₁(Θ)=0.30. Sensor 2 (smoke): m₂({Fire})=0.60, m₂({NoCause})=0.10, m₂(Θ)=0.30. After applying Dempster's rule, the combined Bel({Fire})≈0.88 and conflict K≈0.07. A second engineer says: "We should use Bayesian updating instead — just set P(Fire)=0.88." What is the fundamental conceptual error in the engineer's suggestion?
✅ Correct! The key distinction: in DST, Bel({Fire})=0.88 and Pl({Fire})≈0.94 means we're confident in fire but there remains some residual ignorance (mass on Θ). The interval [0.88, 0.94] honestly represents both our evidence AND our uncertainty about that evidence. Setting P(Fire)=0.88 in a Bayesian framework treats this as a precise probability, implying we're equally certain about "fire" and "no fire" at this level — collapsing the distinction between "strong evidence FOR fire" and "absence of evidence AGAINST fire." In safety-critical systems (fire, nuclear, medical), this distinction is crucial: [Bel=0.88, Pl=0.94] should trigger an alarm with a safety margin; P=0.88 might not if the threshold is set at 0.90.