fuzzy logic
DESCRIPTION
TRANSCRIPT
FUZZY LOGIC
Origins and Evolution of Fuzzy Logic
• Origin: Fuzzy Sets Theory (Zadeh, 1965)
• Aim: Represent vagueness and impre-cission
of statements in natural language
• Fuzzy sets: Generalization of classical sets
• In the 70s: From FST to Fuzzy Logic
• Nowadays: Applications to control systems
– Industrial applications
– Domotic applications, etc.
What is a set
Classical Sets
Classical sets – either an element belongs to the set or it does not.
For example, for the set of integers, either an integer is even or it is not (it is odd).
Classical sets are also called crisp (sets).
Lists: A = {apples, oranges, cherries, mangoes}
A = {a1,a2,a3 }
A = {2, 4, 6, 8, …}
Formulas: A = {x | x is an even natural number}
A = {x | x = 2n, n is a natural number}
Membership or characteristic function
Ax
Axx
A if 0
if 1)(
Classical Sets
Introduction to fuzzy logic
Introduction to fuzzy logic
Fuzzy Sets
Sets with fuzzy boundaries
A = Set of tall people
Heights5’10’’
1.0
Crisp set A
Membershipfunction
Heights5’10’’6’2’’
.5
.9
Fuzzy set A1.0
Membership Functions (MFs) Characteristics of MFs:
Subjective measures Not probability functions
MFs
Heights5’10’’
.5
.8
.1
“tall” in Asia
“tall” in the US
“tall” in NBA
Fuzzy Sets
Formal definition:A fuzzy set A in X is expressed as a set of
ordered pairs:
A x x x XA {( , ( ))| }
Universe oruniverse of discourse
Fuzzy setMembership
function(MF)
A fuzzy set is totally characterized by amembership function (MF).
An Example• A class of students
(E.G. MCA. Students taking „Fuzzy Theory”)• The universe of discourse: X
• “Who does have a driver’s licence?”• A subset of X = A (Crisp) Set• (X) = CHARACTERISTIC FUNCTION
• “Who can drive very well?” (X) = MEMBERSHIP FUNCTION
1 0 1 1 0 1 1
0.7 0 1.0 0.8 0 0.4 0.2
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)
Fuzzy Sets Crisp Sets
Membership Characteristic
function function
]1,0[XA }1,0{XmA
Set-Theoretic Operations
Set-Theoretic Operations Subset
Complement
Union
Intersection
( ) ( ), A BA B x x x U
( ) max( ( ), ( )) ( ) ( )C A B A BC A B x x x x x
( ) min( ( ), ( )) ( ) ( )C A B A BC A B x x x x x
( ) 1 ( )AAA U A x x
Set-Theoretic Operations
A B
A B
A
A B
Properties Of Crisp Set
A AInvolution
A B B A Commutativity
A B B A
A B C A B C Associativity A B C A B C
A B C A B A C Distributivity A B C A B A C
A A A Idempotence
A A A
A A B A Absorption A A B A
A B A B
De Morgan’s laws
A B A B
Properties The following properties are invalid
for fuzzy sets: The laws of contradiction
The laws of exclude middleA A
A A U
Properties of Fuzzy Set
height0
1
short tall
Example we have two discrete fuzzy sets
Example (cont..)
Summarize propertiesInvolution
Commutativity AB=BA, AB=BA
AssociativityABC=(AB)C=A(BC),ABC=(AB)C=A(BC)
DistributivityA(BC)=(AB)(AC),A(BC)=(AB)(AC)
Idempotence AA=A, AA=A
Absorption A(AB)=A, A(AB)=A
Absorption of complement
Abs. by X and AX=X, A=Identity A=A, AX=A
Law of contradiction
Law of excl. middle
DeMorgan’s laws
AA
BABAA
BABAA
AA
XAA
BABABABA
Fuzzy and Crisp
Operations
Fuzzy Set Operations
Crisp Set Operations
Representation of Crisp set
Fuzzy and crisp Relations
CARTESIAN PRODUCT
An ordered sequence of r elements, written in the form (a1, a2, a3, . . . , ar), is called an ordered r-tuple.
For crisp sets A1,A2, . . . ,Ar, the set of all r-tuples(a1, a2, a3, . . . , ar), where a1 A1,a2 A2, ∈ ∈and ar Ar, is called the ∈ Cartesian product of A1,A2, . . . ,Ar, and is denoted by
A1×A2×···×Ar.
(The Cartesian product of two or more sets is not the same thing as the arithmetic product of two or more sets.)
Crisp Relations
A subset of the Cartesian product A1×A2×···×Ar is called an r-ary relation over A1,A2, . . . ,Ar.
If three, four, or five sets are involved in a subset of the full Cartesian product, the relations are called ternary, quaternary, and quinary
Cartesian product
The Cartesian product of two universes X and Y is determined as
X ×Y = {(x, y) | x X, y Y}∈ ∈ which forms an ordered pair of every x X with ∈
every y Y, forming unconstrained∈ matches between X and Y. That is, every element
in universe X is related completely to every element in universe Y.
Fuzzy Relations
Triples showing connection between two sets:
(a,b,#): a is related to b with degree #
Fuzzy relations are set themselves
Fuzzy relations can be expressed as matrices
…
32
Fuzzy Relations Matrices
Example: Color-Ripeness relation for tomatoes
R1(x, y) unripe semi ripe ripe
green 1 0.5 0
yellow 0.3 1 0.4
Red 0 0.2 1
33
Fuzzy Relations
A fuzzy relation R is a 2D MF:
( ,,( , ) ( , )) |R x yx y x yR X Y
35
Fuzzy relation
A fuzzy relation is a fuzzy set defined on the Cartesian product of crisp sets A1, A2, ..., An where tuples (x1, x2, ..., xn) may have varying degrees of membership within the relation.
The membership grade indicates the strength of the relation present between the elements of the tuple.
1 2
1 2 1 2 1 1 2 2
: ... [0,1]
(( , ,..., ), ) | ( , ,..., ) 0, , ,..., R n
n R R n n n
A A A
R x x x x x x x A x A x A
Compositions
A fuzzy relation defined on X an Z.
Max-Min Composition
X Y ZR: fuzzy relation defined on X and Y.
S: fuzzy relation defined on Y and Z.
R。 S: the composition of R and S.
( , ) max min ( , ), ( , )R S y R Sx z x y y z
( , ) ( , )y R Sx y y z
38
Max-min composition
Example
( , ) max[min( ( , ), ( , ))]
[ ( , ) ( , )]
S R R Sy
R Sy
x z x y y z
x y y z
( , ) , ( , )x y A B y z B C
39
Example
(1, ) max[min(0.1,0.9),min(0.2,0.2),min(0.0,0.8),min(1.0,0.4)]
max[0.1,0.2,0.0,0.4] 0.4S R
40
Example
(1, ) max[min(0.1,0.0),min(0.2,1.0),min(0.0,0.0),min(1.0,0.2)]
max[0.0,0.2,0.0,0.2] 0.2S R
41
Max-Product Composition
( , ) max ( , ) ( , )R S v R Sx y x v v y
A fuzzy relation defined on X an Z.
X Y ZR: fuzzy relation defined on X and Y.
S: fuzzy relation defined on Y and Z.
R。 S: the composition of R and S.
Max-min composition is not mathematically tractable, therefore other compositions such as max-product composition have been suggested.
43
Max Product
Max product: C = A・ B=AB= Example
12 ?C
44
Max product
Example
12 0.1C
45
Max product
Example
13 0.5C
46
Max product
Example
C
Fuzzy System
Introduction
Fuzzify crisp inputs to get the fuzzy inputs Defuzzify the fuzzy outputs to get crisp outputs
Fuzzy Systems
Fuzzy Knowledge base
Input FuzzifierInferenceEngine
Defuzzifier Output
Propositional logic
A proposition is a statement- in which English is a declarative sentence and logic defines the way of putting symbols together to form a sentences that represent facts
Every proposition is either true or false.
Example of PL
The conjunction of the two sentences: Grass is greenPigs don't flyis the sentence: Grass is green and pigs don't flyThe conjunction of two sentences will
be true if, and only if, each of the two sentences from which it was formed is true.
Statement symbols and variables
Statement: A simple statement is one
that does not contain any other statement as a part.
A compound statement is one that has two or more simple statement as parts called components.
Symbols for connective
ASSERTION P “P IS TRUE”
NEGATION ¬P ~
! NOT “P IS FALSE”
CONJUCTION
P^Q . & && AND “BOTH P AND Q ARE TRUE
DISJUNCTION
PvQ || | OR “ EITHER P OR Q IS TRUE”
IMPLICATION P-> Q ⇒ IF…THEN
“IF P IS TRUE THEN Q IS TRUE.”
EQUIVALENCE
P⇔Q =⇔
IF AND ONLY IF
“P AND Q ARE EITHER BOTH TRUE OR FALSE”
Truth Value
The truth value of a statement is truth or falsity.
P is either true or false ~p is either true of false p^q is either true or false, and
so on. Truth table is a convenient way of
showing relationship between several propositions..
Case 1
Case 2
Truth Table for Negation
As you can see “P” is a true statement then its negation “~P” or “not P” is false.
If “P” is false, then “~P” is true.
P
T
TF
F
~P
Truth Table for Conjunction
P QCase 1
Case 2
Case 3
Case 4
T
T
F
F
T
F
T
F
T
F
F
F
P Λ Q
Truth Table for Disjunction
P QCase 1
Case 2
Case 3
Case 4
T
T
F
F
T
F
T
F
T
T
T
F
P V Q
Tautology
Tautology is a proposition formed by combining other proposition (p,q,r…)which is true regardless of truth or falsehood of p,q,r…
DEF: A compound proposition is called a tautology if no matter what truth values its atomic propositions have, its own truth value is T.
59L3
Tautology example
Demonstrate that
[¬p (p q )]qis a tautology in two ways:
1. Using a truth table – show that [¬p (p q )]q is always true.
60L3
Tautology by truth table
p q ¬p p q ¬p (p q ) [¬p (p q )]q
T T
T F
F T
F F
61L3
Tautology by truth table
p q ¬p p q ¬p (p q ) [¬p (p q )]q
T T F
T F F
F T T
F F T
62L3
Tautology by truth table
p q ¬p p q ¬p (p q ) [¬p (p q )]q
T T F T
T F F T
F T T T
F F T F
63L3
Tautology by truth table
p q ¬p p q ¬p (p q ) [¬p (p q )]q
T T F T F
T F F T F
F T T T T
F F T F F
64L3
Tautology by truth table
p q ¬p p q ¬p (p q ) [¬p (p q )]q
T T F T F T
T F F T F T
F T T T T T
F F T F F T
Modus Ponens and Modus Tollens
Modus ponens -- If A then B, observe A, conclude B
Modus tollens – If A then B, observe not-B, conclude not-A
Modus Ponens and Tollens
If Joan understood this book, then she would get a good grade. If P then Q Joan understood .: she got a good grade. This uses modus ponens. P .: Q
If Joan understood this book, then she would get a good grade. If P then Q She did not get a good grade .: she did
not understand this book. ~Q .: ~P This uses modus tollens.
Fuzzy QuantifiersThe scope of fuzzy propositions can be
extended using fuzzy quantifiers
• Fuzzy quantifiers are fuzzy numbers that take
part in fuzzy propositions
• There are two different types:
– Type #1 (absolute): Defined on the set of real
numbers
• Examples: “about 10”, “much more than 100”, “at least
about 5”, etc.
– Type #2 (relative): Defined on the interval [0, 1]
• “almost all”, “about half”, “most”, etc.
Fuzzification
The fuzzification comprises the process of transforming crisp values into grades of membership for linguistic terms of fuzzy sets. The membership function is used to associate a grade to each linguistic term.
Measurement devices in technical systems provide crisp measurements, like 110.5 Volt or 31,5 °C. At first, these crisp values must be transformed into linguistic terms (fuzzy sets) . This is called fuzzification.
FuzzifierFuzzy
Knowledge baseFuzzy
Knowledge base
I nput FuzzifierI nference
EngineDefuzzifier OutputI nput Fuzzifier
I nferenceEngine
Defuzzifier Output
Converts the crisp input to a linguistic
variable using the membership functions
stored in the fuzzy knowledge base.
Fuzzy interference
If x is A and y is B then z = f(x, y)
Fuzzy Sets Crisp Function
f(x, y) is very often a
polynomial function w.r.t. x
and y.
Examples
R1: if X is small and Y is small then z = x +y +1
R2: if X is small and Y is large then z = y +3
R3: if X is large and Y is small then z = x +3
R4: if X is large and Y is large then z = x + y + 2
Defuzzification
• Convert fuzzy grade to Crisp output The max criterion method finds the point at
which the membership function is a maximum.
The mean of maximum takes the mean of those points where the membership function is at a maximum.
Defuzzification