You are on page 1of 52

CS402/AL102 – Automata

and Language Theory


DAISY JEAN A. CASTILLO
Subject Instructor
UNIT 1 – SETS
Contents
• Set Theory
• Operations on Set
• Set Builder Notation
• Rules of Algebra of Sets
• Venn Diagram
At the end of this topic, the students should
be able to:
• Recall and learn set theory, its application, properties and operations;
• Manipulate sets to get the equivalent Venn diagram;
• Use the algebra of sets for formal proof and its validity to shorten the
equivalent set expressions.
SET THEORY
• A set is a collection of objects called elements of the set.
• We say that the set is well-defined.
Examples:
A = {a, b, c, d, e, f, g}
B = {0, 1, 2, 3,..., 10}
SET THEORY
• A set is a group of objects represented as a unit.
• Sets may contain any type of object, including numbers, symbols,
and even other sets.
• Sets can be described by listing their elements inside braces.
Elements of the Set
• Each entity or data which contain in a set is known as element.
Characteristics:
1. The members of a set may not necessarily have anything to do with
each other:
• Example: Set D = {Marge, Bart, 11, 13}
2. The ordering of elements does not matter.
• Thus {11, 13, 17, 19} = {13, 11, 19,17}
3. Also repetitions do not count:
• Hence, {11, 13, 17, 19} = {11, 13, 13, 17, 17, 19}
Subsets
• A is a subset of B i.e. A ⊆ B if and only if i.e. for all x ∈ A, x ∈ B.
• A = B if and only if A ⊆ B and B ⊆ A.
• A is a proper subset of B if A ⊆ B and A not equal to B.
• The empty set: A set may have no members. This set is called the
empty set and is represented as { } or Ø.
• The universal set: is a set that contains the entire domain, it is
sometimes represented by U.
Membership
• ∈ denotes set-membership.
• Example: 19 ∈ {11, 13, 17, 19}
• ∉ denotes non-membership.
• Example: 7 ∉ {11, 13, 17, 19}
Types of Sets
A. Finite Sets: are sets where the elements are countable. The
elements in this type of set are well defined and can be counted.
• Example: a set of chairs at room 216, number of chairs in a particular room or
whichever are determined.
• Example: {x I x =>1 and x<=10}, can be read as the set positive integer
between 1 and 10.
Types of Sets
B. Infinite Sets: are sets where the elements are not countable or
limitless.
The elements in this type of set are so huge, possibly millions, billions
or more. Cannot be defined and determined its quantity.
a. Example: In geometry, there's a theorem that says, a set of lines can be
drawn on a point is infinite.
b. The number of stars in a galaxy. According to astronomers, that a galaxy
could have billions of billions of stars and no one dares to count them.
c. Set of all positive real numbers.
Universal Set
• All sets are part of a universal set
• If U denoted as universal set has sets that makes them part of it then
we can say that they belong to universal set U.
Null Set
• Complement of U denoted by (Ø) is a null set.
• Logically speaking, empty set is a subset of any given set.
• {} ⊂ U
• Example:
• U = { { }, A, B, {1, 2} }
• Comparative:
• Given a and {a}, 'a' with no braces denotes an elements that has no
relations to any particular set, while {a} is part of a given set and it is a
set.
Roster Notation
• Is a complete or implied listing of all the elements of the set.
• So X = {1, 2, 3, 4,.., 10} and B = {a, b, c, d} are examples of roster
notation defining sets with 10 and 4 elements respectively.
OPERATIONS ON SET

• Complement is a negation of a set or the values are negated from


given a set, let say A.
• A’ may be read as complement of set A or negation of set A.
Complement(‘)
• Example no. 1:
• Note: U is a universal set
• Example: Let U = {1, 2, 3}, and A = {2, 3}, find A’
• A ⊆ U, A’ is an elements not contained in set A but is in the
universal set U.
• The only element in U which does not belong to A is 1. So, A’ = {1}.
Complement(‘)
• Example no. 2:
• Given two sets A and B
• Let U = {C#, C++, Pascal, VB, JAVA, Heskel, Prolog}, and B={C#, C++,
JAVA, Heskel, VB}. Find B’ ,
• look at the elements in the two sets and compare them. Only
elements Pascal and Prolog do not belong to A,
• therefore B’ = {Pascal, Prolog}.
OPERATIONS ON SET
2. Intersection (∩) example: A ∩ B

