# Sets

(集合)

## Discrete Mathematics I

### 6th lecture, November 8, 2019

https://www.sw.it.aoyama.ac.jp/2019/Math1/lecture6.html

### Martin J. Dürst # Today's Schedule

• 第二回 情報テクノロジー学科同窓会 (2019年11月30日)
• Schedule for the next few weeks
• Leftovers/summary/homework of last lecture
• Sets:
• Set membership and notations
• Operations on sets
• Subsets, powersets, the empty set
• Cardinality of sets
• Laws for sets
• Limits of set theory
• Return of homework due October 19

# 第二回 情報テクノロジー学科同窓会

• 時間: 2019年11月30日 (土), 18:00-21:0
• 場所: アイビーホール青山・表参道 (青山キャンパス隣接)
• 詳細情報は学科の LMS からメールで配信予定

# Summary of Last Lecture

• Logic circuits can be built from gates to implement Boolean functions.
• The main gates are AND, OR, NOT, NAND, NOR, XOR (⊕).
• All Boolean formulæ can be expressed using only NAND (⊼) or only NOR (⊽).
• There are many different ways to axiomatize Boolean logic (learn at least one set of axioms).
• Logical operations important for symbolic logic are implication (→) and equivalence (↔).

# Last Week's Homework: Problem 1

For each of the 16 Boolean functions of two Boolean variables A and B (same as problem 1 of last lecture), find the shortest formula using only NOR. You can use NOR with any number of arguments ≧1, but you cannot use T or F.

Hint: Start with simple formulæ using NOR and find out which functions they represent.

# How to Solve Problem 1

• Method 1: Use the solutions from problem one of lecture 4, replace ∨, ∧, and ¬ with their representation by NOR.
Problem: Solution may not be shortest one.
• Method 2: Work backwards: Take the negation of the results of a Boolean function and try to create it from the disjunction of two Boolean functions for which you already have a solution.
Example: FTTF = ¬(TFFT) = ¬(TFFF ∧ FFFT) = NOR(NOR(A, B), NOR(NOR(A), NOR(B)))
• Method 3: Try to use a program
• Use method 1 or 2
• Create all possible formulæ and evaluate them

# A Program to Solve Problem 1

• The program uses the program languge Ruby
• Formulæ are represented by arrays (shown as [element1, element2,...])
Examples: NOR(A) ⇒ [A], NOR(A,B,C)⇒[A,B,C], NOR(NOR(A), B) ⇒ [[A], B]
• The simplest formulæ are single variables: A, B
• These form the set of expressions E0 = {A, B}
• Create all formulæ with one or less NORs:
All combinations of formulæ from E0 without the empty combination, plus the formulæ in E0
• E1 = {A, B, NOR(A), NOR(B), NOR(A, B)}
• Continue in the same way for E2, E3, and so on
• The number of formulæ increases dramatically, so at each step, only keep one of the formulæ that produce the same result

# Last Week's Homework: Problem 2

Draw logic circuits of the following three Boolean formulæ:

1. A¬DC
2. NAND(G, XOR(H, K), H)
3. NOR(¬E, C) ∧ G

# The Importance of Sets

• Sets are one of the most fundamental concepts of Mathematics
• Sets can be used to represent natural numbers, similar to Peano Arithmetic
E.g.: 0 ≙ {}, 1 ≙ {{}}, 2 ≙ {{{}}}
• Sets are very important for Information Technology

# Examples of Sets

The set of integers from 1 to 5: {1, 2, 3, 4, 5}

The set of prefectures in the Kanto area: {Kanagawa, Saitama, Chiba, Gunma, Tochigi, Ibaraki}

The set of campuses of Aoyama Gakuin University: {Sagamihara, Aoyama}

# The Concept of a Set

