Lecture 04: SETS AND FUNCTIONS 1.6, 1.7, 1.8 - PowerPoint PPT Presentation

1 / 47
About This Presentation
Title:

Lecture 04: SETS AND FUNCTIONS 1.6, 1.7, 1.8

Description:

Lecture 04: SETS AND FUNCTIONS 1.6, 1.7, 1.8 – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 48
Provided by: georgeb
Category:
Tags: and | functions | sets | lecture

less

Transcript and Presenter's Notes

Title: Lecture 04: SETS AND FUNCTIONS 1.6, 1.7, 1.8


1
Lecture 04 SETS AND FUNCTIONS1.6, 1.7, 1.8
CS1050 Understanding and Constructing Proofs
Spring 2006
  • Jarek Rossignac

2
Lecture Objectives
  • Sets, specification, notation, construction
  • Power sets, ordered pairs, relations
  • Operations on sets and pointsets
  • Functions and composition

3
What is a set?
  • Unordered collection of elements (members)
  • A set contains its members
  • We may define a set by listing its elements
  • S a,b,c
  • S1,2,3
  • or by a property (set builder notation)
  • S a a?Z ? (?k?Z a2k1)
  • S x x is a positive integer less than 200
    and divisible by 3

4
What are the important sets of numbers?
  • R real numbers
  • Q p/q p?Z, q?Z, q?0
  • Z 1, 0, 1, . integers
  • N 0,1,2. natural numbers
  • Z 1,2,3 . positive integers

5
When are two sets equal?
  • When they have the same elements
  • a,b,c a,c,b a,b,c,b,b

6
What is a Venn diagram?
  • Graphic depiction of (topological) set
    relationship

Z
N
0
Z
Q
R
7
What operators/notation are used for sets?
  • Sets in upper case. Elements in lower case.
  • s?S s is an element of S. s?S s is not in S
  • S number of elements (cardinality) of a finite
    set S
  • ST S equals T (equality)
  • ?S elements not in S (complement)
  • S?T elements in S and T (intersection)
  • S?T elements in S or T (union)
  • ST S??T, elements of S that are not in T
    (difference)
  • S?T S?T S?T (symmetric difference)
  • S ? T S included in or equal to T (inclusion)
  • S ? T S included in (but not equal to) T ( proper
    inclusion)
  • ? empty (i.e. null) set, also denoted .
    Different from ?

8
What are the subsets of a set S?
  • All sets whose elements are all in S
  • This always includes
  • The empty set, ?, since ? ? S
  • The whole set, S , since S ? S

9
What is the power set of set S?
  • The power set P(S) of set S is the set of all
    subsets of S.
  • P(a,b) ?, a,b,a,b

10
What is the power set of ??
  • P(?) ?
  • Remember that ? is a set, not an element

11
What is the power set of ??
  • P(?) ?, ?
  • Remember that ? has one element, which is a set
  • Hence its power set will contain two elements
  • the empty set ?
  • the set itself ?

12
What is an ordered n-tuple?
  • The ordered n-tuple (a,b,c) is the ordered list
    of elements
  • a, b, c
  • Two n-tuples are equal , (a,b,c) (d,e,f) ,
  • when corresponding elements are equal, (ad, be,
    cf).

13
What is an ordered pair?
  • An n-tuple of two elements
  • For example,
  • The (x,y) coordinates of a point in the plane
  • The vertices (a,b) of an oriented edge or link in
    the graph

14
What is the Cartesian product of two sets?
  • A ? B (a,b) a?A, b?B
  • set of ordered pairs (a,b) such that a is an
    element of A and b is an element of B
  • a,b ? c,d (a,c), (a,d), (b,c), (b,d)
  • Note that in general, A ? B ?B ? A

15
How to use quantifiers with sets?
  • ?s?S means for all s in S
  • ?s?S means there exists an element s in S
  • ?!s?S means there exists a single element s in S

16
What are unions and intersections of sets?
  • Union S?T u u?S ? u?T
  • Intersection S?T u u?S ? u?T

17
What are the differences of sets?
  • Complement ?S u u?S, also denoted !S
  • Implicitly defined in a universal set U as ?S
    US
  • Difference ST S??T u u?S ? u?T
  • Symmetric difference S?T (ST) ? (TS)

18
Individual exercise
  • Prove that (S?T) (S?T) (ST) ? (TS)

19
When are two sets disjoint?
  • When their intersection is empty S?T ?
  • We often have to prove that two or more sets are
    pairwise disjoint
  • Often it is necessary to test whether two sets
    are disjoint
  • Components of a car engine do not interfere
  • Objects do not collide in an animation

20
What is S?T ?
  • The cardinality, S?T, is the number of elements
    of the union, S?T, of the two finite sets S and
    T.
  • S?T S T S?T
  • we need to subtract elements of S?T, since they
    were counted both in S and in T.

21
Identities of Boolean operators
  • Identity A?UA, A?UA
  • Idempotence A?AA, A?AA
  • Domination A?UU, A???
  • Complement A??A U, A??A?
  • Commutativity A?BB?A, A?BB?A,
  • Associativity A?(B?C)(A?B)?C, A?(B?C)(A?B)?C
  • Distributivity A?(B?C)(A?B)?(B?C),
    A?(B?C)(A?B)?(B?C)
  • !S denotes ?S Sand has higher priority than ? , ?
    , and
  • Complementation !(!A)A
  • de Morgan !(A?B) !A?!B , !(A?B) !A?!B
  • Absorption A?(A?B)A, A?(A?B)A

22
Relation between sets and Booleans?
  • Define the propositions A(u)(u?A) and
    B(u)(u?B).
  • Then
  • A?B u ? U A(u)?B(u)
  • A?B u ? U A(u)?B(u)
  • !A u ? U A(u)
  • Hence, there is a correspondence between
  • ? and ? (AND, )
  • ? and ? (OR, )
  • ! and (AND NOT, !)
  • ? and F (false)
  • U and T (true)
  • Translate the previous identities into logic

23
Prove !(A?B) !A?!B using inclusion
  • Hint To prove that S T, prove that (S?T) ?
    (T?S)
  • To prove that !(A?B) ? !A ? !B
  • assume that for some arbitrary x, x ? !(A?B)
  • hence (x?A ? x?B)
  • hence x?A ? x?B
  • hence x?!A ? x?!B
  • it follows that x ? (!A ? !B)
  • Since our choice of x?!(A?B) was arbitrary,
    ?x?!(A?B) x?(!A ? !B)
  • Hence!(A?B) ? !A ? !B
  • To prove that !A ? !B ? !(A?B)
  • prove that it follows that x ? !(A?B)

24
Prove !(A?B) !A?!B using builder
  • This time we use the set builder notation
  • !(A?B) x x ? A?B
  • x (x ? A?B)
  • x ((x ? A) ? (x ? B))
  • x (x ? A) ? (x ? B)) de Morgan
  • x x ? !A ? x ? !B
  • x x ? (!A?!B)

25
Prove A?(B?C)(A?B)?(A?C) using cells
  • Test one element in each cell against both
    expressions

A
B
C
26
Exercise
  • Provide a concise Boolean expression for the set
    marked by the green cells

A
B
C
27
Prove !(A?B) !A?!B using a truth table
  • Test all combinations

28
How to represent finite sets?
  • Consider a finite domain Ua,b,c,d. where
    Ult220
  • We can represent any subset of U by listing its
    elements.
  • But working on such a representation may be
    expensive.
  • A more efficient representation may be derived
    if we assume an ordering of the elements.
  • For example the n-tuple (a,b,c,d)
  • Represent a subset S of U by a classification
    vector (bit string)
  • V(S) 0110 which indicates that
  • a?S, b?S, c?S, d?S

29
How to perform Boolean operations on sets?
  • Consider 2D arrays Aij and Bij of bits
    representing digitized versions of 2D sets A and
    B
  • (Pixel(i,j)?A) ? (Aij 1) red if 1, green
    if 0
  • (Pixel(i,j)?B) ? (Bij 1)
  • How to represent and compute A?B?

30
How to deal with continuous pointsets?
  • Use a constructive model SA?(B?C)
  • Provide point/primitive classification methods
  • A.isIn(x,y) returns true if point(x,y) ? A
  • For example, if A is rect(lx,ly,hx,hy), then
  • A.isIn(x, y) return((lxltx)(xlthx)
    (lylty)(ylthy))
  • Provide Boolean classification methods
  • U.isIn(L,R) combines truth values L and R
  • For example, if U is a union operator, then
  • U.isIn(L,R) return ( L R )

31
What is Constructive Solid Geometry?
  • A CSG model is a binary tree representing a 3D
    shape
  • Leaves represent solid primitives (blocks,
    spheres, bunnies)
  • Nodes represent Boolean operators (?, ?, )

32
What is a relation from set A to set B?
  • It is a subset of A ? B
  • Think of it as links from elements of A to
    elements of B
  • A relation assigns to each set of A zero or more
    elements of B

33
What is a function from A to B
  • A relation assigning exactly one element of B to
    each element of A.
  • Note that it may assign the same element b?B to
    two different elements of A.
  • We write it f A ? B (here ? is not an
    implication)
  • ?a?A ?b?B bf(a)
  • A is the domain of f

A
B
34
What is the image of S by f?
  • b?B is the image of all elements a?A for which
    bf(a)
  • The image f(S) of a subset S of A is the set of
    the images of elements of S.

S
A
B
35
What is the range of a function?
  • The image of A.
  • (The set of images of elements of A).

A
B
36
When is a function injective?
  • f is injective (one-to-one) when f(x)f(y) ?
    xy

Not injective
Injective
A
A
B
B
37
When is a function surjective?
  • f is surjective (onto) when ?b?B ?a?A f(a)b

Not surjective
Surjective
A
A
B
B
38
When is a function bijective?
  • f is bijective when it is both injective and
    surjective
  • (one-to-one and onto)
  • one-to-one correspondence
  • ?b?B ?!a?A f(a)b

Not bijective
Bijective
A
A
B
B
39
What is the inverse of a function?
  • The inverse is only defined for bijective
    functions
  • The inverse f1 of f maps each b?B to a?A where
    bf(a)
  • f1(b)a ? bf(a)

f
f1
A
A
B
B
40
What is the composition of two functions?
  • Let f A ? B and g B ? C
  • The composition f?g A ? C of f and g is defined
    as
  • f?g(a) f(g(a))

41
Application to computer graphics
  • Translation
  • Rotation
  • Composition
  • Do rotations and translations commute?

T(2,1)
R(30)
T(2,1)?R(30)
42
What is the graph of a function?
  • Set of ordered pairs (a,b) a?A, b?B, bf(a)
  • Sometimes we can plot it
  • Here f maps points (x,y) on the plane into height

f(x,y) x22y41
43
What are floor and ceiling?
  • The floor ?x? of x is the larges integer not
    exceeding to x
  • The ceiling ?x? is the smallest integer x
  • Properties
  • x1lt ?x? x ?x? lt x1
  • ?x??x?, ?x? ?x?
  • ?xn??x?n, ?xn? ?x?n
  • Compute ?0.5? and ?0.5?
  • How many bytes (8-bit strings) do you need to
    encode 100 bits?
  • Prove or disprove ?xy? ?x? ?y?

44
Quick test
  • Let A and B be two sets
  • What is the symmetric difference of A and B?
  • When are A and B disjoint?
  • How would you prove that AB?
  • What is the cardinality of A?B?
  • What is Constructive Solid Geometry
  • Let f be a function from A to B
  • What property does f have?
  • What is the image of a subset S of A by f?
  • When is f injective?
  • When is the inverse of f defined?
  • What is the floor of 3.2?

45
Assigned Reading
  • Sections 1.6, 1.7, 1.8

46
Assigned Exercises (for quiz)
  • 1.6 p 85
  • 18
  • 1.7 p 95
  • 11, 15, 16, 21, 27, 28, 29, 30, 31, 32 ,33
  • 1.8 p 109-110
  • 28, 32, 35.b), 38, 40

47
Assigned Project
  • P1 is due Tu Jan 24 (on your PPP)
  • Email TA only if
  • you did not submit P0.
  • you plan to have a late submission.
  • you changed your PPP url.
Write a Comment
User Comments (0)
About PowerShow.com