You are on page 1of 19

FORMAL

METHODS
Lecture 5:Set Theory

LECTURER: QURATULAIN
DEPARTMENT OF INFORMATION TECHNOLOGY
GOVERNMENT COLLEGE UNIVERSITY FAISALABAD
Formal Specification
FORMALISING AND REASONING ABOUT COMPUTATION

FORMALISING : Give (Something) Legal Or Formal Status


REASONING : The action of thinking about something in a logical, sensible way.
Importance of
SET THEORY
Set theory is one of the areas of mathematics most often applied in CS: Set Theory
•Data structures
•Class-based object-oriented systems
•Machine learning
•Databases
•Pattern matching, and by extension, compilers
Set Theory
The branch of mathematics which deals with the formal properties of sets
as units (without regard to the nature of their individual constituents ‫)اجزا‬
and the expression of other branches of mathematics in terms of sets.
Set theory is a branch of mathematical logic that studies sets, which
informally are collections of objects.
Developed by German mathematician Georg Cantor (1845-1918). He first encountered
sets while working on “Problems on Trigonometric Series” .

Trigonometry (from Greek trigōnon,


"triangle" and metron, "measure") is a
branch of mathematics that studies
relationships involving lengths and
angles of triangles.
Engineering
Computer Science
Social Sciences
Real life applications of trigonometry

•It is used in oceanography in calculating the


height of tides in oceans.
•The sine and cosine functions are fundamental
to the theory of periodic functions, those that
Measure Height Video Games describe the sound and light waves.
•Calculus is made up of Trigonometry and
Algebra.
•Trigonometry can be used to roof a house, to
make the roof inclined ( in the case of single
individual bungalows) and the height of the roof
in buildings etc.
Marine Engineering Navigation •It is used naval and aviation industries.
•It is used in cartography (creation of maps).
•Also trigonometry has its applications in
• Trigonometry in construction satellite systems.
• Trigonometry in flight engineering
• Trigonometry in physics
• Trigonometry in criminology
• Trigonometry in Archaeologists
Set theory is now a ubiquitous (‫ )ہر جگہ موجود‬part of
mathematics, and can be used as a foundation from
which nearly all of mathematics can be derived.
Terminology used to describe sets Operation
2 Circle Venn Diagrams Shadings
3 Circle Venn Diagrams Shadings

Venn Diagrams Find A ∪ B ∪ C = U ?


Given the following sets:
U = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
A = {-1, 0, 1, 2, 5, 6, 9, 10}
B = {1, 2, 4, 6, 8, 10}
C = {1, 3, 5, 7, 9}
Scenario # 7.1:
In a group of 60 people, 27 like cold drinks and 42
like hot drinks and each person likes at least one of
the two drinks. How many like both C & H drink?
Solution:
Let A = Set of people who like cold drinks.
B = Set of people who like hot drinks.

Given
(A ∪ B) = 60
n(A) = 27
n(B) = 42 then;
n(A ∩ B) = n(A) + n(B) - n(A ∪ B)
= 27 + 42 - 60
= 69 - 60 = 9
=9
Therefore, 9 people like both tea and coffee. (A ∩ B) ?

https://www.hitbullseye.com/Quant/Set-Theory.php
Scenario # 7.2:
In a group of 100 persons, 72 people can speak English and 43 can speak French. How many can speak English only?
How many can speak French only and how many can speak both English and French?
Solution: Let A be the set of people who speak English. B be the set of people who speak French.
A - B be the set of people who speak English and not French.
B - A be the set of people who speak French and not English.
A ∩ B be the set of people who speak both French and English. = 72 – 15 = 57
57 15 28 = 43 – 15 = 28
n(A) = 72
n(B) = 43
A-B A∩B B-A
n(A ∪ B) = 100
Therefore, Number of persons who speak both French and English = 15
n(A) = n(A - B) + n(A ∩ B) ⇒
Given, n(A - B) = n(A) - n(A ∩ B)
n(A) = 72 = 72 - 15
n(B) = 43 = 57
n(A ∪ B) = 100 and n(B - A) = n(B) - n(A ∩ B)
Now, n(A ∩ B) = n(A) + n(B) - n(A ∪ B) = 43 - 15
= 72 + 43 - 100 = 28
= 115 - 100 Therefore, Number of people speaking English only = 57
= 15 Number of people speaking French only = 28
Venn Diagrams
Venn diagrams were conceived around 1880
by John Venn.
They are used to teach elementary set theory, as well as
illustrate simple set relationships in probability, logic,
statistics linguistics and computer science.
Venn diagram consist of rectangles and closed curves usually
circles. The universal is represented usually by rectangles and its
subsets by circle.

