Discrete Structures

# Lecture Notes, 1 Dec 2010

 Last Update: 1 December 2010 Note: or material is highlighted

### §§8.1; 8.5: Relations

1. Database Theory as the Computational Theory of Relations:

1. All set operations apply to relations: That's how databases work!

2. E.g.)

Let C = {c | c is a course at UB}
Let S = {s | s is a student at UB}

Then can define Ri ⊆ S × C such that:

• R1 = {(s,c) | student s is taking course c}
• R2 = {(s,c) | student s must take course c for the CSE major}

• Then:

1. R1 ∪ R2 = {(s,c) | (s is taking c) ∨ (s must take c for CSE)}

• i.e.) returns list of all (s,c) specifying students' actual and required CSE courses.

2. R1 ∩ R2 = {(s,c) | (s is taking c) ∧ (s must take c for CSE)}

• i.e.) returns list of all (s,c) with current courses that are required

3. R1 – R2 = {(s,c) | (s is taking c) ∧ (s doesn't have to take c for CSE)}

• i.e.) returns list of all (s,c) with current electives.

3. E.g.)

• Let < be defined recursively as we did last time

Let = ⊆ N×N be defined recursively as follows:

• Base Case: (0,0) ∈ =
Recursive Case: (x,y) ∈ =  →  (S(x),S(y)) ∈ =

Then: ≤  =def  < ∪ =

(= {(x,y) | (x,y) ∈ <   ∨   (x,y) ∈ =})

2. Equivalence Relations:

1. Let ∼ ⊆ A × A.
Then ∼ is an equivalence relation on A =def
R is reflexive, symmetric, & transitive.

• Notation: "a ∼ b" for: (a,b) ∈ ∼
(read: "a is equivalent to b")

2. E.g.)

Let WFPL = {A | A is a well-formed proposition of propositional logic}
Let ≡ ⊆ WFPL×WFPL s.t. A≡B iff tval(A)=tval(B)
i.e.) iff (A↔B) is a tautology
Then ≡ is an equivalence relation on WFPL

• proof:

tval(A)=tval(A)
∴ A≡A

tval(A)=tval(B) → tval(B)=tval(A)
∴ A≡B → B≡A

(tval(A)=tval(B) ∧ tval(B)=tval(C)) →
tval(A)=tval(C)
∴ (A≡B ∧ B≡C) → A≡C
QED

3. Def:

Let A1, …, An ⊆ A.
Then:

1. The Ai are mutually exclusive =def
they are "pairwise disjoint"

• i.e.) (∀Ai, Aj)[Ai ∩ Aj = ∅]

2. The Ai are jointly exhaustive =def iAi = A

3. Let A1, …, An ⊆ A be mutually exclusive
& jointly exhaustive.
Then {A1, …, An} isdef a partition of A.

• So A looks like this:

4. Def:

Let ∼ be an equivalence relation on set A.
Let a ∈ A.

Then:

1. the equivalence class of a under
denoted [a]
=def

{a′ ∈ A | a′ ∼ a}

2. α is a representative of [a] =def α ∈ [a].

5. Thm:

Let A be a set.
Then:

(∀ equiv relation ∼ ⊆ A×A)(∃ A1,…,An ⊆ A)[{A1,…,An} is a partition of A]

1. i.e.) ∀ equivalence relation, ∃ partition
i.e.) every equiv relation "induces" a partition

2. proof sketch:

Let ∼ be an equiv relation on A.

Let P = {[a1], …, [an]} be the set of all equivalence classes of elements of A under ∼.

Then i[ai] = A.

∴ They are jointly exhaustive.

And (∀i, j)[[ai] ∩ [aj] = ∅

∴ They are mutually exclusive.

∴ P is a partition of A.

QED.

6. Thm:

(∀ partition {A1,…,An} of A)(∃ ∼ that is an equivalence relation on A]

1. i.e.) ∀ partition, ∃ equivalence relation

2. proof sketch,

Let P = {A1,…,An} be a partition of A.
Let a,b ∈ A.
Let a ∼ b =def ∃Ai[a,b ∈ Ai].
Show ∼ reflexive, symmetric, & transitive.
QED

7. Best Example: Q as fractions:

1. Consider the set of all fractions F = {numerals m/n | m,n ∈ Z}

1. numerals are symbols that name numbers:

• "1", "one", "un", "uno", and "I"
are 5 different numerals
that all name the same number (namely, S(0)).

2. "½" ∈ F;
"2/4" ∈ F;
and those are two different members of F

3. As numerals, "½" ≠ "2/4".
4. As numbers, ½ = 2/4

5. Better: As numerals, ½ ∼ 2/4,
where a/b ∼ c/d  =def  ad=bc

2. The relation between 2 fractions
when they can be reduced to the same lowest common denominator
is an equivalence relation that partitions F
into subsets of equivalent fractions

• Let ∼ be that equivalence relation on F, as above.
Then [½] = [2/4]
& any fraction a/b ∼ ½ can represent any other fraction that = ½.