Vous êtes sur la page 1sur 301

# CLASSICAL LOGIC AND FUZZY LOGIC

Dr S.Natarajan
Professor
Department of Information Science and Engineering
PESIT, Bangalore

## CLASSICAL LOGIC AND FUZZY LOGIC

Part I Logic
Equivalence, Exclusive Or Exclusive Nor, Logical Proofs,
Deductive Inferences
Fuzzy Logic, Approximate Reasoning, Fuzzy
Proofs, Other forms of the Implication Operation
Part II Fuzzy Systems
Natural language processing, Lingustic Hedges, Rule
Based Systems, Multiple conjunctve antecedents ,
Aggregation of Fuzzy Rules, Graphical techniques of
inference
2

Classical Logic
What is
LOGIC- Small part of Human body to reason
LOGIC- means to compel us to infer correct answers
What is
NOT LOGIC- Not responsible for our creativity or ability to
remember
LOGIC helps in organizing words to form words- not
context dependent
3

Fuzzy Logic

## FUZZY LOGIC is a method to formalize human

capacity to Imprecise learning called Approximate
Reasoning
Such reasoning represents human ability to reason
approximately and judge under uncertainty

## In Fuzzy Logic --- all truths are partial or approximate

Here, the reasoning has been termed as Interpolative
reasoning
4

Negation (NOT)
Unary Operator, Symbol:

September 5, 2006

true

false

false

true

## Applied Discrete Mathematics

Week 1: Logic and Sets

Conjunction (AND)
Binary Operator, Symbol:

September 5, 2006

PQ

true

true

true

true

false

false

false

true

false

false

false

false

## Applied Discrete Mathematics

Week 1: Logic and Sets

Disjunction (OR)
Binary Operator, Symbol:

September 5, 2006

P Q

true

true

true

true

false

true

false

true

true

false

false

false

## Applied Discrete Mathematics

Week 1: Logic and Sets

Exclusive Or (XOR)
Binary Operator, Symbol:

September 5, 2006

P Q

true

true

false

true

false

true

false

true

true

false

false

false

## Applied Discrete Mathematics

Week 1: Logic and Sets

## Implication (if - then)

Binary Operator, Symbol:

September 5, 2006

P Q

true

true

true

true

false

false

false

true

true

false

false

true

## Applied Discrete Mathematics

Week 1: Logic and Sets

## Biconditional (if and only if)

Binary Operator, Symbol:

September 5, 2006

P Q

true

true

true

true

false

false

false

true

false

false

false

true

## Applied Discrete Mathematics

Week 1: Logic and Sets

10

## Statements and Operators

Statements and operators can be combined in any
way to form new statements.

P
true

Q (P)(Q)

false

true

false true

true

true false

## false false true

September 5, 2006

true

## Applied Discrete Mathematics

Week 1: Logic and Sets

true
11

## Statements and Operations

Statements and operators can be combined in any way
to form new statements.

true

true

PQ (PQ) (P)(Q)
true

false

false

true

true

true

true

## false false false

true

true

September 5, 2006

## Applied Discrete Mathematics

Week 1: Logic and Sets

12

Equivalent Statements
P

true

true false

false

true

true

true

false true

true

true

true

true

true

## The statements (PQ) and (P)(Q) are logically

equivalent, because (PQ) (P)(Q) is always true.
September 5, 2006

## Applied Discrete Mathematics

Week 1: Logic and Sets

13

Conditional (Implication)
This one is probably the least intuitive. Its only
partly akin to the English usage of if,then or
implies.
DEF: p q is true if q is true, or if p is false. In
the final case (p is true while q is false) p q
is false.
Semantics: p implies q is true if one can
mathematically derive q from p.

September 5, 2006

## Applied Discrete Mathematics

Week 1: Logic and Sets

14

Truth Tables
P

PQ

PQ

PQ

PQ

False

False

True

False

False

True

True

False

True

True

False

True

True

False

True

False

False

False

True

False

False

True

True

False

True

True

True

True

15

A tautology is a statement that is always true.
Examples:
R(R)
(PQ) (P)(Q)
If S T is a tautology, we write ST.
If S T is a tautology, we write ST. This symbol
is also used for logical equivalence.

September 5, 2006

## Applied Discrete Mathematics

Week 1: Logic and Sets

16

A contradiction is a statement that is always
false.
Examples:
R(R)
((PQ) (P)(Q))
The negation of any tautology is a contradiction, and the negation of any contradiction is
a tautology.
September 5, 2006

## Applied Discrete Mathematics

Week 1: Logic and Sets

17

TAUTOLOGIES
Tautologies Compound Propositions which are
ALWAYS TRUE , irrespective of TRUTH VALUES
of INDIVIDUAL SIMPLE PROPOSITIONS
APPLICATIONS- DEDUCTIVE REASONING,
THEOREM PROVING ,
DEDUCTIVE INFERENCING ETC.,
Example: A is a set of prime numbers given by
(A1 = 1 , A2 = 2, A3 = 3, A4 = 5, A5 = 7, A6 = 11 ) on
the real line universe X, then the proposition Ai
is not divisible by 6 is A TAUTOLOGY
18

## A method for proving p q.

Assume p, and prove that p (q q)
(q q) is a trivial contradiction, equal to F
Thus pF, which is only true if p=F

19

Definition: The real number r is rational if there
exist integers p and q 0, with no common factors
other than 1 (i.e., gcd(p,q)=1), such that r=p/q. A
real number that is not rational is called irrational.
Theorem: Prove that 2 is irrational.

20

Classical Logic

disjunction ()
conjunction ()
negation ()
implication ()
equivalence ()

## Classical Logic & Fuzzy Logic

Classical predicate logic
T: uU [0,1]
U: universe of all propositions.
All elements u U are true for proposition P are called
the truth set of P: T(P).
Those elements u U are false for P are called falsity
set of P: F(P).
T(Y) = 1 T() = 0

22

Logic
Example 5.1. Let P be the proposition The
structural beam is an 18WF45 and let Q be
the proposition The structural beam is made
of steel. Let X be the universe of structural
members comprising girders, beams, and
columns;
x is an element (beam);
A is the set of all wide-flange (WF) beams; and
B is the set of all steel beams. Hence,
P : x is in A
Q : x is in B

## Classical Logic &Fuzzy Logic

Given a proposition P: xA, P: xA, we have the
following logical connectives:
Disjunction
PQ: x A or x B
hence, T(PQ) = max(T(P),T(Q))
Conjunction
PQ: xA and xB
hence T(P Q)= min(T(P),T(Q))
Negation
If T(P) =1, then T(P) = 0 then T(P) =1
Implication
(P Q): xA or xB
Hence , T(P Q)= T(P Q)
(P Q) : T (P Q) = 1, for T (P) = T (Q)
= 0, for T (P) T (Q)

24

Equivalence
(P Q): T(PQ)=

1,

0,

## The logical connective implication, i.e.,P Q (P implies

Q) presented here is also known as the classical
implication.
P is referred to as hypothesis or antecedent
Q is referred to as conclusion or consequent.
25

## Classical Logic &Fuzzy Logic

T(PQ)=(T(P)T(Q))
Or PQ= (AB is true)
T(PQ) = T(PQ is true) = max (T(P),T(Q))
(A B)= (AB)= AB
So (AB)= A B
Or AB false A B
Truth table for various compound propositions
P

PQ

PQ

PQ

PQ

T(1)

T(1)

F(0)

T(1)

T(1)

T(1)

T(1)

T(1)

F(0)

F(0)

T(1)

F(0)

F(0)

F(0)

F(0)

T(1)

T(1)

T(1)

F(0)

T(1)

F(0)

F(0)

F(0)

T(1)

F(0)

F(0)

T(1)

T(1)

26

Classical Logic
P : truth that x A
Q : truth that x B where truth is measured in terms of the
truth value, that is,
if x A, T (P) = 1; otherwise, T (P) = 0
if x B, T (Q) = 1; otherwise, T (Q) = 0
or, using the characteristic function to represent truth (1) and
falsity (0), the following notation results:
A(x) = 1 x A
=0 x A
A notion of mutual exclusivity arises in this calculus.
For the situation involving two propositions P and Q, where T
(P) T (Q) = , we have that the truth of P always implies the
falsity of Q and vice versa;
hence, P and Q are mutually exclusive propositions.

Logic
(P Q) : T (P Q) = 1, for T (P) = T (Q)
= 0, for T (P) T (Q)

