12 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.

Slides:



Advertisements
Similar presentations
18 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Advertisements

18 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
22 March 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
13 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
The Engineering Design of Systems: Models and Methods
Copyright © Cengage Learning. All rights reserved. CHAPTER 1 SPEAKING MATHEMATICALLY SPEAKING MATHEMATICALLY.
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
1 Functions Chapter 10 Formal Specification using Z.
7 INVERSE FUNCTIONS. The common theme that links the functions of this chapter is:  They occur as pairs of inverse functions. INVERSE FUNCTIONS.
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
Functions. A function between two sets is a relation between those sets that has a special property, namely that each member of the from-set is related.
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,
13 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
10 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
01 March 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
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.
22 March 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
12 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
Chapter 3 Functions Functions provide a means of expressing relationships between variables, which can be numbers or non-numerical objects.
Functions. Copyright © Peter Cappello2 Definition Let D and C be nonempty sets. A function f from D to C, for each element d  D, assigns exactly 1 element.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
17 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
08 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (2)
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
1 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.
03 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
Functions1 Elementary Discrete Mathematics Jim Skon.
Chapter 1 SETS, FUNCTIONs, ELEMENTARY LOGIC & BOOLEAN ALGEBRAs BY: MISS FARAH ADIBAH ADNAN IMK.
Functions Reading: Chapter 6 (94 – 107) from the text book 1.
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.
Chapter 5 – Relations and Functions. 5.1Cartesian Products and Relations Definition 5.1: For sets A, B  U, the Cartesian product, or cross product, of.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
Language: Set of Strings
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
MATH 224 – Discrete Mathematics
CHAPTER 3 FUZZY RELATION and COMPOSITION. 3.1 Crisp relation Product set Definition (Product set) Let A and B be two non-empty sets, the product.
Mathematical Preliminaries
Formal Methods in SE Lecture 16 Formal Methods in SE Qaisar Javaid Assistant Professor.
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.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
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.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
“It is impossible to define every concept.” For example a “set” can not be defined. But Here are a list of things we shall simply assume about sets. A.
Functions Goals Introduce the concept of function
CHAPTER 2 Set Theory A B C.
Relations, Functions, and Matrices
Cartesian product Given two sets A, B we define their Cartesian product is the set of all the pairs whose first element is in A and second in B. Note that.
MATH 224 – Discrete Mathematics
Chapter 2 Sets and Functions.
Relation and function.
Chapter 3 Relation and Function Homework 4 For each of the following relations on set A = { 1,2,3,4 }, check each of them whether they are reflexive, irreflexive,
CS201: Data Structures and Discrete Mathematics I
7 INVERSE FUNCTIONS.
Discrete Math (2) Haiming Chen Associate Professor, PhD
Functions.
Introduction to Relations and Functions
Ch 5 Functions Chapter 5: Functions
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Functions.
Copyright © Cengage Learning. All rights reserved.
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Presentation transcript:

12 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal Methods Functions

12 April 2009Instructor: Tasneem Darwish2 Outlines Partial functions Lambda notation Functions on relations Overriding Properties of functions Finite sets

12 April 2009Instructor: Tasneem Darwish3 Partial Functions A partial function from X to Y is a relation that maps each element of X to at most one element of Y ; we write to denote the set of all such relations Example 8.1 An organisation has a system for keeping track of its employees while they are on the premises. Each employee is issued with an active badge which reports their current position to a central database. If the set of all people is Person, and the set of all locations is Location, then the information provided by the system may be described by a relation where_is of type Person↔Location. It is impossible for an employee to be in two places at once, so this relation will be a partial function:

12 April 2009Instructor: Tasneem Darwish4 Partial Functions These relations are called partial functions because there may be elements of X that are not related to any element of Y. If each element of X is related to some element of Y, then the function is said to be total; we write X →Y to denote the set of all total functions from X to Y Example 8.2 We may define a relation double on the set of natural numbers N as follows: This relation is a total function: for every natural number m there is a unique number n such that

12 April 2009Instructor: Tasneem Darwish5 Partial Functions If a lies within the domain of a function f, we write f (a) to denote the unique object that is related to x We say that f (a) is the result of applying function f to argument a There are two inference rules associated with function application:

12 April 2009Instructor: Tasneem Darwish6 Partial Functions Example 8.3 If Rachel is an employee, then we may write where_is rachel to denote her current location. Where_is = =

12 April 2009Instructor: Tasneem Darwish7 Lambda notation Suppose that f is a function whose domain is precisely those elements of X that satisfy a constraint p. If the result of applying f to an arbitrary element x can be written as the expression e, then f can be described as The lambda notation offers a more concise alternative; Example 8.4 The function double could also be defined by

12 April 2009Instructor: Tasneem Darwish8 Lambda notation Example 8.5 The function min maps a set of natural numbers to the least number present in that set: the minimum value If the declaration part of a lambda expression introduces more than one variable, then the source type of the function is given by the resulting characteristic tuple The source is the Cartesian product set

12 April 2009Instructor: Tasneem Darwish9 Lambda notation Example 8.6 The function pair takes two functions f and g as arguments, each of which must be a homogeneous relation on N. The result is a function that takes a natural number n and returns the pair formed by applying each of f and g to n: Example 8.7 Let triple be the function

