11 - M W ; 3. products are analogous to the product types...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
same time. We do this using an ordered pair . An ordered pair ( a,b ) is a pair of objects a and b where the order in which a and b are written matters. For any objects a,b,c,d , we have ( a,b ) = ( c,d ) if and only if a = c and b = d . In our example, we have the pair (John, Mary) in the ‘loves’ relation, but not necessarily the pair (Mary, John) since the love might be unrequited. Hence, the order of the pair is important. The product constructor allows us to collect the ordered pairs together in one set. D EFINITION 2.11 (C ARTESIAN / BINARY PRODUCT ) Let A and B be arbitrary sets. The Cartesian (or binary) product of A and B , written A × B , is { ( a,b ) : a A b B } . We sometimes write A 2 instead of A × A . [Do not confuse the binary relation × on sets with the standard multiplication × on numbers.] Simple examples of Cartesian products include: 1. the coordinate system of real numbers R 2 : points are described by their coordinates ( x,y ) ; 2. computer marriage bureau: let M be the set of men registered and W the set of women, then the set of all possible matches is
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: M W ; 3. products are analogous to the product types of Haskell: for instance, (Int, Char) is Haskells notation for the product Int Char . Fact Let A and B be nite sets. Then | A B | = | A | | B | . Proof If you are uncertain about whether this fact is true, explore examples such as { a,b } { 1 , 2 , 3 } and { a,b } . We give an informal proof, which you do not need to remember. Suppose that A and B are arbitrary sets with A = { a 1 ,...,a m } and B = { b 1 ,... ,b n } . Draw a table with m rows and n columns of the members of A B : ( a 1 ,b 1 ) ( a 1 ,b 2 ) ... ( a 2 ,b 1 ) ( a 2 ,b 2 ) ... ... Such a table has m n entries. We can extend this denition of Cartesian product to the n-ary case. D EFINITION 2.12 ( n-ARY PRODUCT ) 1. For any n 1 , an n-tuple is a sequence ( a 1 ,... ,a n ) of n objects where the order of the a i matter. 12...
View Full Document

Ask a homework question - tutors are online