# Lecture5---Fuzzy Logic

```Introduction to
Fuzzy Set Theory

Content








Fuzzy Sets
Set-Theoretic Operations
MF Formulation
Extension Principle
Fuzzy Relations
Linguistic Variables
Fuzzy Rules
Fuzzy Reasoning
Introduction to
Fuzzy Set Theory
Fuzzy Sets
Types of Uncertainty

Stochastic uncertainty
–

Linguistic uncertainty
–

E.g., rolling a dice
E.g., low price, tall people, young age
Informational uncertainty
–
E.g., credit worthiness, honesty
Crisp or Fuzzy Logic

Crisp Logic
–
A proposition can be true or false only.
•
•
–

Bob is a student (true)
Smoking is healthy (false)
The degree of truth is 0 or 1.
Fuzzy Logic
–
The degree of truth is between 0 and 1.
•
•
William is young (0.3 truth)
Ariel is smart (0.9 truth)
Crisp Sets

Classical sets are called crisp sets
–
either an element belongs to a set or not, i.e.,
x A

or
x A
Member Function of crisp set
0 x  A
 A ( x)  
1 x  A
 A ( x) 0,1
Crisp Sets
P : the set of all people.
Y : the set of all young people.
P
Y
Young   y y  age( x)  25, x  P
Young ( y )
1
25
y
Crisp sets
 A ( x) 0,1
Fuzzy Sets
 A ( x) [0,1]
Example
Young ( y )
1
y
Lotfi A. Zadeh, The founder of fuzzy logic.
Fuzzy Sets
L. A. Zadeh, “Fuzzy sets,” Information and Control,
vol. 8, pp. 338-353, 1965.
U : universe of discourse.
Definition:
Fuzzy Sets and Membership Functions
If U is a collection of objects denoted generically
by x, then a fuzzy set A in U is defined as a set of
ordered pairs:
A  ( x,  A ( x)) x  U 
membership
function
 A : U  [0,1]
Example (Discrete Universe)
# courses a student
may take in a semester.
U  {1, 2,3, 4,5, 6, 7,8}
 (1, 0.1) (2, 0.3) (3, 0.8) (4,1) 
A

(5,
0.9)
(6,
0.5)
(7,
0.2)
(8,
0.1)


1
 A ( x)
0.5
0
2
4
6
x : # courses
8
appropriate
# courses taken
Example (Discrete Universe)
U  {1, 2,3, 4,5, 6, 7,8}
# courses a student
may take in a semester.
 (1, 0.1) (2, 0.3) (3, 0.8) (4,1) 
A

(5,
0.9)
(6,
0.5)
(7,
0.2)
(8,
0.1)


appropriate
# courses taken
Alternative Representation:
A  0.1/ 1  0.3/ 2  0.8/ 3 1.0/ 4  0.9/ 5  0.5/ 6  0.2/ 7  0.1/ 8
Example (Continuous Universe)
possible ages
U : the set of positive real numbers
B  ( x,  B ( x)) x  U 
 B ( x) 
1
 x  50 
1 

 5 
4
1.2
1
Alternative
Representation:
B
 B ( x)
0.8
0.6
0.4
0.2
1
R  1 x550 
4
x
0
0
20
40
60
x : age
80
100
Alternative Notation
A  ( x,  A ( x)) x  U 
U : discrete universe
A

xi U
U : continuous universe
A
( xi ) / xi
A    A ( x) / x
U
Note that  and integral signs stand for the union of
membership grades; “ / ” stands for a marker and does not imply
division.
Membership Functions (MF’s)
A fuzzy set is completely characterized by
a membership function.
–
–
a subjective measure.
not a probability measure.
Membership
value

“tall” in Asia
1
“tall” in USA
0
“tall” in NBA
5’10”
height
Fuzzy Partition

Fuzzy partitions formed by the linguistic
values “young”, “middle aged”, and “old”:
MF Terminology
cross points
1
MF
0.5

0
core
width
-cut
support
x
More Terminologies

Normality
–

Fuzzy singleton
–


support one single point
Fuzzy numbers
–

core non-empty
fuzzy set on real line R that satisfies convexity and
normality
Symmetricity
 A (c  x)   A (c  x), x U
Open left or right, closed
lim  A ( x)  1, lim  A ( x)  0
x 
x 
Convexity of Fuzzy Sets

A fuzzy set A is convex if for any  in [0, 1].
 A ( x1  (1   ) x2 )  min(  A ( x1 ),  A ( x2 ))
Introduction to
Fuzzy Set Theory
Set-Theoretic
Operations
Set-Theoretic Operations

Subset
A  B   A ( x)   B ( x), x U

Complement
A  U  A   A ( x)  1   A ( x)

Union
C  A  B  C ( x)  max(  A ( x), B ( x))   A ( x)  B ( x)

Intersection
C  A  B  C ( x)  min(  A ( x), B ( x))   A ( x)  B ( x)
Set-Theoretic Operations
A B
A
A B
A B
Properties
Involution
A A
Commutativity
A B  B  A
A B  B  A
Associativity
Distributivity
 A  B  C  A   B  C 
 A  B  C  A   B  C 
A   B  C    A  B   A  C 
A   B  C    A  B   A  C 
Idempotence
A A  A
A A  A
Absorption
A   A  B  A
A   A  B  A
De Morgan’s laws
A B  A B
A B  A B
Properties

The following properties are invalid for
fuzzy sets:
–
A A  
–
The laws of excluded middle
A A U
Other Definitions for Set Operations
 Union
 AB ( x)  min 1,  A ( x)  B ( x) 
 Intersection
 AB ( x)   A ( x)  B ( x)
Other Definitions for Set Operations
 Union
 AB ( x)   A ( x)  B ( x)   A ( x) B ( x)
 Intersection
 AB ( x)   A ( x)  B ( x)
Generalized Union/Intersection
 Generalized
Intersection
t-norm
 Generalized
Union
t-conorm
T-Norm
Or called triangular norm.
T :[0,1]  [0,1]  [0,1]
1.
Symmetry
T ( x, y )  T ( y , x )
2.
Associativity
T (T ( x, y ), z )  T ( x, T ( y, z ))
3.
Monotonicity
x1  x2 , y1  y2  T ( x1 , y1 )  T ( x2 , y2 )
4.
Border Condition T ( x,1)  x
T-Conorm
Or called s-norm.
S :[0,1]  [0,1]  [0,1]
1.
Symmetry
S ( x, y )  S ( y , x )
2.
Associativity
S ( S ( x, y ), z )  S ( x, S ( y, z ))
3.
Monotonicity
x1  x2 , y1  y2  S ( x1 , y1 )  S ( x2 , y2 )
4.
Border Condition
S ( x, 0)  x
Examples: T-Norm &amp; T-Conorm

Minimum/Maximum:
T (a, b)  min(a, b)  a  b
S (a, b)  max(a, b)  a  b

Lukasiewicz:
T (a, b)  max(a  b  1, 0)  LAND(a, b)
S (a, b)  min(a  b,1)  LOR(a, b)

Probabilistic:
T (a, b)  ab  PAND(a, b)
S (a, b)  a  b  ab  POR(a, b)
Introduction to
Fuzzy Set Theory
MF Formulation
MF Formulation


Triangular MF

 xa cx 
trimf ( x; a, b, c)  max  min 
,
,0
b

a
c

b

 

Trapezoidal MF

dx 
 xa
trapmf ( x; a, b, c, d )  max  min 
,1,
, 0 
b

a
d

c

 


Gaussian MF
gaussmf ( x; a, b, c)  e

Generalized bell MF
gbellmf ( x; a, b, c) 
1  x c 
 

2  
1
xc
1
b
2b
2
MF Formulation
gbellmf ( x; a, b, c) 
Manipulating Parameter of the
Generalized Bell Function
1
xc
1
a
2b
Sigmoid MF
sigmf ( x; a, c) 
Extensions:
Abs. difference
of two sig. MF
Product
of two sig. MF
1
1  e a ( x c )
L-R MF
 cx
 FL    , x  c

 
LR ( x; c,  ,  )  
F  x  c  , x  c
R 






Example: FL ( x)  max(0,1  x 2 )

FR ( x)  exp  x
3

c=65
c=25
=60
=10
=10
=40
Introduction to
Fuzzy Set Theory
Extension Principle
Functions Applied to Crisp Sets
y
y = f(x)
B  f ( A)
B
B(y)
x
A(x)
A
x
Functions Applied to Fuzzy Sets
y
y = f(x)
B
B(y)
B  f ( A)
x
A(x)
A
x
Functions Applied to Fuzzy Sets
y
y = f(x)
B
B(y)
B  f ( A)
x
A(x)
A
x
Assume a fuzzy set A and a function f.
How does the fuzzy set f(A) look like?
The Extension Principle
y
 B ( y )   f ( A) ( y )
y = f(x)
B
 max

(
x
)
A
1
x f
B(y)
x
A(x)
A
x
( y)
 sup  A ( x)
x  f 1 ( y )
The Extension Principle
A1
An
fuzzy sets
defined on
X1
f : X1 
 Xn V
Xn
The extension of f operating on A1, …, An gives a
fuzzy set F with membership function
 F (v ) 

 x1 ,
 x1 ,

min  

(x )
max 1 min  A1 ( x1 ),
,  An ( xn )
sup
,  An
, xn   f
, xn   f
(v)
1
(v)
A1
( x1 ),
n
Introduction to
Fuzzy Set Theory
Fuzzy Relations
Binary Relation (R)
b1
b2
b3
b4
b5
a1
A
a2
a3
a4
R  A B
B
R  A B
Binary Relation (R)
b1
b2
b3
b4
b5
a1
A
a2
a3
a4
1
0
MR  
1

0
0
1
0
0
0
0
0
0
1
1
0
0
0
1 
0

0
B
a1 Rb1 a1 Rb3 a2 Rb5
(a1 , b1 ), (a1 , b3 ), (a2 , b5 ) 
R

(
a
,
b
),
(
a
,
b
),
(
a
,
b
)
3
4
4
2 
 3 1
a3 Rb1 a3 Rb4 a4 Rb2
The Real-Life Relation

x is close to y
–

x depends on y
–

x and y are events
x and y look alike
–

x and y are numbers
x and y are persons or objects
If x is large, then y is small
–
x is an observed reading and y is a
corresponding action
Fuzzy Relations
A fuzzy relation R is a 2D MF:
R   ( x, y), R ( x, y)  | ( x, y)  X  Y 
R   ( x, y), R ( x, y)  | ( x, y)  X  Y 
Example (Approximate Equal)
X  Y  U  {1, 2,3, 4,5}
1
uv  0

0.8 u  v  1
 R (u , v)  
0.3 u  v  2
0
otherwise
0 
 1 0.8 0.3 0
0.8 1 0.8 0.3 0 


M R   0.3 0.8 1 0.8 0.3


 0 0.3 0.8 1 0.8
 0
0 0.3 0.8 1 
Max-Min Composition
X
Y
Z
R: fuzzy relation defined on X and Y.
S: fuzzy relation defined on Y and Z.
R。S: the composition of R and S.
A fuzzy relation defined on X an Z.
R S (x, z)  max y min  R ( x, y), S ( y, z) 
  y  R ( x, y)  S ( y, z) 
S R (x, y)  max v min  R ( x, v), S (v, y) 
Example
R
a
b
c
d
S



1
0.1 0.2 0.0 1.0
a
0.9 0.0 0.3
2
0.3 0.3 0.0 0.2
b
0.2 1.0 0.8
3
0.8 0.9 1.0 0.4
c
0.8 0.0 0.7
d
0.4 0.2 0.3
0.1 0.2 0.0 1.0
min 0.9 0.2 0.8 0.4
max 0.1 0.2
R S

0.0 0.4


1
0.4 0.2 0.3
2
0.3 0.3 0.3
3
0.8 0.9 0.8
Max-min composition is not mathematically
tractable, therefore other compositions such as
max-product composition have been suggested.
Max-Product Composition
X
Y
Z
R: fuzzy relation defined on X and Y.
S: fuzzy relation defined on Y and Z.
R。S: the composition of R and S.
A fuzzy relation defined on X an Z.
R S (x, z)  max y  R ( x, y)S ( y, z) 
Dimension Reduction
Projection
R
RY   R  Y 
RX   R  X 
Dimension Reduction
Projection
R
RY   R  Y 
RY   R  Y 
  max R ( x, y) / y
Y
x
 R ( y )  max  R ( x, y )
Y
x
RX   R  X 
RX   R  X 
  max R ( x, y ) / x
X
y
R ( x)  max R ( x, y)
X
y
Dimension Expansion
Cylindrical Extension
A : a fuzzy set in X.
C(A) = [AXY] : cylindrical extension of A.
C ( A)  
X Y
 A ( x) | ( x, y)
C ( A ) ( x, y )   A ( x )
Introduction to
Fuzzy Set Theory
Linguistic Variables
Linguistic Variables


Linguistic variable is “a variable whose
values are words or sentences in a natural
or artificial language”.
Each linguistic variable may be assigned
one or more linguistic values, which are in
turn connected to a numeric value through
the mechanism of membership functions.
Motivation

Conventional techniques for system
analysis are intrinsically unsuited for
dealing with systems based on human
judgment, perception &amp; emotion.
Example
if temperature is cold and oil is cheap
then heating is high
Example
Linguistic
Variable
Linguistic
Value
Linguistic
Variable
Linguistic
Value
if temperature is cold and oil is cheap
cold
high
cheap
then heating is high
Linguistic
Variable
Linguistic
Value
A linguistic variable is characterized by a quintuple
 x, T ( x),U , G, M 
Name
Term Set
Universe
Syntactic Rule
Semantic Rule
Example
A linguistic variable is characterized by a quintuple
 x, T ( x),U , G, M 
age
old, very old, not so old,

G (age)  more or less young,
quite young, very young

[0, 100]





Example semantic rule:
M (old)   u, old (u )  u  [0,100]
0
u  [0,50]


1

old (u )     u  50 2 
u  [50,100]
 1   5  
 

  
Example
Linguistic Variable : temperature
Linguistics Terms (Fuzzy Sets) : {cold, warm, hot}
(x)
1
cold
warm
20
hot
60
x
Introduction to
Fuzzy Set Theory
Fuzzy Rules
Classical Implication
AB
A  B
A
T
T
F
F
B
T
F
T
F
AB
T
F
T
T
A
1
1
0
0
B
1
0
1
0
AB
1
0
1
1
A
T
T
F
F
B
T
F
T
F
A  B
T
F
T
T
A
1
1
0
0
B
1
0
1
0
A  B
1
0
1
1
Classical Implication
AB
 A ( x)   B ( y )
1
 AB ( x, y)  
B ( y) otherwise
A  B
AB ( x, y)  max 1   A ( x), B ( x) 
A
1
1
0
0
B
1
0
1
0
AB
1
0
1
1
A
1
1
0
0
B
1
0
1
0
A  B
1
0
1
1
Modus Ponens
AB
A  B
 A
 A
B
A
1
1
0
0
B
1
0
1
0
AB
1
0
1
1
If A then B
 A is true
B
B is true
Fuzzy If-Than Rules
A  B  If x is A then y is B.
antecedent
or
premise
consequence
or
conclusion
Examples
A  B  If x is A then y is B.
 If pressure is high, then volume is small.
 If the road is slippery, then driving is dangerous.
 If a tomato is red, then it is ripe.
 If the speed is high, then apply the brake a little.
Fuzzy Rules as Relations
A  B  If x is A then y is B.
R
A fuzzy rule can be defined
as a binary relation with MF
R  x, y    AB  x, y 
Depends on how
to interpret A  B
R  x, y    AB  x, y   ?
Interpretations of A  B
A coupled with B
A entails B
y
y
B
B
xx
A
xx
A
R  x, y    AB  x, y   ?
Interpretations of A  B
A coupled with B
y
A coupled with
B (A and
A entails
B B)
y
R  AB
  B  A ( x)* B ( y) /( x, y)
X Y
B
xx
A
t-norm
A
xx
R  x, y    AB  x, y   ?
Interpretations of A  B
A coupled with B
y
A coupled with
B (A and
A entails
B B)
y
R  AB
  B  A ( x)* B ( y) /( x, y)
X Y
B
E.g.,
xx
A
x
R  x, y   min  A ( x), B ( y)x
A
R  x, y    AB  x, y   ?
Interpretations of A  B
A entails B (not A or B)
A coupled with B
A entails B
• Material implication
y
y
R  A  B  A  B
• Propositional calculus
R  A  B  A  ( A  B )
B
• Extended
propositional calculus
B
R  A  B  (A  B)  B
• Generalization of modus ponens
xx
 A ( x)   B ( y )
1
R ( x, y)  
) otherwise
B ( yA
xx
A
R  x, y    AB  x, y   ?
Interpretations of A  B
A entails B (not A or B)
• Material implication
R  A  B  A  B
• Propositional calculus
R  A  B  A  ( A  B )
R ( x, y)  max 1   A ( x), B ( x) 
R ( x, y)  max 1   A ( x), min   A ( x), B ( x)  
• Extended propositional calculus
R  A  B  (A  B)  B
• Generalization of modus ponens
 A ( x)   B ( y )
1
R ( x, y)  
B ( y) otherwise
R ( x, y)  max 1  max   A ( x), B ( x)  , B ( x) 
Introduction to
Fuzzy Set Theory
Fuzzy Reasoning
Generalized Modus Ponens
Single rule with single antecedent
Rule: if x is A then y is B
Fact:
x is A’
Conclusion:
y is B’
Fuzzy Reasoning
Single Rule with Single Antecedent
Rule: if x is A then y is B
 ( x)
Fact:
x is A’
Conclusion:
y is B’
A
 ( y)
A’
x
B
y
R ( x, y)   A ( x)  B ( y)
Fuzzy Reasoning
Single Rule with Single Antecedent
Max-Min Composition
Rule: if x is A then y is B
Fact:
x is A’
Conclusion:
y is B’
B ( y)  max x min   A ( x), R ( x, y) 
  x   A ( x)  R ( x, y) 
  x   A ( x)   A ( x)  B ( y) 
  x   A ( x)   A ( x)     B ( y )
Firing
Strength
 ( x)
A
Firing Strength
 ( y)
A’
B
B
x
y
R ( x, y)   A ( x)  B ( y)
Fuzzy Reasoning
Single Rule with Single Antecedent
Max-Min Composition
Rule: if x is A then y is B
Fact:
x is A’
Conclusion:
y is B’
B ( y)  max x min   A ( x), R ( x, y) 
  x   A ( x)  R ( x, y) 
  x   A ( x)   A ( x)  B ( y) 
  x   A ( x)   A ( x)     B ( y )
B  A ( A  B)
 ( x)
A
 ( y)
A’
B
B
x
y
Fuzzy Reasoning
Single Rule with Multiple Antecedents
Rule: if x is A and y is B then z is C
Fact:
Conclusion:
x is A and y is B
z is C
Fuzzy Reasoning
Single Rule with Multiple Antecedents
Rule: if x is A and y is B then z is C
Fact:
x is A’ and y is B’
Conclusion:
z is C’
 ( y)
 ( x)
A
A’
 ( z)
B’
x
B
C
y
z
R  A B  C
Rule: if x is A and y is B then z is C
Fact:
x is A’ and y is B’
Fuzzy
Reasoning  ( x, y, z)    ( x, y, z)
z is C’
Conclusion:
  ( x)   ( y )   ( z )
Single Rule with Multiple Antecedents
AB C
R
A
B
C
Max-Min Composition
C  ( y )  max x , y min   A, B ( x, y ),  R ( x, y, z ) 
  x , y   A, B ( x, y )   R ( x, y, z ) 
  x, y   A ( x)  B ( y)   A ( x)  B ( y)  C ( z) 
  x   A ( x)   A ( x)     y   B ( y )   B ( y )    C ( z )
Firing Strength
 ( y)
 ( x)
A
A’
 ( z)
B’
x
B
C
y
C
z
R  A B  C
Rule: if x is A and y is B then z is C
Fact:
x is A’ and y is B’
Fuzzy
Reasoning  ( x, y, z)    ( x, y, z)
z is C’
Conclusion:
  ( x)   ( y )   ( z )
Single Rule with Multiple Antecedents
AB C
R
A
B
C
Max-Min Composition
C  ( y )  max x , y min   A, B ( x, y ),  R ( x, y, z ) 
  x , y   A, B ( x, y )   R ( x, y, z ) 


C   A

B
A

B

C



 ( x)   ( x)       ( y )   ( y )     ( z )
  x, y   A ( x)  B ( y)   A ( x)  B ( y)  C ( z) 
x
A
A
y
B
B
C
Firing Strength
 ( y)
 ( x)
A
A’
 ( z)
B’
x
B
C
y
C
z
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
Rule1: if x is A1 and y is B1 then z is C1
Rule2: if x is A2 and y is B2 then z is C2
Fact:
Conclusion:
x is A’ and y is B’
z is C’
Rule1: if x is A1 and y is B1 then z is C1
Rule2: if x is A2 and y is B2 then z is C2
Fact:
x is A’ and y is B’
Conclusion: z is C’
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
 ( x)
A’
 ( y)
A1
B’
B1
 ( y)
A’ A2
x
C1
z
y
x
 ( x)
 ( z)
B2
 ( z)
B’
y
C2
z
Rule1: if x is A1 and y is B1 then z is C1
Rule2: if x is A2 and y is B2 then z is C2
Fact:
x is A’ and y is B’
Conclusion: z is C’
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
Max-Min Composition
 ( x)
A’
 ( y)
A1
B’
B1
 ( y)
A’ A2
C1
C1
z
y
x
 ( x)
 ( z)
B2
 ( z)
B’
C2
C2
C   A  B
 R1  R2 
  A  B  R1    A  B 
 C1  C2
R2 
Max
y
x
 ( z)
z
C   C1  C2
z
```