Logic
Example 5.2. (Similar to Gill, 1976). Consider the following four
propositions:
1. if 1 + 1 = 2, then 4 > 0; conclusion is T regardless of the
Hypothesis
2. if 1 + 1 = 3, then 4 > 0; conclusion is T regardless of the
Hypothesis
3. if 1 + 1 = 3, then 4 < 0; both propositions are false but this does
not
disprove the implication
4. if 1 + 1 = 2, then 4 < 0. a true hypothesis cannot produce a false
conclusion
Hence, the classical form of the implication is true for all
propositions of P and Q except for those propositions that are in
both the truth set of P and the false set of Q
_ __ _
T (P Q) = T (P) T (Q)

Logic
__
(P Q) (A B is true) (either not in A or in B)
_
___
so that T (P Q) = T (P Q) = max(T (P), T (Q))
This expression is linguistically equivalent to the statement P
Q is true when either not A or B is true (logical or)
Graphically, this implication and the analogous set operation
are represented by the Venn diagram in Figure

Logic

## Suppose the implication operation involves two different

universes of discourse:
P is a proposition described by set A, which is defined on
universe X, and
Q is a proposition described by set B, which is defined on
universe Y. Then, the implication P Q can be represented in
set-theoretic terms by the relation R, where R is defined as
_
R = (A B) (A Y) IF A, THEN B IF x A where x X
and A X
THEN y B where y Y and B Y
The graphic in the figure below, represents the space of the
Cartesian product X Y showing typical sets A and B;
superposed on this space is the set-theoretic equivalent of
the implication. That is,

## Classical Logic &Fuzzy Logic

PQ: If x A, Then y B, or PQ AB
The shaded regions of the compound Venn diagram in
the following figure represent the truth domain of the
implication, If A, then B(PQ).
X
A

B
Y

32

33

34

A coupled with B

A entails B

## Fuzzy if-then rules (cont.)

Two ways to interpret If x is A then y is B:
A coupled with B

35

## Classical Logic &Fuzzy Logic

IF A, THEN B, or IF A , THEN C
PREDICATE LOGIC
(PQ)(PS)
Where P: xA, AX
Q: yB, BY
S: yC, CY
SET THEORETIC EQUIVALENT
(A X B)(A X C) = R = relation ON X Y
Truth domain for the
above compound
proposition.
36

37

38

Classical Logic

## Venn diagram for equivalence (darkened areas), that is, for T

(A B).
Example:
Suppose we consider the universe of positive integers, X =
{1 n 8}. Let P = n is an even number and let Q = (3
n 7) (n = 6). Then T (P) = {2, 4, 6, 8} and T (Q) = {3, 4,
5, 7}. The equivalence

