You are on page 1of 36

Applied Logic

Lecture 3 part 1 - Fuzzy logic

Marcin Szczuka

Institute of Informatics, The University of Warsaw

Monographic lecture, Spring semester 2018/2019

Marcin Szczuka (MIMUW) Applied Logic 2019 1 / 36


Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 2 / 36


The origins of fuzziness

In contrast to precise, limited and constrained language that we use to


describe notions, entities, and concepts while building logical models (so
far), the real-life concepts and entities are described in much less rigid way.
Let’s consider the following example. In real life sentence:

John is a tall guy

may mean many things, depending of our perspective, the place we live
(meaning of tall is different in e.g. Japan) and so on.
But, if we want to feed John’s data into computer, we have to determine
his height precisely – say 190 cm.
But what if do not know John’s height exactly?

Marcin Szczuka (MIMUW) Applied Logic 2019 3 / 36


The origins of fuzziness

In real life we are doing perfectly all right with the sentences like:
It takes about 40 minutes to reach an airport if the traffic is not too
heavy.
But what if we want a computer to understand such a sentence?
How do we represent about and too heavy in a machine?

Marcin Szczuka (MIMUW) Applied Logic 2019 4 / 36


Fuzzy concepts and fuzzy sets

In 1965 Lotfi Zadeh proposed a different way of looking at notions such as:
set, containment, subset. His target was to make it possible to deal with
concepts (sets) and dependencies that by nature are imprecise and vague -
so called fuzzy concepts (sets).
Again, the example of such concept is the natural language sentence:

John is a tall guy.

If we know, that John is 175 cm tall, we may start to wonder about the
validity of the above sentence.
In classical set theory we are forced to make definite decision whether 175
cm qualifies John as tall or not.
In the fuzzy set theory we may be more subtle and express to what degree
175 cm of height makes John a tall guy.

Marcin Szczuka (MIMUW) Applied Logic 2019 5 / 36


Fuzzy sets

In classical set theory and with classical binary logic, that we usually
employ when doing things with use of computer, the (contents of a) set A
in some universe X can be expressed in the form of its characteristic
(containment) function:

1 if x ∈ A
χA (x) =
0 if x ∈ /A

Such classical, rigidly defined set we will further call crisp or definite.
The key step in defining fuzzy set theory is the replacement of
characteristic function χA by function µA : X → [0, 1].
µA is called membership function or fuzzy membership.
If ∀x∈X µA (x) ∈ {0, 1} then A is a classical set i.e., crisp (definite) set. If
there exists x ∈ X such that 0 < µA (x) < 1 – the set A is fuzzy.

Marcin Szczuka (MIMUW) Applied Logic 2019 6 / 36


Fuzzy sets - examples
A classical example of a fuzzy set near − zero provided by Zadeh for the
concept of real number near 0. This set may be defined, for example, by
the following membership function:
1
µnear−zero =
1 + x2
Which looks like:

Marcin Szczuka (MIMUW) Applied Logic 2019 7 / 36


Fuzzy sets - examples
The previously considered notion of tall guy could be given – for height x
in centimetres – by membership:

 0 if x ≤ 125
µtall = 1 if x ≥ 185
 x−185
2 + 1 if 125 < x < 185
Which looks like:
µwysoki
1

125 185 Wzrost w cm

Marcin Szczuka (MIMUW) Applied Logic 2019 8 / 36


Fuzzy sets - examples

Another example of three fuzzy sets for the notion of cold, warm and hot,
where x is a temperature.

Marcin Szczuka (MIMUW) Applied Logic 2019 9 / 36


Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 10 / 36


Fuzzy sets – definitions and properties

Fuzzy set A given by membership function µA : X → [0, 1] is normal iff


∃x∈X µA (x) = 1.
For the fuzzy set theory to be really a set theory we must establish some
fundamental notions such as: containment, subset, empty set and so on.
Fuzzy inclusion
Let A, B be fuzzy sets in some universe X. Fuzzy set A is included in
fuzzy set B (A ⊆ B) iff ∀x∈X µA (x) ≤ µB (x).

Some properties
For each fuzzy set we may establish:
Height of A: height(A) = h(A) = maxx∈X µA (x).
Support of A: Supp(A) = {x ∈ X : µA (x) > 0}.
Core of A: Core(A) = {x ∈ X : µA (x) = 1}.

Marcin Szczuka (MIMUW) Applied Logic 2019 11 / 36


Fuzzy sets – definitions and properties

Empty fuzzy set


Fuzzy set ∅ is said to be an empty set iff ∀x∈X µ∅ (x) = 0

