Download as pdf or txt
Download as pdf or txt
You are on page 1of 51

‫كلية الحاسبات وتقنية المعلومات‬

Faculty of Computing & Information Technology

CSC 607 - Fuzzy logic Systems


Chapter 1. Classical Set Theory
1. Introduction
2. Classical set theory
3. Mathematical representation of a set
4. Types of sets
Outline 5. Operations on Classical Sets
6. Properties of operations on Crisp Sets
7. Class Work
8. Lab (operations on Crisp Sets)
1. Introduction
• Fuzzy Logic was introduced in 1965 by Lofti A. Zadeh in his research paper
“Fuzzy Sets”. He is considered as the father of Fuzzy Logic.

• Fuzzy Logic resembles the human decision-making methodology. It deals with


vague and imprecise information. This is gross over simplification of the real-
world problems and based on degrees of truth rather than usual true/false or
1/0 like Boolean logic.

3 CSC 607 - Fuzzy logic Systems


1. Introduction
• In fuzzy systems, the values are indicated by a number in the range from 0 to
1. Here 1.0 represents absolute truth and 0.0 represents absolute falseness.
The number which indicates the value in fuzzy systems is called the truth
value.

Figure. Boolean Logic and Fuzzy Logic

4 CSC 607 - Fuzzy logic Systems


2. Classical set theory
• A classical set is defined as a collection of objects, which share certain
characteristics. It is an unordered collection of different elements. It can be
written explicitly by listing its elements using the set bracket. If the order of the
elements is changed or any element of a set is repeated, it does not make any
changes in the set.

• A classical set is a collection of distinct objects, where each individual entity in


a set is called a member or an element of the set.

• The classical set (CRISP) is defined in such a way that the Universe of
Discourse is split into 2 groups: members and Nonmembers.
5 CSC 607 - Fuzzy logic Systems
2. Classical set theory
• The classical set is a container that wholly includes or wholly excludes any
given element. For example, the set of days of the week unquestionably
includes Tuesday, Wednesday, and Saturday. It just as unquestionably,
excludes butter, liberty, shoe polish, and so on.

• It was Aristotle who first formulated the law of the Excluded Middle, which says
X must either be in set A or in set not-A, i.e., of any subject, one thing must be
either asserted or denied.

6 CSC 607 - Fuzzy logic Systems


2. Classical set theory
2.1. Example

• A set of all positive integers.

• A set of all the planets in the solar system.

• A set of all the states in India.

• A set of all the lowercase letters of the alphabet.

7 CSC 607 - Fuzzy logic Systems


2. Classical set theory
2.2. Defining a set

There are several ways of defining a set:

❖ A={2, 4, 6, 8, 10}
❖ A={x l x is the number < 20 }
𝑋𝑖 +1
❖ A={Xi+1= ,𝑖 = 1 𝑡𝑜 10, where 𝑋1 = 1}
5

❖ A={x l x is an element belonging to P AND Q}

1 𝑖𝑓 𝑥 ∈ 𝐴
❖ 𝜇𝐴 (𝑥) = ቊ where 𝜇𝐴 (𝑥) is the membership function for set A.
0 𝑖𝑓 𝑥 𝑑𝑜𝑒𝑠 𝑛𝑜𝑡 ∈ 𝐴

8 CSC 607 - Fuzzy logic Systems


3. Mathematical representation of a set
3.1 Mathematical representation

There are two methods of representing a set:

a) Roster or tabular form

b) Set-builder form.

9 CSC 607 - Fuzzy logic Systems


3. Mathematical representation of a set
a) Roster or Tabular Form
• In roster form, all the elements of a set are listed, the elements are being
separated by commas and are enclosed within braces { }.
• Following are the examples of set in Roster or Tabular Form:
❖ Z=the set of all integers={…,−3,−2,−1,0,1,2,3,…}
❖ Set of vowels in English alphabet, A = {a, e, i, o, u}
❖ Set of odd numbers less than 10, B = {1, 3, 5, 7, 9}

