This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 2. Let A = {1, 2, 3} and B = {a, b}. Let f ⊆ A × B be deﬁned by f = {(1, a), (1, b), (2, b), (3, a)}. This f is not a welldeﬁned function, since one element of A is related to two elements in B as is evident from the diagram: A B
1 2 3 b a 3. The following are examples of functions with inﬁnite domains and codomains: (b) the function f : N → N deﬁned by f (x) = x 2 ; (a) the function f : N × N → N deﬁned by f (x, y ) = x + y ; (c) the function f : R → R deﬁned by f (x) = x + 3. The binary relation R on the reals deﬁned by x R y if and only if x = y 2 is not a function, since for example 4 relates to both 2 and −2. P R O P O S I T I O N 4 . 3 ( F I N I T E CA R D I N A L I T Y ) Let A → B denote the set of all functions from A to B , where A and B are ﬁnite sets. If A = m and B  = n, then A → B  = n m . Sketch proof For each element of A, there are m independent ways of mapping it to B . You do not need to remember this proof. 4.2 Partial Functions Recall that it is easy to write Haskell functions which return runtime errors on some (or all) arguments. For example, when designing a program P to compute square roots, it is quite reasonable to have P return an error message for negative inputs. We can either regard P as a function which returns the error answer on negative inputs, or we can regard the program as a partial function which is undeﬁned on negative arguments. D E FI N I T I O N 4 . 4 A partial function f from a set A to a set B , written f : A B , is a relation f ⊆ A × B such that just some elements of A are related to unique elements of B ; more formally, it is a relation which satisﬁes: (a, b1 ) ∈ f ∧ (a, b2 ) ∈ f ⇒ b1 = b2 32 ...
View
Full
Document
This note was uploaded on 01/02/2010 for the course MATH Math2009 taught by Professor Koskesh during the Spring '09 term at SUNY Empire State.
 Spring '09
 Koskesh
 Math

Click to edit the document details