Q has
setT (Q)) (T (P)
___ T (Q))
___ = {4}
TP (P
Q) the
= (Ttruth
(P )
{1} = {1, 4}

Classical Logic
Example . Prove that P Q if P = n is an integer power of 2
less than 7 and greater than zero and Q = n2 6n + 8 = 0.
Since T (P) = {2, 4} and T (Q) = {2, 4}, it follows that P Q is
an equivalence

Classical Logic

## Exclusive OR grey areas

Tautologies
Modus ponens deduction, is a very common inference scheme used in
forwardchaining rule-based expert systems
It is an operation whose task is to find the truth value of a consequent in a
production rule, given the truth value of the antecedent in the rule
Modus ponens deduction concludes that given two propositions,
P and P Q, if both of which are true, then the truth of the simple
proposition Q is automatically inferred.
Modus tollens, an implication between two propositions is combined with a
second
proposition and both are used to imply a third proposition
Common Tautologies
_
B B X.
_
A X; A X X.
(A (A B)) B (modus ponens)
_
_
(B (A B)) A (modus tollens).

## Classical Logic &Fuzzy Logic

Exclusive or
Exclusive Nor
Exclusive or P Q
(AB) (AB)
Exclusive Nor
(P Q)(PQ)
Logical proofs
Logic involves the use of inference in everyday life.
In natural language if we are given some hypothesis it is
often useful to make certain conclusions from them the
so called process of inference (P1P2.Pn) Q is
true.

## Classical Logic &Fuzzy Logic

Hypothesis : Engineers are mathematicians. Logical
thinkers do not believe in magic. Mathematicians are
logical thinkers.
Conclusion : Engineers do not believe in magic.
Let us decompose this information into individual
propositions
P: a person is an engineer
Q: a person is a mathematician
R: a person is a logical thinker
S: a person believes in magic
The statements can now be expressed as algebraic
propositions as
((PQ)(RS)(QR))(PS)
It can be shown that the proposition is a tautology.

## Classical Logic &Fuzzy Logic

Deductive inferences
The modus ponens deduction ( for p q if p holds the q is inferred)
is used as a tool for making inferences in rule based systems. This
rule can be translated into a relation between sets A and B.
R = (AB)(AY) Y is the universe
Now suppose a new antecedent say A is known, since A implies B
is defined on the cartesian space X Y, B can be found through the
following set theoretic formulation
__
B= AR= A((AB)(AY))
Denotes the composition operation. Modus ponens deduction can
also be used for compound rule.

## Classical Logic &Fuzzy Logic

Whether A is contained only in the complement of A
or whether A and A overlap to some extent as
described next:
IF AA, THEN y=B
IF AA THEN y =C
IF AA , AA, THEN y= BC

Fuzzy Logic
The restriction of classical propositional calculus to a twovalued logic has created many interesting paradoxes over
the ages. For example, the barber of Seville is a classic
paradox (also termed as Russells barber). In the small
Spanish town of Seville, there is a rule that all and only
those men who do not shave themselves are shaved by a
barber. Who shaves the barber?
Another example comes from ancient Greece. Does the liar
from Crete lie when he claims, All Cretians are liars? If he
is telling the truth, then the statement is false. If the
statement is false, he is not telling the truth.

Fuzzy Logic
Let

## S: the barber shaves himself

S: he does not

S S and S S
T(S) = T(S) = 1 T(S)
T(S) = 1/2
But for binary logic T(S) = 1 or 0
Fuzzy propositions are assigned for fuzzy sets:

T P A x
~

0 A 1
~

## Classical Logic &Fuzzy Logic

Some common tautologies follow:
BB X
AX;

A X X

## AB (A(AB))B (modeus ponens)

(B(AB))A (modus tollens)
Proof:
(A(AB)) B
(A(AB)) B Implication
((AA) (AB))B
Distributivity
((AB))B
Excluded middle laws
(AB)B
Identity
(AB)B
Implication
(AB)B
Demorgans law
A(BB)
Associativity
AX
Excluded middle laws
X T(X) =1
Identity; QED

50

Proof
(B(AB))A
(B(AB))A
((BA)(BB)) A
((BA))A
(BA)A
(BA)A
(BA)A
B(AA)
BX = X T(X) =1

Truth table
(modus ponens)

AB

(A(AB)

(A(AB)B

O 0

O 1

51

52

## Classical Logic &Fuzzy Logic

Exclusive or
Exclusive Nor
Exclusive or P Q
(AB) (AB)
Exclusive Nor
(P Q)(PQ)
Logical proofs
Logic involves the use of inference in everyday life.
In natural language if we are given some hypothesis it is
often useful to make certain conclusions from them the
so called process of inference (P1P2.Pn) Q is
true.
53

## Classical Logic &Fuzzy Logic

Hypothesis : Engineers are mathematicians. Logical
thinkers do not believe in magic. Mathematicians are
logical thinkers.
Conclusion : Engineers do not believe in magic.
Let us decompose this information into individual
propositions
P: a person is an engineer
Q: a person is a mathematician
R: a person is a logical thinker
S: a person believes in magic
The statements can now be expressed as algebraic
propositions as
((PQ)(RS)(QR))(PS)
It can be shown that the proposition is a tautology.

54

## Classical Logic &Fuzzy Logic

Deductive inferences
The modus ponens deduction is used as a tool for
making inferences in rule based systems. This rule can
be translated into a relation between sets A and B.
R = (AB)(AY)
Now suppose a new antecedent say A is known, since A
implies B is defined on the cartesian space X Y, B can
be found through the following set theoretic formulation
B= AR= A((AB)(AY))
Denotes the composition operation. Modus ponens
deduction can also be used for compound rule.
55

## Classical Logic &Fuzzy Logic

Whether A is contained only in the complement of A
or whether A and A overlap to some extent as
described next:
IF AA, THEN y=B
IF AA THEN y =C
IF AA , AA, THEN y= BC

56

Fuzzy Logic

Negation

T P 1 T P

Disjunction

P Q : x A or B

T P Q max T P , T Q
~
~ ~
~

Conjunction

P Q : x A and B
~

T P Q min T P , T Q
~
~ ~
~

PQ
~

T P Q T P Q max T P , T Q
~
~
~
~ ~
~

Fuzzy Logic
When the logical conditional implication is of the
compound form,
IF x is A~ , THEN y is B~ , ELSE y is C~
Then fuzzy relation is:

R A B A C
~

## whose membership function can be expressed as:

R x, y max A x B y , 1 A x C y
~
~
~
~
~

Fuzzy Logic
Rule-based format to represent fuzzy information.
Rule 1: IF x is A
, THEN y is B~ , where A
and B~ represent
~
~
fuzzy propositions (sets)
Now suppose we introduce a new antecedent, say, and we
consider the following rule
' , THEN y is B '
Rule 2: IF x is A
~
~

B ' A'R
~

Fuzzy Logic

Fuzzy Logic
Suppose we use A in fuzzy composition, can we get

B B R
~

Example:
For the problem in pg 127, let
A = A
B = A R
= A R
= {0.4/1 + 0.4/2 + 1/3 + 0.8/4 + 0.4/5 + 0.4/6} B

## Classical Logic &Fuzzy Logic

Logic connectives
Disjunction
Conjunction
Negation
Implication
Equivalence
If xA, T(P) =1 otherwise T(P) = 0
Or
xA(x)={ 1 if x A, otherwise it is 0 }
If T(p)T()=0 implies P true, false, or true P false.
P and are mutually exclusive propositions.
62

## Fuzzy if-then rules

General format:
If x is A then y is B (where A & B are linguistic
values defined by fuzzy sets on universes of
discourse X & Y).
x is A is called the antecedent or premise
y is B is called the consequence or
conclusion
Examples:

## 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.

63

64

## Meaning of fuzzy if-then-rules (A B)

It is a relation between two variables x & y;
therefore it is a binary fuzzy relation R defined on
X*Y
There are two ways to interpret A B:
A coupled with B
A entails B
if A is coupled with B then:

## Fuzzy if-then rules (3.3) (cont.)

65

If A entails B then:
R = A B = A B ( material implication)
R = A B = A (A B) (propositional calculus)
R = A B = ( A B) B
(extended propositional calculus)

66

67

Rules of Inference
Rules of inference provide the justification of
the steps used in a proof.
One important rule is called modus ponens or the
law of detachment. It is based on the tautology
(p (p q)) q. We write it in the following
way:
The two hypotheses p and p q are
p
written in a column, and the conclusion
p q below a bar, where means therefore.
____
q
Spring 2003

## CMSC 203 - Discrete Structures

68

Rules of Inference
The general form of a rule of inference is:
p1
p2
.
.
.
pn
____
q

Spring 2003

## The rule states that if p1 and p2 and

and pn are all true, then q is true as well.
Each rule is an established tautology of
p1 p 2 p n q
These rules of inference can be used in
any mathematical argument and do not
require any proof.
CMSC 203 - Discrete Structures
69

CS 173
Proofs - Modus Ponens
I am Mila.
If I am Mila, then I am a great swimmer.
I am a great swimmer!
p
pq

Tautology:
(p (p q)) q

Inference
Rule:
Modus
Ponens
70

CS 173
Proofs - Modus Tollens
I am not a great skater.
If I am Erik, then I am a great skater.
I am not Erik!
q
pq

Tautology:
(q (p q)) p

Inference
Rule:
Modus
Tollens
71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

Fuzzy Logic
The restriction of classical propositional calculus to a twovalued logic has created many interesting paradoxes over
the ages. For example, the barber of Seville is a classic
paradox (also termed as Russells barber). In the small
Spanish town of Seville, there is a rule that all and only
those men who do not shave themselves are shaved by a
barber. Who shaves the barber?
Another example comes from ancient Greece. Does the liar
from Crete lie when he claims, All Cretians are liars? If he
is telling the truth, then the statement is false. If the
statement is false, he is not telling the truth.
92

Fuzzy Logic
Let

## S: the barber shaves himself

S: he does not

S S and S S
T(S) = T(S) = 1 T(S)
T(S) = 1/2
But for binary logic T(S) = 1 or 0
Fuzzy propositions are assigned for fuzzy sets:

T P A x
~

0 A 1
~

93

Fuzzy Logic

Negation

T P 1 T P

Disjunction

P Q : x A or B

T P Q max T P , T Q
~
~ ~
~

Conjunction

P Q : x A and B
~

T P Q min T P , T Q
~
~ ~
~

PQ
~

T P Q T P Q max T P , T Q
~
~
~
~ ~
~

94

Fuzzy Logic

R A B A Y
~

R x, y max A x B y , 1 A x
~

Example:

A = medium uniqueness =
~

0.6 1 0.2

2 3 4

~

## 0.4 1 0.8 0.3

5
2 3 4

Then
95

Fuzzy Logic

96

Fuzzy Logic
When the logical conditional implication is of the
compound form,
IF x is A~ , THEN y is B~ , ELSE y is C~
Then fuzzy relation is:

R A B A C
~

## whose membership function can be expressed as:

R x, y max A x B y , 1 A x C y
~
~
~
~
~

97

Fuzzy Logic
Rule-based format to represent fuzzy information.
Rule 1: IF x is A
, THEN y is B~ , where A
and B~ represent
~
~
fuzzy propositions (sets)
Now suppose we introduce a new antecedent, say, and we
consider the following rule
' , THEN y is B '
Rule 2: IF x is A
~
~

B ' A'R
~

98

Fuzzy Logic

99

Fuzzy Logic
Suppose we use A in fuzzy composition, can we get

B B R
~

Example:
For the problem in pg 127, let
A = A
B = A R
= A R
= {0.4/1 + 0.4/2 + 1/3 + 0.8/4 + 0.4/5 + 0.4/6} B
100

Equivalence, and Logical Proofs
The following form of the implication operator show
different techniques for obtaining the membership function
values of fuzzy relation R defined on the Cartesian product
~
space X Y:

101

Equivalence, and Logical Proofs
The following common methods are among those proposed
B A R
A
in the literature for the composition operation
,
~
~
~
~
B
where is the input, or antecedent defined on the universe~ X,
is the output, or consequent defined on the universe Y, R~
and
is a fuzzy relation characterizing the relationship
between specific inputs (x) and specific outputs (y):

## Refer fig on next slide

102

Equivalence, and Logical Proofs
The extension of truth operations for tautologies,
contradictions, equivalence, and logical proofs is no
different for fuzzy sets; the results, however, can differ
considerably from those in classical logic. If the truth
values for the simple propositions of a fuzzy logic
compound proposition are strictly true (1) or false (0), the
results follow identically those in classical logic. However,
the use of partially true (or partially false) simple
propositions in compound propositional statements results
in new ideas termed quasi tautologies, quasi
contradictions, and quasi equivalence. Moreover, the idea
of a logical proof is altered because now a proof can be
shown only to a matter of degree. Some examples of
these will be useful.
103

Equivalence, and Logical Proofs
Truth table (approximate modus ponens)
A

AB

(A(AB))

.3

.2

.7

.3

.7

.3

.8

.8

.3

.8

.7

.2

.3

.3

.7

.7

.8

.8

.7

.8

(A(AB))B
Quasi tautology

## Truth table (approximate modus ponens)

A

AB

(A(AB))

.4

.1

.6

.4

.6

.4

.9

.9

.4

.9

.6

.1

.4

.4

.6

.6

.9

.9

.6

.9

(A(AB))B
Quasi tautology

104

Equivalence, and Logical Proofs
The following form of the implication operator show
different techniques for obtaining the membership function
values of fuzzy relation R defined on the Cartesian product
~
space X Y:

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

## CLASSICAL LOGIC AND FUZZY LOGIC

Part I Logic
Equivalence, Exclusive Or Exclusive Nor, Logical Proofs,
Deductive Inferences
Fuzzy Logic, Approximate Reasoning, Fuzzy
Proofs, Other forms of the Implication Operation
Part II Fuzzy Systems
Natural language processing, Lingustic Hedges, Rule
Based Systems, Multiple conjunctve antecedents ,
Aggregation of Fuzzy Rules, Graphical techniques of
inference
132

133

NATURAL LANGUAGE

## Is perhaps the most powerful form of conveying

information.
Despite its vagueness and ambiguity it is the
vehicle for human communication, and it seems
appropriate that a mathematical theory that deals
with fuzziness and ambiguity is also the same
tool used to express and interpret the linguistic
character of our language. Natural language is
used in the expression of knowledge form
known as RULE BASED SYSTEMS

NATURAL LANGUAGE

## Cognitive scientists tell us that human base their

thinking primarily on conceptual patterns and
mental images rather than on any numerical
quantities.
In fact the expert system paradigm known as
Frames is based on the notion of a cognitive
picture in one's mind.
Furthermore, humans communicate with their own
natural language by referring to previous mental
images with rather vague but simple terms.
Despite the vagueness and ambiguity in natural
language, humans communicating in a common
language have very little trouble in basic
understanding.

## Since a vast amount of information involved in

human communication involves natural language
terms that, by their very nature, are often vague,
imprecise, ambiguous, and fuzzy, we will propose
the use of fuzzy sets as the mathematical
foundation of our Natural Language (NL).
NL consists of
- atomic terms :The fundamental terms.
Ex: slow, medium, young, beautiful etc.
composite : a collection of of atomic terms or
set of terms.
Ex: very slow horse, heavy-weight female,
fairly beautiful painting, etc

Natural Language
The time interval x was the period exhibiting a 100 percent maximum of
possible values as measured along some arbitrary social scale, [and]
the interval x was the period of time exhibiting 100 percent minimum of
these values as measured along the same scale.
Crisp version of this passage is identical to that posed by the law of
excluded middle of probability theory.
The decomposition of compound rules into canonical (equivalent)
forms and the treatment of rules forms as logical propositions. The
characterization of the confidence in a particular rule is addressed
by using the truth qualifications. The expression of rules as a
collection of logical implications manipulated by inference schemes
137

## Knowledge & Mappings

Knowledge is a collection of facts from
some domain.
What we need is a representation of facts
that can be manipulated by a program.
Some symbolic representation is necessary.
Need to be able to map facts to symbols.
Need to be able to map symbols to facts?

138

## A.I. Problems & K.R.

Game playing - need rules of the game,
strategy, heuristic function(s).
Expert Systems - list of rules, methods to
extract new rules.
Learning - the space of all things learnable
(domain representation), concept
representation.
Natural Language - symbols, groupings,
semantic mappings, ...
139

Representation Properties
Representational Adequacy - Is it possible to
represent everything of interest ?
Inferential Adequacy - Can new information
be inferred?
Inferential Efficiency - How easy is it to infer
new knowledge?
Acquisitional Efficiency - How hard is it to
gather information (knowledge)?
140

## Search and State Representation

Each state could be represented as a
collection of facts.
Keeping many such states in memory may
be impossible.
Most facts will not change when we move
from one state to another.

141

## The Frame Problem

Determining how to best represent facts that
change from state to state along with those
facts that do not change is the Frame
Problem.
Sometimes the hard part is determining
which facts change and which do not.

142

## Fuzzy Rule-based systems

Using fuzzy sets as a calculus to interpret natural
language. It is vague, imprecise, ambiguous and fuzzy.
Fundamental terms atoms
Collection of atomic terms composite or set of terms
An atomic term (a linguistic variable) can be interpreted
using fuzzy sets.
An atomic term in the universe of natural language, X.
Define a fuzzy set A
~ in the universe of interpretations or
meanings, Y as a specific meaning of .
143

## Suppose we define a specific atomic term in the

universe of NL, X, as element and we define
fuzzy set A in the universe of interpretations , or
meanings, Y, as a specific meaning for the term .
then NL can be expressed as a mapping, M from a
set of atomic terms in X to a corresponding set of
interpretations defined on Y.

## Each atomic term in X corresponds to a fuzzy

set A in Y, which is the interpretation of

A

MA

M , y A y
~

1 y 25

25

M youg y
~

y 25
y 25

145

## Fuzzy Rule-based systems

Composite

or :
or y max y , y
and :
and y min y , y
Not : y 1 y

146

LINGUISTIC HEDGES

## In linguistics, fundamental atomic terms are often

like very, low, slight, almost, more-or-less, etc
Using fuzzy sets as the calculus of interpretation,
these linguistic hedges have the effect of
modifying the membership function for a basic
atomic term
Define = a(y)/y, then
y

very = 2 = [(y)]2/y

Very, very = 4

plus =1.25

minus = 0.75

concentrations

## Another operation on linguistic fuzzy sets is

known as intensification.
Intensification can be expressed by numerous
algorithms, one of which, proposed by Zadeh, is
2 2(y)

2
1-2[1-
(y)]

intensify a = =

## for 0<= (y) <= 0.5

for 0.5 <= (y) <= 1

## Combination of concentration and dilation

Parentheses may be used to change the precedence
order and ambiguities may be resolved by the use
of association-to-the-right. For example, plus
very minus as plus(very(minus))

Concentration
of A

Dilation of A

x
Intensification
of A

## Concentration reduces the degree of membership of the elements

which are partly in the set
Hedge very with membership of .9 reduced by 10 percent to a value
.81 whereas, membership value of .1 is reduced by an order of
magnitude .01.
Decrease Manifestation of the properties of the properties of the
membership value itself for 0 1 then >= 2
Dilation- Stretch or dilate fuzzy set by increasing the membership
of elements that are partly in the set
For the hedge slightly membership value .81 is increased by 11% to
get 0.9 and the membership value of 0.01 is increased by an order
of magnitude to 0.1

151

## Precedence for linguistic hedges

and logical operations
Precedence

Operation

First

Hedge, not

Second

and

Third

or

Linguistic Hedges
Very

y

y
y
Very

very 4

plus 1.25
Slightly

y

y
y

Minus 0.75
2 y

Intensify

1 21 y 2

0 y 0.5
0.5 y 1

It increases contrast.
153

## Precedence of the Operations

Example:
Suppose we have a universe of integers, Y = {1,2,3,4,5}.
We define the following linguistic terms as a mapping onto
Y:
small = 1 .8 .6 .4 .2
large =

3
4
5
1 2
.2 .4 .6 .8 .1

2
3
4
5
1

154

## very small = small2 = {1/1 + 0.64/2 + 0.36/3 + 0.16/4

+0.04/5}
Not very small = 1- very small = {0/1 + 0.36/2 + 0.64/3+
0.84/4+ 0.96/5}
Thus we construct a phrase, or a composite term:
= not very small and not very very large which
involves the following set-theoretic operations:

155

Example (contd)
1 21 1 2 1 21 0.8 2 1 21 0.6 2

1
2
3

Intensely small =
2
2
2 0.4 2 0.2

4
5
1 0.92 0.68 0.32 0.08

2
3
4
5
1

156

Rule-based systems

## In the field of AI there are various ways to

represent knowledge.
IF premise (antecedent), THEN conclusion
(consequent)
Commonly referred to as the IF-THEN rule-based
form
The rule-based system is distinguished from
expert systems in the sense that the rules
comprising a rule-based system might derive from
sources other that human experts and, in this
context, are distinguished from expert systems.

Rule-based Systems
IF-THEN rule based form
Canonical Rule Forms
1. Assignment statements
x = large, x y
2. Conditional statements
If A then B,
If A then B, else C
3. Unconditional statements
stop
go to 5
unconditional can be
If any conditions, then stop
If condition Ci, then restrict Ri

158

## Canonical Rule Forms

Assignment statements
x = large
bananas color = yellow
x approx= s
Conditional statements
IF the tomato is red THEN the tomato is ripe
IF x is very hot THEN stop

Unconditional statements
go to 9
stop
divide by x
turn the pressure higher

## The rule base under consideration could be

described using a collection of conditional
restrictive statements. These statements may also
be modeled as fuzzy conditional statements, such
as
IF condition C1 THEN restriction R1.

## The unconditional restrictions might be in the form

R1: The output is B1
AND
R2: The output is B2
AND
etc.
Where B1, B2, . Are fuzzy consequents.

## Rule 1: IF cond C1, THEN restriction R1

Rule 2: IF cond C2, THEN restriction R2
.
.
Rule n: IF cond Cn, THEN restriction Rn.

Example
if the temperature is hot, then the pressure is
rather high.
if the temperature is cold, then the pressure is
very low.
The vague term rather high in the first statement
places a fuzzy restriction on the pressure , based
on a fuzzy hot temperature condition in the
antecedent.

## Decomposition of Compound Rule

Any compound rule structure can be decomposed and
reduced to a number of simple canonical rules.
The most commonly used techniques
Multiple Conjunctive Antecedents
2
L
S
A
If x is and A A , then y is B
~

Define

A A A A
~

A x min A x , , A x

S
S
IF A THEN B
~

163

## A linguistic statement expressed by a human might

involve compound rule structures
as an example, consider a rule-based for a simple
home temperature control problem, which might
contain the following rules.
IF it is raining hard
THEN close the window.
IF the room temp is very hot,
THEN
IF the heat is on
THEN turn the heat lower
AND IF it is not raining hard
THEN open the window. etc..

## Multiple Disjunctive Antecedents

1

A or or A
If x is A
or
~
~
~
then y is B
~

S
S

A A A A
~

AS x max A1 x , , A L x
S

B
IF A
THEN
~
~

165

## Multiple conjunctive antecedents

IF x is A1 and A2 and AL THEN y is Bs
As = A1 A2 AL
As(x) = min [A1(x), , Al(x)]
IF As THEN Bs

## Multiple disjunctive antecedents

IF x is A1 or A2 or AL THEN y is Bs
As = A1 A2 A L
As(x) = max [A1(x), , Al(x)]
IF x is As THEN y is Bs

Condition Statements
1

1
B ) decomposed into:
B
1. IF A
THEN
(
ELSE
~
~
1
1~
1
2
B
A THEN B
IF A
THEN
or
IF
NOT
~
~
~
~
1

1
2
B
A
2. IF A
(THEN
)
unless
decomposed into:
~
~
~
1
1
2
1
IF A THEN B
or
IF NOT A THEN NOT B
~

1
A THEN ( B 2 )) decomposed into:
B
3. IF A
THEN
(
ELSE
IF
~
~
1
1~
1 ~
2
2
B
A and A THEN NOT B
IF A
THEN
or
IF
NOT
~
~
~
~
~

## 4. Nested IF-THEN rules

1
1
2
B
IF A THEN (IF A , THEN ( ~ )) becomes
~1
~
2
IF A and A THEN B1
~

## Each canonical form is an implication, and we can reduce

the rules to a series of relations.
167

Condition Statements
likely very likely highly likely true fairly true very true
false fairly false very false

x X
anything x 1
Let be a fuzzy truth value very true true fairly true
fairly false false
A truth qualification proposition can be expressed as:
x is A~ is
or
x is A~ is = A x
~

A x 0.5
~

168

## Aggregation of fuzzy rule

The process of obtaining the overall consequent
(conclusion) from the individual consequent contributed by
each rule in the rule-base is known as aggregation of
rules.
Conjunctive System of Rules:
y y1 y 2 y r
y y min y1 y , , y r y y Y

## Disjunctive System of Rules:

y y1 y 2 y r
y y max y1 y , , y r y y Y

169

170

171

## highly unlikely = minus very very unlikely =

(very
very unlikely)0.75 = 1/0 + 1/.1 + 1/.2 + .5/.3 + .3/.4}
Ex: if a fuzzy variable x has a membership value equal to .85 in
the fuzzy set A i.e., (x)=.85 as shown in the figure then its
membership values for the following truth qualification
statements are determined from figure
: x is A is
true
: x is A is
false
: x is A is
fairly true
: x is A is
very false

A(x) = .85

A(a)
1

A(x) = .15

.96
.85

A(x) = .96

.15
a

.85

A(x) = .04

## Conjunctive system of rules.

y = y1 and y2 and and yr
Or
y = y1 y2 yr
Defined by y(y) = min (y1(y),yr(y))
for y belongs to Y

## Disjunctive system of rules

y = y1 or y2 or or yr
Or
y = y1 U y2 U U y r
Defined by y(y) = max (y1(y), y(r-1)(y), yr(y))
for y belongs to Y

175

176

177

178

179

180

181

182

183

184

185

186

## Fuzzy rules can be formulated:

from human experts knowledge or experience
by statistical analysis of numerical data obtained
from experimentation
through neuro-fuzzy optimisation (learning)
Inference System), FuNe (Neuro-Fuzzy learning
network with rule generation)

