{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 10 - a i in turn and deciding whether or not to include it...

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

Consider the Haskell function: h’ :: [Int] -> [Int] -> [Int] h’ xs rs = [ x | (x,r) <- zip xs rs, r > x] Given the list xs , we may obtain any sublist as the output list depending on the list rs . Constructing the list of possible output lists associated with list xs is analogous to the power set constructor. Examples of power sets include: P ( { a, b } ) = { , { a } , { b } , { a, b }} P ( ) = { } P ( N ) = { , { 1 } , { 2 } , . . . , { 1 , 2 } , { 1 , 3 } , . . . , { 2 , 1 } , { 2 , 2 } , . . . } Let A be an arbitrary finite set. One way to list all the elements of P ( A ) is to start with , then add the sets taking one element of A at a time, then the sets talking two elements from A at a time, and so on until the whole set A is added, and P ( A ) is complete. P ROPOSITION 2.10 Let A be a finite set with | A | = n . Then |P ( A ) | = 2 n . Proof This statement is true, but you may need some convincing. If so, test the proposition on an example such as P ( { a, b } ) . Here is one proof, which you do not need to remember. Consider an arbitrary set A = { a 1 , . . . , a n } . We form a subset X of A by taking each element
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a i in turn and deciding whether or not to include it in X . This gives us n independent choices between two possibilities: in X or out. The number of different subsets we can form is therefore 2 n . An alternative way of explaining this is to assign a or 1 to all the elements a i . Each subset corresponds to a unique binary number with n digits. There are 2 n such posibilities. Another proof will be given in the reasoning course next term, using the so-called ‘induction principle’. ± 2.2.5 Introducing Products The last set construct we consider is the product of two (or arbitrary n ) sets. This constructor forms an essential part of the deFnition of relation discussed in the next section. If we want to describe the relationship ‘John loves Mary’, then we require a way of talking about John and Mary at the 11...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online