30 - A B . For any X A , dene the image of X under f to be...

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

View Full Document Right Arrow Icon
4.1 Introducing Functions D EFINITION 4.1 (F UNCTIONS ) A function f from a set A to a set B , written f : A B , is a relation f A × B such that every element of A is related to one element of B ; more formally, it is a relation which satis±es the following additional properties: 1. ( a,b 1 ) f ( a,b 2 ) f b 1 = b 2 ; 2. a A. b B. ( a,b ) f . The set A is called the domain of f , and B is the co-domain of f . If a A , then f ( a ) denotes the unique b B such that ( a,b ) f . One awkward convention is that, if the domain A is the n -ary product A 1 × . . . × A n , then we often write f ( a 1 , . . . , a n ) instead of f (( a 1 , . . . , a n )) . The intended meaning should be clear from the context. Also, recall the difference between the following two Haskell functions: f :: a -> b -> c -> d f :: (a,b,c) -> d In de±nition 4.1, the de±nition of function can not be curried. D EFINITION 4.2 Let f :
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A B . For any X A , dene the image of X under f to be f [ X ] def = { f ( a ) : a X } The set f [ A ] of all images of f is called the image set of f . We explore some examples. Since functions are special binary relations, we can use the representations given in section 3 to describe relations. When the domain and co-domain are nite, a useful representation is the diagram representation. 1. Let A = { 1 , 2 , 3 } and B = { a,b, c } . Let f A B be dened by f = { (1 , a ) , (2 , b ) , (3 , a ) } . Then f is a function, as is clear to see from the diagram: A B 1 2 3 a b c The image set of f is { a,b } . The image of { 1 , 3 } under f is { a } . 31...
View Full Document

Ask a homework question - tutors are online