Intro to Maths for CS: 2013/14 Sets (2) – OPTIONAL MATERIAL John Barnden Professor of Artificial Intelligence School of Computer Science University of.

Slides:



Advertisements
Similar presentations
(BY MISS.MANITA MODPHAI)
Advertisements

COUNTING AND PROBABILITY
Week 7 - Wednesday.  What did we talk about last time?  Set proofs and disproofs  Russell’s paradox.
Fundamentals/ICY: Databases 2013/14 Week 6: Monday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
1 Diagonalization Fact: Many books exist. Fact: Some books contain the titles of other books within them. Fact: Some books contain their own titles within.
Great Theoretical Ideas in Computer Science.
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
CHAPTER 4 Decidability Contents Decidable Languages
Chapter 2 The Basic Concepts of Set Theory
Pigeonhole.
Sequence A list of objects arranged in a particular order.
A Very Practical Series 1 What if we also save a fixed amount (d) every year?
Cardinality of a Set “The number of elements in a set.” Let A be a set. a.If A =  (the empty set), then the cardinality of A is 0. b. If A has exactly.
2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/L5- CountingAndEnumeration.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul.
Cantor’s Legacy: Infinity And Diagonalization Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 25Apr 13, 2004Carnegie.
Fundamentals/ICY: Databases 2012/13 WEEK 11 (relational operators & relational algebra) John Barnden Professor of Artificial Intelligence School of Computer.
Convert Decimals to Fractions
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
THE NATURE OF SETS Copyright © Cengage Learning. All rights reserved. 2.
CS355 - Theory of Computation Lecture 2: Mathematical Preliminaries.
Copyright © Cengage Learning. All rights reserved. 0 Precalculus Review.
Real Numbers Week 1 Topic 1.
Relation, function 1 Mathematical logic Lesson 5 Relations, mappings, countable and uncountable sets.
Advanced Math Chapter P
Fundamentals/ICY: Databases 2012/13 WEEK 7 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
Relations And Functions. A relation from non empty set A to a non empty set B is a subset of cartesian product of A x B. This is a relation The domain.
1 Lecture 3 (part 3) Functions – Cardinality Reading: Epp Chp 7.6.
Intro to Maths for CS: 2012/13 Sets (week 1 part) John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Fundamentals/ICY: Databases 2012/13 WEEK 10 (maths, normalization) John Barnden Professor of Artificial Intelligence School of Computer Science University.
Copyright © Cengage Learning. All rights reserved. CHAPTER 7 FUNCTIONS.
Fundamentals/ICY: Databases 2012/13 WEEK 11 – 4 th Normal Form (optional material) John Barnden Professor of Artificial Intelligence School of Computer.
Ch. 11: Cantor’s Infinity!. N = {1, 2, 3, 4, 5, 6, …} “the natural numbers” Z = {…, –3, –2, –1, 0, 1, 2, 3, …} “the integers” Q = {all quotients “a/b”
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Mathematical Induction
REAL Numbers Rational #’s Irrational #’s Whole #’s 0, 1, 2, 3 … Integers: …-2, -1, 0, 1, 2 … Rational #’s ( ) (1/2, 2/3, 5/1, 0.5, 0.666…, 5) e …
Copyright © 2014 Curt Hill Cardinality of Infinite Sets There be monsters here! At least serious weirdness!
Fundamentals/ICY: Databases 2013/14 WEEK 9 –Monday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
CS201: Data Structures and Discrete Mathematics I
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
COMPSCI 102 Introduction to Discrete Mathematics.
Aim: How can the word ‘infinite’ define a collection of elements?
INFIINITE SETS CSC 172 SPRING 2002 LECTURE 23. Cardinality and Counting The cardinality of a set is the number of elements in the set Two sets are equipotent.
Relations And Functions. A relation is a set of ordered pairs {(2,3), (-1,5), (4,-2), (9,9), (0,-6)} This is a relation The domain is the set of all x.
Fundamentals/ICY: Databases 2013/14 WEEK 9 –Friday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Cardinality with Applications to Computability Lecture 33 Section 7.5 Wed, Apr 12, 2006.
(CSC 102) Lecture 13 Discrete Structures. Previous Lectures Summary  Direct Proof  Indirect Proof  Proof by Contradiction  Proof by Contra positive.
I dare you not to get excited when you read Cantor’s Diagonal Proof: Georg Cantor was the most important mathematician no one has ever heard of. He did.
Great Theoretical Ideas in Computer Science.
Adding and Subtracting Decimals © Math As A Second Language All Rights Reserved next #8 Taking the Fear out of Math 8.25 – 3.5.
CompSci 102 Discrete Math for Computer Science February 7, 2012 Prof. Rodger Slides modified from Rosen.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
Intro to Maths for CS: 2012/13 Sets (end, week 3) John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Section 3.2: Sequences and Summations. Def: A sequence is a function from a subset of the set of integers (usually the set of natural numbers) to a set.
CS 285- Discrete Mathematics
Fundamentals/ICY: Databases 2013/14 Week 11 – Monday – relations, ended. John Barnden Professor of Artificial Intelligence School of Computer Science University.
To Infinity And Beyond! CS Lecture 11 The Ideal Computer: no bound on amount of memory Whenever you run out of memory, the computer contacts the.
Week 7 - Wednesday.  What did we talk about last time?  Proving the subset relationship  Proving set equality  Set counterexamples  Laws of set algebra.
Section 2.5. Cardinality Definition: A set that is either finite or has the same cardinality as the set of positive integers (Z + ) is called countable.
Great Theoretical Ideas In Computer Science
Discrete Mathematics CS 2610
Intro to Maths for CS: 2012/13 Sets (contd, week 2)
Number Systems INTRODUCTION.
Lesson 5 Relations, mappings, countable and uncountable sets
Module #4.5, Topic #∞: Cardinality & Infinite Sets
Discrete Mathematics and its Applications
Lesson 5 Relations, mappings, countable and uncountable sets
Module #4.5, Topic #∞: Cardinality & Infinite Sets
John Barnden Professor of Artificial Intelligence
Everything is an Integer Countable and Uncountable Sets
Presentation transcript:

Intro to Maths for CS: 2013/14 Sets (2) – OPTIONAL MATERIAL John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK

“Tuples” uA “tuple” is an ordered sequence of items of any sort. We will only deal with finite tuples. Items CAN be duplicated. l Can also be called a “vector.” uNotation:  6, JAB, 5, “JAB”, 5, , 9> Or: ( 6, JAB, 5, “JAB”, 5, , 9) uSingleton and empty tuples:, <> u,, and are all different.

Ordered Pairs uWe considered ordered pairs of numbers, when discussing graphs. uAn ordered pair is simply a tuple of length two:  6, JAB >  “JAB”,  >  - 6, -6 >  5, -6 >  ,  >

“Cartesian Products” and “Relations” uThe set of all possible tuples formed from some sets is called the Cartesian product of the sets. Notation, e.g.: D  E  F  G  H if D, E, F, G, H are the sets—not necessarily different.  Each tuple is of form where d  D, e  E, etc. uAny subset at all of that Cartesian product is called a relation on the sets in question (D, E, …) l even the whole of the product (even if infinite) l and even the empty set. uI.e., a relation on D, E, …, H is just some set of tuples that are each of form where d  D, e  E, …, h  H.

Examples uLet A = {3, 8, 2} and B = {‘jjj’, ‘bb’}. Then A  B = {,,,,, }. B  B = {,,, }.  A   =  =   A A  {JAB} = {,, } uSome relations on A and B: l {,, } l { }  l A  B l 

Changing the Sets in a Relation Around uA relation R on A, B, C, D, E, say, obviously “induces” (i.e., gives rise to, in a natural way) a relation on any reordering of the sets, such as D, A, B, E, C, just by reordering each tuple in the same way. uWhen there are just two sets A and B, the (only possible) reordering of the sets gives the inverse of R.

Inverse Example u Suppose R = {,, } uThen the inverse of R, notated - R -1 is the relation {,, }

Functional Relations (Partial Functions) uA relation R from A to B is functional if, for any a in A, there is AT MOST one (but perhaps no) b in B such that  a, b> is in R. uSo several things in A can be related to the same thing in B. uBut you can’t have several things in B related to the same thing in A. uA functional relation from A to B is also called a partial function from A to B.

Examples uA = {3, 8, 2, 100}, B = {‘jjj’, ‘bb’, ‘c’, ‘x’, ‘y’}. R = {,,,, } NOT functional, because 3 maps to both ‘jjj’ and ‘bb’, and … uR = {,, } IS functional (NB: 8 doesn’t map to anything, and both 3 and 2 map to ‘jjj’)

Totality of Relations uA relation R from A to B is total (on A) if it relates everything in A to AT LEAST one thing in B.  > l I.e., for every member a of A, there is at least one b in B such that  a, b > is in R. uA relation may be merely partial (on A above) in not being total. However, technically all relations are “partial”, with total being a special case.

Examples uA = {3, 8, 2, 100}, B = {‘jjj’, ‘bb’, ‘c’, ‘x’, ‘y’}. R = {,,,, } IS total (NB: 3 maps to more than one thing) uR = {,, } NOT total, because 8 fails to map to anything.

Functions uA total functional relation from A to B is called a function from A to B. Each thing in A is related to exactly one thing in B. (But two different things in A can be related to the same thing in B, and not everything in B needs to be related to anything in A. So the inverse relation is not necessarily either functional or total.) uCaution: every function is also a partial function.

Examples uA = {3, 8, 2, 100}, B = {‘jjj’, ‘bb’, ‘c’, ‘x’, ‘y’}. R = {,,,, } NOT a function, because 3 maps to more than one thing uR = {,, } NOT a function, because 8 fails to map to anything. uR = {,,, } IS a function.

Other Categories of Relation uA relation R from A to B is one-to-one (1-1) if, for any a in A, there is at most one b in B such that  a, b> is in R, AND for any b in B, there is at most one a in A such that  a, b> is in R. l That is, both the relation and its inverse from B to A are functional. (But they don’t need to be total.) l To put it another way: it is functional and different members of A map to (= are related to) different members of B. l Or again: Different members of A map to different members of B and different members of B map to different members of A.

Example uA = {3, 8, 2, 100}, B = {‘jjj’, ‘bb’, ‘c’, ‘x’, ‘y’}. R = {,, } IS 1-1

Other categories, contd. uA one-to-one correspondence between a set A and B is a SPECIAL one-to-one relation from A to B (or B to A): u it is not only one-to-one but also TOTAL (on A) and ONTO (B). (Or we can say: total on both A and B.)

Example uA = {3, 8, 2, 100}, B = {‘jjj’, ‘bb’, ‘c’, ‘y’}. R = {,, } NOT a 1-1 correspondence between A and B, even though it is 1-1, as 2 is left out from A, and ‘bb’ is left out from B. uR = {,,, } IS a 1-1 correspondence between A and B

Other categories, contd. uBut any 1-1 relation from A to B is a 1-1 correspondence between the subsets of A, B consisting of those members that do happen to feature in the relation!

Countable and Uncountable Sets [Brief Intro; Optional Material] countable one-to-one correspondence uA set X is countable if it can be placed in a one-to-one correspondence with some subset of N, the set of natural numbers from 1. uTrivial case: X = N { | x  X}. Let R be the relation { | x  X}. This is the identity relation on X. Then R is a 1-1 correspondence between X and X.

Countable Sets, contd 1 uSimilarly for any proper subset X of N: just use the identity relation on X again. uMore interesting case: X = the set of all whole numbers (negative, positive and zero). Let R be the relation { | x  X, x  0}  { | x  X, x | x  X, x  0}  { | x  X, x < 0 } So R = {(0,0), (-1,1), (1,2), (-2,3), (2,4), (-3,5), (3,6), …} Then R is a 1-1 correspondence between X and N.

Countable Sets, contd 2 uYet more interesting case: X = the set of positive rational numbers. Can get our relation R by putting the possible fractions (with positive whole number parts) in a square infinite table with numerators increasing horizontally and denominators increasing vertically: 1/1 2/1 3/1 4/1 5/1 6/1 … 1/2 2/2 3/2 4/2 5/2 6/2 … 1/3 2/3 3/3 4/3 5/3 6/3 … 1/4 2/4 2/5 2/6 : : … : : : : : : … Then traverse through the numbers in sequence by going up and down diagonals, with steps on edges as necessary, and missing out fractions that are not in simplest form (missed out ones are shown in brackets): 1/1, 2/1, 1/2, 1/3, (2/2), 3/1, 4/1, 3/2, 2/3, 1/4, 1/5, (2,4), (3,3), (4,2), 5/1, … Count as:

Uncountable Sets uAll finite sets are countable. And they needn’t be sets of numbers! The set of socks in this class is countable. uWe have seen that some infinite ones are countable … uEven if the set X contains the natural numbers as a tiny proper subset!! E.g., X = the set of rational numbers. uBut some infinite sets are not countable: notably the set of real numbers (rational and irrational numbers together), or even the set of real numbers between 0 and 1. Can be shown by a an incredibly interesting and deep “diagonalization” argument based on the decimal representations of the numbers (see next slide)…

Uncountable Sets: The Real Numbers uConsider the set of real numbers strictly between 0 and 1, and represent them as decimals …  … in a canonical form – i.e. don’t allow them to end with 9 recurring (e.g., use not ….), and fill out terminating decimals with an ninfifnte sequence of zeroes at the and (so actually use …..) (D) uCan show that: (D) different numbers always then have different decimal representations. uNow, suppose you could enumerate the above real numbers in some order, i.e. put them into 1-1 correspondence with natural numbers, e.g. (next slide). We will derive a contradiction.

The Real Numbers, contd  Here’s how the enumeration might look:  No.1: …  No.2: ….  No.3: …..  No.4: …. uNow form a decimal number by where the nth digit is the nth digit of the nth decimal above: … uNow replace each digit in that decimal by a different digit other than 9 (doesn’t matter which), e.g. to get … (D) uThis decimal is therefore different from any in the enumeration above, because it always differs from the nth decimal in at least one digit, namely the nth. And therefore by (D) above it represents a real number between 0 and 1 not counted in the enumeration!!!!! We have our contradiction.

Diagonalization, contd  For deep reasons, diagonalization arguments crop up all over the place in maths and logic and especially in their application to CS.  A relatively general formulation is that when you have an function of two arguments, f(n,m), you can force both arguments to be the same, to get a new function g(n) = f(n,n). Function g is the diagonalization of f.  Why? – Just imagine setting out the values of f(n,m) in a square array. Then g(n)’s values will be on the diagonal.  In our case f(n,m) gives the nth digit of the mth decimal (in the supposed enumeration of decimals). So the values of g(n) for n=1 upwards give us a new decimal number which causes trouble.  Diagonalization is often used in other, completely different, contexts to create entities that cause trouble, typically by not being able to be accounted for in some way.