100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

Lectures Sets

Rating
-
Sold
3
Pages
37
Uploaded on
01-11-2019
Written in
2017/2018

Lecture notes of Sets.

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
November 1, 2019
Number of pages
37
Written in
2017/2018
Type
Class notes
Professor(s)
Unknown
Contains
All classes

Subjects

Content preview

Sets Hoorcollege 1
Set Theory for Computer Science 8 februari 2018

● Definition and notation
○ Learn with Sets how to structure data.
○ Definition and notation of a set
■ Set: unordered collection of elements
■ To denote a set we use: {}
■ Try to use a name that describes the set
■ Use dots to indicate you want to continue with all the integer numbers
that lie between.
■ Examples:
● DaysOfWeek := {Mon, Tue, Wed, Thu, Fri, Sat, Sun}
● A := {1, 2, 3}
● Digits := 0, 1, … , 9}

● N := {1, 2, 3, … } natural numbers
● Z := { ... , -2, -1, 0, 1, 2, … } integer numbers
■ Second notation: Prototypes en discription notation:
● MulitplesOf2 := {2k : k a natural number} = {0, 2, 4, … }
● Months := {x: x is a month}
● “Elements of the form x where x is a month”
○ Element and subset
■ Element
● a∈A means a is an element of set A
● a∉A means a is not an element of set A
■ Subset
● A⊆B means all elements of A are
elements of B
● Meaning: A is a subset of B
● A ⊈B means at least one element of A is
not in B
● Meaning: A is not a subset of B
■ Examples
● 4 ∈ {1, 2, 3, 4} {2, 3} ⊆ {1, 2, 3, 4}
● 5 ∉ {1, 2, 3, 4} {2, 5} ⊈ {1, 2, 3, 4}
○ Equality, empty set and number of elements
■ Equality
● Equal if: Set A is a subset of B and B is a subset of A.
● The order in which you write the elements of the set doesn’t
matter.
● A=B ⇔ A ⊆ B and B ⊆ A
⇔ A and B have exactly the
same elements
■ Examples
● {1, 2, 3, 4} = {4, 3, 2, 1} = {4, 3, 3, 2 1 2}
● {1, 2, 3, 4} ≠ {2, 3, 4, 5}
■ The empty set

, ● Ø or {} set with no elements
■ Number of elements
■ Use # to denote the number of elements of the set
■ {} is also a subset
● #{4, 3, 3, 2, 1, 2} = 4 #Ø = 0
○ Review exercises
■ Exercise 1
● Write down all subsets of {1} and of {1,2}
○ Subsets of {1}
■ {1}{}
○ Subsets of {1, 2}
■ {1}, {2}, {} and {1,2}
■ The set itself is also a subset.
■ Exercise 2
● Are the following set inclusions true or false?
○ a) {1, 3, 5, 7} ⊆ {7, 6, 5, 4, 3, 2, 6, 8}
■ False
○ b) {1, 3, 5, 7} ⊆ {7, 4, 1, 6, 5, 4, 4, 3}
■ True
● Fundamental set operations
○ Universe
■ Sets are subsets of a universe U:





■ Example:
● U: all 4-letter words
● A: words with ‘a’
■ The elements that are outside ‘a’ but in the U are all the 4-letter words
without ‘a’.
■ A’: words with no ‘a’
● A’ := {x ∈ U : x ∉ A}
■ U defines the context we work in
○ Complement
■ Complement of A

, ■
■ Example:
● U: all 4-letter words
● A: words with ‘a’
● A’: words with no ‘a’
■ A’ := {x ∈ U: x ∉ A}
○ Union and intersection
■ Union of A and B





■ Example
● U: all 4-letter words
● A: words with ‘a’
● B: words with ‘b’
● A U B: words with ‘a’ or ‘b’ (inclusive or)
■ Prototype description notation: A U B := {x ∈ U: x ∈ A or x ∈ B}
○ Union and intersection
■ Intersection of A and B





■ Example
● U: all 4-letter words
● A: words with ‘a’
● B: words with ‘b’
● A ∩ B: words with ‘a’ and ‘b’
■ A ∩ B := { {x ∈ U: x ∈ A and x ∈ B}

, ○ Set-theoretic and symmetric difference
■ A minus B






Example
● U: all 4-letter words
● A: words with ‘a’
● B: words with ‘b’
● A \ B: words with ‘a’ but no ‘b’
■ A \ B := { x ∈ A: x ∉ B} = A ∩ B’
■ B minus A is not the same as A minus B
○ Set-theoretic and symmetric difference
■ Symmetric difference of A and B
■ Example
● U: all 4-letter words
● A: words with ‘a’
● B: words with ‘b’
● A △ B: words with ‘a’ or ‘b’ but not both (exclusive or) B: words with ‘a’ or ‘b’ but not both (exclusive or)
■ A △ B: words with ‘a’ or ‘b’ but not both (exclusive or) B := (A \ B) U (B \ A)
= (A U B) ∩ (A ∩ B)’


Review exercises
■ Exercise
● We are given the data:
○ A := {0, 1, 2, 3}
○ B := {2, 3, 4, 5}
○ The universe is N
● Determine the following sets:
○ A U B = {0, 1, 2, 3, 4, 5} A \ B = {0, 1}
○ A ∩ B = {2, 3} B \ A = {4, 5}
○ A’ = {4, 5, 6, … } A △ B: words with ‘a’ or ‘b’ but not both (exclusive or) B = {0, 1, 4, 5}
○ B’ = {0, 1} U {6, 7, 8, …}
● Venn diagrams and partitions
○ Venn diagram: abstract visualisation of relations between sets
■ 2 sets ⇒ 4 regions 3 sets ⇒ 8 regions





■ Any region in a Venn diagram might be empty

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
cdh Vrije Universiteit Amsterdam
Follow You need to be logged in order to follow users or courses
Sold
43
Member since
6 year
Number of followers
36
Documents
13
Last sold
2 year ago

4.0

1 reviews

5
0
4
1
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions