Download presentation
1
Relations Discrete Structures (CS 173)
Van Gogh Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois
2
Midterm 1 Oct 1 in class Skills list on website, under exams
Practice midterm and practice problems will also be up soon.
3
Last Class: Sets A set is an unordered collection of objects
grandfather Madonna mother father Beethoven sister my friend me
4
Last Class: Sets Family grandfather Madonna mother father Beethoven
sister my friend me
5
Today’s class: Relations
mother father sister grandfather me parent sibling Madonna Beethoven my friend
6
Today’s class How to represent relations
Properties and types of relations: reflexive, symmetric, transitive, partial order, etc. Practice proofs with relations
7
Representing relations
A relation 𝑅 on a set 𝐴 is a set of ordered pairs of elements from 𝐴 i.e. 𝑅 ⊆𝐴 ×𝐴 Consider relation 𝑅 to stand for “parent” on the set of people mother 𝑅 me 𝑅 = {(grandfather, mother), (mother, me), (father, me), (mother, sister), (father, sister)} Relation 𝑆 stands for “sibling” 𝑆={(sister, me), (me, sister)} mother father sister grandfather me parent sibling
8
Relations with numbers
“less than” 1 2 3 4 5 6 7 8 “divides” 1 2 3 4 5 6 7 8 “congruent mod 3” 1 2 3 4 5 6 7 8
9
Application: Relational Databases, SQL
A database can be seen as a relation (or sets of relations) Represented as tables Query languages (like SQL) SELECT statements combine relations to get new relations SELECT * FROM Book WHERE price > ORDER BY title; Uses JOINs, etc. Uses Boolean connectives, etc.
10
Reflexivity Reflexive: all elements relate to self 𝐹𝑜𝑟 𝑎𝑙𝑙 𝑥∈𝐴, 𝑥𝑅𝑥 Irreflexive: no elements relate to self 𝐹𝑜𝑟 𝑎𝑙𝑙 𝑥∈𝐴, 𝑥𝑅𝑥 (𝑅 means “𝑅 does not hold”) Is irreflexive the negation of reflexive? No!
11
Symmetry Symmetric: ∀𝑥, 𝑦∈𝐴, 𝑥𝑅𝑦→𝑦𝑅𝑥 Antisymmetric: ∀𝑥, 𝑦∈𝐴 with 𝑥≠𝑦, 𝑥𝑅𝑦→𝑦𝑅𝑥 equivalent: ∀𝑥, 𝑦∈𝐴, 𝑥𝑅𝑦∧ 𝑦𝑅𝑥→ 𝑥=𝑦
12
Transitivity Transitive: ∀𝑥,𝑦,𝑧∈𝐴, 𝑥𝑅𝑦∧𝑦𝑅𝑧→𝑥𝑅𝑧 Example of a relation that is transitive? Not transitive?
13
Practice identifying relation properties
Never both ways if not same If one way then both All to self None to self if x->y->z, x->z Antisymmetric Reflexive Irreflexive Symmetric Transitive
14
Practice identifying relation properties
Never both ways if not same If one way then both All to self None to self if x->y->z, x->z Antisymmetric Symmetric Reflexive Irreflexive Transitive “less than” “divides” “congruent mod k” “is square of”
15
Disproof of transitive
Claim: “is square of” is not transitive. Definition: Relation 𝑅 on set 𝐴 is transitive iff ∀𝑥,𝑦,𝑧∈𝐴, 𝑥𝑅𝑦∧𝑦𝑅𝑧→𝑥𝑅𝑧 Emphasize writing down definition
16
Proof of antisymmetric
Claim: “is square of” is antisymmetric. Definition: Relation 𝑅 on set 𝐴 is antisymmetric if ∀𝑥, 𝑦∈𝐴 with 𝑥≠𝑦, 𝑥𝑅𝑦→𝑦𝑅𝑥, or equivalently ∀𝑥, 𝑦∈𝐴, 𝑥𝑅𝑦∧ 𝑦𝑅𝑥→ 𝑥=𝑦 Note that second case is often more useful
17
Types of relations Partial order: reflexive, antisymmetric, transitive
18
Types of relations Linear order: partial order (reflexive, antisymmetric, transitive) in which every pair of elements is comparable: ∀𝑥,𝑦∈𝐴, (𝑥𝑅𝑦 or 𝑦𝑅𝑥)
19
Types of relations Strict partial order: irreflexive, antisymmetric, transitive
20
Types of relations Equivalence relation: reflexive, symmetric, transitive
21
Equivalence example Relation 𝐶 on 𝑅 2 : 𝑥,𝑦 𝐶(𝑎, 𝑏) iff 𝑥 2 + 𝑦 2 = 𝑎 2 + 𝑏 2 0,1 𝐶 contains all points on the unit circle
22
Proof of equivalence Claim: “congruent mod k” is an equivalence relation Definition: An equivalence relation is reflexive, symmetric, and transitive
23
The subset relation What kind of ordering is the subset () relation sets?
24
Types of relations Antisymmetric Symmetric Irreflexive Reflexive
Transitive Partial Order Strict Partial Order Linear Order Equivalence Relation
25
Things to remember How to illustrate a relation graphically
Be able to identify basic properties of relations: reflexivity, symmetry, transitivity Types of relations: partial order, strict partial order, linear order When proving (or disproving) a property of a relation, write down definition of relation and property
26
See you next week! Functions and more functions
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.