Chapter 7: Relations Flashcards
What is a relation?
A connection between two sets. a relation R from s -> T is a subset of S x T
Give examples of relations
Two column table in a relational database- binary relation
database set of n-ary relations
The graph of a function
A function with exactly one t with (s, t) in R
Give the identity relation on s
{(s, s) in S x S | s in S}
Give the relational composite
R’ = {(s,s’’) in S x S’’ | exists s’ in S. (s,s’) in R and (s’,s’’) in R’}
What operations can be performed on relations
Union: R U S = {(a,b) in A x B | (a,b) in R or S}
Intersection: R and S = {(a,b) in A x B | (a,b) in R and S}
Complement: Rc = {(a,b) in A x B | (a,b) not in R}
Opposite/inverse Rop = {(a,b) in A x B | (b,a) in R}
Define a partial function
for every s in S there is at most one t in T with
s mapped to t
What is the domain of definition of a partial function?
{s in S | fs is defined}.
There is a unique total function g: dom f to T for which all s in dom f are defined as gs = fs
Give the composite of two partial functions
(g . f) s = g(fs) if fs and g(fs) are defined
What is a binary relation
A relation from a set to itself: S -> S
What is a directed graph?
A directed graph on a set is given by a binary relation on S. elements of S are nodes and the pairs in the relation the edges
What is reflexivity? What is the reflexive closure?
A binary relation is reflexive if for all s in S, sRs.
The reflexive closure of a relation A is:
R U Identity_a
What is symmetry? What is the symmetric closure?
A binary relation is symmetric if for all s, s’ in S sRs’ and s’Rs
The symmetric closure is R U Rop
What is anti symmetry?
if aRb and bRa then a=b
What is transitivity? What is the transitive closure?
A binary relation is transitive if for s, s’, s’’ in S
sRs’ and s’Rs’’ implies sRs’’
If there is a path from s to s’ then there is an edge from s to s’
What is an equivalence relation?
A binary relation that is reflexive, symmetric and transitive