• Intersection is a combination of two sets namely A and B, where the elements


that may found are common to both set and are enumerated in another set let
say C without any repeated elements.
• A ∩ B, the intersection of A and B, is {x | x is in A and A is in B}
Intersection (∩)
• Example 1:
• Let A = {Pascal, C, C#, JAVA, Modula, Ada, Heskel},
• and B = {Ada, Heskel, COBOL, Pascal, J++,C++}
• C = A ∩ B. What are the elements of C?
• C = A ∩ B = {Ada, Heskel, Pascal}
Intersection (∩)
• Example 2:
• Let A = {a, b, c, d, e, f, g} and B = {a, b, c, g, t, h, m}
• Find C, C = A ∩ B.
• C = {a, b, c, g}
OPERATIONS ON SET
3. Union ( ∪ ) example: A ∪ B

• A Union is a list of all elements that may be found on two sets namely A and B,
where the elements found to both set are enumerated in another set let say C
without any repeated elements.
• Thus, the union of A and B, is {x I x is in A or x is in B}
Union (∪)
• Example 1:
• Let A = {Pascal, C, C#, JAVA, Modula, Ada, Heskel},
• and B={Ada, Heskel, COBOL, Pascal, J+ +,C++}
• Find C, C = A ∪ B.
• C = A ∪ B= {Ada, C, C++, C#, COBOL, Heskel, J++, JAVA, Modula, Pascal}
Union (∪)
• Example 2:
• Let A = {a, b, c, d, e, f, g} and B = {a, b, c, g, t, h, m}
• Find C, C = A ∪ B.
• C = {a, b, c, d, e, f, g, h, m, t}
OPERATIONS ON SET
4. Difference Example: A – B

• Given two sets A and B, noted that the expression A-B means, elements found in
A but not found in B are extracted and list down.
• Hence, the difference between A and B, {x | x is in A and x is not in B}
Difference (-)
• Example:
• Let X = {a, b, c, d, e, f, g} and Y = {a, b, g, h, o, p}
• Z = X – Y, what is Z?
• Z contains elements that are in set X but not in set Y
• Z = {c, d, e, f}
OPERATIONS ON SET
4. Cartesian Product (Multiplication)
Example: A X B read as A crossed B

• If A and B are two sets, the Cartesian Product or Cross Product of A and B written
A X B, is the set of all 2-tuples, where the first member of the 2-tuple is a
member of A and the second member is a member of B.
• A X B = {(x, y) I x ∈ A ^ y ∈ B}
• The definition of cross-product can be generalized to take n arguments.
Cartesian Product (-)
• Example:
• Let A= {1, 2, 3}, and B = {a, b},
• find the Cartesian product of A and B (A X B).
• A X B is as follows:
• (1,a), (1,b), (2,a), (2,b), (3,a), and (3,b).
Cartesian Product (-)
OPERATIONS ON SET
Power Set
SET BUILDER NOTATION
• Set-builder notation is used when the roster method is cumbersome
or impossible.
• The set B = (2, 4, 6, ..., 40} could be described by {x I 2 < = x < = 40
and x is even} .
• The vertical bar, "I", is read as "such that" so this notation is read
aloud as "the set of x such that x is between 2 and 40 (inclusive) and x
is even.
THE SYMBOLS
RULES OF ALGEBRA SETS
RULES OF ALGEBRA SETS
APPLICATION
• Using the algebra of sets, prove that LHS ≡ RHS (read as left hand side is logically
equivalent to the right hand side of the equation).
RULES OF ALGEBRA SETS
APPLICATION
VENN DIAGRAM
• Venn diagrams are visual tools that assist us to see the relationships
between sets.
• Method for representing sets by shading suitable Venn diagrams.
• “painting by the numbers”
VENN DIAGRAM
• First, let A and B be subsets of a universal set U.
• Shade A-B in a suitable Venn diagram.
• By convention, we denote U by a rectangle, and we denote A and B
by intersecting circles, even though the sets A and B do not
necessarily have a non-empty intersection.

U
VENN DIAGRAM
• Next, we consider the Venn diagram as a jigsaw puzzle, and we
label each piece of the puzzle with a number.
• That is, each region of the universe is labeled with a number.
• Now, with this picture, we can set A = {1,2}.
• This does not mean that we only have a special set with two
elements.
• This notation is really saying that set A consists of the two
regions 1 and 2.
• Likewise, B = {2, 3}.
• Then, A - B = {1, 2} - {2, 3} = {1}.
VENN DIAGRAM

• A - B = {1, 2} - {2, 3} = {1}


• Finally, we can shade region 1 of the Venn diagram.
VENN DIAGRAM (With 3 sets)
• Look at the 3 sets (A, B, C), they are part of the
square known as Universal set, so we can say
that A, B and C ⊆ U.
• A region is each section bounded by arcs and
lines, in this case the regions that U has is 8
while set A, B and C has 4 regions each.
VENN DIAGRAM (With 3 sets)
• To find the maximum number of regions of
sets depends on numbers of sets, the formula
is 2^s.
• In the figure above, it has 3 set therefore 2^s
is 2^3 = 8 regions.
• Note: Painting or shading a diagram is easier
when you know the regions of a set. This is a
personal technique of shading a Venn
diagram.
VENN DIAGRAM (With 3 sets)
• Example no. 1: A U (B U C)’
• Enumerate the elements of the set
• Let U = {1, 2, 3, 4, 5, 6, 7, 8}
• A = {1, 4, 5, 7}
• B = {2, 4, 6, 7}
• and C = {3, 5, 6, 7}
VENN DIAGRAM (With 3 sets)
• By substitution:
1. A U (B U C)’ =
{1, 4, 5, 7} U ({2, 4, 6, 7} U {3, 5, 6, 7})’ do the union of B & C
{1, 4, 5, 7} U ({2, 3, 4, 5, 6, 7})’ complement, elements which are not
listed
{1, 4, 5, 7} U {1, 8} union
{1, 4, 5, 7, 8} no repetition allowed, final answer.
VENN DIAGRAM (With 3 sets)
• By substitution:
1. A U (B ∩ C)’
= {1, 4, 5, 7} U ({2, 4, 6, 7} U {3, 5, 6, 7})’ do the union of B & C
= {1, 4, 5, 7} U ({2, 3, 4, 5, 6, 7})’ complement, elements which are not
listed
= {1, 4, 5, 7} U {1, 8} union
= {1, 4, 5, 7, 8} no repetition allowed, final answer.
VENN DIAGRAM (With 3 sets)
• Example no. 1: A U (B ∩ C)’
• Enumerate the elements of the set
• Let U = {1, 2, 3, 4, 5, 6, 7, 8}
• A = {1, 4, 5, 7}
• B = {2, 4, 6, 7}
• and C = {3, 5, 6, 7}
VENN DIAGRAM (With 3 sets)
• So, regions {1, 4, 5, 7, 8} shall be shaded.
VENN DIAGRAM (With 3 sets)
• Example no. 2: A’ ∩ (B U C)
• Enumerate the elements of the set
• Let U = {1, 2, 3, 4, 5, 6, 7, 8}
• A = {1, 4, 5, 7}
• B = {2, 4, 6, 7}
• and C = {3, 5, 6, 7}
VENN DIAGRAM (With 3 sets)
• By substitution:
1. A’ ∩ (B U C)
= {1, 4, 5, 7}’ ∩ ({2, 4, 6, 7} U {3, 5, 6, 7})
= {2, 3, 6, 8} ∩ ({2, 4, 6, 7} U {3, 5, 6, 7}) complement of A
= {2, 3, 6, 8} ∩ {2, 3, 4, 5, 6, 7} union of B and C
= {2, 3, 6} intersection (common regions)
VENN DIAGRAM (With 3 sets)
• So, regions {2,3,6} shall be shaded.

You might also like