Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter1 Lecture adapted from CS3511, Discrete Methods Kees van Deemter Slides originally adapted.

Similar presentations


Presentation on theme: "Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter1 Lecture adapted from CS3511, Discrete Methods Kees van Deemter Slides originally adapted."— Presentation transcript:

1 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter1 Lecture adapted from CS3511, Discrete Methods Kees van Deemter Slides originally adapted from Michael P. Franks Course Based on the Text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen

2 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter2 Adaptation of Module #4: 1. Functions Rosen 5 th ed., §1.8 ~45 slides, ~1 lecture

3 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter3 Functions From calculus, you know the concept of a real- valued function f, which assigns to each number x R one particular value y=f(x), where y R.From calculus, you know the concept of a real- valued function f, which assigns to each number x R one particular value y=f(x), where y R. Example: f defined by the rule f(x)=x 2Example: f defined by the rule f(x)=x 2 The notion of a function can be generalized to the concept of assigning elements of any set to elements of any set.The notion of a function can be generalized to the concept of assigning elements of any set to elements of any set. Functions are also called operators.Functions are also called operators.

4 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter4 Functions Functions were the key concept in lambda calculus and Haskell:Functions were the key concept in lambda calculus and Haskell: x.x+2 is the function that sends any appropriate argument x to the corresponding value x+2 x.x+2 is the function that sends any appropriate argument x to the corresponding value x+2 After the Haskell definition f x = x+2, f denotes that same function x.x+2After the Haskell definition f x = x+2, f denotes that same function x.x+2 Lets be more precise about functions, working towards a classification of functionsLets be more precise about functions, working towards a classification of functions

5 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter5 Function: Formal Definition A function f from (or mapping) A to B (f:A B) is an assignment of exactly one element f(x) B to each element x A.A function f from (or mapping) A to B (f:A B) is an assignment of exactly one element f(x) B to each element x A. Generalizations:Generalizations: –Functions of n arguments: f: (A 1 x A 2... x A n ) B. –A partial (non-total) function f assigns zero or one elements of B to each element x A.

6 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter6 Graphs of Functions We can represent a function f:A B as a set of ordered pairs f ={(a,f(a)) | a A}.We can represent a function f:A B as a set of ordered pairs f ={(a,f(a)) | a A}. This makes f a relation between A and B: f is a subset of A x B. But functions are special:This makes f a relation between A and B: f is a subset of A x B. But functions are special: –for every a A, there is at least one pair (a,b). Formally: a A b B((a,b) f) –for every a A, there is at most one pair (a,b). Formally: a,b,c((a,b) f (a,c) f b c) A relation over numbers can be represent as a set of points on a plane. (A point is a pair (x,y).)A relation over numbers can be represent as a set of points on a plane. (A point is a pair (x,y).) –A function is then a curve (set of points), with only one y for each x.

7 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter7 Functions can be represented graphically in several ways:Functions can be represented graphically in several ways: A B a b f f x y Plot Bipartite Graph Like Venn diagrams AB

8 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter8 Functions that youve seen before A set S over universe U can be viewed as a function from the elements of U to …A set S over universe U can be viewed as a function from the elements of U to …

9 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter9 Still More Functions A set S over universe U can be viewed as a function from the elements of U to …A set S over universe U can be viewed as a function from the elements of U to … … {T, F}, saying for each element of U whether it is in S. (This is called the characteristic function of S) … {T, F}, saying for each element of U whether it is in S. (This is called the characteristic function of S) Suppose U={0,1,2,3,4}. Then Suppose U={0,1,2,3,4}. Then S={1,3} S(0)=S(2)=S(4)=F, S(1)=S(3)=T. S={1,3} S(0)=S(2)=S(4)=F, S(1)=S(3)=T.

10 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter10 Still More Functions A set operator, such as or, can be viewed as a function from … to …A set operator, such as or, can be viewed as a function from … to …

11 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter11 Still More Functions A set operator such as or can be viewed as a function … … from (ordered) pairs of sets, to sets.A set operator such as or can be viewed as a function … … from (ordered) pairs of sets, to sets. –Example: (({1,3},{3,4})) = {3}

12 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter12 A new notation Sometimes we write Y X to denote the set F of all possible functions f: X Y.Sometimes we write Y X to denote the set F of all possible functions f: X Y. Thus, f Y X is another way of saying that f: X Y.Thus, f Y X is another way of saying that f: X Y. (This notation is especially appropriate, because for finite X, Y, we have |F| = |Y| |X|. )(This notation is especially appropriate, because for finite X, Y, we have |F| = |Y| |X|. )

13 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter13 Some Function Terminology If f:A B, and f(a)=b (where a A & b B), then we say:If f:A B, and f(a)=b (where a A & b B), then we say: –A is the domain of f. –B is the codomain of f. –b is the image of a under f. –a is a pre-image of b under f. In general, b may have more than 1 pre-image.In general, b may have more than 1 pre-image. –The range R B of f is R={b | a f(a)=b }. We also say the signature of f is AB.

14 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter14 Range versus Codomain The range of a function may not be its whole codomain.The range of a function may not be its whole codomain. The codomain is the set that the function is declared to map all domain values into.The codomain is the set that the function is declared to map all domain values into. The range is the particular set of values in the codomain that the function actually maps elements of the domain to.The range is the particular set of values in the codomain that the function actually maps elements of the domain to. (The range is the smallest set that could be used as its codomain.)(The range is the smallest set that could be used as its codomain.)

15 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter15 Choosing the right (co)domain Consider the function f = λx.100/x Is f a (total) function from Int to R? f is a partial function from Int to Rf is a partial function from Int to R f is a (total) function from Int-{0} to Rf is a (total) function from Int-{0} to R Consider g = λx.x Is g a (total) function from R to R? g is a total function from R+ to RxR e.g. g(4)= (2,-2)

16 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter16 Images of Sets under Functions Given f:A B, and S A,Given f:A B, and S A, The image of S under f is the set of all images (under f) of the elements of S. f(S) : {f(s) | s S} : {b | s S: f(s)=b}.The image of S under f is the set of all images (under f) of the elements of S. f(S) : {f(s) | s S} : {b | s S: f(s)=b}. The range of f equals the image (under f) of...The range of f equals the image (under f) of...

17 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter17 Images of Sets under Functions Given f:A B, and S A,Given f:A B, and S A, The image of S under f is the set of all images (under f) of the elements of S. f(S) : {f(s) | s S} : {b | s S: f(s)=b}.The image of S under f is the set of all images (under f) of the elements of S. f(S) : {f(s) | s S} : {b | s S: f(s)=b}. The range of f equals the image (under f) of fs domain.The range of f equals the image (under f) of fs domain.

18 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter18 One-to-One Functions A function is one-to-one (1-1), or injective, or an injection, iff every element of its range has only 1 pre-image.A function is one-to-one (1-1), or injective, or an injection, iff every element of its range has only 1 pre-image. –Formally: given f:A B, f is injective : ( x,y: x y f(x) f(y)). In other words: only element of the domain is mapped to any given one element of the range.In other words: only one element of the domain is mapped to any given one element of the range. –In this case, domain & range have same cardinality. What about codomain?

19 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter19 Codomain may be larger.Codomain may be larger.

20 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter20 One-to-One Illustration Are these relations one-to-one functions?Are these relations one-to-one functions?

21 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter21 One-to-One Illustration Are these relations one-to-one functions?Are these relations one-to-one functions? One-to-one

22 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter22 One-to-One Illustration Are these relations one-to-one functions?Are these relations one-to-one functions? One-to-one Not one-to-one

23 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter23 One-to-One Illustration Are these relations one-to-one functions?Are these relations one-to-one functions? One-to-one Not one-to-one Not even a function!

24 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter24 Sufficient Conditions for 1-1ness For functions f over numbers, we say:For functions f over numbers, we say: –f is strictly increasing iff x>y f(x)>f(y) for all x,y in domain; –f is strictly decreasing iff x>y f(x) y f(x)

25 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter25 Onto (Surjective) Functions A function f:A B is onto or surjective or a surjection iff its range is equal to its codomain ( b B, a A: f(a)=b).A function f:A B is onto or surjective or a surjection iff its range is equal to its codomain ( b B, a A: f(a)=b). Consider country of birth of: A B, where A=people, B=countries. Is this a function? Is it an injection? Is it a surjection?Consider country of birth of: A B, where A=people, B=countries. Is this a function? Is it an injection? Is it a surjection?

26 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter26 Onto (Surjective) Functions A function f:A B is onto or surjective or a surjection iff its range is equal to its codomainA function f:A B is onto or surjective or a surjection iff its range is equal to its codomain Consider country of birth of: A B, where A=people, B=countries. Is this a function? Yes (always 1 c.o.b.) Is it an injection? No (many have same c.o.b.) Is it a surjection? Probably yes..Consider country of birth of: A B, where A=people, B=countries. Is this a function? Yes (always 1 c.o.b.) Is it an injection? No (many have same c.o.b.) Is it a surjection? Probably yes..