• An unordered collection of objects
(i.e. {Sagamihara, Aoyama} = {Aoyama, Sagamihara})
• Conditions:
• It must be clear whether an object belongs to a set or not
• It must be clear whether two objects are the same or not
(one and the same object can belong to a set only once)
• Sets are usually denoted with upper-case letters (e.g. A, B, C)

# Elements and Membership

• The objects belonging to a set are called its elements
• Usually, lower-case letters are used to denote elements
• If an element b belongs to a set C, we write bC (or Cb)
(read: b is an element of set C; b is a member of C; element b belongs to set C; C contains element b)
• If an element does not belong to a set, we write bC or Cb
(bC¬bC; ∈, ∋, ∉, and ∌ are predicates written in the form of operators.)

# Element Uniformity

• Elements can be anything: instances, categories, types, concepts,...
Examples:
• Set of categories/types: {dog, cat, cow, horse, sheep, goat}
• Set of instances: {Garfield, Tom, Crookshanks, コロ、Sunny}
• There is no need for the elements in a set to be uniform
Example: {cow, happyness, Garfield, Mt. Fuji}
• A set is also an object. Therefore, it can become an element of another set:
Example: {1, {1,2}, {{1}, {1, {1,2}}}}

# Notations for Sets

• Denotation (enumeration):
List up the elements separated by commas and enclose them in braces ({})
Examples: {a, b, c}, {1, 2, 3, 4}, {1, 3, 5, 7,...}
Reading for {a, b, c}: The set (with elements/members) a, b, and c.
• Connotation (description of membership conditions):
Define the condition for elements
Examples: A = {n|n ∈ ℕ, n>0, n<5}, B = {{c, d}| c,d∈ℕ, c>3, c<10, d=3c-4}
Alternative: A = {n|n ∈ ℕ ∧ n>0 ∧ n<5}, B = {{c, d}| c∈ℕ∧ d∈ℕ ∧ c>3 ∧ c<9 ∧ d=3c-4}
Reading for {n|n ∈ ℕ, n>0, n<5}: The set of all n, where n is a(n element of the) natural number(s), n is greater than 0, and n is smaller than 5

Express A and B using denotation:

A = {1, 2, 3, 4}
B={{4, 8}, {5, 11}, {23, 9}, {6, 14}, {17, 7}, {8, 20}}

# Connotation Details

Elements of the notation, in order from left to right (example: {n|n ∈ ℕ, n>0, n<5})

• {: Opening brace
• n: Variable or expression using variable(s)
• |: Separator
• n ∈ ℕ, n>0, n<5: Conditions, connected by commas (for ∧) or logical operators; set-related conditions usually come first
• }: Closing brace

# Frequently used Sets of Numbers

• ℕ: (set of) natural numbers (5, 12, 47,...)
0: ℕ including 0; ℕ+: positive ℕ, not including 0
(ℕ may denote ℕ0 or ℕ+ depending on context)
• ℤ: Integers (whole numbers; German: Zahlen (numbers))
(-7, 13, -43, 99,...)
• ℚ: Rational numbers (the Q comes from quotient)
(¼, ½, -23, ¾, -⁵/₁₁, ⁵⁶⁷/₈₉,...)
• ℝ: Real numbers (0.37, π, e, sin(53°),...)
• ℂ: Complex numbers (23.7, √-1, -i, 7+3i,...)

# Equality of Sets

• An element can belong to a set only once.
• The order of elements in a set is irrelevant.
• Example: {1, 2} = {2, 1} = {2, 1, 2},...
• More formally:
A=B ⇔ ∀x: xAxB
• Reading of ∀x: for all x

# The Empty Set

• The empty set is the set that contains no (zero) elements
• The empty set is written {} or ∅
• When working with sets, always check for the empty set

# Neutral Element of an Operation

(also unit element, identity element, identity)

An element e is a neutral element for an operation △, if
x: ex = x = xe