Slide 187

188

Fuzzy Logic

## Graphical Techniques of Inference

The most commonly used fuzzy inference technique is the
so-called Mamdani method.
In 1975, Professor Ebrahim Mamdani of London
University built one of the first fuzzy systems to control a
steam engine and boiler combination. He applied a set of
fuzzy rules supplied by experienced human operators.

189

## Inspiration: lexical imprecision in natural language

reasoning
price of crude oil which has edged higher in recent
weeks after being remarkably stable through much
of the year, may fluctuate as much as a dollar a
barrel in the months ahead, but abrupt changes are
not likely, many analysts believe.
Almost all our everyday reasoning is approximate
in nature.

Slide 190

FIS: Inspiration

## High precision entails high cost.

park the car
park the car 10cm from the curb

## High precision entails low tractability

reduce the precision of information to make a
complex problem more tractable

Slide 191

FIS: Applications

## Replacement of human operator by a FIS:

Sendai subway (Hitachi), Elevator control (Hitachi,
Toshiba)
Nuclear reactor control (Hitachi)
Automobile transmission (Nissan, Subaru, Honda)
Video image stabilisation (Canon, Minolta)

## Replacement of human expert by a FIS:

medical diagnosis
Securities
Fault diagnosis
Credit worthiness

Slide 192