27 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter27 Onto (Surjective) Functions A function f:A B is onto or surjective or a surjection iff its range is equal to its codomainA function f:A B is onto or surjective or a surjection iff its range is equal to its codomain In predicate logic:In predicate logic:

28 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter28 Onto (Surjective) Functions A function f:A B is onto or surjective or a surjection iff its range is equal to its codomain.A function f:A B is onto or surjective or a surjection iff its range is equal to its codomain. In predicate logic:In predicate logic: b B a A f(a)=b b B a A f(a)=b

29 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter29 Onto (Surjective) Functions A function f:A B is onto or surjective or a surjection iff its range is equal to its codomain ( b B a A f(a)=b).A function f:A B is onto or surjective or a surjection iff its range is equal to its codomain ( b B a A f(a)=b). E.g., for domain & codomain Z, the function x.x+1 is injective and surjective.E.g., for domain & codomain Z, the function x.x+1 is injective and surjective.

30 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter30 Claim: if f:Z Z and f = x.x+1 then f is 1-to-1 and also onto. ( Z is the set of all integers) ( Z is the set of all integers) Proof that f is onto: Consider any arbitrary element a of Z. We have f(a-1)=a, where a Z.Proof that f is onto: Consider any arbitrary element a of Z. We have f(a-1)=a, where a Z. Proof that f is 1-to-1: Suppose f(u)=f(w)=a. In other words, u+1=a and w+1=a. It follows that u=a-1 and w=a-1, so u=w.Proof that f is 1-to-1: Suppose f(u)=f(w)=a. In other words, u+1=a and w+1=a. It follows that u=a-1 and w=a-1, so u=w.

31 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter31 Illustration of Onto Are these functions onto their depicted co- domains?Are these functions onto their depicted co- domains?

32 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter32 Illustration of Onto Are these functions onto?Are these functions onto?

33 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter33 Illustration of Onto Are these functions onto?Are these functions onto? onto not onto onto not onto

34 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter34 Illustration of Onto Are these functions 1-1?Are these functions 1-1? onto not onto onto not onto

35 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter35 Illustration of Onto Are these functions 1-1?Are these functions 1-1? not 1-1 onto not 1-1 not onto 1-1 onto 1-1 not onto

36 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter36 Bijections A function is said to be a one-to-one correspondence, or a bijection iff it is both one-to-one and onto.A function is said to be a one-to-one correspondence, or a bijection iff it is both one-to-one and onto.

37 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter37 Two terminologies for talking about functions 1.injection = one-to-one 2.surjection = onto 3.bijection = one-to-one correspondence 3 = 1&2

38 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter38 Bijections For bijections f:A B, there exists a function that is the inverse of f, written f 1 : B AFor bijections f:A B, there exists a function that is the inverse of f, written f 1 : B A Intuitively, this is the function that undoes everything that f doesIntuitively, this is the function that undoes everything that f does Formally, its the unique function such thatFormally, its the unique function such that......

39 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter39 Bijections For bijections f:A B, there exists an inverse of f, written f 1 : B AFor bijections f:A B, there exists an inverse of f, written f 1 : B A Intuitively, this is the function that undoes everything that f doesIntuitively, this is the function that undoes everything that f does Formally, its the unique function such thatFormally, its the unique function such that (the identity function on A)

40 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter40 Bijections Example 1: Let f: Z Z be defined as f(x)= x+1. What is f 1 ?Example 1: Let f: Z Z be defined as f(x)= x+1. What is f 1 ? Example 2: Let g: be defined as g(x)= |x|. What is g 1 ?Example 2: Let g: Z N be defined as g(x)= |x|. What is g 1 ?

41 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter41 Bijections Example 1: Let f: Z Z be defined as f(x)=x+1. What is f 1 ?Example 1: Let f: Z Z be defined as f(x)=x+1. What is f 1 ? f 1 is the function (lets call it h) h: Z Z defined as h(x)=x-1.f 1 is the function (lets call it h) h: Z Z defined as h(x)=x-1. Proof:Proof: h(f(x)) = (x+1)-1 = x