• Neutral element of addition: 0
• Neutral element of multiplication: 1
• Neutral element of conjunction (∧): true
• Neutral element of disjunction (∨): false
• Neutral element of subtraction:
does not exist, but 0 is a rigth identity (satisfying only ∀x: x = xe)

# Operation on Sets: Union

(also: sum)

• The union of two sets A and B is written AB.
• The union of sets A and B is the set of elements that belong to A or B (or both):
AB = {e|eAeB}
• Neutral element of set union: {}
• Examples:
• A = {1, 2, 3, 4}; B = {2, 4, 6, 8, 10}; C = {3, 4, 5, 6}

AB = {1, 2, 3, 4, 6, 8}

AC = {1, 2, 3, 4, 5, 6}

BC = {2, 3, 4, 5, 6, 8, 10}

# Operation on Sets: Intersection

(also: product)

• The intersection of two sets A and B is written AB.
• The intersection of sets A and B is the set of elements that belong to A and B:
AB = {e|eAeB}
• Neutral element of set intersection: U
• Examples:
• A = {1, 2, 3, 4}; B = {2, 4, 6, 8, 10}; C = {3, 4, 5, 6}

AB = {2, 4}

AC = {3, 4}

BC = {4, 6}

# Operation on Sets: Set Difference

(result is called difference set)

• The difference set of A and B is written A - B (or AB).
• The difference set of sets A and B is the set of elements that belong to A but not to B.
A - B = {e|eAeB}
• Examples:
• A = {1, 2, 3, 4}; B = {2, 4, 6, 8, 10}; C = {3, 4, 5, 6}

A - B = {1, 3}; B - A = {6, 8}

A - C = {1, 2}; C - A = {5, 6}

B - C = {2, 8, 10}; C - B = {3, 5}

# Universal Set

• For logic, arithmetic, and other fields of mathematics, it is often convenient to limit the objects used to be uniform.
Examples: Integers, students taking this lecture,...
• Often, there is only one main kind of objects of interest
• In such cases, the set of all such objects is called the universal set
• The universal set is often written U
• The universal set can also be the set of all possible elements

# Operation on Sets: Complement

(also: complementary set)

• The complement of A is written Ac.
• The complement of set A is the set of all elements that do not belong to A (but belong to the universal set U).
Ac = {e|eUeA} = U-A.
• Examples:
U = {1,...,10}; A = {1, 2, 3, 4}; B = {2, 4, 6, 8, 10}
Ac = {5, 6, 7, 8, 9, 10}
Bc = {1, 3, 5, 7, 9}

```

```

# Subset

• A subset of a set A is a set of some (zero or more) of the elements of A
• We write BA (B is a subset of A) or AB (A is a superset of B)
• BA ⇔ ∀x: xBxA
• A: AA (any set is a subset of itself)
• If BA and BA, then B is a proper subset of A.
• The empty set is a subset of every set (∀A: {} ⊂ A)
(reason: ∀A: ∀x: x∈{}→xA)

(Notation: Sometimes, ⊊ is used to denote proper subsets. Some authors use ⊂ for proper subsets, and ⊆ for subsets in general.)

# Size of a Set

• A finite set is a set with a finite number of elements.
• The number of elements in a set A is written |A|.
• Examples:
• |{dog, cat, cow, horse, sheep, goat}| = 6
• |{}| = 0
• |{n|n≤20, prime(n)}| =
• |{1, {1,2}, {{1}, {1, {1,2}}}}| =

# Power Set

(also: powerset)

• The power set of A is denoted P(A).
• The power set of a set A is the set of all subsets of A:

P(A) = {B|BA}

• Examples:
• P({1, 2}) = {{}, {1}, {2}, {1, 2}}
• P({dog, cow, sheep}) = {{}, {dog}, {cow}, {sheep}, {dog, cow}, {dog, sheep}, {cow, sheep}, {dog, cow, sheep}}
• P({Mt. Fuji}) = {{}, {Mt. Fuji}}
• P({}) = {{}}

