Presentation is loading. Please wait.

Presentation is loading. Please wait.

SETS, RELATIONS, FUNCTIONS

Similar presentations


Presentation on theme: "SETS, RELATIONS, FUNCTIONS"— Presentation transcript:

1 SETS, RELATIONS, FUNCTIONS
Dr Alexander Bolotov – Principal Lecturer, Course Leader for BSc, BEng/MEng Software Engineering, BSc Artificial Intelligence Room N7.120

2 Why is Set Theory important for Computer Science?
Set Theory is an important language and tool for reasoning, It's a basis for Mathematics| Set Theory is a useful tool for reasoning about computation and the objects of computation. It is a source of fundamental ideas in Computer Science from theory to practice; and likely to stay for long time. Computer Science, had many of its constructs and ideas inspired by Set Theory. Start with Object orientation, where the concepts of CLASS, INHERITANCE reflect sets and set-theoretical operations! Finally, a knowledge of Set Theory should facilitate your ability to think abstractly. It will provide you with a foundation on which to build a firm understanding and analysis of the new ideas in Computer Science that you will meet.

3 A set is a collection of objects (of any nature!)
What is a set? A set is a collection of objects (of any nature!) Names of the objects are written inside curly braces separated by commas Some examples of sets include: {☼, 5, ♣} {1, 2, 3, 5, 7} {computer system fundamentals, mathematics for computing, …} {a,b,c,d,e,f,g,h,I,j,k,l,m,o,p,q,r,s,t,u,v,w,x,y,z} {Finland, Norway, Sweden, Denmark}

4 Some well known and named sets
“N” is the natural numbers {0, 1, 2, 3, 4, 5, …} “Z” is the set of integers {…-2,-1,0,1,2,…} “Q” is the set of rational numbers (any number that can be written as a fraction “R” is the set of real numbers (all the numbers/fractions/decimals that you can imagine

5 Notation You don’t list anything more than once
The order of objects doesn’t matter 5

6 Both of these would be considered identical sets since they have all the same elements and only the order is different. and {☼, 5, ♣} and {5,♣, ☼} 6

7 More notation:  and  ☼  {☼, 5, ♣} means: “☼ is an element of {☼, 5, ♣}” 6  {☼, 5, ♣} means: “6 is not an element of {☼, 5, ♣}” {☼, 5}  {☼, 5, ♣} means: “{☼,5} is a subset of {☼, 5, ♣}”

8 Formal Definitions Definition [proper subset]: A set A is a proper subset of a set B (abbreviated as A  B) if the following conditions hold Every element of A is an element of B B has at least one element x which is not an element of A (abbreviated as A  B) Examples: {1,2,3}  {1,2,3,4} as both conditions above hold {☼, 5}  {☼, 5, ♣} means: “{☼,5} is a subset of {☼, 5, ♣}”

9 Formal Definitions Definition [equal sets]: A set A is equivalent to a set B (abbreviated as A  B) if the following conditions hold 1) Every element of A is an element of B 2) Every element of B is an element of A Examples: {1,2,3}  {1,2,3} as both conditions above hold {♣ ,☼, 5}  {☼, 5, ♣}

10 Formal Definitions Definition [weak subset]:
A is a weak subset of B (abbreviated A  B) if A  B or A  B This is analogous to the relations “less” and “less or equal” Examples: {1,2}  {1,2,3} as one of the conditions above holds, i.e. {1,2}  {1,2,3} {♣ ,☼, 5}  {☼, 5, ♣} as one of the conditions above holds, i.e. {♣ ,☼, 5}  {☼, 5, ♣}

11 EMPTY AND UNIVERSAL SETS
When we speak about sets we can collect objects of any nature. However, to be sensible we do want to collect objects that have something in common: could be some common properties or some relations. This “something in common” allows us to make useful abstractions. Examples: a set of people (people are animals but have some common features, i.e. social for example)

12 EMPTY AND UNIVERSAL SETS
Thus, we introduce a so called universal set, abbreviated as U. Universal set collects any object of any set which we are considering. It gives us a reference to the nature of objects under considerations. It “sets up” the scenario, if you want. FACT: for every set A, for every element x  A the following holds: x  U

13 EXAMPLE PROOF Prove the following proposition:
Proposition: for every set A, the following holds: A  U Proof: Given a universal set U, use the following FACT: “for every set A, for every element x  A the following holds: x  U” Therefore, for every set A, if x  A then x  U EndProof

14 EMPTY AND UNIVERSAL SETS
Consider a set of round squares. It looks like there are no objects in this set? Such a set is called the empty set abbreviated as or FACT: for every set A the following holds: {}  A

15 EXAMPLE PROOF Prove the following proposition:
Proposition: for every set A, the following holds: {}  A Proof: We will prove this by refutation: assume the contrary, i.e. that Given an arbitrary set we have {}  A i.e that {} is not a subset of A. Therefore, there exists (at least one) element x of {}, such that f x  A. This clearly contradicts the statement that {} has no elements. So our assumption that {}  A was wrong. We conclude then that EndProof

16 Proof by Contradiction (reductio ad absurdum)
We need to prove some statement A from some conditions Cond Instead of proving it directly we can assume the contrary, not-A Now we are trying to reason and derive a contradiction from this assumption. If we have derived a contradiction from not-A it means that our assumption was wrong So we conclude not-not-A, or simply A

17 Set Operations Union A B Create a new set by combining
all of the elements of two sets A B U

18 Union Examples

19 Intersection Create a new set, C, using the elements the two sets have in common A B C U

20 Intersection Examples

21 Difference Create a new set, C, by taking all of the elements of the first set (A) and removing from it all of the elements in the second set (B) B A C U A

22 Difference Examples

23 U A’ A Complementation Given the universal set U, and a set A,
a complementation of A denoted as A’ is the set of all those objects of the universal set that are not elements of A. U A’ A 23

24 LAWS of SET ALGEBRA Commutative Laws Distributivity Laws Other Laws

25 Power Set or Definition: A Power set is a set that consists of all of the subsets of the set A

26 Power Set Examples

27 Cartesian Product Creates a new set from sets A, B and C, which consists of ordered tuples of elements (one from each set) in all possible combinations.

28 What is a coordinate pair
Tuples are written in the form <x, y> or <x,y,z> depending on the number of sets in the Cartesian product Definition: A Cartesian Product of sets A1 x A2 x …. X An {x,y,…,z|xA1, yA2, … zAn}

29 Cartesian Product Examples


Download ppt "SETS, RELATIONS, FUNCTIONS"

Similar presentations


Ads by Google