No Slide Title

Download Report

Transcript No Slide Title

Relations
Relations between sets are like functions, but with a
more general definition (given later).
presentations: a set, a binary matrix, a graph…
distinguished types: orderings, symmetric, reflexive,
transitive,...
By the end of the next two weeks you should be able to
say what a relation is
translate between different presentations
recognise (and prove) if a relation is of a certain type
Functions
Recall a function f from set A to set B gave a unique
element of B for every element of A.
f
A domain
B codomain
Also partial functions allow some domain elements
without images
Describing functions using pairs
Functions on finite sets can be defined by listing pairs
(x, f(x))
f
a
b
c
d
A domain
p
q
r
B codomain
f can be given by the set {(a,p), (b,p), (d,p), (c,q) },
a subset of the Cartesian product of A and B.
Describing functions using a table
Functions on finite sets can be defined using a table
f
a
b
p
q
c
r
d
A domain
a
p 1
q 0
r 0
b
1
0
0
B codomain
Notice that all columns sum to 1 - why?
c
0
1
0
d
1
0
0
Reading or writing functions
f
a
b
c
d
p
q
r
A domain
B codomain
f(a) = p
say
“ f of a is p ” or “ f maps a to p ”
or
or
f :a b
Write
“ the image of a under f is p ”
Inverse functions
f
a
p
q
c
r
d
A domain
p
B codomain
f-1
a
q
r
B domain
c
d
A codomain
Composing functions
f
g
a
b
c
d
A domain
p
q
p
q
r
r
4
B codomain B domain
composite
a
2
b
15
c
d
A domain
domain
2
15
4
C codomain
C codomain
Relations
Some relations between sets don’t give functions.
A
B
Q: why isn’t this a function from A to B?
Q: why isn’t it a function from B to A?
Using pairs to describe a relation
Relations can be defined using a set of pairs
R
a
b
c
d
A
p
q
r
B
R is a relation between sets A and B . R can be given
by the set {(a,p), (b,p), (b,q), (d,p), (c,q) },
a subset of the Cartesian product of A and B.
Formal definition of a relation
A relation R between two sets A and B is a subset of
the Cartesian product of A and B.
R  A B
Using a binary matrix to describe a relation
a
b
c
d
A
p
q
r
B
a
p 1
q 0
r 0
b
1
1
0
c
0
1
0
d
1
0
0
1 1 0 1


0 1 1 0
0 0 0 0


There are no restrictions on the entries in this binary
matrix for relations
Reading or writing relations
R
a
b
c
d
q
r
A
Write aRp
say
p
B
or
a is related to p under R
or
R relates a to p
or
a, p R
a is related to p
A relation between two sets
Given the set
A = {(1,0), (2,0), (3,4), (1,1)}
and the set
B = {1, 2, 3, 4, 5}
aRb iff
a is at least distance b from the origin (0,0)
Describe this relation
using dots and arrows ,
using a set of pairs
and
using a binary matrix
A relation “on a set”
On the set A = {1, 2, 3, 4} we can say that “3 is less
than 4” (and other examples).
The template “- is less than -” gives a relation
between the set A and the set A (gives a relation “on
the set A”)
a1Ra2  a1  a2
R   a1 , a2  | a1 , a2  1,2,3,4  a1  a2 
Describe this relation
using dots and arrows ,
using a set of pairs
and
using a binary matrix
Inverse relations
R
a
p
q
b
c
r
d
A
p
q
r
B
R-1
a
b
c
d
B
A
Inverse relations
R
a
p
q
b
c
A
q
r
(c,q), (d,p), (d,q) }
r
d
p
B
R-1
a
b
c
R -1 = { (p,a), (r,a),
(q,c), (p,d), (q,d) }
d
B
R = { (a,p), (a,r),
A
Inverse relations
R
a
p
q
b
c
r
d
A
p
q
r
b
0
0
0
c
0
1
0
d
1
1
0
B
R-1
a
b
c
d
B
p
q
r
a
1
0
1
A
a
b
c
d
p
1
0
0
1
q
0
0
1
1
r
1
0
0
0
Composing relations
R
S
a
b
c
d
p
q
q
r
A
B
composite
a
b
p
r
4
B
C
2
15
c
4
d
A
2
15
C
Distinguished types of relation
A function from set A to set B
is a relation between A and B such that
a  A !b  B | aRb
Distinguished types of relation
A reflexive relation on set A
is a relation on A such that
a  A, aRa
Distinguished types of relation
A symmetric relation on set A
is a relation on A such that
a, b  A, aRb  bRa
Distinguished types of relation
An antisymmetric relation on set A
is a relation on A such that
a, b  A, aRb bRa  a  b
Distinguished types of relation
A transitive relation on set A
is a relation on A such that
a, b, c  A, aRb  bRc  aRc
Distinguished types of relation
A partial ordering on set A
is a reflexive, antisymmetric and transitive relation on A
Distinguished types of relation
A total ordering on set A
is a partial ordering on A with
a1 , a2  A, a1Ra2  a2 Ra1
Distinguished types of relation
An equivalence relation on set A
is a relation on A which is reflexive, symmetric and transitive.