CS621: Artificial Intelligence
Pushpak Bhattacharyya
CSE Dept.,
IIT Bombay
Lecture 38: Fuzzy Logic
Uncertainty Studies
Uncertainty Study
Qualitative
Reasoning
Probability Based
Probabilistic
Reasoning
Information Theory
based
Markov
Processes
& Graphical
Models
Bayesian Belief Network
Entropy
Centric
Algos
Fuzzy Logic Based
Outlook
(0)
Temp
(T)
Humidit
y
(H)
Windy
(W)
Decision
to play
(D)
Sunny
Sunny
Cloudy
Rain
Rain
Rain
Cloudy
High
High
High
Med
Cold
Cold
Cold
High
High
High
High
Low
Low
Low
F
T
F
F
N
T
T
N
N
Y
Y
Y
N
Y
To-play-or-not-to-play-tennis data vs. Climatic-Condition from
Ross Quinlan’s paper on ID3 (1986), C4.5 (1993)
Weather
(0)
Temp
(T)
Humidit
y
(H)
Windy
(W)
Decision
(D)
Sunny
Med
High
F
N
Sunny
Cold
Low
F
Y
Rain
Med
Low
F
Y
Sunny
Med
Low
T
Y
Cloudy
Med
High
T
Y
Cloudy
High
Low
F
Y
Rain
High
High
T
N
Outlook
Sunny
Humidity
Cloudy
Rain
Yes
Windy
High
Low
T
No
Yes
No
F
Yes
Rule Base
R1: If outlook is sunny and if humidity is high
then Decision is No.
R2: If outlook is sunny and if humidity is low
then Decision is Yes.
R3: If outlook is cloudy then Decision is Yes.
Fuzzy Logic
Fuzzy Logic tries to capture the
human ability of reasoning with
imprecise information
Models Human Reasoning
Works with imprecise statements such as:
In a process control situation, “If the
temperature is moderate and the pressure is
high, then turn the knob slightly right”
The rules have “Linguistic Variables”, typically
adjectives qualified by adverbs (adverbs are
hedges).
Underlying Theory: Theory of
Fuzzy Sets
Intimate connection between logic and set theory.
Given any set ‘S’ and an element ‘e’, there is a very
natural predicate, μs(e) called as the belongingness
predicate.
The predicate is such that,
μs(e) = 1,
iff e ∈ S
= 0,
otherwise
For example, S = {1, 2, 3, 4}, μs(1) = 1 and μs(5) =
0
A predicate P(x) also defines a set naturally.
S = {x | P(x) is true}
For example, even(x) defines S = {x | x is even}
Fuzzy Set Theory (contd.)
Fuzzy set theory starts by questioning the
fundamental assumptions of set theory viz., the
belongingness predicate, μ, value is 0 or 1.
Instead in Fuzzy theory it is assumed that,
μs(e) = [0, 1]
Fuzzy set theory is a generalization of classical set
theory also called Crisp Set Theory.
In real life belongingness is a fuzzy concept.
Example: Let, T = set of “tall” people
μT (Ram) = 1.0
μT (Shyam) = 0.2
Shyam belongs to T with degree 0.2.
Linguistic Variables
Fuzzy sets are named
by Linguistic Variables
(typically adjectives). μtall(h)
Underlying the LV is a
numerical quantity
1
E.g. For ‘tall’ (LV),
‘height’ is numerical
quantity.
Profile of a LV is the
plot shown in the figure
0
shown alongside.
0.4
4.5
1
2
3
4
height h
5
6
Example Profiles
μpoor(w)
μrich(w)
wealth w
wealth w
Example Profiles
μA (x)
μA (x)
x
Profile representing
moderate (e.g. moderately rich)
x
Profile representing
extreme
Concept of Hedge
Hedge is an intensifier
Example:
LV = tall, LV1 = very
tall, LV2 = somewhat
tall
‘very’ operation:
μvery tall(x) = μ2tall(x)
‘somewhat’ operation:
μsomewhat tall(x) = √(μtall(x))
somewhat tall
tall
1
μtall(h)
0
very tall
h
Representation of Fuzzy sets
Let U = {x1,x2,…..,xn}
|U| = n
The various sets composed of elements from U are presented
as points on and inside the n-dimensional hypercube. The crisp
μA(x1)=0.3
sets are the corners of the hypercube.
μA(x2)=0.4
(0,1)
U={x1,x2}
(1,1)
x2
(x1,x2)
A(0.3,0.4)
x2
(1,0)
(0,0)
Φ
x1
x1
A fuzzy set A is represented by a point in the n-dimensional
space as the point {μA(x1), μA(x2),……μA(xn)}
Degree of fuzziness
The centre of the hypercube is the “most
fuzzy” set. Fuzziness decreases as one nears
the corners
Measure of fuzziness
Called the entropy of a fuzzy set
Fuzzy set
Farthest corner
E ( S ) d ( S , nearest ) / d ( S , farthest)
Entropy
Nearest corner
(0,1)
(1,1)
x2
(0.5,0.5)
A
d(A, nearest)
(0,0)
(1,0)
x1
d(A, farthest)
Definition
Distance between two fuzzy sets
n
d ( S1 , S 2 ) | s1 ( xi ) s2 ( xi ) |
i 1
L1 - norm
Let C = fuzzy set represented by the centre point
d(c,nearest) = |0.5-1.0| + |0.5 – 0.0|
=1
= d(C,farthest)
=> E(C) = 1
Definition
Cardinality of a fuzzy set
n
m( s ) s ( xi ) [generalization of cardinality of
i 1
classical sets]
Union, Intersection, complementation, subset hood
s s ( x) max[ s ( x), s ( x)]x U
1
2
1
2
s s ( x) min[ s ( x), s ( x)]x U
1
2
s ( x) 1 s ( x)
c
1
2
Note on definition by extension and intension
S1 = {xi|xi mod 2 = 0 } – Intension
S2 = {0,2,4,6,8,10,………..} – extension
How to define subset hood?
Meaning of fuzzy subset
Suppose, following classical set theory we say
A B
if
A ( x) B ( x)x
Consider the n-hyperspace representation of A and B
(0,1)
(1,1)
A
x2
Region where A ( x) B ( x)
. B1
.B2
.B3
(0,0)
x1
(1,0)
This effectively means
B P( A) CRISPLY
P(A) = Power set of A
Eg: Suppose
A = {0,1,0,1,0,1,…………….,0,1} – 104 elements
B = {0,0,0,1,0,1,……………….,0,1} – 104 elements
Isn’t B A with a degree? (only differs in the 2nd element)
Fuzzy definition of subset
Measured in terms of “fit violation”, i.e. violating the
condition A ( x) B ( x)
Degree of subset hood = 1- degree of superset hood
max( 0, A ( x) B ( x))
= x
1
m( A)
m(A) = cardinality of A
= A ( x)
x
We can show that E ( A) S ( A Ac , A Ac )
Exercise 1:
Show the relationship between entropy and subset hood
Exercise 2:
Prove that
S ( B, A) m( A B) / m( A)
Subset hood of B in A
Fuzzy sets to fuzzy logic
Forms the foundation of fuzzy rule based system or fuzzy expert system
Expert System
Rules are of the form
If
C1 C2 ...........Cn
then
Ai
Where Cis are conditions
Eg: C1=Colour of the eye yellow
C2= has fever
C3=high bilurubin
A = hepatitis
In fuzzy logic we have fuzzy predicates
Classical logic
P(x1,x2,x3…..xn) = 0/1
Fuzzy Logic
P(x1,x2,x3…..xn) = [0,1]
Fuzzy OR
P( x) Q( y ) max( P( x), Q( y ))
Fuzzy AND
P( x) Q( y ) min( P( x), Q( y ))
Fuzzy NOT
~ P( x) 1 P( x)
Fuzzy Implication
Many theories have been advanced and many
expressions exist
The most used is Lukasiewitz formula
t(P) = truth value of a proposition/predicate. In
fuzzy logic t(P) = [0,1]
t(P Q ) = min[1,1 -t(P)+t(Q)]
Lukasiewitz definition of implication
t ( P Q) min( t ( P), t (Q))
Eg: If pressure is high then Volume is low
t (high ( pressure ) low(volume))
High
Pressure
Pressure
Fuzzy Inferencing
Fuzzy Inferencing: illustration through inverted
pendulum control problem
Core
The Lukasiewitz rule
t( P Q ) = min[1,1 + t(P) – t(Q)]
An example
Controlling an inverted pendulum
.
θ
d / dt = angular velocity
Motor
i=current
The goal: To keep the pendulum in vertical position (θ=0)
in dynamic equilibrium. Whenever the pendulum departs
from vertical, a torque is produced by sending a current ‘i’
Controlling factors for appropriate current
Angle θ, Angular velocity θ
.
Some intuitive rules
.
If θ is +ve small and θ is –ve small
then current is zero
.
If θ is +ve small and θ is +ve small
then current is –ve medium
Control Matrix
.θ
-ve
med
-ve
small
Zero
-ve
small
+ve
med
+ve
small
Zero
Zero
+ve
small
Zero
-ve
small
+ve
small
Zero
-ve
small
-ve
med
θ
+ve
small
+ve
med
-ve
med
+ve
med
Region of
interest
Each cell is a rule of the form
.
If θ is <> and θ is <>
then i is <>
4 “Centre rules”
.
1. if θ = = Zero and θ = = Zero then i = Zero
.
2. if θ is +ve small and θ = = Zero then i is –ve small
.
3. if θ is –ve small and θ = = Zero then i is +ve small
.
4. if θ = = Zero and θ is +ve small then i is –ve small
.
5. if θ = = Zero and θ is –ve small then i is +ve small
Linguistic variables
1. Zero
2. +ve small
3. -ve small
Profiles
1
+ve small
-ve small
-ε3
-ε2
-ε
+ε
ε2
ε3
.
Quantity (θ, θ , i)
Inference procedure
.
1.
2.
3.
4.
5.
Read actual numerical values of θ and θ
Get the corresponding μ values μZero, μ(+ve small),
μ(-ve small). This is called FUZZIFICATION
For different rules, get the fuzzy I-values from
the R.H.S of the rules.
“Collate” by some method and get ONE current
value. This is called DEFUZZIFICATION
Result is one numerical value of ‘i’.
© Copyright 2026 Paperzz