Fuzzy Logic
Fuzzy Logic
of tuples
A = {(u, A(u))|u X}.
Frequently we will write A(x) instead of A(x). The
family of all fuzzy sets in X is denoted by F(X).
If X = {x1, . . . , xn} is a finite set and A is a fuzzy
set in X then we often use the notation
A = 1/x1 + + n/xn
where the term i/xi, i = 1, . . . , n signifies that i
is the grade of membership of xi in A and the plus
sign represents the union.
1
-2
-1
as
A(t) = exp((t 1)2)
where is a positive real number.
3000$
4500$
6000$
{1}
if 0.6 < 1
Definition 5. (convex fuzzy set) A fuzzy set A of X is
called convex if [A] is a convex subset of X
[0, 1].
10
cut
Definition 7. (quasi fuzzy number) A quasi fuzzy number A is a fuzzy set of the real line with a normal,
fuzzy convex and continuous membership function
satisfying the limit conditions
lim A(t) = 0.
lim A(t) = 0,
t
Fuzzy number.
Let A be a fuzzy number. Then [A] is a closed
convex (compact) subset of R for all [0, 1]. Let
us introduce the notations
a1() = min[A] , a2() = max[A]
In other words, a1() denotes the left-hand side and
a2() denotes the right-hand side of the -cut. It is
easy to see that
If then [A] [A]
12
a1()
a2 ()
a1 (0)
a2 (0)
at
if a t a
1
ta
A(t) =
1
if a t a +
0
otherwise
and we use the notation A = (a, , ). It can easily
be verified that
[A] = [a (1 ), a + (1 )], [0, 1].
The support of A is (a , b + ).
14
a-
a+
1 (a t)/ if a t a
1
if a t b
A(t) =
1 (t b)/ if a t b +
0
otherwise
15
a-
b+
16
scribed as
at
L
if t [a , a]
1
if t [a, b]
A(t) =
t b)
R
if t [b, b + ]
0
otherwise
where [a, b] is the peak or core of A,
L : [0, 1] [0, 1],
1-x
A is a subset of B.
18
19
1X
1
10
x0
x0
Fuzzy point.
Let A = x0 be a fuzzy point. It is easy to see that
[A] = [x0, x0] = {x0}, [0, 1].
20
21
24
R (u, v) =
Property 3. (total order) R is a total order relation if it is partial order and u, v R, (u, v)
R or (v, u) R hold
Example 4. Let us consider the binary relation subset of. It is clear that we have a partial order relation.
The relation on natural numbers is a total order
relation.
Consider the relation mod 3 on natural numbers
{(m, n) | (n m) mod 3 0}
This is an equivalence relation.
Definition 7. Let X and Y be nonempty sets. A
fuzzy relation R is a fuzzy subset of X Y .
In other words, R F(X Y ).
If X = Y then we say that R is a binary fuzzy relation in X.
4
1 if u = v
R(u, v) = 0.8 if |u v| = 1
0.3 if |u v| = 2
In matrix notation it can be represented as
5
1 1 0.8 0.3
2
0.8
1
0.8
3 0.3 0.8 1
Operations on fuzzy relations
Fuzzy relations are very important because they can
describe interactions between variables. Let R and
S be two binary fuzzy relations on X Y .
Definition 8. The intersection of R and S is defined
by
y 1 y2 y3 y4
x2 0 0.8 0 0
x3 0.9 1 0.7 0.8
S = x is very close to y
y1 y2 y3 y4
y1 y2 y3 y4
(R S)(x, y) =
x2 0 0.4 0 0
x3 0.3 0 0.7 0.5
The union of R and S means that x is considerable
larger than y or x is very close to y.
y1 y2 y3 y4
(R S)(x, y) =
R(u, v) =
Y = {y Y | x X : (x, y) R}
where X denotes projection on X and Y denotes
projection on Y .
Y (y) = sup{R(x, y) | x X}
Example 7. Consider the relation
R = x is considerable larger than y
10
y1 y2 y3 y4
x2 0 0.8 0 0
x3 0.9 1 0.7 0.8
then the projection on X means that
x1 is assigned the highest membership degree
from the tuples (x1, y1), (x1, y2), (x1, y3), (x1, y4),
i.e. X (x1) = 1, which is the maximum of the
first row.
x2 is assigned the highest membership degree
from the tuples (x2, y1), (x2, y2), (x2, y3), (x2, y4),
i.e. X (x2) = 0.8, which is the maximum of the
second row.
x3 is assigned the highest membership degree
from the tuples (x3, y1), (x3, y2), (x3, y3), (x3, y4),
i.e. X (x3) = 1, which is the maximum of the
third row.
11
Y
Shadows of a fuzzy relation.
Definition 11. The Cartesian product of A F(X)
and B F(Y ) is defined as
(A B)(u, v) = min{A(u), B(v)}.
for all u X and v Y .
12
AxB
13
Really,
X (x) = sup{(A B)(x, y) | y}
= sup{A(x) B(y) | y} =
min{A(x), sup{B(y)} | y}
= min{A(x), 1} = A(x).
Definition 12. The sup-min composition of a fuzzy
set C F(X) and a fuzzy relation R F(X Y )
is defined as
for all y Y .
The composition of a fuzzy set C and a fuzzy relation R can be considered as the shadow of the relation R on the fuzzy set C.
14
C(x)
R(x,y')
(C o R)(y')
X
y'
R(x,y)
R=AB
a fuzzy relation.
Observe the following property of composition
A R = A (A B) = A,
15
B R = B (A B) = B.
Example 9. Let C be a fuzzy set in the universe of
discourse {1, 2, 3} and let R be a binary fuzzy relation in {1, 2, 3}. Assume that
C = 0.2/1 + 1/2 + 0.2/3
and
1 1 0.8 0.3
R=
2
0.8
1
0.8
3 0.3 0.8 1
Using the definition of sup-min composition we get
1 1 0.8 0.3
=
CR = (0.2/1+1/2+0.2/3)
2 0.8 1 0.8
3 0.3 0.8 1
16
R(x, y) = 1 |x y|.
Using the definition of sup-min composition we get
1+y
(C R)(y) = sup min{x, 1 |x y|} =
2
x[0,1]
for all y [0, 1].
Definition 13. (sup-min composition of fuzzy relations) Let R F(X Y ) and S F(Y Z). The
sup-min composition of R and S, denoted by R S
is defined as
17
y 1 y2 y3 y4
x2 0 0.8 0 0
x3 0.9 1 0.7 0.8
18
z1 z2 z3
z1 z2 z3
RS =
x
0
0.4
0
2
x3 0.7 0.9 0.7
Formally,
y1
x1 0.8
x2 0
x3 0.9
y2 y3 y4
z1 z2 z3
0.8 0 0
z1 z2 z3
x2 0 0.4 0
x3 0.7 0.9 0.7
i.e., the composition of R and S is nothing else, but
the classical product of the matrices R and S with
the difference that instead of addition we use maximum and instead of multiplication we use minimum
operator.
20
pq=
p
1
0
0
1
1 if (p) (q)
0 otherwise
q pq
1
1
1
1
0
1
0
0
X Y = sup{Z|X Z Y }.
Fuzzy implications
Consider the implication statement
if pressure is high then volume is small
The membership function of the fuzzy set A, big
pressure, illustrated in the figure
1
if u 5
5u
A(u) = 1
if 1 u 5
0
otherwise
The membership function of the fuzzy set B, small
volume, can be interpreted as (see figure)
5 is in the fuzzy set small volume with grade of
4
membership 0
4 is in the fuzzy set small volume with grade of
membership 0.25
2 is in the fuzzy set small volume with grade of
membership 0.75
x is in the fuzzy set small volume with grade of
membership 1, for all x 1
1
if v 1
v1
B(v) = 1
if 1 v 5
0
otherwise
1 if (p) (q)
0 otherwise
A(u) B(v) =
1 if A(u) B(v)
0 otherwise
A(u) B(v) =
1
if A(u) B(v)
B(v) otherwise
p q = p q
9
x y = xy
x y = min{1, 1 x + y}
x y = min{x, y}
1 if x y
xy=
0 otherwise
1 if x y
xy=
y otherwise
1 if x y
xy=
y/x otherwise
x y = max{1 x, y}
x y = 1 x + xy
Larsen
ukasiewicz
Mamdani
Standard Strict
Godel
Gaines
Kleene-Dienes
Kleene-Dienes-uk.
Modifiers
The use of fuzzy sets provides a basis for a systematic way for the manipulation of vague and imprecise concepts.
In particular, we can employ fuzzy sets to represent
linguistic variables.
old
very old
30
60
A linguistic variable can be regarded either as a variable whose value is a fuzzy number or as a variable
whose values are defined in linguistic terms.
12
old
30
60
low.
slow
medium
fast
55
40
speed
70
NB
NM
NS
ZE
PS
PM
PB
-1
Absolutely f alse(u) =
Absolutely true(u) =
1 if u = 0
0 otherwise
1 if u = 1
0 otherwise
TRUTH
1
Absol ut ely
f alse
True
False
Absol ut ely
true
F airly true(u) = u
17
Very tru e
1
F airly f alse(u) = 1 u
for each u [0, 1].
V ery f alse(u) = (1 u)2
for each u [0, 1].
18
TRUTH
Fairly
false
Very f alse
1
is defined by
x is A = x is A
because
( A)(u) = (A(u)) = A(u)
for each u [0, 1].
It is why everything we write is considered to be
true.
A = "A is true"
1
a-
b-
20
where
( A)(x) =
1 if A(x) = 1
0 otherwise
A is Absolutely true
1
a-
b-
21
a-
b -
a-
b-
a-
23
b-
premise
y = f (x)
fact
x = x
consequence y = f (x)
This inference rule says that if we have y = f (x), x
X and we observe that x = x then y takes the value
f (x).
y
y=f(x)
y=f(x)
x=x'
1 : If x = x1 then y = y1
also
2 : If x = x2 then y = y2
also
...
also
n : If x = xn then y = yn
Suppose that we are given an x X and want to
find an y Y which correponds to x under the
rule-base.
1 :
also
2 :
also
If
x = x1 then y = y1
If
x = x2 then y = y2
...
also
n :
fact:
If
...
x = xn then y = yn
x = x
y = y
consequence:
if x is A1 then y is C1,
if x is A2 then y is C2,
if x is An then y is Cn
n :
fact:
x is A
consequence:
y is C
x is B
Mary is young
5
x is close to 3
y is close to 2
not (x is high)
x is A
x is not high
premise
if p then q
fact
p
consequence
q
This inference rule can be interpreted as: If p is true
and p q is true then q is true.
The fuzzy implication inference is based on the compositional rule of inference for approximate reasoning suggested by Zadeh.
Definition 6. (compositional rule of inference)
premise
if x is A then y is B
fact
x is A
consequence:
y is B
where the consequence B is determined as a composition of the fact and the fuzzy implication opera8
tor
B = A (A B)
that is,
B (v) = sup min{A(u), (A B)(u, v)}, v V.
uU
premise
if x is A then y is B
fact
y is B
consequence: x is A
which reduces to Modus Tollens when B = B
and A = A, is closely related to the backward
goal-driven inference which is commonly used in
expert systems, especially in the realm of medical
diagnosis.
10
A(x)
min{A(x), B(y)}
B'(y) = B(y)
B(y)
y
AxB
A A B = B.
Suppose that A, B and A are fuzzy numbers. The
Generalized Modus Ponens should satisfy some rational properties
11
B'= B
Basic property.
12
A'
B'
Total indeterminance.
13
Property 3. Subset:
if x is A then y is B
x is A A
y is B
if pressure is big then volume is small
pressure is very big
volume is small
B' = B
A
A'
Subset property.
14
Property 4. Superset:
if x is A then y is B
x is A
y is B B
A'
B'
Superset property.
Suppose that A, B and A are fuzzy numbers.
We show that the Generalized Modus Ponens with
Mamdanis implication operator does not satisfy all
the four properties listed above.
Example 1. (The GMP with Mamdani implication)
15
if x is A then y is B
x is A
y is B
where the membership function of the consequence
B is defined by
B (y) = sup{A(x) A(x) B(y)|x R}, y R.
Basic property. Let A = A and let y R be
arbitrarily fixed. Then we have
B (y) = sup min{A(x), min{A(x), B(y)} =
x
min{B(y), 1} = B(y).
So the basic property is satisfied.
Total indeterminance. Let A = A = 1 A and
16
17
B
B'
A(x)
x
B(y)
<1
=
1 + B(y)
this means that the total indeterminance property is
not satisfied.
Subset. Let A A and let y R be arbitrarily
19
B
B'
20
n
Ci = x0 y0 R1 x0 y0 Rn
i=1
if x is A1 and y is B1 then z is C1
fact :
x is x0 and y is y0
if x is A2 and y is B2 then z is C2
consequence :
z is C
C1 (w) = (1 C1(w)),
C2 (w) = (2 C2(w))
Then the overall system output is computed
by oring the individual rule outputs
C(w) = C1 (w) C2 (w)
= (1 C1(w)) (2 C2(w))
Finally, to obtain a deterministic control action, we employ any defuzzification strategy.
A1
B2
A2
xo
C1
B1
C2
yo
w
min
the equations
1 = C1(z1),
2 = C2(z2)
1 :
also
2 :
if x is A1 and y is B1 then z is C1
fact :
x is x0 and y is y0
if x is A2 and y is B2 then z is C2
consequence :
z is C
C2(z2) = 0.6
C1
B1
A1
0.7
0.3
0.3
u
B2
A2
C2
0.6
0.8
0.6
xo
z1 = 8
yo
min
z2 = 4
ing architecture
1 :
also
2 :
fact : x is x0 and y is y0
cons. :
z0
10
A2
A1
1
u
a1 x + b 1 y
B2
B1
2
x
min
a2 x + b 2 y
z
i
i
,
z0 = i=1
n
i=1 i
where i denotes the firing level of the i-th
rule, i = 1, . . . , n
Example 2. We illustrate Sugenos reasoning method by the following simple example
11
1 :
z1 = x + y
also
2 :
fact :
x0 is 3 and y0 is 2
conseq :
z0
1= 0.2
x+y=5
0.9
0.6
2=0.6
u
min
2x-y=4
A1
B2
A2
xo
C1
B1
C2
yo
w
min
1 = A1(x0) B1(y0),
2 = A2(x0) B2(y0)
then the individual rule outputs are c1 and
c2, and the crisp control action is expressed
as
1c1 + 2c2
1 + 2
If we have n rules in our rule-base then the
crisp control action is computed as
n
ici
,
z0 = i=1
n
i=1 i
where i denotes the firing level of the i-th
rule, i = 1, . . . , n
z0 =
16
L1
H2
L3
1
c1
M1
M2
M3
2
c2
H1
H3
H2
3
min
17
z3