In case of classical set theory the size of the set is measured in terms of the
number of its elements. In case of fuzzy set elements may be only partly in
the set, so we use membership function to determine the P ower of set –
the equivalent of cardinality for classic sets.
Power of fuzzy set
For a fuzzy set A its “cardinality” is given as
 Pn
µ (x) if X = {x1 , . . . , xn }
P ower(A) = A = R i=1 A
X µA (x)dx otherwise

To complete the picture, we have to define the way of constructing fuzzy


sets by summing, superposing, and complementing the fuzzy sets. For that,
we need fuzzy set operators.
Marcin Szczuka (MIMUW) Applied Logic 2019 12 / 36
Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 13 / 36


Fuzzy sets – operations
In classical set theory we perform operations on sets, e.g. union,
intersection, complement, difference. In case of fuzzy sets there are
actually several ways of defining set operators. In majority (over 90%) of
practical applications we use minimum of membership values (as
membership for intersection) and maximum of membership values (as
membership for union).
Fuzzy operators
For fuzzy sets A and B with corresponding memberships µA and µB , we
have:
Sum of fuzzy sets A ∪ B:
µA∪B = max(µA , µB ).
Intersection of fuzzy sets A ∩ B:
µA∩B = min(µA , µB ).
Complement of fuzzy set \A:
µ\A = 1 − µA .
Marcin Szczuka (MIMUW) Applied Logic 2019 14 / 36
Fuzzy sets – operations

µB(x) µB(x)

µA(x) µA(x)

Alternative ways of defining operations on fuzzy sets include:


µA∪B = max(0, µA + µB − 1), µA∩B = min(1, µA + µB )
so called Łukasiewicz operators.
µA∪B = max(0, µA + µB − µA µB ), µA∩B = µA µB - so called
product operators.

Marcin Szczuka (MIMUW) Applied Logic 2019 15 / 36


Important notes on fuzzy sets

It is very important to realise that:


1 Fuzzy set theory is NOT an alternative to classical set theory. It is an
extension of classical set theory that cannot exist independently. We
have to use the apparatus of classical set theory in order to define
fuzzy sets. Hence, fuzzy set theory is not independent of classical
one.
2 Fuzzy set theory, despite an immediate intuitive association, is NOT a
replacement for probabilistic reasoning. This association is caused by
the fact that both methodologies are founded on the interval [0, 1].
However, it may be the case that no reasonable probability distribution
corresponds to the layout of a family of fuzzy sets in a given space.

Marcin Szczuka (MIMUW) Applied Logic 2019 16 / 36


Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 17 / 36


Linguistic rules

Linguistic rules are the statements of the form:

IF A1 AND A2 AND ... AND Ak THEN D

where conditions A1 , . . . , Ak and decision D correspond to fuzzy sets.


For example:

IF waether is good AND traffic is light AND we have enough fuel


THEN we will reach the airport in about 30 minutes

such rules we may obtain form a human expert or discover (mine) from
data. In order to use them in the context of fuzzy sets, we will employ
fuzzy set operators.

Marcin Szczuka (MIMUW) Applied Logic 2019 18 / 36


Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 19 / 36


Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 20 / 36


Fuzzy operators

As mentioned before, there are in fact (infinitely) many ways for defining
operations on fuzzy sets. That comes form the fact, that there is more
than one:
1 Function that satisfies conditions for a T-norm, i.e., equivalent to
intersection.
2 Function that satisfies conditions for a T- co-norm (S-norm), i.e.,
equivalent to union.
3 Function that satisfies conditions complement (negation).
We will see several examples of such functions.

Marcin Szczuka (MIMUW) Applied Logic 2019 21 / 36


Fuzzy intersection – T-norm

The whole class of functions that are called T-norms can be used as fuzzy
intersection.
Definition – T-norm
For any a, b, c, d ∈ [0, 1] T-norm is a function T : [0, 1]2 → [0, 1] such that:
Commutativity: T (a, b) = T (b, a);
Associativity: T (a, T (b, c)) = T (T (a, b), c);
Monotonicity: T (a, b) ≥ T (c, d) whenever a ≥ c, b ≥ d;
Invariance for 1: T (a, 1) = a

It is quite easy to see that the intersection of fuzzy sets defined by


T (a, b) = min(a, b) is a proper T-norm. In fact, the function min(., .) is a
maximal element in the class of T-norms.

Marcin Szczuka (MIMUW) Applied Logic 2019 22 / 36


