Group 7 Presentation 2
Group 7 Presentation 2
Discrete Structure
(IS 143)
2. Lowercase letters are usually used to denote elements of sets. For example,
a∈ A
Ways or method of representing sets
There are two main way or method of representing set.
First method; Roster method it’s also known as (listing method), is the
way of representing a set by listing the element or member of a set. For example
let P be a set, then P= {1,2,3,4,5}
If there is a clear pattern to the elements, an ellipsis (three dots) can be used. For
example, the set of even number between 0 and 10 can be written as { 0, 2,… ,8}
This method of listing the elements of the set is also known as ‘Tabulation’
Second method; Set builder method, the set is defined by specifying a
property that elements of the set have in common. For example, let set B be the
set of even numbers between 0 and 30 can be written:
B= {x: x is even and 0 < x < 30}
Types of sets
SINGLETON SET
a singleton, Is a set having only one element /member.
For example: A= {2}
FINITE SET
A set which contain defined number of element.
For example: (i) A= {1,2,3,4,5}
INFINITE SET
A set which contain undefined or uncountable number of element.
For example: (i) A= {x| x is even number greater than zero x >0 }
Types of sets
SUBSET
A set A is a subset of the set B if and only if every element of A is also an element of
B. It’s denoted as A ⊆ B
For example: A= {a, c, f } and B= { a, b, c, d, e, f }
There two types of subset , which are Proper subset and Improper subset .
Proper subset, A set A is called proper subset of the set B, if set A does not contain all
element of set B. For example; A= {1,2,3} while B= {1,2,3,4,5,6}.
Improper subset, A set A is called improper subset of the set B, if set A contain all
element of set B. For example; A= {a, b, c} and B= {a, b, c}.
SUPER SET
If set A is a subset of B then, B is a super set.
Types of sets
POWER OF SET
A set of all subset of a set. Power of set Q is denoted as P(Q)
For example: Set A is given as A= {1,2,3} then the powerset of set A is P= { {}, {1}, {2},
{3}, {1,2}, {1,3}, {2,3}, {1,2,3} }
EMPTY SET /NULL SET
A set with no element. For example: A= {} or A= Φ .
UNIVERSAL SET
A set which contain all possible element of all given sets.
Example: If A = {0, 2, 7}, B = {3, 5, 6}, C = {1, 8, 9, 10} then the universal set can be
taken as the set. U = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
1.Properties of sets
A∪A=A
● Idempotent Properties:
A∩A=A
(A ∩ B)' = A' ∪ B’
A ∪ A' = U
● Complement Properties:
A ∩ A' = ∅
Properties of sets
• Identity Properties:
A∪∅=A
A∩U=A
• Commutative Properties:
A∪B=B∪A
A∩B=B∩A
• Associative Properties:
(A ∪ B) ∪ C = A ∪ (B ∪ C)
(A ∩ B) ∩ C = A ∩ (B ∩ C)
• Distributive Properties:
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
Operation of sets
UNION OF SETS:
Is the combination of two sets. The union of two sets A and B is the set whose
elements are all of the elements in A or in B or in both. And it’s denoted as A∪ B.
For example: Set A= {1, 2, 3} and set B= {4, 5, 8} then union of set A and B ( A∪ B) =
{1, 2, 3, 4, 5, 8}
INTERSECTION OF SETS
Two or more sets are said to be intersected if they have one or more common
elements. And it’s denoted as A∩B.
For example: Set A= {1, 2, 3, 4} and set B= {3, 4, 5} since set A and B have element 3
and4 which are common to both A and B then A and B intersect (A∩B).
symbolically: A∩B={x| x∈ A and x∈ B }
Operation of sets
DIFFERENCE OF TWO SETS (Relative complement )
If A and B are subsets of the universal set U, then the difference of set A to set B ( A - B ) means is
the element that is in set A but not in set B.
Symbolically: (A\B) or (A -B) = { x| x ∈ A and x ∉ B}
For example: Set A= {1, 2, 3, 4} and set B= {3, 4, 5, 6} , then A – B = {1, 2}
SYMMETRIC DIFFERENCE
If A and B are subsets of the universal set U, then the symmetric difference of set A and B
means the element can be either in set A or in set B but not in both. It’s denoted as (AΔB)
or( A⨁B).
Symbolically: A Δ B = {x| x ∈ A ∪ B and x ∉ A ∩ B} or A Δ B= (A – B) ∪ (B – A)
For example: Set A= { 1, 2, 3, 4} and set B= {3, 4, 5, 6, 7, 8}, then A Δ B = {1, 2, 5, 6, 7, 8}
COMPLEMENT OF A SET
Venn diagrams
● These are diagrams that are used to give a visual
presentation of sets and to highlight the way they relate to
one another .
● They usually uses circles to represent a single set ,
meanwhile a rectangle outside represent a universal set.
● Example of venn diagram.
Venn diagrams cont...
● Venn diagrams helps to illustrate various set operations as
follows
i) Union (A∪B).
•it’s shown by shading both circles in the venn
diagram.
iv)Complement (A’).
• It’s shown by shading the area outside the
particular set
within a universal set.
Venn diagrams cont..
● Venn diagrams are used in set theory to give a
graphical and much detailed representation
on the relationship that exists between
particular sets.
• In Boolean algebra:
If A = 1 (true), B = 1 (true), then A AND B = 1
So, Boolean algebra is like set theory with just two elements:
true and false.
Application of Set theory, Boolean algebra, and
Propositional Logic
● Databases.
SQL operations like JOIN, UNION, INTERSECT
are based on set theory as the foundation.
• Data structures.
Collections like arrays, lists, sets, and maps are often
treated as mathematical sets in most data structure
•Search Engines.
Search engines use the concept of intersection from the
set theory to match the search results and the queries.
Application cont...
● Digital circuitry and hardware.
Boolean algebra is used to design the electronic digital
circuits that uses logic, flip flops, adders and CPU.
• Programming Logic.
Conditional statements in programming languages are
based on Boolean functions.
Example Conditional statements like if, Else, loops and
every true/ false decision in code.
Application cont...
● Artificial intelligence.
Propositional Logic helps AI to reason and to make
decisions using rule-based systems, and logical inference
engines.
• Formal verification.
Propositional logic helps to Prove Mathematically if a
program or software works correctly according to it’s
specifications.
It finds all errors in the software even the ones that the test
might miss.
Demonstration on how structural induction is used to prove properties of sets and
recursive data structures
NOTE:
● By completing both the base case and the inductive step,
the property is proven for all n≥0.
Application of Sets in Computer Science and
Engineering
● Databases: At the core of a relational database lies the concept of sets. Each table
represents a set of unique records (tuples) where operations such as union,
intersection, and difference are not only defined but essential. For example, when
combining results from multiple tables, the union operation ensures we don’t have
duplicates, thereby maintaining data integrity.
● Data Structures: Sets are implemented through various data structures such as
hash sets or balanced trees, which allow for efficient management of unique items.
This is particularly crucial in applications like spell checkers—where a dictionary
might be a set of valid words—and in performing efficient membership checks,
insertions, and deletions.
Cont..
● Formal Proofs and Logic: In the realm of formal methods, sets serve as a
foundation to define system properties. Through set theory, we can formulate
logical propositions that help verify the correctness of algorithms and
systems, thus ensuring that software behaves as expected.
4. Bit Set
A bit set is a data structure that uses bits to represent a set of
non-negative integers, with each bit indicating the presence
(1) or absence (0) of an element.
This might be used in network applications to track active
connections efficiently. For example, if you need to track which
IP addresses in a subnet are currently engaged, a bit set minimizes
memory usage while allowing quick membership testing.
Advantages and disadvantages of set
applications in Computer Science.
● Advantages.
Allows efficient membership testing ; sets mainly helps to
check whether an element really exists .its an ideal for searching
and filtering mainly in algorithms where fast look ups is
important.
Simplifies code and logic; sets reduces the manual loops and
conditions leads to more readable and concise codes.
Advantages cont...
Efficient performance; as sets are generally faster than
lists of larger data thus is used in large data processing
like in databases.
Supports mathematical operations; sets performs
mathematical operation for combining or comparing
datasets (union , intersection, difference)
Automatic duplicate removal; sets ensures only the unique
data are stored as its useful in data cleaning.
Disadvantages
No duplicate values; sets limits the elements as it
automatically removes the duplicates as sometimes its
important .example in counting votes or items .
2. Computational Complexity
● Problem: Set operations like union, intersection, and complement are
often conceptually simple but can be computationally expensive when
dealing with large data sets. While set theory can describe these
operations abstractly, efficient computation in practice often requires
optimization techniques.
● Example: Set membership tests (checking whether an element is in a set)
can be slow in large sets. Optimizing such operations in a real system
often requires using data structures like hash tables or trees, which go
beyond basic set theory.
Limitations of Sets Theory in Computer Science and Engineering
3. Representation of Data
● Problem: Set theory abstracts away many details of how data is stored and
represented in a computer. Real-world data structures and algorithms often
need to consider performance trade-offs, memory management, and access
patterns that set theory does not inherently address.
● Example: In computer science, sets may be represented using hash sets, trees,
or arrays, each with different time complexities for various operations. Set
theory does not specify the best representation for these data structures.
Limitations of Sets Theory in Computer Science and
Engineering
5. Scalability Issues
Problem: As the size of data sets grows, certain operations on sets, such as determining
intersections or computing power sets, can become inefficient. The scalability of
algorithms based on set theory often requires advanced techniques like approximation,
heuristics, or distributed computing.
Example: Calculating the power set of a large set has exponential complexity (2^n
subsets), which becomes impractical for large n. Computer systems must find alternative
ways to deal with large data sets without explicitly computing the power set.
Limitations of Sets Theory in Computer Science and Engineering
6.Non-Disjoint Operations
Problem: In classical set theory, operations like union, intersection, and difference are
well-defined for disjoint sets, but in many real-world scenarios, data may overlap or not
be cleanly separable. Set theory does not always provide an elegant way to handle non-
disjoint or partially overlapping data sets.
Example: In database queries, when dealing with records that might have duplicate or
partially overlapping entries, handling such sets requires more sophisticated methods like
normalization, indexing, or multi-way joins.
References