42 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter42 Bijections Example 2: Let g: be defined as g(x)=|x|. What is g 1 ?Example 2: Let g: Z N be defined as g(x)=|x|. What is g 1 ? This was a trick question: there is no such function, since g is not a bijection: There is no function h such that h(|x|)=x and h(|x|)= xThis was a trick question: there is no such function, since g is not a bijection: There is no function h such that h(|x|)=x and h(|x|)= x (NB There is a relation h for which this is true.)(NB There is a relation h for which this is true.)

43 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter43 The Diagonalisation Method Georg Cantor (1873): Can we compare the sizes of infinite sets?Georg Cantor (1873): Can we compare the sizes of infinite sets? Example: card( N ) = card({0 * 1 * })?Example: card( N ) = card({0 * 1 * })? –Both are infinite –But is one larger than the other? Cantors idea:Cantors idea: –The size (cardinality) of a set should not depend on the identity of its elements –Two finite sets A and B have the same size if we can pair the elements of A with elements of B –Formally: there exists a bijection between A and B

44 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter44 Correspondences (Contd) Example: LetExample: Let – N be the set of natural numbers {1, 2, 3, …} – E be the set of even natural numbers {2, 4, 6, …} Using Cantors definition of size, we can show that N and E have the same size:Using Cantors definition of size, we can show that N and E have the same size: –Bijection (!): f (n) = 2n Intuitively, E is smaller than N, butIntuitively, E is smaller than N, but –Pairing each element of N with its corresponding element in E is possible, –So we declare these two set to be the same size –This even though E N ( E is a real subset of N ) f (n)f (n)f (n)f (n)n ……

45 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter45 Countable sets A set X is finite if it has n elements, for some n in N.A set X is finite if it has n elements, for some n in N. A set is countable if eitherA set is countable if either –It is finite or –It has the same size as N, the natural numbers For example,For example, –N is countable, and so are all its subsets: –E is countable –{0,1,2,3} is countable – is countable How about supersets of N ?How about supersets of N ?

46 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter46 An Even Stranger Example… Let Q be the set of positive rational numbersLet Q be the set of positive rational numbers Q = { m/n | m,n N } Just like E, the set Q has the same size as N !Just like E, the set Q has the same size as N ! –We show this giving a bijection from Q to N –Q is thus countable One way is to enumerate (i.e., to list) Xs elements. For example, for X= Q :One way is to enumerate (i.e., to list) Xs elements. For example, for X= Q : 1.Pair the first element of X with 1 from N And so on, making sure every member of Q And so on, making sure every member of Q appears only once in the list appears only once in the list

47 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter47 An Even Stranger Example… (Contd) To build a list with the elements of QTo build a list with the elements of Q –make inf. matrix with all positive rational numbers –i -th row contains all numbers with numerator i –j -th column has all numbers with denominator j –i /j is in i -th row and j -th column 1/11/21/31/41/5 2/12/22/32/42/5 3/13/23/33/43/5 4/14/24/34/44/5 5/15/25/35/45/5...

48 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter48 An Even Stranger Example… (Contd) Now we turn the previous matrix into a listNow we turn the previous matrix into a list A bad way: begin list with first rowA bad way: begin list with first row –Since rows are infinite, we will never get to 2 nd row!

49 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter49 An Even Stranger Example… (Contd) Instead, we list the elements along diagonals:Instead, we list the elements along diagonals: 1/11/21/31/41/5 2/12/22/32/42/5 3/13/23/33/43/5 4/14/24/34/44/5 5/15/25/35/45/5... We should, however, eliminate repeated elements

50 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter50 An Even Stranger Example… (Contd) We list elements along diagonals w/o repetitions:We list elements along diagonals w/o repetitions: 1/11/21/31/41/5 2/1 2/2 2/3 2/4 3/13/2 3/3 4/1 4/2 5/1... 1/1, 2/1, 1/2, 3/1, 1/3, …

51 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter51 Uncountable sets Some sets have no correspondence with NSome sets have no correspondence with N These sets are simply too big!These sets are simply too big! –They are not countable: we say uncountable Theorem:Theorem: –The set of real numbers between 0 and 1 (e.g., 0.244, ) is uncountable Call this set R 0,1 (Some sets are even larger. Serious set theory is all about theorems that concern infinite sets. – Most of this is irrelevant for this course.) (Some sets are even larger. Serious set theory is all about theorems that concern infinite sets. – Most of this is irrelevant for this course.)

52 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter52 Finally: diagonalisation Theorem: | R 0,1 | > |N|. Proof strategy: | R 0,1 |>=|N|. Suppose | R 0,1 |=|N| and derive a contradiction: Each member of R 0,1 can be written as a zero followed by a dot and a countable sequence of digits. Suppose there existed a complete enumeration of R, (using whatever order).