Fuzzy union – T- co-norm
Analogously, the whole class of S-norms (T- co-norms) can be used as
fuzzy union.
Definition – S-norm
For any a, b, c, d ∈ [0, 1] S-norm (T- co-norm) is a function
S : [0, 1]2 → [0, 1] such that:
Commutativity: S(a, b) = S(b, a);
Associativity: S(a, S(b, c)) = S(S(a, b), c);
Monotonicity: S(a, b) ≥ S(c, d) whenever a ≥ c, b ≥ d;
Invariance for 0: S(a, 0) = a.

We have already seen examples of T-norms and S-norms such as:


T (a, b) = max(0, a + b − 1), S(a, b) = min(1, a + b) - so called
Łukasiewicz operators.
T (a, b) = a + b − ab, S(a, b) = ab - so called product operators.
Marcin Szczuka (MIMUW) Applied Logic 2019 23 / 36
Fuzzy complement
The complement of a fuzzy set (fuzzy negation) we can also define in great
number of ways. All we need, is that negation conforms to a set of
conditions.
Definition – fuzzy complement (negation)
For any a, b ∈ [0, 1] function N : [0, 1] → [0, 1] is called a complement
(negation) operation if the following holds:
Preservation of constants: N (0) = 1;N (1) = 0;
Reversing of the order: N (a) ≤ N (b) iff b ≤ a;
Involution: N (N (a)) = a.

There are several functions that may be used as complement, but in 99.9%
of applications (and further in this lecture) the only function used is
N (x) = 1 − x (µ\A = 1 − µA ).
If in the definition above we cannot assure involution, the resulting
operator is called an intuitionistic negation.
Marcin Szczuka (MIMUW) Applied Logic 2019 24 / 36
Duality of T-norms and S-norms

Once we have a negation operator, we can define an S-norm (T - co-norm)


dual to a given T-norm.
Definition – dual S-norm
Given a T-norm T : [0, 1]2 → [0, 1] we can define its dual co-norm
(S-norm), and vice versa, by:

S(a, b) = N (T (N (a), N (b)))

As an exercise one may check if the examples of T-norms and S-norms


presented previously are dual to each other.
As mentioned before, the pair of operations min(., .) and min(., .) play a
special role. They are only idempotent operators in the class of T-norms
and S-norms, respectively. They are also ones that conform to distributive
laws: A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) and
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).

Marcin Szczuka (MIMUW) Applied Logic 2019 25 / 36


Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 26 / 36


Fuzzy relations

In classical set theory a (binary) relation is defined as a subset of a


Cartesian product. In fuzzy case the definition is analogous. We will
consider only binary (two argument) relations, but is worth mentioning that
the definitions presented in this section are easily extensible to the case of
n-ary relations for any finite n.

Definition - fuzzy relation


Any fuzzy subset of X × Y is a fuzzy relation defined over X × Y .

Fuzzy relation defined in such a way possesses all the required features.
However, please note that in order to introduce fuzzy relation we have not
used the notion of Cartesian product of fuzzy sets.

Marcin Szczuka (MIMUW) Applied Logic 2019 27 / 36


Cartesian product of fuzzy sets

We want to define the Cartesian product of two fuzzy sets and check how
it relates to the previously introduced notion of fuzzy relation.
Definition - Cartesian product of fuzzy sets
Let A, B be fuzzy sets in universes X and Y , respectively. Cartesian
product A × B is a relation R (notation: R = A × B) defined on X × Y by:

µR (x, y) = min(µA (x), µB (y))

In general (n-ary) case:

µR (x1 , . . . , xn ) = min(µAi (xi ))


i

where R = A1 × A2 × . . . × An

Marcin Szczuka (MIMUW) Applied Logic 2019 28 / 36


Cylindrical extension and projection
In some situations it is useful to consider the properties of fuzzy relation
w.r.t. particular argument. To do that, we introduce two more notions –
cylindrical extension and projection.
Definition – cylindrical extension and projection
Let A be a fuzzy set in universe X. Cylindrical extension of set A over
Cartesian product X × Y is a fuzzy relation  = A × Y defined by fuzzy
membership function:

µÂ (x, y) = T (µA (x), µY (y)) = T (µA (x), 1) = µA (x),

where T is a T-norm.
Let R be a fuzzy relation defined over X × Y . Projection of R on X
(analogously on other co-ordinates) is a fuzzy set A◦ in X, denoted by
A◦ = P rojx (A) and given by membership function:

µA◦ (x) = max(µA (x, y)).


y
Marcin Szczuka (MIMUW) Applied Logic 2019 29 / 36
Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 30 / 36


Classic vs. fuzzy logic