# Size of Infinite Sets

• All infinite subsets of ℕ and ℤ have the same cardinality
Example: |{1, 2, 3,...}| = |{1, 3, 5,...}|
Proof: 1↔1, 2↔3, 3↔5,...
• This cardinality is denoted by א0 (aleph zero)
• |ℚ| is also א‎0
• |ℝ| > א‎0; |ℝ| = א‎1
• In general: |S| = אn ⇒ |P(S)| = אn+1
• It is unknown whether there is a cardinality between א‎0 and א‎1,... (Cantor's continuum hypothesis)

# Laws for Sets

1. Idempotent laws: AA = A; AA = A
2. Commutative laws: AB = BA; A ∪ B = B ∪ A
3. Associative laws: (AB) ∩ C = A ∩ (BC); (AB) ∪ C = A ∪ (BC)
4. Distributive laws: (AB) ∩ C = (AC) ∪(BC);
(AB) ∪ C = (AC) ∩ (BC)
5. Absorption laws: A ∩ (AB) = A; A ∪ (AB) = A
6. Involution law: A = (Ac)c
7. Law of the excluded middle: AAc = U
8. Law of (non)contradiction: AAc = {}
9. De Morgan's laws: (AB)c = AcBc;
(AB)c = AcBc

# Limits of Sets

• Set theory seems to be able to deal with anything, but there are limits.
• We can divide the set of all sets U into two sets (AB=U, AB={}):
1. A: The set of all sets that include themselves (A = {a|aU, aa})
2. B: The set of all sets that do not include themselves (B = {b|bU, bb})
• B is a set and so BU. But does B belong to A or to B?
• Let's assume BA: BABBBB: contradiction
• Let's assume BB: BBBBBA: contradiction
• There is no solution, so this is a paradox
• Concrete example: A library catalog of all library catalogs that do not list themselves.

# This Week's Homework

Deadline: November 14, 2019 (Thursday), 19:00.

Format: A4 single page (using both sides is okay; NO cover page), easily readable handwriting (NO printouts), name (kanji and kana) and student number at the top right

Where to submit: Box in front of room O-529 (building O, 5th floor)

1. Create a set with four elements. If you use the same elements as other students, there will be a deduction.
2. Create the powerset of the set you created in problem 1.
3. For sets A of size zero to six, create a table of the sizes of the powersets (|P(A)|). Example:
 |A| |P(A)| 0 ? 1 ? ... ?
4. Express the relationship between the size of a set A and the size of its powerset P(A) as a formula.
5. Explain the reason behind the formula in problem 4.
6. Create a table that shows, for sets A of size zero to five, and for each n (size of sets in P(A)), the number of such sets.
Example: |A|=3, n=2 ⇒ |{B|BA∧|B|=n}| = 3

# About Returns of Tests and Homeworks

• Today, the graded homeworks due October 19 will be returned
• This is not part of the lecture itself (i.e. after 12:30)
• If you have some other commitment after 12:30, you can come to my office in the afternoon (after 16:00) to pick up your homework
• Homeworks including names in kana/Latin letters will be distributed first, then those without
• Homeworks with higher points will be distributed before those with lower points
• When your name is called, immediately and very clearly raise your hand, and come to the front
• When taking your homework, make sure it is really yours
• NEVER take the homework of somebody else (a friend,...)
• Carefully analize your mistakes and work on fixing them and avoiding them in the future
• Feel free to ask questions

# Glossary

set

prefecture
element

denotation

brace (curly bracket)

connotation

natural number

integer

rational number

real number

complex number

equality

uniformity

instance

universal set

(set) union

(set) intersection

difference set/set difference

complement, complementary set

Venn diagram
ベン図
subset

superset

proper subset

empty set

size of a set

finite

finite set

power set
べき (冪) 集合
infinite set

cardinality, cardinal number

aleph zero
アレフ・ゼロ
continuum hypothesis

involution law