ILLUSTRATION:
In fig U = { 1, 2, 3, …., 10 } is the universal set of
which
A = { 2, 4, 6, 8, 10 } and B = { 4, 6 } are subsets, and
also B ⊂ A
A‟ (A ∩ B)‟
SOME PROPERTIES OF THE OPERATION OF UNION
1) AUB=BUA ( commutative law )
2) (AU B ) UC =AU ( B U C ) ( associative law )
3) AUϕ=A ( law of identity element )
4) AUA=A ( idempotent law )
5) U UA= U ( law of U ) A∪B B’ (B dash)

SOME PROPERTIES OF THE OPERATION OF INTERSECTION


1) A∩B=B∩A ( commutative law )
2) (A∩ B ) ∩ C =A∩ ( B ∩ C ) ( associative law )
3) Φ ∩ A = Φ, U ∩ A = A ( law of Φ and U )
4) A∩A=A ( idempotent law ) A∩B A-B
5) A∩( BU C ) =(A∩ B ) U (A∩ C ) ( distributive law )

1) Complement laws : 1) A U A‟ = U 2) A ∩ A‟ = Φ
2) De Morgan’s law :
(i) (A U B)' = A' ∩ B' (De Morgan's law of union).
(ii) (A ∩ B)' = A' U B' (De Morgan's law of intersection). (A ∪ B)’ (A - B)’
3) Laws of double complementation : ( A‟ ) „ = A
4) Laws of empty set and universal set : Φ „ = U & U‟ = Φ
For example;
Use Venn diagrams in different situations to find the following sets.
ξ = {a, b, c, d, e, f, g, h, i, j} (1) B - A

A = {a, b, c, d, f}

B = {d, f, e, g
(2) (A ∩ B)'

(3) (A ∪ B)' ?
B - A = {elements which are in B but not in A} = {e, g}
(A ∩ B)' = {elements of ξ which are not in A ∩ B}
= {a, b, c, e, g, h, i, j}
(A ∪ B)' = {elements of ξ which are not in A ∪ B} = {h, i, j}

Venn diagram word problems generally give you two


or three classifications and a bunch of numbers. You
then have to use the given information to populate the
diagram and figure out the remaining information.
Scenario # 8.1
“A Class of 40 students completed a survey on what pets they like. The choices were:
Cats, Dogs, and Birds. Everyone liked at least one pet.
10 students liked Cats and Birds but not dogs
6 students liked Cats and Dogs but not birds
2 students liked Dogs and Birds but not Cats
2 students liked all three pets
10 students liked Cats only
9 students liked Dogs only
1 student liked Birds only
Represent these results using a three circle Venn Diagram.”
Solving
Word
Problems
Scenario # 8.2
Twenty-four dogs are in a kennel. Twelve of the dogs are black, six of the
dogs have short tails, and fifteen of the dogs have long hair.

There is only one dog that is black with a short tail and long hair. Two of the
dogs are black with short tails and do not have long hair. Two of the dogs
have short tails and long hair but are not black.

If all of the dogs in the kennel have at least one of the


mentioned characteristics, how many dogs are black
with long hair but do not have short tails?
Solution-
Given: B= 12 ST=6
U = 24
12  Black
B
 2
6  Short Tail  ST
15  Long Hair  LH 1
1  B + ST + LH X 2
2  B & ST – LH
2  ST + LH -B

B + LH –ST = ?  X LH= 15
U= 24
ST Only = ? B= 12 ST=6
= 6-2-1-2 = 1
B only = ?
= 12-2-1-x = 9-x
2
LH only = ?
= 15-2-1-x = 12-x
1
X 2

LH= 15
U= 24

B= 12 ST=6
B =?
12-X-1-2 = 12

B  9- X = 12
2 1
X = 3
B only = 6 1
X 2
LH only = 3+1+2-15
LH only  = 9

LH= 15
U= 24

B= 12 ST=6
Sum of All
B+ST+LH= 24
12 + 6 + 15 = 24
6 2 1
1
3 2
9
LH= 15

You might also like