In the case of classical set theory, set operators are connected 1-to-1 to
logical operators (logical connectives). In fuzzy case the situation is more
complicated.
To begin with, we can have several different set operators. Therefore, when
we consider logical operators associated with fuzzy set operations, we have
to use different meaning of the truth/falsity for logical formulæ.
In the classical logic the valuation is a function v : V AR → {0, 1}, so the
formula has either value equal to 0 (falsity) or 1 (truth). In fuzzy logic we
will permit the formula to have logical value between 0 and 1. More
precisely, [[φ]]v ∈ [0, 1].

Marcin Szczuka (MIMUW) Applied Logic 2019 31 / 36


Fuzzy logical connectives

In fuzzy case logical connectives (logical operators) can no longer be


defined with use of truth-tables. They are now functions [0, 1]2 → [0, 1]
([0, 1] → [0, 1] in the case of negation).
Using T-norms and S-norms (T- co-norms) we can introduce fuzzy
conjunction and fuzzy alternative (disjunction) in quite natural way as:

[[φ ∧ ψ]]v = T ([[φ]]v , [[ψ]]v ),


[[φ ∨ ψ]]v = S([[φ]]v , [[ψ]]v )
Usually, we will assume the T-norm T and S-norm S in the above
definitions to be dual to each other.
Similarly, for negation we can use any function that meets requirements,
but almost always we will use:

[[¬φ]]v = 1 − [[φ]]v .

Marcin Szczuka (MIMUW) Applied Logic 2019 32 / 36


Fuzzy logical connectives

Equivalence is defined using implication and conjuction:

[[φ ⇔ ψ]]v = [[(φ ⇒ ψ) ∧ (ψ ⇒ φ)]]v

By assuming that

[[φ]]v ≤ [[ψ]]v ⇒ [[φ ⇒ ψ]]v = 1,

we obtain [[φ ⇒ ψ]]v = 1 lub [[ψ ⇒ φ]]v = 1. Hence, for conjunction


operator defined by means of T-norm we finally get

[[φ ⇔ ψ]]v = min([[φ ⇒ ψ)]]v , [[ψ ⇒ φ)]]v )

regardless of our choice on conjunction operator (T-norm).

Marcin Szczuka (MIMUW) Applied Logic 2019 33 / 36


Lecture plan

1 Introduction
Definitions and properties
Operations on fuzzy sets
Linguistic rules

2 Fuzzy sets and fuzzy reasoning


Basic fuzzy notions revisited
Fuzzy relations

3 Fuzzy logical operators


Fuzzy implication

Marcin Szczuka (MIMUW) Applied Logic 2019 34 / 36


Fuzzy implication
To complete the picture we need to define the meaning of φ ⇒ ψ (the
value of [[φ ⇒ ψ]]v ) in fuzzy case.
It is not much of a surprise that we can do it in several ways. Some
examples are presented below.

Name of implication Value of [[φ ⇒ ψ]]v


Łukasiewicz min(1
 − [[φ]]v + [[ψ]]v , 1)
1 if [[φ]]v ≤ [[ψ]]v
Gödel
( [[ψ]]v otherwise
1 if [[φ]]v = 0
Goguen [[ψ]]v
min(1, [[φ]] ) otherwise
v
Kleene-Dienes max(1 − [[φ]]v , [[ψ]]v )
Zadeh max(1 − [[φ]]v , min([[ψ]]v , [[φ]]v ))
Reichenbach 1 − [[φ]]v + [[ψ]]v · [[φ]]v

Marcin Szczuka (MIMUW) Applied Logic 2019 35 / 36


Fuzzy connectives - peculiarities

In case of fuzzy connectives we can define ones by means of others using


tautologies, just as we did in classical case. We have to be careful, though.
Depending on the tautology used, the results can be different.
For example, using Łukasiewicz implication we can define two different
alternative operators as follows:

[[φ ∨1 ψ]]v = [[¬φ ⇒ ψ]]v = min([[φ]]v + [[ψ]]v , 1) (1)

[[φ ∨2 ψ]]v = [[¬φ ⇒ ¬(ψ ⇒ φ)]]v = max([[φ]]v , [[ψ]]v ) (2)


In classical logic both definitions would yield the same result since both
formulas: ¬φ ⇒ ψ and φ ⇒ ¬(ψ ⇒ φ) are equivalent to alternative. In
fuzzy case with Łukasiewicz implication we should only use negation and
alternative, i.e., only formula (1).

Marcin Szczuka (MIMUW) Applied Logic 2019 36 / 36

You might also like