FIS

Defuzzifier

Slide 193

Fuzzy Operations

## Union operation (OR)

A B ( x) max A , B

## Intersection operation (AND)

A B ( x) min A , B

A ( x) 1 A

Slide 194

## Single rule with single antecedent

Rule: if x is A then y is B
Fact: x is A
Inference: y is B
Graphical Representation:
A A

x is A

B
X

y is B

Y
Slide 195

## ith rule: if x1 is A1i and and xn is Ani then y is Bi

1. Determine the degree of membership of each input to
different fuzzy terms Aji:
2. Determine the strength of each rule antecedent
j runs on each fuzzy term
i runs on each rule

## 3. Determine the contribution of each rule

4. Rule aggregation
5. Defuzzification
Slide 196

Fuzzy Logic

in four steps:

## 1. Fuzzification of the input variables

2. Rule evaluation (inference)
3. Aggregation of the rule outputs (composition)
4. Defuzzification.
13th October 2005

197

Fuzzy Logic

## Mamdani Fuzzy Inference

We examine a simple two-input one-output problem that includes three
rules:
Rule: 1
IF
OR
THEN

Rule: 1
x is A3 IF
y is B1 OR
project_staffing is small
z is C1 THEN risk
is low

Rule: 2
IF
AND
THEN

Rule: 2
x is A2 IF
project_funding is marginal
y is B2 AND project_staffing is large
z is C2 THEN risk
is normal

Rule: 3 Rule: 3
IF
x is A1 IF
THEN z is C3 THEN risk
is high
13th October 2005

198

## Artificial Intelligence CS364

Fuzzy Logic

Step 1: Fuzzification

The first step is to take the crisp inputs, x1 and y1 (project funding and
project staffing), and determine the degree to which these inputs
belong to each of the appropriate fuzzy sets.

Crisp Input
x1
1
0.5
0.2
0

A1

A2
x1

(x = A1) = 0.5
(x = A2) = 0.2

Crisp Input
y1
1
0.7

A3
X

B1

0.1
0

Project Funding
13th October 2005

B2

y1

(y = B1) = 0.1
(y = B2) = 0.7

Project Staffing
Bogdan L. Vrusias 2005

Fuzzy Logic

## Step 2: Rule Evaluation

The second step is to take the fuzzified inputs,
(x=A1) = 0.5, (x=A2) = 0.2, (y=B1) = 0.1 and (y=B2) = 0.7,
and apply them to the antecedents of the fuzzy rules.
If a given fuzzy rule has multiple antecedents, the fuzzy
operator (AND or OR) is used to obtain a single number
that represents the result of the antecedent evaluation.
This number (the truth value) is then applied to the
consequent membership function.

200

Fuzzy Logic

## Step 2: Rule Evaluation

RECALL:
To evaluate the disjunction of the rule antecedents, we use the
OR fuzzy operation. Typically, fuzzy expert systems make
use of the classical fuzzy operation union:

## AB(x) = max [A(x), B(x)]

Similarly, in order to evaluate the conjunction of the rule
antecedents, we apply the AND fuzzy operation intersection:

## AB(x) = min [A(x), B(x)]

13th October 2005

201

Fuzzy Logic

## Step 2: Rule Evaluation

1

A3

B1

0.1

0.0
0

x1

Rule 1: IF x is A3 (0.0)

OR

y1

y is B1 (0.1)

A2
0

x1

y1

1

A1

AND
(min)
Y

## 13th October 2005

0.2

C1

C2

z is C2 (0.2)
C2

THEN
Bogdan L. Vrusias 2005

C3

1
0.5 C1

Rule 3: IF x is A1 (0.5)

C3

z is C1 (0.1)

THEN

0.5

x1

C2

B2
0

C1

THEN
0.7

0.2
X

OR
(max)

0.1

C3
Z

z is C3 (0.5)
202

Fuzzy Logic

## Step 2: Rule Evaluation

Now the result of the antecedent evaluation can be applied
to the membership function of the consequent.
There are two main methods for doing so:
Clipping
Scaling

203

Fuzzy Logic

## Step 2: Rule Evaluation

The most common method of correlating the rule
consequent with the truth value of the rule antecedent is to
cut the consequent membership function at the level of the
antecedent truth. This method is called clipping (lambdacut).
Since the top of the membership function is sliced, the
clipped fuzzy set loses some information.
However, clipping is still often preferred because it
involves less complex and faster mathematics, and
generates an aggregated output surface that is easier to
defuzzify.
13th October 2005

204

Fuzzy Logic

## Step 2: Rule Evaluation

While clipping is a frequently used method, scaling offers
a better approach for preserving the original shape of the
fuzzy set.
The original membership function of the rule consequent
is adjusted by multiplying all its membership degrees by
the truth value of the rule antecedent.
This method, which generally loses less information, can
be very useful in fuzzy expert systems.

