Presentation is loading. Please wait.

Presentation is loading. Please wait.

COT 3100, Spring 2001 Applications of Discrete Structures

Similar presentations


Presentation on theme: "COT 3100, Spring 2001 Applications of Discrete Structures"— Presentation transcript:

1 COT 3100, Spring 2001 Applications of Discrete Structures
Section #1089X - MWF 4th period Dr. Michael P. Frank Lecture #10 Wed., Jan. 31, 2001 1/31/01 Lecture #10

2 Administrivia 1st exam: Wed., Feb. 28 (week before break)
Evening exam. Periods E2-E3 (8:20pm-10:10pm). Location TBA. Remember, HW#3 pm tomorrow. Today’s lecture: Polish off §1.5, Set Operations Blaze through §1.6, Functions. 1/31/01 Lecture #10

3 Review of §1.4-1.5 Sets S, T, U… Special sets N, Z, R.
Set notations {a,b,...}, {x|P(x)}… Relations xS, ST, ST, S=T, ST, ST. Operations |S|, P(S), , , , , Set equality proof techniques: Mutual subsets. Derivation using logical equivalences. 1/31/01 Lecture #10

4 Proving Set Identities
To prove statements about sets, of the form E1 = E2 (where Es are set expressions), here are three useful techniques: Prove E1  E2 and E2  E1. Use set builder notation & logical equivalences. Use a membership table. 1/31/01 Lecture #10

5 Method 3: Membership Tables
Just like truth tables for propositional logic. Columns for different set expressions. Rows for all combinations of memberships in constituent sets. Use “1” to indicate membership in the derived set, “0” for non-membership. Prove equivalence with identical columns. 1/31/01 Lecture #10

6 Membership Table Example
Prove (AB)B = AB. 1/31/01 Lecture #10

7 Membership Table Exercise
Prove (AB)C = (AC)(BC). 1/31/01 Lecture #10

8 Generalized Unions & Intersections
Since union & intersection are commutative and associative, we can extend them from operating on ordered pairs of sets (A,B) to operating on sequences of sets (A1,…,An), or even unordered sets of sets, X={A | P(A)}. 1/31/01 Lecture #10