10 CSC 607 - Fuzzy logic Systems


3. Mathematical representation of a set
b) Set Builder Notation
• In this form, the set is defined by specifying a property that elements of the
set have in common. All the elements of the set, must possess a single
property to become the member of that set.

• The set is described as: A = {x | p(x)}

11 CSC 607 - Fuzzy logic Systems


3. Mathematical representation of a set
Example:
• Z={x | x is an integer}: You can read Z={x | x is an integer} as "The
set Z equals all the values of x such that x is an integer."

• M={x | x>3}: This last notation means "all real numbers x such that x is
greater than 3." So, for example, 3.1 is in the set M, but 2 is not. The
vertical bar | means "such that".

12 CSC 607 - Fuzzy logic Systems


3. Mathematical representation of a set
❖ You can also have a set, which has no elements at all. This special set is
called the empty set, and we write it with the special symbol ∅.

❖ If x is an element of a set A, we write x∈A.

❖ if x is not an element of A, we write x∉A .

• Therefore, using the sets defined above M={x | x>3}: −862 ∈ Z, since −862
is an integer, and 2.9∉M, since 2.9 is not greater than 3.

13 CSC 607 - Fuzzy logic Systems


3. Mathematical representation of a set
• The set {a, e, i, o, u} is written as: A = {x | x is a vowel in English alphabet}.

• The set {1, 3, 5, 7, 9} is written as: B = {x | 1 ≤ x < 10 and (x%2) ≠ 0}.

❖ If an element x is a member of any set S, it is denoted by x ∈ S and if an


element y is not a member of set S, it is denoted by y ∉ S.

• If S = {1, 1.2, 1.7, 2}, 1 ∈ S but 1.5 ∉ S.

14 CSC 607 - Fuzzy logic Systems


3. Mathematical representation of a set
3.2 Cardinality of a Set
• The cardinality of a set is a measure of a set's size, meaning the
number of elements in the set.
• For instance, the set S={1,2,4} has a cardinality of 3 for the three
elements that are in it. The cardinality of a set is denoted by vertical
bars, like absolute value signs;
• For instance, for a set S its cardinality is denoted |S|. The number is
also referred as the cardinal number. If a set has an infinite number of
elements, its cardinality is ∞.

Examples
▪ |{1,4,3,5}| = 4,
▪ |{1,2,3,4,5,…}| = ∞
15 CSC 607 - Fuzzy logic Systems
3. Mathematical representation of a set
• If there are two sets X and Y, |X| = |Y| denotes two sets X and Y having same
cardinality. It occurs when the number of elements in X is exactly equal to the
number of elements in Y. In this case, there exists a bijective function ‘f’ from X
to Y.

• To formulate this notion of size without reference to the natural numbers, one
might declare two finite sets A and B to have the same cardinality if and only if
there exists a bijection A→B. For finite sets, these two definitions are
equivalent. A bijection will exist between A and B only when elements of A can
be paired in one-to-one correspondence with elements of B, which necessarily
requires A and B have the same number of elements.

Two sets A and B are said to have the same cardinality if there exists a
bijection A→B.
16 CSC 607 - Fuzzy logic Systems
3. Mathematical representation of a set
• |X| ≤ |Y| denotes that set X’s cardinality is less than or equal to set Y’s
cardinality. It occurs when the number of elements in X is less than or equal to
that of Y. Here, there exists an injective function ‘f’ from X to Y.

• |X| < |Y| denotes that set X’s cardinality is less than set Y’s cardinality. It occurs
when the number of elements in X is less than that of Y. Here, the function ‘f’
from X to Y is injective function but not bijective.

If |X| ≤ |Y| and |X| ≥|Y| then |X| = |Y|. The sets X and Y are commonly
referred as equivalent sets.

17 CSC 607 - Fuzzy logic Systems