205

Fuzzy Logic

Degree of
Membership
1.0

Degree of
Membership
1.0
C2

C2

0.2

0.2

0.0

0.0

clipping

scaling

206

Fuzzy Logic

## Step 3: Aggregation of the rule outputs

Aggregation is the process of unification of the outputs of
all rules.
We take the membership functions of all rule consequents
previously clipped or scaled and combine them into a
single fuzzy set.
The input of the aggregation process is the list of clipped
or scaled consequent membership functions, and the output
is one fuzzy set for each output variable.

207

Fuzzy Logic

C1

C2

C3

0.5

0.2

0.1
0

z is C 1 (0.1)

0.5
0.1

z is C 2 (0.2)

z is C 3 (0.5)

0.2
0

208

## Artificial Intelligence CS364

Fuzzy Logic

Step 4: Defuzzification
The last step in the fuzzy inference process is
defuzzification.
Fuzziness helps us to evaluate the rules, but the final
output of a fuzzy system has to be a crisp number.
The input for the defuzzification process is the aggregate
output fuzzy set and the output is a single number.

209

## Artificial Intelligence CS364

Fuzzy Logic

Step 4: Defuzzification
There are several defuzzification methods, but probably
the most popular one is the centroid technique. It finds
the point where a vertical line would slice the aggregate set
into two equal masses. Mathematically this centre of
gravity (COG) can be expressed as:
b

COG

A x x dx
a
b

A x dx
a

210

## Artificial Intelligence CS364

Fuzzy Logic

Step 4: Defuzzification
Centroid defuzzification method finds a point representing
the centre of gravity of the fuzzy set, A, on the interval, ab.
A reasonable estimate can be obtained by calculating it
over a sample of points.
(x)
1.0
0.8
A

0.6
0.4
0.2
0.0
150
13th October 2005

160

170

180

190

200

X
210
211

## Artificial Intelligence CS364

Fuzzy Logic

Step 4: Defuzzification
Degree of
Membership
1.0
0.8
0.6
0.4
0.2
0.0
0

10

20

30

40

50

60

70
67.4

COG

80

90

100
Z

## (0 10 20) 0.1 (30 40 50 60) 0.2 (70 80 90 100) 0.5

67.4
0.1 0.1 0.1 0.2 0.2 0.2 0.2 0.5 0.5 0.5 0.5

212

Fuzzy Logic

## Sugeno Fuzzy Inference

Mamdani-style inference, as we have just seen, requires us
to find the centroid of a two-dimensional shape by
integrating across a continuously varying function. In
general, this process is not computationally efficient.
Michio Sugeno suggested to use a single spike, a singleton,
as the membership function of the rule consequent.
A singleton, or more precisely a fuzzy singleton, is a fuzzy
set with a membership function that is unity at a single
particular point on the universe of discourse and zero
everywhere else.
13th October 2005

213

Fuzzy Logic

## Sugeno Fuzzy Inference

Sugeno-style fuzzy inference is very similar to the
Mamdani method. Sugeno changed only a rule
consequent. Instead of a fuzzy set, he used a mathematical
function of the input variable. The format of the Sugenostyle fuzzy rule is
IF x is A
AND
y is B
THEN
z is f(x, y)
where x, y and z are linguistic variables; A and B are fuzzy
sets on universe of discourses X and Y, respectively; and
f(x, y) is a mathematical function.
13th October 2005

214

Fuzzy Logic

## Sugeno Fuzzy Inference

The most commonly used zero-order Sugeno fuzzy
model applies fuzzy rules in the following form:
IF
x is A
AND y is B
THEN z is k
where k is a constant.
In this case, the output of each fuzzy rule is constant. All
consequent membership functions are represented by
singleton spikes.
13th October 2005

215

Fuzzy Logic

216

Fuzzy Logic

1
0.1
0

0.5

0.5

0.1
0

0.2
k1

z is k1 (0.1)

k2

z is k2 (0.2)

k3

z is k3 (0.5)

0.2
k1

k2

k3

217

## Graphical Technique of Inference

Case 1 : CRISP SETS max-min

## Graphical Technique of Inference

Case 2: CRISP SETS: Using max-product (or correlation product)
implication technique, aggregated output for r rules would be:

k
~
~1
~2

k
~
~2
~1

k 1,2, , r

k 1,2, , r

## Mamdani-style inference, as we have just seen,

requires us to find the centroid of a two-dimensional
shape by integrating across a continuously varying
function. In general, this process is not
computationally efficient.
Michio Sugeno suggested to use a single spike, a
singleton, as the membership function of the rule
consequent. A singleton, or more precisely a fuzzy
singleton, is a fuzzy set with a membership function
that is unity at a single particular point on the
universe of discourse and zero everywhere else.

220

## Sugeno-style fuzzy inference is very similar to the

Mamdani method. Sugeno changed only a rule
consequent. Instead of a fuzzy set, he used a
mathematical function of the input variable. The
format of the Sugeno-style fuzzy rule is
IF
x is A
AND y is B
THEN z is f (x, y)
where x, y and z are linguistic variables; A and B are
fuzzy sets on universe of discourses X and Y,
respectively; and f (x, y) is a mathematical function.

221

## The most commonly used zero-order Sugeno fuzzy

model applies fuzzy rules in the following form:
IF
x is A
AND y is B
THEN z is k
where k is a constant.
In this case, the output of each fuzzy rule is constant.
All consequent membership functions are represented
by singleton spikes.

222

## Sugeno-style rule evaluation

1

A3

B1

0.1

0.0
0

x1

Rule 1: IF x is A3 (0.0)

y1

OR y is B1 (0.1)

A2
0

x1

y1

1

A1

## Negnevitsky, Pearson Education, 2002

z is k1 (0.1)

AND
(min)
Y

0.2
0

THEN

k2

z is k2 (0.2)

Rule 3: IF x is A1 (0.5)

k1

1
0.5

0.5

x1

B2
0

0.1

THEN
0.7

0.2
X

OR
(max)

THEN

k3

z is k3 (0.5)

223

1
0.1
0

0.5

0.5

0.1
0

0.2
k1

z is k1 (0.1)

k2

z is k2 (0.2)

k3

z is k3 (0.5)

0.2
k1

k2

k3

224

## Weighted average (WA):

(k1) k1 (k 2) k 2 (k 3) k 3 0.1 20 0.2 50 0.5 80
WA

65
(k1) (k 2) (k 3)
0.1 0.2 0.5

Sugeno-style defuzzification

z1

Crisp Output
z1

225

## How to make a decision on which method

to apply Mamdani or Sugeno?

## Mamdani method is widely accepted for capturing

expert knowledge. It allows us to describe the
expertise in more intuitive, more human-like
manner. However, Mamdani-type fuzzy inference
entails a substantial computational burden.
On the other hand, Sugeno method is
computationally effective and works well with
optimisation and adaptive techniques, which makes
it very attractive in control problems, particularly
for dynamic nonlinear systems.

226

## A service centre keeps spare parts and repairs failed

ones.
A customer brings a failed item and receives a spare
of the same type.
Failed parts are repaired, placed on the shelf, and
thus become spares.
The objective here is to advise a manager of the
service centre on certain decision policies to keep
the customers satisfied.

227

## Process of developing a fuzzy expert system

1. Specify the problem and define linguistic variables.
2. Determine fuzzy sets.
3. Elicit and construct fuzzy rules.
4. Encode the fuzzy sets, fuzzy rules and procedures
to perform fuzzy inference into the expert system.
5. Evaluate and tune the system.

228

## Step 1: Specify the problem and define

linguistic variables
There are four main linguistic variables: average
waiting time (mean delay) m, repair utilisation
factor of the service centre , number of servers s,
and initial number of spare parts n.

229

230

## Step 2: Determine fuzzy sets

Fuzzy sets can have a variety of shapes. However,
a triangle or a trapezoid can often provide an
adequate representation of the expert knowledge,
and at the same time, significantly simplifies the
process of computation.

231

Degree of
Membership
1.0
0.8

VS

0.6
0.4
0.2
0.0
0

0.1

0.2

0.3

## Negnevitsky, Pearson Education, 2002

0.4

0.5

0.6

0.7
0.8
0.9
1
Mean Delay (normalised)

232

Degree of
Membership
1.0
0.8

0.6
0.4
0.2
0.0
0

0.1

0.2

0.3

## Negnevitsky, Pearson Education, 2002

0.4

0.5

0.6
0.7
0.8
0.9
1
Number of Servers (normalised)

233

Degree of
Membership
1.0
0.8

0.6
0.4
0.2
0.0
0

0.1

0.2

0.3

## Negnevitsky, Pearson Education, 2002