9 Generalized Union Binary union operator: AB
n-ary union: AA2…An ((…((A1 A2) …) An) (grouping & order is irrelevant) “Big U” notation: Or for infinite sets of sets: 1/31/01 Lecture #10

10 Generalized Intersection
Binary intersection operator: AB n-ary intersection: AA2…An((…((A1A2)…)An) (grouping & order is irrelevant) “Big Arch” notation: Or for infinite sets of sets: 1/31/01 Lecture #10

11 Representations A frequent theme of this course will be methods of representing one discrete structure using another discrete structure of a different type. E.g., one can represent natural numbers as Sets: 0, 1{0}, 2{0,1}, 3{0,1,2}, … Bit strings: 00, 11, 210, 311, 4100, … 1/31/01 Lecture #10

12 Representing Sets with Bit Strings
For an enumerable u.d. U with ordering {x1, x2, …}, represent a finite set SU as the finite bit string B=b1b2…bn where i: xiS  (i<n  bi=1). E.g. U=N, S={2,3,5,7,11}, B= In this representation, the set operators “”, “”, “” are implemented by bitwise OR, AND, NOT! 1/31/01 Lecture #10

13 On to section 1.6… Functions
From calculus, you are familiar with the concept of a real-valued function f, which assigns to each number xR a particular value y=f(x), where yR. But the notion of a function can be naturally extended to the concept of assigning elements of any set to elements of any set. 1/31/01 Lecture #10

14 Function: Formal Definition
For any sets A, B, we say that a function f from (or “mapping”) A to B (f:AB) is a particular assignment of exactly one element f(x)B to each element xA. Some generalizations: A partial (non-total) function f assigns zero or one elements of B to each element xA. Functions of n arguments; relations (ch. 6). 1/31/01 Lecture #10

15 Graphical Representations
Functions can be represented graphically in several ways: f f y a b x A B Like Venn diagrams Bipartite Graph Plot 1/31/01 Lecture #10

16 Functions We’ve Seen So Far
A proposition can be viewed as a function from “situations” to truth values {T,F} (situation theory). p=“It is raining.”; s=our situation here,now p(s){T,F}. A propositional operator can be viewed as a function from pairs of truth values to truth values: ((F,T)) = T. 1/31/01 Lecture #10

17 More functions so far… A predicate can be viewed as a function from objects to propositions (or truth values): P=“is 7 feet tall”; P(Mike)=“Mike is 7 feet tall.”=False. A bit string B of length n can be viewed as a function from the numbers {1,…,n} (bit positions) to the bits {0,1}. B=101; B(3)=1. 1/31/01 Lecture #10

18 Still More Functions 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. S={3}; S(0)=F, S(3)=T. A set operator such as ,, can be viewed as a function from pairs of sets to sets. (({1,3},{3,4})) = {3} 1/31/01 Lecture #10

19 A Neat Trick Sometimes we write YX to indicate the set F of all possible functions f:XY. This is appropriate because for finite X, Y, |F| = |Y||X|. If we use representations F0, T1, 2{0,1}={F,T}, then a subset TS is just a function from S to 2, so the power set of S is 2S in this notation. 1/31/01 Lecture #10

20 Some Function Terminology
If f:AB, and f(a)=b (where aA & bB), then: 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. The range RB of f is {b | a f(a)=b }. 1/31/01 Lecture #10

21 Range versus 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 range is the particular set of values in the codomain that the function actually maps elements of the domain to. 1/31/01 Lecture #10

22 Range vs. Codomain - Example
Suppose I say, “f is a function mapping students in this class to the set of grades {A,B,C,D,E}.” At this point, you know the codomain is: __________, and the range is ________. Suppose the grades turn out all As and Bs. Then the range of f is _________, but its codomain is __________________. {A,B,C,D,E} unknown! {A,B} still {A,B,C,D,E}! 1/31/01 Lecture #10

23 Operators An n-ary operator over the set S is any function from the set of ordered n-tuples of elements of S, to S itself. E.g., if S={T,F},  can be seen as a unary operator, and , are binary operators on S. , are binary operators on the set of sets. 1/31/01 Lecture #10

24 Constructing Function Operators
If  (“dot”) is any operator over B, then we can extend  to also denote an operator over functions f:AB. Given any binary operator :BBB, and functions f,g:AB, we define (fg):AB to be the function defined by aA, (f g)(a) = f(a)g(a). 1/31/01 Lecture #10

25 Function Operator Example
,· (“plus”,“times”) are binary operators over R. (Normal addition & multiplication.) Therefore, we can also add and multiply functions f,g:RR: (fg):RR, where (f  g)(x) = f(x)  g(x) (f·g):RR, where (f·g)(x) = f(x) · g(x) 1/31/01 Lecture #10

26 Function Composition Operator
For functions g:AB and f:BC, there is a special operator called compose (“ ° ”). This operator composes a new function out of f,g by applying f to the result of g. (f °g):AC, where (f °g)(a) = f(g(a)). Note g(a)B, so f(g(a)) is defined and C. Note that ° (like Cartesian , but unlike +,,) is non-commuting. (Generally f°g g°f.) 1/31/01 Lecture #10

27 Images of Sets under Functions
Given f:AB, and SA, The image of S under f is simply the set of all images (under f) of the elements of S. f(S)  {f(s) | sS}  {b |  sS: f(s)=b}. Note the range of f can be defined as simply the image (under f) of f’s domain! 1/31/01 Lecture #10

28 One-to-One Functions May Be Larger
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, “x is injective”  (x,y: xy  f(x)f(y)). Only one element of the domain is mapped to any given one element of the range. Domain & range have same cardinality. What about codomain? Each element of the domain is injected into a different element of the range. Compare “each dose of vaccine is injected into a different patient.” May Be Larger 1/31/01 Lecture #10

29 One-to-One Illustration
Bipartite (2-part) graph representations of functions that are (or not) one-to-one: Not one-to-one Not a function! One-to-one 1/31/01 Lecture #10

30 Sufficient Conditions for 1-1ness
For functions f over numbers, f is strictly (or monotonically) increasing iff x>y  f(x)>f(y) for all x,y in domain; f is strictly (or monotonically) decreasing iff x>y  f(x)<f(y) for all x,y in domain; If f is either strictly increasing or strictly decreasing, then f is one-to-one. Eg x3 Converse not necessarily true. Eg 1/x 1/31/01 Lecture #10

31 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). An onto function maps the set A onto (over, covering) the entirety of the set B, not just over a piece of it. Eg for domain & codomain R, x cubed is onto, x squared isn’t. 1/31/01 Lecture #10

32 Illustration of Onto Some functions that are or are not onto their codomains: Onto (but not 1-1) Not Onto (or 1-1) Both 1-1 and onto 1-1 but not onto 1/31/01 Lecture #10

33 The Identity Function For any domain A, the identity function I:AA (variously written, IA, 1, 1A) is the unique function such that aA: I(a)=a. Some identity functions you’ve seen: ing 0, ·ing by 1, ing with T, ing with F, ing with , ing with U. Note that the identity function is both one-to-one and onto. 1/31/01 Lecture #10

34 Identity Function Illustrations
The identity function: y x Domain and range 1/31/01 Lecture #10

35 Bijections A function f is a one-to-one correspondence, or a bijection, or reversible, or invertible, iff it is both one-to-one and onto. For bijections f:AB, there exists an inverse of f, written f 1:BA, which is the unique function such that (the identity function) 1/31/01 Lecture #10

36 A Fun Application In a computer, the function mapping state at clock cycle #t to state at clock cycle #t+1 is called the computer’s transition function. If the transition function is reversible (a bijection), then the computer’s operation in principle requires no energy expenditure. The study of low-power reversible computing is my main research area. 1/31/01 Lecture #10

37 Graphs of Functions We can represent a function f:AB as a set of ordered pairs {(a,f(a)) | aA}. Note that a, there is only 1 pair (a,f(a)). Later (ch.6): relations loosen this restriction. For functions over numbers, we can represent an ordered pair (x,y) as a point on a plane. A function is then drawn as a curve (set of points) with only one y for each x. 1/31/01 Lecture #10

38 Comment About Representations
You can represent any type of discrete structure (propositions, bit-string, number, set, ordered pair, function) in terms of virtually any of the other structures (or some combination thereof). Probably none of these structures is truly more fundamental than the others (whatever that would mean). However, strings, logic, and sets are often used as the foundation for all else. (See famous book Principia Mathematica.) 1/31/01 Lecture #10

39 A Couple of Key Functions
We will frequently use the following functions over real numbers: x (floor of x) is the largest (most positive) integer  x. x (ceiling of x) is the smallest (most negative) integer  x. 1/31/01 Lecture #10


Download ppt "COT 3100, Spring 2001 Applications of Discrete Structures"

Similar presentations


Ads by Google