Professional Documents
Culture Documents
Lecture04 (Fuzzy Logic)
Lecture04 (Fuzzy Logic)
Lecture04 (Fuzzy Logic)
University
ASTU
School of EEC
1. Classical logic
Juliet, would
you marry
me?
1
Contd
Juliet, would
you take my
heart?
Juliet is impressed.
Contd
Am I tall?
1foot= 30.48cm
2
Contd
(Definition) Classical logic
Logic is defined as the study of human thinking and
its principles.
true false
yes no
1 0
Contd
This has evolved into three-valued logic, in which
there are three truth values indicating true, false and
indeterminate, as well as n-valued logic.
3
Contd
(Definition) Proposition(or statement)
A proposition is a sentence(subject + predicate) that
is either true or false. If a proposition is true, then we
say its truth value is true, and vice versa.
For example
(1) Ethiopia is in Africa. (true)
(2) 12+8= 20 (true)
(3) 6 2 (false)
(4) What is this? (not proposition)
Note that (2) and (3) are formulas, but they can be
described in sentence form.
2. Classical connectives
Connectives
• Sentences are connected with the words 'not',
'and', 'or', and 'if-then'.
• not negates the original sentence.
• and joins two sentences to form the conjunction
of the two sentences.
• or joins two sentences to form the disjunction of
the two sentences.
• if-then is called an implication.
For example,
if food is rancid or service is poor, then tip is cheap
if food is good and service is good, then tip is
average
4
Contd
(Definition) Negation
Logical negation is an operator that results false
when the proposition is true and vice versa, denoted
by 'not p' or p.
p p
0 1
1 0
For example
p: ASTU is located in Adama. p= 1 (true)
p : ASTU is not located in Adama p = 0 (false)
Contd
(Definition) Disjunction (Inclusive or)
'Inclusive or' is a connective that results true when at
least one of the propositions is true, denoted by pq.
p q pq
0 0 0
0 1 1
1 0 1
1 1 1
5
Contd
For example
p: 2 2 p= 0
q: 5 2 q= 1
pq: ( 2 2) or ( 5 2) pq= 1
For example
p: 5 is a prime number p= 1
q: 18 is an odd number q= 0
pq: 5 is a prime number or 18 is an odd number
pq= 1
Contd
(Definition) Disjunction (Exclusive or)
'Exclusive or (XOR)' is a logical operator which
results true when either of the propositions are true
(one is true and the other one is false) but both are
not true, denoted by 'pq'.
p q pq
0 0 0
XOR
0 1 1
1 0 1
1 1 0
6
Contd
For example
p: A tossing coin's face is head p= 1
q: A tossing coin's face is tail q= 0
pq: A tossing coin's face is head or a
tossing coin's face is tail pq= 1
A: 1 1 0
B: 0 1 1
A: 110
B: 011
S 001
CPU Adder Cout 1
Contd
A: 1 1 0 CPU Adder
XOR
B: 0 1 1 XOR
AND
OR
AND
A: 110
B: 011
S 001
Cout 0
7
Contd
A: 1 1 0 CPU Adder
XOR
B: 0 1 1 XOR
AND
OR
AND
A: 110
B: 011
S 001
Cout 1
Contd
A: 1 1 0 CPU Adder
XOR
B: 0 1 1 XOR
AND
OR
AND
A: 110
B: 011
S 001
Cout 1
8
Contd
(Definition) Conjunction
Conjunction is a logical operator which results true
when both p and q are true, denoted by pq.
p q pq
0 0 0
0 1 0
1 0 0
1 1 1
Contd
For example
p: 2+2= 4 p=1
q: 3+2= 9 q= 0
pq: (2+2= 4) and (3+2)= 9 pq= 0
For example
p: is a real number p= 1
q: > 3.14 q= 1
pq: is a real number and > 3.14
pq= 1
9
Contd
(Definition) Implication
Implication ('if-then') is a logical connective that
represents a type of relationship between two
statements as:
if p, then q pq
• 'pq' means 'p implies q'. 'implies' is used in the
strongest possible sense.
• 'pq' is false only when p=1 and q=0, and is
always true in the others.
Contd
if p, then q pq
10
Contd
For example
p= Janice has a driver's license
q= Janice can drive
Contd
Logical implication does not work both ways.
For example
p= the sky is clear
q= the sun is visible
If p(= 0), then q(= 1) (true)
However,
If q(= 1), then p(= 0) (not necessarily true. It might be
not clear or clear)
11
3. Classical rules of inference
Classical rules of inference
• An inference rule is a process of deriving a new
proposition or logical expression from a proposition
or a logical expression.
• New propositions or logical expressions must not
have logical contradictions with existing propositions
or logical expressions. That is, logical consequences
must always be true.
• Typical reasoning rules are modus ponens, modus
tollens, and hypothetical syllogism.
Contd
(Definition) Modus Ponens(MP)
Modus ponens leads to a new proposition q (result)
from two propositions p (fact) and p→q (premise or
rule), which is intuitively expressed as follows:
fact : p
rule : if p, then q (or p q)
result: q
12
Contd
For example
fact : Jones doesn't breathe
rule : if x doesn't breathe, then it will die
result: Jones will die
For example
fact : The pine tree is a plant
rule : If x is a plant, then it needs water, air
and sunlight
result: The pine tree needs water, air and sunlight
Contd
fact :p
rule or premise : p q
result :q
can be expressed simply as (p(pq))q
p q pq p(pq) (p(pq))q
0 0 1 0 1
0 1 1 0 1
1 0 0 0 1
1 1 1 1 1
13
Contd
(Definition) Modus Tollens(MT)
Modus tollens leads to a new proposition p (result)
from two propositions q (fact) and p→q (premise or
rule), which is intuitively expressed as follows:
fact : q
rule : if p, then q (or p q)
result : p
The final result of modus tollens is always true
regardless of the value of p and q.
Contd
fact : q
rule : p q
result : p
For example
fact : RoboCop does not die
rule : if x is a human being, then one will die
result : RoboCop isn't a human being
14
Contd
fact :q
rule : p q
result :p
can be expressed simply as (q(pq))p
p(p) q(q) pq q(pq) (q(pq))p
0(1) 0(1) 1 1 1
0(1) 1(0) 1 0 1
1(0) 0(1) 0 0 1
1(0) 1(0) 1 0 1
Contd
(Definition) Hypothetical syllogism(HS)
Syllogism leads to a new proposition pr (result)
from two propositions pq and qr, which are
intuitively expressed as follows:
15
Contd
fact : pq
rule : q r
result : pr
For example
fact : if x is a robocop, then it patrols
rule : if x patrols, then it needs a motorbike
result : if x is a robocop, then it need a motorbike
Contd
fact : pq
rule : qr
result : pr
can be expressed as ((pq)(qr))(pr)
(pq) ((pq)(qr))
p q r pq qr pr
(qr) (pr)
0 0 0 1 1 1 1 1
0 0 1 1 1 1 1 1
0 1 0 1 0 1 0 1
0 1 1 1 1 1 1 1
1 0 0 0 1 0 0 1
1 0 1 0 1 1 0 1
1 1 0 1 0 0 0 1
1 1 1 1 1 1 1 1
16
4. Linguistic variables
(Definition) Linguistic variable
A variable which can take words in natural languages
as its values (linguistic value) is called a linguistic
variable. linguistic value(fuzzy set)
If error is big, then control is big
linguistic variable
small mediem big
error
0 5 10 15
5. Fuzzy modifiers
• Fuzzy modifiers(hedges) are terms that modify the
shape of fuzzy sets.
• They include adverbs such as very, somewhat,
quite, more or less and slightly.
17
Contd
Hedge Mathematical Graphical Representation
Expression
Contd
(Definition) Fuzzy logic
Fuzzy logic is described in the form of sentences, as
classical logic, but by using ambiguous words and
ambiguous sentences, the result can not be either true
or false.
For example
p: John is a handsome boy.
q: He is tall.
r: Lake Langano is beautiful.
18
6. Fuzzy logic: Definition
(Definition) Fuzzy proposition
A single fuzzy proposition is called a simple fuzzy
proposition, and it is called a compound fuzzy
proposition when they are combined with the
conjunction such as 'and', 'or', 'not' or 'if-then'.
single compound
p1: x is Small p3: x is Small or y is not Big
p2: y is Big p4: x is Small and y is Big
x, y: liguistic variables
Small, Big: liguistic values or fuzzy sets
7. Compound proposition
(Definition) Logical negation
Consider a fuzzy set A and a fuzzy proposition.
p: x is not A
'not A' can be expressed as a fuzzy complement:
19
Contd
Standard:
A̅(u)= 1A(u)
Sugeno class:
1 A (u )
A̅(u)= , where (-1,)
1 A (u )
Yager class:
1
A̅(u)= (1 A (u )) w
w
, where w(0,)
Contd
For example A(u) 1
U= {u| -2u2}
A= 'zero'= {(u,A(u))}
p: x is not A u
-0.5 0 0.5
not A can be written simply as A, and when the standard
operator is adopted, its MF is as follows:
A̅(u)
A̅(u)= 1A(u) 1
u
-0.5 0 0.5
20
Contd
(Definition) Disjunction
Given A= {(u,A(u))}, B= {(v,B(v))}, the compound
fuzzy proposition
p: x is A or y is B
results a fuzzy relation as
AB= {((u,v), AB(u,v)) | uA, vB)
where AB(u,v)= s[A(u),B(v)]
Contd
Standard
AB(u,v)= A(u)B(v)
Algebraic
AB(u,v)= A(u)+B(v)-A(u)B(v)
Yager class
1
AB(u,v)=
min[1, ( A (u ) B (v)) w ]
w w
Bounded sum
AB(u,v)= min[1, A(u)+B(v)]
Drastic sum A (u ), if B (v) 0
AB(u,v)= B (v), if A (u ) 0
1, if A (u ), B (v) 0
21
Contd
a 1.0
For example, U= {a, b, c, d}
b 0.8
A= 1.0/a + 0.8/b+0.5/c+0.3/d MA
B= 0.3/a + 0.4/b+0.5/c+1.0/d c 0.5
d 0.3
a b c d
M B 0.3 0.4 0.5 1.0
Compound fuzzy proposition
using the standard operator is a b c d
p: x is A or y is B AB a 1.0 1.0 1.0 1.0
b 0.8 0.8 0.8 1.0
M A B MA MB
c 0.5 0.5 0.5 1.0
d 0.3 0.4 0.5 1.0
Contd
For example, consider the relation matrices of fuzzy
sets A and B as
a b v w x
M A 0.5 0.7 M B 0.6 0.1 0.9
22
Contd
For example U= {u| -2u2}, V= {v| -3v3}
A= 'zero'= {(u,A(u))}, B= 'positive'= {(v,B(v))}
A(u) 1 B(v) 1
u v
-0.5 0 0.5 0 1
Contd
When a standard operator is adopted, its MF is
AB(u,v)= A(u)B(v).
AB(u,v)
1
0.5
0
2 2
0
0
v -2
-2
u
23
Contd
(Definition) Conjunction
Given A= {(u,A(u))}, B= {(v,B(v))}, the compound
fuzzy proposition
p: x is A and y is B
results a fuzzy relation as
AB= {((u,v), AB(u,v)) | uA, vB)
where AB(u,v)= t[A(u),B(v)]
Contd
Standard
AB(u,v)= A(u)B(v)
Algebraic
AB(u,v)= A(u)B(v)
Yager class 1
AB(u,v)= 1 min[1, ((1 A (u )) (1 B (v)) ) ]
w w w
Bounded sum
AB(u,v)= max[0, A(u)+B(v)-1]
Drastic sum A (u ), if B (v) 1
AB(u,v)= B (v), if A (u ) 1
0, if A (u ), B (v) 1
24
Contd
a 1.0
For example, U= {a, b, c, d}
b 0.8
A= 1.0/a + 0.8/b+0.5/c+0.3/d MA
B= 0.3/a + 0.4/b+0.5/c+1.0/d c 0.5
d 0.3
a b c d
M B 0.3 0.4 0.5 1.0
Compound fuzzy proposition
using the standard operator is a b c d
p: x is A and y is B AB a 0.3 0.4 0.5 1.0
b 0.3 0.4 0.5 0.8
M A B MA MB
c 0.3 0.4 0.5 0.5
d 0.3 0.3 0.3 0.3
Contd
For example, consider the relation matrices of fuzzy
sets A and B as
a b v w x
M A 0.5 0.7 M B 0.6 0.1 0.9
25
Contd
For example U= {u| -2u2}, V= {v| -3v3}
A= 'zero'= {(u,A(u))}, B= 'positive'= {(v,B(v))}
A(u) 1 B(v) 1
u v
-0.5 0 0.5 0 1
Contd
When a standard operator is adopted, its MF is
AB(u,v)= A(u)B(v).
AB(u,v) 0.5
0
2 2
0 0
-2
v -2
u
26
8. Fuzzy if-then statement
(Definition) Single if-then statement
Given A= {(u,A(u))}, B= {(v,B(v))}, the fuzzy
implication
if x is A, then y is B
Contd
Boolean:
AB(u,v)= (1-A(u))B(v)
Zadeh(arithmetic):
AB(u,v)=1(1- A(u)+B(v))
Zadeh(max):
AB(u,v)=max[A(u)B(v),1-A(u)]
Mamdani(min):
AB(u,v)= A(u)B(v)
Larsen(product):
AB(u,v)= A(u)B(v)
27
Contd
For example U= {u| -2u2}, V= {v| -3v3}
A= 'zero'= {(u,A(u))}, B= 'positive'= {(v,B(v))}
A(u) 1 B(v) 1
u v
-0.5 0 0.5 0 1
Fuzzy implication
p: if x is A, then y is B
Contd
The MF using the min or product operator is
AB(u,v)= A(u)B(v) : min operator
AB(u,v)= A(u).B(v) : product operator
AB(u,v) AB(u,v)
1
1
0.5
0.5
0
0
2 2
2 2 0
0 0
0 -2
-2
-2
v -2
v u u
min product
28
Contd
For example, a 0.2
U= {a,b,c}, V={e,f,g} M A b 0.6
A= 0.2/a+0.6/b+1.0/c c 1.0
B= 1.0/e+ 0.4/f+0.5/g e f g
Fuzzy implication M B 1.0 0.4 0.5
p: if x is A, then y is B
e f g
Applying the min operator gives
a 0.2 0.2 0.2
M A B M A M B b 0.6 0.4 0.5
c 1.0 0.4 0.5
Contd
a 0.2 e f g
M A b 0.6 M B 1.0 0.4 0.5
c 1.0
29
Contd
(Quiz 1) Given U= {u1,u2,u3,u4}, V={v1,v2,v3}
A= 0.7/u2+0.2/u3+0.3/u4, B= 0.6/v1+0.6/v3
obtain
p: if x is A, then y is B
using the Boolean and Zadeh(arithmetic) operators.
Note that
Boolean: AB(u,v)= (1-A(u))B(v)
Zadeh(arithmetic): AB(u,v)=1(1- A(u)+B(v))
Contd
Relation matrices of A and B
u1 0
v1 v2 v3
u2 0.7
MA M B 0.6 0 0.6
u3 0.2
u4 0.3
Boolean: AB(u,v)= (1-A(u))B(v)
v1 v2 v3
u1 1.0 1.0 1.0
u 0.6 0.3
0.6
M A B 2
u3 0.8 0.8 0.8
u4 0.7 0.7 0.7
30
Contd
Relation matrices of A and B
u1 0
v1 v2 v3
u2 0.7
MA M B 0.6 0 0.6
u3 0.2
u4 0.3
Zadeh(arithmetic): AB(u,v)=1(1- A(u)+B(v))
v1 v2 v3
u1 1 1 1
u2 0.9 1 1
M A B
u3 1 0.8 1
u4 1 0.7 1
Contd
(Definition) Compound if-then statement
if x is A1, then y is B1 also
if x is A2, then y is B2 also
:
if x is An, then y is Bn
where x, y: linguistic variables
Ai, Bi(i=1,...,n): fuzzy sets
31
Contd
In general, since the connective 'also' uses the max
operator, it can be calcuated as follows:
Contd
For example, U= {a,b,c}, V= {e,f,g}
A1= 0.2/a+0.6/b+1.0/c, B1= 1.0/e+ 0.4/f
A2= 0.7/a+0.4/c, B2= 0.5/f+ 0.2/g
Fuzzy proposition
if x is A1, then y is B1 also
if x is A2, then y is B2
32
Contd
Relation matrices of A1, B1 are
a 0.2 e f g
M A1 b 0.6 M B1 1.0 0.4 0
c 1.0
Contd
Relation matrices of A2, B2 are
a 0.7 e f g
M A2 b 0 M B 2 0 0.5 0.2
c 0.4
Fuzzy implication A2B2 yields
e f g
a 0 0.5 0.2
M A2 B2 b 0 0 0
c 0 0.4 0.2
33
Contd
Therefore, A1B1 also A2B2 becomes
e f g e f g
a 0.2 0.2 0 a 0 0.5 0.2
M A1 B1 also M A2 B 2 b 0.6 0.4 0 b 0 0 0
c 1.0 0.4 0 c 0 0.4 0.2
e f g
a 0.2 0.5 0.2
b 0.6 0.4 0
c 1.0 0.4 0.2
Contd
For example, U= {a,b,c}, V= {e,f,g}
A1= 0.2/a+0.6/b+1.0/c, B1= 1.0/e+ 0.4/f
A2= 0.7/a+0.4/c, B2= 0.5/f+ 0.2/g
Fuzzy proposition
if x is A1, then y is B1 also
if x is A2, then y is B2
34
Contd
Relation matrices of A1, B1 are
a 0.2 e f g
M A1 b 0.6 M B1 1.0 0.4 0
c 1.0
Contd
Relation matrices of A2, B2 are
a 0.7 e f g
M A2 b 0 M B 2 0 0.5 0.2
c 0.4
Fuzzy implication A2B2 yields
e f g
a 0 0.35 0.14
M A2 B2 b 0 0 0
c 0 0.2 0.08
35
Contd
Therefore, A1B1 also A2B2 becomes
e f g e f g
a 0.2 0.08 0 a 0 0.35 0.14
M A1 B1 also M A2 B 2 b 0.6 0.24 0 b 0 0 0
c 1.0 0.4 0 c 0 0.2 0.08
e f g
a 0.2 0.35 0.14
b 0.6 0.24 0
c 1.0 0.4 0.08
Error
0 0.5 1 1.5 2
A= ‘Big error’
36
(Answer) U= ‘Errors’= {0, 0.5, 1.0, 1.5, 2}
Error
0 0.5 1 1.5 2
A (u ) 1 A (u )
37
U= {a, b, c, d} and
A= 1/a+0.5/c+0.2/d
A (u ) 1 A (u )
(Answer)
A= 1/b+0.5/c+0.8/d
R= 0.1/(x1,y1)+0.9/(x2,y1)+0.7/(x2,y3)
S= 0.2/(x1,y3) +0.6/(x2,y3)
38
(Answer)
(1) Write the relation matrices
MR y1 y2 y3 MS y1 y2 y3
x1 0.1 0 0 x1 0 0 0.2
x2 0.9 0 0.7 x2 0 0 0.6
Note that
AB(u,v)= A(u)B(v)
39
(Answer)
x1 0.1
MA= x2 MAB y1 y2 y3
0
x3 0.5 x1 0.07 0 0.02
x4 0.8 x2 0 0 0
x3 0.35 0 0.1
MB=
y1 y2 y3 x4 0.56 0 0.16
0.7 0 0.2
40