100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Lectures Sets $3.75   Add to cart

Class notes

Lectures Sets

 38 views  3 purchases
  • Course
  • Institution

Lecture notes of Sets.

Preview 4 out of 37  pages

  • November 1, 2019
  • 37
  • 2017/2018
  • Class notes
  • Unknown
  • All classes
avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller cdh. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $3.75. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67474 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$3.75  3x  sold
  • (0)
  Add to cart