12 April 2009Instructor: Tasneem Darwish10 Functions on Relations Example 8.8 The domain and range operators may be defined by

12 April 2009Instructor: Tasneem Darwish11 Functions on Relations Example 8.9 The restriction operators may be defined by

12 April 2009Instructor: Tasneem Darwish12 Functions on Relations Example 8.10 The relational composition operator may be defined by

12 April 2009Instructor: Tasneem Darwish13 Functions on Relations Example 8.11 The relational inverse operator may be defined by

12 April 2009Instructor: Tasneem Darwish14 Functions on Relations Example 8.12 The transitive closure operator may be defined by

12 April 2009Instructor: Tasneem Darwish15 Overriding To combine the information contained in functions f and g, we could simply write f U g. However, there may be objects that are mapped to one value under f, and to another under g; if this is the case, then f U g is not a function. Function f Function g f U g Not a function

12 April 2009Instructor: Tasneem Darwish16 Overriding If f and g are functions of the same type, we write f g to denote the relational overriding of f with g. Relational overriding is a relation that agrees with f everywhere outside the domain of g; but agrees with g where g is defined and its result is a function: Function f Function g Relational overriding of f with g

12 April 2009Instructor: Tasneem Darwish17 Overriding Although the operator is usually employed for functions, it may be applied to any two relations of the same type.

12 April 2009Instructor: Tasneem Darwish18 Overriding Example 8.13 Suppose that a partial update arrives from the staff location system, informing us that Rachel and Sally are in the lobby and that Tim is in the office. This update may be represented by a partial function from Person to Location:  The expression (where_is U update) rachel is not defined, as there are two locations associated with rachel in this relation.  If the information obtained from the update function takes precedence, then we may use

12 April 2009Instructor: Tasneem Darwish19 Overriding If two functions have disjoint domains, then there is no conflict between them, and overriding behaves as the union operator: In this case, the overriding operator is commutative Example 8.14 If we were to receive two pieces of information, one locating Quentin and Peter and the other locating Rachel and Sally, then then we could combine them in either order:

12 April 2009Instructor: Tasneem Darwish20 Properties of functions The characteristic property of a function is a lack of diverging arrows in its graph (no element of the source is mapped to more than one element of the target) If there are no converging arrows, then the function is said to be an injective function, or an injection. f is an injection if Example 8.15 The location function of Example 8.3 is not injective. According to where_is, there are at least two different people in the meeting room: Where_is quentin = meeting Where_is peter = meeting and quentin ≠ peter.

12 April 2009Instructor: Tasneem Darwish21 Properties of functions If the range of a function is the whole of the target, then it is said to be a surjective function, or a surjection. If the target of function f is B, then f is a surjection if ran f = B Example 8.16 There are three entrances to the Pink Flamingo: the front door, the back door, and the fire exit. Kenny and Peanut are paid to stand at the front door, Neville and Sammy are watching the back, and Animal is leaning on the fire exit. This situation is represented by a surjective function,

12 April 2009Instructor: Tasneem Darwish22 Properties of functions A bijective function, or bijection, is a function which is both injective and surjective (no two elements of the domain are mapped to the same object, and the range is the whole of the target set). Example 8.17 It is Senior Citizens Night at the Pink Flamingo, so Reg Thorpe, the owner, decides that he needs just one bouncer on each door. Peanut and Sammy are given the night off, This is a partial bijection from the set of bouncers

12 April 2009Instructor: Tasneem Darwish23 Properties of functions Functions can be categorized to six category according to their properties:

12 April 2009Instructor: Tasneem Darwish24 Properties of functions By generic abbreviation we can define the set of all partial injective functions : if A and B are sets, then A total injective function is any member of partial injective functions which is also a total function from A to B. Example 8.18 If s and t are the two sets {1, 2} and {a, b, c} respectively, then the set of all partial injective functions from s to t is given by: and the set of all total injective functions is given by

12 April 2009Instructor: Tasneem Darwish25 Properties of functions By generic abbreviation we can define the set of all partial surjective functions : if A and B are sets, then A total surjective function is any member of partial surjective functions which is also a total function from A to B. Example 8.19 If s and t are as defined in Example 8.18, then there are no surjective functions from s to t : The source s has fewer elements than the target t, and for a function to be surjective, there must be at least as many elements in the domain as there are in the target.

12 April 2009Instructor: Tasneem Darwish26 Properties of functions By generic abbreviation we can define the set of all partial Bijection functions : if A and B are sets, then A total Bijection function is any member of partial Bijection functions which is also a total function from A to B. Example 8.20 As none of the functions from s and t are surjections, there can be no bijections between these two sets. If we replace t with the set {a, b}, then two bijections are possible: Both of these are total

12 April 2009Instructor: Tasneem Darwish27 Finite sets A finite set is one whose elements are countable up to some natural number n The number range operator is a function on pairs of natural numbers, for defining finite sets of numbers. Example 8.22 There are a finite number of oceans: we can exhibit a total bijection from the range to the set of all Oceans:

12 April 2009Instructor: Tasneem Darwish28 Finite sets if X is a set, then the set of all finite subsets of X is given by If X is a finite set, then FX and PX are equal. If s is a finite set, we write #s to denote the number of elements in s. This operator, called size or cardinality. Example 8.23 #Oceans = 4 #Primes is undened