COT 3100, Spring 2001 Applications of Discrete Structures

Slides:



Advertisements
Similar presentations
1.6 Functions. Chapter 1, section 6 Functions notation: f: A B x in A, y in B, f(x) = y. concepts: –domain of f, –codomain of f, –range of f, –f maps.
Advertisements

Lecture adapted from CS3511,Discrete Methods Kees van Deemter
Functions Section 2.3 of Rosen Fall 2008
modified from UCI ICS/Math 6D, Fall Sets+Functions-1 Sets “Set”=Unordered collection of Objects “Set Elements”
1 Section 1.8 Functions. 2 Loose Definition Mapping of each element of one set onto some element of another set –each element of 1st set must map to something,
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
Section 1.8: Functions A function is a mapping from one set to another that satisfies certain properties. We will first introduce the notion of a mapping.
Functions.
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
FUNCTION Discrete Mathematics Asst. Prof. Dr. Choopan Rattanapoka.
Relations and Functions Another Foundational Concept Copyright © 2014 – Curt Hill.
ICS 253: Discrete Structures I
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
4.1 CompSci 102© Michael Frank Today’s topics FunctionsFunctions – –Notations and terms – –One-to-One vs. Onto – –Floor, ceiling, and identity Reading:
Functions Section 2.3 of Rosen Spring 2012 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions: Use Piazza.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl Module #4.
1.4 Sets Definition 1. A set is a group of objects . The objects in a set are called the elements, or members, of the set. Example 2 The set of positive.
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Basic Structures: Sets, Functions, Sequences, and Sums.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
1 Functions CS 202 Epp section ??? Aaron Bloomfield.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 04: SETS AND FUNCTIONS 1.6, 1.7, 1.8 Jarek Rossignac CS1050:
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
FUNCTIONS.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Functions Goals Introduce the concept of function
ICS 253: Discrete Structures I
Relations, Functions, and Matrices
COT 3100, Spring 2001 Applications of Discrete Structures
COT 3100, Spring 2001 Applications of Discrete Structures
CS 2210:0001 Discrete Structures Sets and Functions
Applied Discrete Mathematics Week 2: Functions and Sequences
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
MATH 224 – Discrete Mathematics
Functions.
Chapter 2 Sets and Functions.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
Introduction to Set Theory
… and the following mathematical appetizer is about…
Functions.
Sets Set Identities Sets and propositional logic have some similar properties In fact both are forms of boolean algebra Compare Set Identities table (p.
Functions Section 2.3.
Discrete Math (2) Haiming Chen Associate Professor, PhD
Functions.
CSE15 Discrete Mathematics 02/27/17
Set Theory Rosen 6th ed., §
Discrete Mathematics and its Applications
… and the following mathematical appetizer is about…
Functions CS 202 Epp section 7.1.
Unit I: Part I Set Theory
Lesson 5 Relations, mappings, countable and uncountable sets
Rosen 5th ed., §1.8 ~44 slides, ~2 lectures
Functions.
Lesson 5 Relations, mappings, countable and uncountable sets
Introduction to Relations and Functions
Dept. of Mathematics 이산수학 Discrete Mathematics Dr. Chae, Gab-Byung
ICS 253: Discrete Structures I
… and the following mathematical appetizer is about…
Functions Rosen 6th ed., §2.3.
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Properties of Functions
Discrete Mathematics and its Applications
Functions Section 2.3.
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Discrete Mathematics and its Applications
Presentation transcript:

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

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

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

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

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

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

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

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

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

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

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

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=001101010001. In this representation, the set operators “”, “”, “” are implemented by bitwise OR, AND, NOT! 1/31/01 Lecture #10

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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