53 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter53 Cantors diagonalisation trick: (starting from an arbitrary list) e e e e

54 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter54 Now construct a Real number n thats not in the enumeration: ns first digit (after the dot) = [e1s first digit] + 1 ns second digit = [e2s second digit] General: ns i-th difit = [e-is i-th digit] + 1 i: n differs from e-i in its i-th digit i: n differs from e-i in its i-th digit Contradiction: is not a (complete) enumeration after all. QED

55 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter55 Adaptation of Module #3: 2. Sets and the Russell Paradox Rosen 5 th ed., §1.6 especially ex. 30 on p. 86

56 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter56 Basic Set Notations Set enumeration {a, b, c}Set enumeration {a, b, c} and set-builder {x|P(x)}. and set-builder {x|P(x)}. relation, and the empty set. relation, and the empty set. Set relations =,,,,,, etc.Set relations =,,,,,, etc. Venn diagrams.Venn diagrams. Cardinality |S| and infinite sets N, Z, R.Cardinality |S| and infinite sets N, Z, R. Power sets P(S).Power sets P(S).

57 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter57 Axiomatic set theory Various axioms, e.g., saying that the union of two sets is also a setVarious axioms, e.g., saying that the union of two sets is also a set One key axiom: Given a Predicate P, construct a set. The set consists of all those elements x such that P(x) is true.One key axiom: Given a Predicate P, construct a set. The set consists of all those elements x such that P(x) is true. But, the resulting theory turns out to be logically inconsistent!But, the resulting theory turns out to be logically inconsistent! –This means, there exist set theory propositions p such that you can prove that both p and p follow logically from the axioms of the theory! – The conjunction of the axioms is a contradiction! –This theory is fundamentally uninteresting, because any possible statement in it can be (very trivially) proved by contradiction!

58 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter58 This version of Set Theory is inconsistent Russells paradox: Consider the set that corresponds with the predicate x x :Consider the set that corresponds with the predicate x x : S = {x | x x }. S = {x | x x }. Now ask: is S S?Now ask: is S S?

59 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter59 Russells paradox Let S = {x | x x }. Is S S?Let S = {x | x x }. Is S S? If S S, then S is one of those objects x for which x x. In other words, S S With Proof by Contradiction, we have S SIf S S, then S is one of those objects x for which x x. In other words, S S With Proof by Contradiction, we have S S If S S, then S is not one of those objects x for which x x. In other words, S S With Proof by Contradiction, we have S SIf S S, then S is not one of those objects x for which x x. In other words, S S With Proof by Contradiction, we have S S We conclude that both S S nor S SWe conclude that both S S nor S S Paradox!Paradox!

60 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter60 To avoid inconsistency, set theory must somehow changeTo avoid inconsistency, set theory must somehow change Bertrand Russell

61 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter61 One technique to avoid the problem: Given a set S and a predicate P, construct a new set, consisting of those elements x of S such that P(x) is true.Given a set S and a predicate P, construct a new set, consisting of those elements x of S such that P(x) is true. Youve seen this technique in use: Haskells list comprehensions allow us to write [x | x [1..], even x], but not simply [x | even x],Youve seen this technique in use: Haskells list comprehensions allow us to write [x | x [1..], even x], but not simply [x | even x],

62 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter62 Another technique to avoid the problem: Russells paradox arises from the fact that we can write x x (or x x, for that matter). Forbid such expressions using types.Russells paradox arises from the fact that we can write x x (or x x, for that matter). Forbid such expressions using types. Youve seen this technique in use: Haskells use of typing. Applied to the present case: give a type that forbids it from relating two things of the same type.Youve seen this technique in use: Haskells use of typing. Applied to the present case: give a type that forbids it from relating two things of the same type.

63 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter63 Our focus: computability We shall not worry about saving set theory from paradoxes like RussellsWe shall not worry about saving set theory from paradoxes like Russells Instead, we shall use the Russell paradox in a different settingInstead, we shall use the Russell paradox in a different setting Before we do this, we need to talk about computability and Turing Machines.Before we do this, we need to talk about computability and Turing Machines.

64 Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter64


Download ppt "Module #4 - Functions 4/6/2014Michael P. Frank / Kees van Deemter1 Lecture adapted from CS3511, Discrete Methods Kees van Deemter Slides originally adapted."

Similar presentations


Ads by Google