4. Types of sets
• Sets can be classified into many types; some of which are finite, infinite,
subset, universal, proper, singleton set, etc.
4.1. Finite Set
• A set that contains a definite number of elements is called a finite set.

Examples
• S = {x|x ∈ N and 70 > x > 50}.
• A = {x | x is a month in a year}; Set A will have 12 elements.
• B={y | y is the zero of a polynomial (x4 − 6x2 + x + 2)}; Set B will have 4 zeros.

18 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.2. Infinite Set
• A set that contains infinite number of elements is called an infinite set.
Examples
• S = {x|x ∈ N and x > 10}.
• A = {x | x is a natural number}; There are infinite natural numbers. Hence, A is
an infinite set.
• B = {y | y is the ordinate of a point on a given line}; There are infinite points on
a line. Therefore, B is an infinite set.

19 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.3. Subset

• Definition: If a set X contains elements which are all the elements of set Y as well,
then X is known as the subset of Y.

Examples

• A set X is a subset of set Y (Written as X ⊆ Y) if every element of X is an element of


set Y.

• If Y={-9,13,6}, then, Subsets of Y= ϕ, {-9}, {13}, {6}, {-9,13}, {13,6}, {6,-9}, {-9,13,6}

20 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.3. Subset
Examples
• Let, X = {1, 2, 3, 4, 5, 6} and Y = {1, 2}. Here set Y is a subset of set X as all
the elements of set Y is in set X. Hence, we can write Y⊆X.

• Let, X = {1, 2, 3} and Y = {1, 2, 3}. Here set Y is a subset (not a proper subset)
of set X as all the elements of set Y is in set X. Hence, we can write Y⊆X.

21 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.4. Proper Subset

• The term “proper subset” can be defined as “subset of but not equal to”. A Set X
is a proper subset of set Y (Written as X ⊂ Y) if every element of X is an element
of set Y and |X| < |Y|.

Example

• Let, X = {1, 2, 3, 4, 5, 6} and Y = {1, 2}. Here set Y ⊂ X, since all elements in Y
are contained in X too and X has at least one element, which is more than set Y.

22 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.5. Universal Set

• It is a collection of all elements in a particular context or application. All the sets


in that context or application are essentially subsets of this universal set.
Universal sets are represented as U.

Example

• We may define U as the set of all animals on earth. In this case, a set of all
mammals is a subset of U, a set of all fishes is a subset of U, a set of all
insects is a subset of U, and so on.

23 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.6. Empty Set
• An empty set means that there are no elements in the set. It is denoted by Φ.
As the number of elements in an empty set is finite, empty set is a finite set.
The cardinality of empty set or null set is zero.
Example
• If a set doesn’t have any elements, it is known as an empty set or null set or
void set. For e.g. consider the set:

✓ P = {x : x is a leap year between 1904 and 1908}. Between 1904 and 1908,
there is no leap year. So, P = Φ. Similarly,

✓ S = {x|x ∈ N and 7 < x < 8} = Φ.

24 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.7. Singleton Set or Unit Set

• A Singleton set or Unit set contains only one element. A singleton set is
denoted by {s}.

Example

• S = {x|x ∈ N, 7 < x < 9} = {8}.

25 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.8. Equal Set

• If two sets contain the same elements, they are said to be equal.

Example

• If A = {1,2,6} and B = {6,1,2}, they are equal as every element of set A is an


element of set B and every element of set B is an element of set A.

26 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.9. Equivalent Set

• If the cardinalities of two sets are same, they are called equivalent sets.

Example

• If A = {1, 2, 6} and B = {16, 17, 22}, they are equivalent as cardinality of A is


equal to the cardinality of B. i.e. |A| = |B| = 3.

27 CSC 607 - Fuzzy logic Systems