0.4

0.5

0.6

0.7
0.8
0.9
1
Repair Utilisation Factor

234

Degree of
Membership
1.0
0.8

VS

RS

RL

VL

0.6
0.4
0.2
0.0
0

0.1

0.2

0.3

## Negnevitsky, Pearson Education, 2002

0.4

0.5

0.6
0.7
0.8
0.9
1
Number of Spares (normalised)

235

## Step 3: Elicit and construct fuzzy rules

describe how the problem can be solved using the
fuzzy linguistic variables defined previously.
Required knowledge also can be collected from
other sources such as books, computer databases,
flow diagrams and observed human behaviour.

236

s

VS

RL

RS

VL

VS

237

238

Rule Base 1

239

s

s
L
M
S

VS VS VS
VS VS VS
S
S
VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
H
VS VS VS
M
L
VS
S
M

VS

VS

VS

VS

VS

VS

VS

VS

RS

VL

VS

s
L

RS

RS

VS

VS

VS

VS

s
S

RL

240

## Step 4: Encode the fuzzy sets, fuzzy rules

and procedures to perform fuzzy
inference into the expert system
To accomplish this task, we may choose one of
two options: to build our system using a
programming language such as C/C++ or Pascal,
or to apply a fuzzy logic development tool such as
MATLAB Fuzzy Logic Toolbox or Fuzzy
Knowledge Builder.

241

## Step 5: Evaluate and tune the system

The last, and the most laborious, task is to evaluate
and tune the system. We want to see whether our
fuzzy system meets the requirements specified at
the beginning.
Several test situations depend on the mean delay,
number of servers and repair utilisation factor.
The Fuzzy Logic Toolbox can generate surface to
help us analyse the systems performance.

242

## Three-dimensional plots for Rule Base 1

n u m b e r_ o f_ sp a re s

0.6
0.5
0.4
0.3
0.2
0
0.2
0.4
0.6

mean_delay

## Negnevitsky, Pearson Education, 2002

0.2

0.4

0.6

0.8

number_of_servers
243

number_of_spares

0.6
0.5
0.4
0.3
0.2
0
0.2
0.4
0.6

mean_delay

## Negnevitsky, Pearson Education, 2002

0.2

0.4

0.6

0.8

utilisation_factor
244

number_of_spares

0.35
0.3
0.25
0.2
0.15
0
0.2
0.4
0.6

mean_delay

## Negnevitsky, Pearson Education, 2002

0.2

0.4

0.6

0.8

number_of_servers

245

number_of_spares

0.5

0.4

0.3

0.2

0
0.2
0.4
0.6

mean_delay

## Negnevitsky, Pearson Education, 2002

0.2

0.4

0.6

0.8

utilisation_factor
246

## However, even now, the expert might not be

satisfied with the system performance.
To improve the system performance, we may use
additional sets Rather Small and Rather Large
on the universe of discourse Number of Servers,
and then extend the rule base.

247

Degree of
Membership
1.0
0.8

RS

RL

0.6
0.4
0.2
0.0
0

0.1

0.2

0.3

## Negnevitsky, Pearson Education, 2002

0.4

0.5

0.6
0.7
0.8
0.9
1
Number of Servers (normalised)

248

s

s
L
RL
M
RS
S

VS VS VS
VS VS VS
S
S
VS
VS VS VS
VS VS VS
S
S
VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS

VS VS VS
VS VS VS
H
VS VS VS
M
L
VS
S
M

RL

s
L

RS

RL

RS

VS

M RS

VS

M VS

VS

VS

RS VS

VS

VS

S VS

VS

VS

VS

RS

VS

VS

VS

VS

VS

VS

RS

RS

RS VL

RL

RS

S VL

VS

s
S

RL RL

249

number_of_spares

0.35
0.3
0.25
0.2
0.15
0
0.2
0.4
0.6

mean_delay

## Negnevitsky, Pearson Education, 2002

0.2

0.4

0.6

0.8

number_of_servers
250

number_of_spares

0.5

0.4

0.3

0.2

0
0.2
0.4
0.6

mean_delay

## Negnevitsky, Pearson Education, 2002

0.2

0.4

0.6

0.8

utilisation_factor

251

## Tuning fuzzy systems

1. Review model input and output variables, and if
required redefine their ranges.
2. Review the fuzzy sets, and if required define
additional sets on the universe of discourse.
The use of wide fuzzy sets may cause the fuzzy
system to perform roughly.
3. Provide sufficient overlap between neighbouring
sets. It is suggested that triangle-to-triangle and
trapezoid-to-triangle fuzzy sets should overlap
between 25% to 50% of their bases.

252

## 4. Review the existing rules, and if required add new

rules to the rule base.
5. Examine the rule base for opportunities to write
hedge rules to capture the pathological behaviour
of the system.
6. Adjust the rule execution weights. Most fuzzy
logic tools allow control of the importance of rules
by changing a weight multiplier.
7. Revise shapes of the fuzzy sets. In most cases,
fuzzy systems are highly tolerant of a shape
approximation.

253

## Graphical Technique of Inference

Example:
1
1
1
B
A
A
Rule 1: if x1 is ~ 1 and x2 is ~ 2 , then y is ~
2
2
2
B
A
A
Rule 2: if x1 is ~ 1 or x2 is ~ 2, then y is ~

input(i) = 0.35

input(j) = 55

If x1 is

and x2 is

then y is

, k = 1,2,..., r

## Graphical methods that emulate the inference process and

make manual computations involving a few simple rules.
Case 1: inputs x1, and x2 are crisp.
Memberships
(x1) = (x1 input(i)) =
(x2) = (x2 input(i)) =

x1 = input(i)

otherwise

1
0

x2 = input(i)
otherwise
255

## Graphical Technique of Inference

For r disjunctive rules:

B y max min A input i , A input j
k

k 1,2, , r
k

~1

~2

## A11 refers to the first fuzzy antecedent of the first rule.

A12 refers to the second fuzzy antecedent of the first rule.

256

257

258

Summary
Fuzzy Modelling subjectivity
blessing rather than a curse
Vagueness present in the definition of the terms is consistent with the
information contained in the conditional rules developed by
the Engineer when observing some complex process
Set of linguistic variables and their meanings is compatible and
consistent with set of conditional rules used, the outcome of the
qualitative process is translated into objective and quantifiable results
Fuzzy mathematical tools and the calculus of fuzzy IF-THEN
rule provide a most useful paradigm for the automation and
implementation of an extensive body of human knowledge which are
not embodied in the quantitative modelling process

259

## Fuzzification: definition of fuzzy sets, and

determination of the degree of membership of crisp
inputs in appropriate fuzzy sets.

## Inference: evaluation of fuzzy rules to produce

an output for each rule.

## Composition: aggregation or combination of

the outputs of all rules.

October 2005

260

## Fuzzy Expert Systems

Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary

October 2005

261

## Example: Air Conditioner

1a. Specify the problem
Air-conditioning involves the delivery of air, which can be
warmed or cooled and have its humidity raised or lowered.
An air-conditioner is an apparatus for controlling, especially
lowering, the temperature and humidity of an enclosed
space. An air-conditioner typically has a fan which
blows/cools/circulates fresh air and has a cooler. The cooler
is controlled by a thermostat. Generally, the amount of air
being compressed is proportional to the ambient
temperature.

## 1b. Define linguistic variables

Ambient Temperature
Air-conditioner Fan Speed
October 2005

262

## Example: Air Conditioner

2. Determine Fuzzy Sets: Temperature
Temp
(0C).

0< (T)<1

(T)=0

October 2005

COLD

COOL

PLEASANT

WARM

HOT

Y*

10

12.5

Y*

15

17.5

Y*

20

22.5

Y*

25

27.5

30

Y*

(T)=1

263

## Example: Air Conditioner

2. Determine Fuzzy Sets: Temperature

October 2005

264

## Example: Air Conditioner

2. Determine Fuzzy Sets: Fan Speed
Rev/sec
(RPM)

October 2005

MINIMAL

SLOW

MEDIUM

FAST

BLAST

Y*

10

20

30

Y*

40

50

Y*

60

70

Y*

80

90

100

Y*
265

## Example: Air Conditioner

2. Determine Fuzzy Sets: Fan Speed

October 2005

266

## Example: Air Conditioner

3. Elicit and construct fuzzy rules
RULE 1:
RULE 2:
RULE 3:
RULE 4:
RULE 5:

October 2005

IF
IF
IF
IF
IF

temp is
temp is
temp is
temp is
temp is

cold
THEN
cool
THEN
pleasant THEN
warm THEN
hot
THEN

speed is minimal
speed is slow
speed is medium
speed is fast
speed is blast

267

## Example: Air Conditioner

