Docstoc

Discrete Structure

Document Sample
Discrete Structure Powered By Docstoc
					Discrete Structure
   Li Tak Sing(李德成)
Equivalence relations

Any binary relation that is reflexive,
 symmetric, and transitive is called an
 equivalence relation.
Sample equivalence relations

R is over N, xRy means x+y is even
R is over real number, xRy means
 sin(x)=sin(y)
Examples

Let R be defined on N by xRy iff |x-y| is
 odd. Show that R is not an equivalance
 relation on N.
Given the relation over the integers
 defined by a~b iff |a|=|b|, either prove that
 ~ is an equivalence relation or prove that ~
 not an equivalence relation.
Intersection property of equivalence

If E and F are equivalence relations on the
 set A, then EF is an equivalence relation
 on A.
Kernel relations

If f is a function with domain A, then the
 relation ~ defined by
        x~y iff f(x)=f(y)
 is an equivalence relation on A, and it is
 called the kernel relation of f.
Equivalence classes

Let R be an equivalence relation on a set
 S. If aS, then the equivalence class of a,
 denoted by [a], is the subset of S
 consisting of all elements that are
 equivalent to a. In other words, we have
         [a]={x S | xRa}
Example of equivalence class

a~b iff a+b is even
a~b iff sin(a)=sin(b)
a~b iff a and b are studying the same
 course
Property of equivalences
 Let S be a set with an equivalence relation R. If
  a, b S, then either [a]=[b] or [a][b]=.
 Proof. If [a][b], and [a][b]  , there is an
  element c so that c[a] and c[b]. So we have
  aRc and cRb, therefore aRb. Now, for any x
  [a] , xRa. Since aRb, therefore we have xRb
  which implies that x [b]. Therefore, [a][b].
  Similarly, we have [b][a].
Partitions
 By a partition of a set we mean a collection of
  nonempty subsets that are disjoint from each
  other and whose union is the whole set.
 If R is an equivalence relation on the set S, then
  the equivalence classes form a partition of S.
  Conversely, if P is a partition of a set S, then
  there is an equivalence relation on S whose
  equivalence classes are sets of P.
Refinement of a partition

Suppose that P and Q are two partitions of
 a set S. If each set of P is a subset of a
 set in Q, then P is a refinement of Q. The
 finest of all partitions on S is the collection
 of singleton sets. The coarsest of all
 partitions of S is the set S itself.
Example

aRb iff ab (mod 2)
aSb iff ab (mod 4)
Example

Given the following set of words.
   {rot, tot, root, toot, roto, toto, too, to otto}.
Let f be the funtion that maps word to its
 set of letters. For kernel relation of f,
 describe the equivalence classes.
Let f be the function that maps a word to
 its bag of letters. For the kernel relation of
 f, describe the equivalence classes.
Kruskai's algorithm for minimal
spanning trees
In the spanning tree problems, we can
 define a relation R so that aRb if there is a
 path between a and b. The algorithm is:
Kruskal's Algorithm
 Sort the edges of the graph by weight, and let L be the
  sorted list.
 Let T be the minimal spanning tree and initialize T:=.
 For each vertex v of the graph, create the equivalence
  class [v]={v}
 while there are 2 or more equivalence classes do
   Let {a,b} be the edge at the head of L;
   L:=tail(L);
   if [a][b] then
      T:=T{{a,b}};
       Replace the equivalence classes [a] and [b] by [a]
  [b]
   fi
 od
Spanning trees
                                 b
             a           2




                                 1
         2
                 1                   c
             2       d       2
    e
                                     1
                     2
                                 f
Spanning trees
                                   a



                               2
                   1
                               e
                       3                   2

                                   2
         b   1 f
                           3
                                       d
                           1                   1


                                                   c

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:0
posted:5/7/2013
language:Unknown
pages:17