4. Types of sets
4.10. Overlapping Set
• Two sets that have at least one common element are called overlapping sets.
In case of overlapping sets:
✓ n(A∪B)=n(A)+n(B)−n(A∩B)
✓ n(A∪B)=n(A−B)+n(B−A)+n(A∩B)
✓ n(A)=n(A−B)+n(A∩B)
✓ n(B)=n(B−A)+n(A∩B)
Example
• Let, A = {1, 2, 6} and B = {6, 12, 42}. There is a common element ‘6’, hence
these sets are overlapping sets.

28 CSC 607 - Fuzzy logic Systems


4. Types of sets
Exercise (CLASSWORK)
• Let A = {1,2,5,7} and B = {8,9,5,7}. Verify the following :
✓ n(A∪B)=n(A)+n(B)−n(A∩B).
✓ n(A∪B)=n(A−B)+n(B−A)+n(A∩B).
✓ n(A)=n(A−B)+n(A∩B).
✓ n(B)=n(B−A)+n(A∩B).

Venn Diagram
29 CSC 607 - Fuzzy logic Systems
4. Types of sets
4.11. Disjoint Set
• Two sets A and B are called disjoint sets if they do not have even one element
in common. Therefore, disjoint sets have the following properties.
✓ n(A∩B)= Φ.
✓ n(A∪B)=n(A)+n(B).

Example

• Let, A = {1, 2, 6} and B = {7, 9, 14}, there is not a single common element,
hence these sets are Disjoint sets.

30 CSC 607 - Fuzzy logic Systems


5. Operations on Classical Sets
• Set Operations include Set Union, Set Intersection, Set Difference,
Complement of Set, and Cartesian Product.
5.1. Union
• The union of sets A and B (denoted by A ∪ B) is the set of elements which are
in A, in B, or in both A and B. Hence, A ∪ B = {x|x ∈ A OR x ∈ B}.
Example
• If A = {10,11,12,13} and B = {13,14,15}, then A ∪ B = {10,11,12,13,14,15} – The
common element occurs only once.

31 CSC 607 - Fuzzy logic Systems


5. Operations on Classical Sets
5.2. Intersection
• The intersection of sets A and B (denoted by A ∩ B) is the set of elements
which are in both A and B.
• Hence, A ∩ B = {x|x ∈ A AND x ∈ B}.
Example

• If A = {10,11,12,13} and B = {13,14,15}, then A ∩ B = {13}.

32 CSC 607 - Fuzzy logic Systems


5. Operations on Classical Sets
5.3. Difference/ Relative Complement
• The set difference of sets A and B (denoted by A–B) is the set of elements
which are only in A but not in B.
• Hence, A − B = {x|x ∈ A AND x ∉ B}.
Example
• If A = {10, 11, 12, 13} and B = {13, 14, 15}, then (A − B) = {10, 11, 12} and (B −
A) = {14, 15}.
• Here, we can see (A − B) ≠ (B − A).

33 CSC 607 - Fuzzy logic Systems


5. Operations on Classical Sets
5.4. Complement of a set
• The complement of a set A (denoted by A′) is the set of elements which are
not in set A. Hence, A′ = {x|x ∉ A}.
• More specifically, A′ = (U−A) where U is a universal set which contains all
objects.
Example
• If A = {x|x belongs to set of add integers} then A′ = {y|y does not belong to
set of odd integers}.

34 CSC 607 - Fuzzy logic Systems


5. Operations on Classical Sets
5.5. Cartesian Product / Cross Product
• The Cartesian product of n number of sets A1, A2,… An denoted as A1 ×
A2...× An can be defined as all possible ordered pairs (x1, x2, …xn) where x1
∈ A1, x2 ∈ A2,…, xn ∈ An.
Example
• If we take two sets A = {a,b} and B = {1,2}.
• The Cartesian product of A and B is written as: A × B = {(a,1),(a,2),(b,1),(b,2)},
and, the Cartesian product of B and A is written as : B × A = {(1,a), (1,b), (2,a),
(2,b)}.