3. Encode into an Expert System
4. Evaluate and tune the system
Consider a temperature of 16oC, use the system
to compute the optimal fan speed.
Operation of a Fuzzy Expert System

October 2005

Fuzzification
Inference
Composition
Defuzzification
268

## Example: Air Conditioner

Fuzzification
Affected fuzzy sets: COOL and PLEASANT

COOL(T) = T / 5 + 3.5

PLSNT(T) = T /2.5 - 6
= 16 /2.5 - 6
= 0.4

= 16 / 5 + 3.5
= 0.3
Temp=16 COLD
0

October 2005

COOL

PLEASANT

WARM

0.3

0.4

HOT
0

269

Inference
RULE 1:
RULE 2:
RULE 3:
RULE 4:
RULE 5:

October 2005

IF
IF
IF
IF
IF

temp is
temp is
temp is
temp is
temp is

cold
THEN
cool
THEN
pleasant THEN
warm THEN
hot
THEN

speed is minimal
speed is slow
speed is medium
speed is fast
speed is blast

270

Inference

THEN

October 2005

271

Composition

October 2005

272

Defuzzification

## COG = 0.125(12.5) + 0.25(15) + 0.3(17.5+20++40+42.5) + 0.4(45+47.5++52.5+55) +

0.25(57.5)
0.125 + 0.25 + 0.3(11) + 0.4(5) + 0.25
= 45.54rpm
October 2005

273

## Fuzzy Expert Systems

Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary

October 2005

274

## Example: Cart Pole Problem

M
The problem is to balance an upright pole, with a mass m at its
head and mass M at its base. A weightless shaft connects these
two masses. The base can be moved on a horizontal axis. The
task is to determine the FORCE (F) necessary to balance the pole.
The calculation of the force F involves the measurement of the
angle and the angular velocity, of the pole .
October 2005

275

nb

nm

nb

ns

az

ps

pb

nm

ps

pm

pb

pm

pb

pm

ns

nm

ns

ps

az

nb

ns

az

ps

ps

ns

ps

pm

nm

pb

nb

nm

## nb: negative big, nm: negative medium,

ps: positive small,
pm: positive medium,

pm

ns

## ns: negative small az: approximately zero

pb: positive big

IF
is negative medium and is approximately zero
THEN F is negative medium
October 2005

276

## Example: Cart Pole Problem

The fuzzy sets for , and F are based on the linear equation
(x)=ax + b, and are defined based on the following table:

if

if

if

October 2005

277

(a)

## Based on the fuzzy sets table draw three graphs showing

the fuzzy sets (nb, nm, ns, az, ps, pm, pb) for each ,
and F individually.

(b)

Consider the case when the input variables are: = 50, = -5.
Use the rule base, execute each of the four tasks to compute
the force F necessary to balance the pole using the Centre of

October 2005

278

## Example: Cart Pole Problem

Fuzzification
i) Determine where and the angular velocity fall in the table
: pm, pb
az
ii) Formulate possible rules from linguistic values obtained
IF is pm AND is az THEN F is pm
IF is pb AND is az THEN F is pb

October 2005

279

## Example: Cart Pole Problem

Fuzzification
iii) Compute membership functions
1

1/22.5 = /17.5

: pm

0.78
22.5

45 50

67.5

45 50

67.5

: pb

1/22.5 = /5

0.22
45

50

67.5

: az

1/11.25 = /6.25
0.56

-11.25

October 2005

-5

10

280

## Example: Cart Pole Problem

Inference
1

IF is pm AND is az THEN F is pm
The two premises in RULE 1 are conjunctive
minimum of the two: min{0.78, 0.56}=0.56

IF is pb AND is az THEN F is pb
The two premises in RULE 2 are conjunctive
minimum of the two: min{0.22, 0.56}=0.22

October 2005

281

Composition

ps
pb

Defuzzification
SoG
C
October 2005

## 3 0.2 (4 5 6) 0.56 (7 8) 0.22

5.30
0.2 0.56 0.56 0.56 0.22 0.22
282

## Fuzzy Expert Systems

Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary

October 2005

283

## Case Study: Building a Fuzzy

Expert System
Step 1: Specify the problem and define
linguistic variables
A service centre keeps spare parts and repairs failed ones. A customer
brings a failed item and receives a spare of the same type. Failed
parts are repaired, placed on the shelf, and thus become spares.
The objective is to advise a manager of the service centre on certain
decision policies to keep the customers satisfied.
There are four main linguistic variables: average waiting time (mean
delay) m, repair utilisation factor of the service centre , number of
servers s, and initial number of spare parts n.
October 2005

284

October 2005

285

## Step 2: Determine fuzzy sets

Fuzzy sets can have a variety of shapes.
However, a triangle or a trapezoid can often
provide an adequate representation of the expert
knowledge, and at the same time, significantly
simplifies the process of computation.

October 2005

286

## Fuzzy sets of Mean Delay m

Degree of
Membership
1.0
0.8

VS

0.6
0.4
0.2
0.0
0

0.1

October 2005

0.2

0.3

0.4

0.5

0.6

0.7
0.8
0.9
1
Mean Delay (normalised)

287

## Fuzzy sets of Number of Servers s

Degree of
Membership
1.0
0.8

0.6
0.4
0.2
0.0
0

0.1

October 2005

0.2

0.3

0.4

0.5

0.6
0.7
0.8
0.9
1
Number of Servers (normalised)

288

## Fuzzy sets of Repair Utilisation Factor

Degree of
Membership
1.0
0.8

0.6
0.4
0.2
0.0
0

0.1

October 2005

0.2

0.3

0.4

0.5

0.6

0.7
0.8
0.9
1
Repair Utilisation Factor

289

## Fuzzy sets of Number of Spares n

Degree of
Membership
1.0
0.8

VS

RS

RL

VL

0.6
0.4
0.2
0.0
0

0.1

October 2005

0.2

0.3

0.4

0.5

0.6
0.7
0.8
0.9
1
Number of Spares (normalised)

290

## Step 3: Elicit and construct fuzzy rules

to describe how the problem can be solved using
the fuzzy linguistic variables defined previously.
Required knowledge also can be collected from
other sources such as books, computer
databases, flow diagrams and observed human
behaviour.

October 2005

291

October 2005

292

October 2005

293

Rule Base 1

October 2005

294

## Fuzzy If-Then Rules

Mamdani style
If pressure is high then volume is small
high

small

Sugeno style
If speed is medium then resistance = 5*speed
medium
resistance = 5*speed

## 1996 Asian Fuzzy Systems Symposium

By using fuzzy sets, we can formulate fuzzy if-then rules that are commonly
used in our daily expressions. Basically, we have two types of fuzzy rules.
For Mamdani style, for instance, if pressure is high then volume is small,
where high? and small are described by fuzzy sets
For Sugeno style, if the speed of a moving object is medium then the
resistance due to atmosphere is 5 times the speed. The basic difference
between these two rules is in their THEN part, where Madman style has a
fuzzy but Surgeon style has a linear equation. Madman style fuzzy rules
were first proposed in the literature; they are more appealing to human
intuition. Surgeon style fuzzy rules are proposed later, but they are more
suited for mathematical design and analysis.
In this, we concentrate on Surgeon style fuzzy if-then rules.

297

## Mamdani Fuzzy System

Graphics representation:
A1

B1

C1
w1

A2

B2

C2
w2

Z
T-norm

C
x is 4.5

y is 56.8

z is zCOA

## Fuzzy Inference System (FIS)

If speed is low then resistance = 2
If speed is medium then resistance = 4*speed
If speed is high then resistance = 8*speed
MFs

low

medium

high

.8
.3
.1
2
Rule 1: w1 = .3; r1 = 2
Rule 2: w2 = .8; r2 = 4*2
Rule 3: w3 = .1; r3 = 8*2

Speed
Resistance = (wi*ri) /
= 7.12

wi

Rule base

## If X is A1 and Y is B1 then Z = p1*x + q1*y + r1

If X is A2 and Y is B2 then Z = p2*x + q2*y + r2

Fuzzy reasoning
A1

B1
w1

X
A2

x=3

Y
B2

z1 =
p1*x+q1*y+r1

y=2

w2

z2 =
p2*x+q2*y+r2

z=

w1*z1+w2*z2
w1+w 2

## Tsukamoto Fuzzy System

Graphics representation:
A1

B1

C1
w1

A2

z1

B2

C2
w2

x is 4.5

y is 56.8

z2

T-norm

z=

w1*z1+w2*z2
w1+w2

## Zhang-Kandel Fuzzy System

Graphics representation:
A1

B1

C1
w1

A2

za

B2

zb

C2
w2

T-norm

zc

z=
x is 4.5

y is 56.8

zd

w1*z1+w2*z2
w1+w2

Z1={Za, Zb}

Z2={Zc, Zd}