35 CSC 607 - Fuzzy logic Systems


6. Properties of operations on Crisp Sets
• Properties on sets play an important role for obtaining the solution. Following
are the different properties of classical sets.

6.1. Commutative Property


• Having two sets A and B, this property states:

36 CSC 607 - Fuzzy logic Systems


6. Properties of operations on Crisp Sets
6.2. Associative Property
• Having three sets A, B and C, this property states

37 CSC 607 - Fuzzy logic Systems


6. Properties of operations on Crisp Sets
6.3. Distributive Property
• Having three sets A, B and C, this property states

38 CSC 607 - Fuzzy logic Systems


6. Properties of operations on Crisp Sets
6.4. Idempotency Property
• For any set A, this property states:

6.5. Identity Property


• For set A and universal set X, this property states:

39 CSC 607 - Fuzzy logic Systems


6. Properties of operations on Crisp Sets
6.6. Involution Property
• For any set A, this property states:

6.7. De Morgan’s Law


• It is a very important law and supports in proving tautologies and contradiction.
This law states:

40 CSC 607 - Fuzzy logic Systems


Class Work 1

Exercise 1
Let, the Universe: .
Class Find:
Work #1 1. The cardinal number of X.
2. The power set of X.
3. The cardinality of the power.
Note:
The power set of consists of all possible sets of X.
Exercise 2

Class Let : , ,

Work #1 Verify that:


1. A∪(B∪C)= (A∪B)∪C

2. A∩ (B∩C)= (A∩B) ∩C

3. A∪(B∩C)= (A∪B) ∩(A∪C)

4. A∩ (B∪C)= (A∩B)∪ (A∩C)


Lab. 1. Operations on Fuzzy Set

1. Introduction

• Fuzzy Logic is determined as a set of mathematical


principles for knowledge representation based on degrees
of membership rather than on crisp membership of classical
binary logic.

• However, the membership function is used to represent the


Lab 1 #1 fuzzy logic on a computer. Most often, a graphic
representation is used to represent the membership
function.

• Figure 1 shows two examples of temperature


representation, one in classical logic, and the other in fuzzy
logic.
Lab 1 #1

Figure 1. Comparison of the temperature membership in classical


logic vs Fuzzy Logic.
2. Operations on Fuzzy Set

2.1. Union

Consider two Fuzzy Sets denoted by A and B, then let’s

Lab 1 #1 consider Y be the Union of them, then for every member of

A and B, Y will be:


Memb(Y)= max(Memb(A), Memb(B))
Exercise 1

Assume that we have the two fuzzy sets A and B defined by:
𝐴 = {0.4, 0.3, 0.6, 0.5}
Lab 1 #1 𝐵 = {0.6, 0.6, 0.4, 0.2}

Write a Simple Program in Python to perform the union Y of


the sets A and B.
2.2. Intersection

Consider two Fuzzy Sets denoted by A and B, then let’s


consider Y be the intersection of them, then for every
member of A and B, Y will be:

Lab 1 #1 Memb(Y)= min(Memb(A), Memb(B))


Exercise 2

Assume that we have the two fuzzy sets A and B defined by:
𝐴 = {0.4, 0.3, 0.6, 0.5}
Lab 1 #1 𝐵 = {0.6, 0.6, 0.4, 0.2}

Write a Simple Program in Python to perform the intersection


Y of the sets A and B.
2.3. Complement

Consider the Fuzzy Set denoted by A, then let’s consider


Y be the complement of it, then for every member of, Y
will be:

Lab 1 #1
Memb(Y)= 1 - Memb(A)
Exercise 3

Assume that we have the fuzzy set A defined by:


𝐴 = {0.4, 0.3, 0.6, 0.5}
Lab 1 #1 Write a Simple Program in Python to perform the
complement Y of the set A.
END ‫كلية الحاسبات وتقنية المعلومات‬
Faculty of Computing & Information Technology

You might also like