2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations(Using RODIN).1 MAT 7003 : Mathematical Foundations (for Software Engineering)

Slides:



Advertisements
Similar presentations
Functions Reading: Epp Chp 7.1, 7.2, 7.4
Advertisements

Introduction The concept of transform appears often in the literature of image processing and data compression. Indeed a suitable discrete representation.
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
Domain Restriction on Relation domain restriction operator,, restricts a relation to only those members whose domain is in a specified set. domain restriction.
The Engineering Design of Systems: Models and Methods
2010: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Logic-SampleAnswers.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson,
Functions Section 2.3 of Rosen Fall 2008
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
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,
1 Category Theory in a ( E,M ) -category Some aspects of category theory, in particular related to universality, can be developed in any finitely complete.
2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/L5- CountingAndEnumeration.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul.
Relations Chapter 9.
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.
Logics for Data and Knowledge Representation Introduction to Algebra Chiara Ghidini, Luciano Serafini, Fausto Giunchiglia and Vincenzo Maltese.
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
Mathematics. Session Set, Relation & Function Session - 3.
Math 3121 Abstract Algebra I Section 0: Sets. The axiomatic approach to Mathematics The notion of definition - from the text: "It is impossible to define.
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
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.
2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.ProofsWithRodin.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul.
An ordered n-tuple is a set of n objects with an order associated with them. If n objects are represented by x 1, x 2,..., x n, then we write the ordered.
INM175 Topic 7 1 Module INM175 Discrete Mathematics Topic 7 Set Theoretic Models.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
1 Annoucement n Skills you need: (1) (In Thinking) You think and move by Logic Definitions Mathematical properties (Basic algebra etc.) (2) (In Exploration)
Functions Section 2.3 of Rosen Spring 2012 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions: Use Piazza.
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.
Math Chapter 6 Part II. POWER SETS In mathematics, given a set S, the power set of S, written P(S) or 2 n(S), is the set of all subsets of S. Remember.
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.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
April 14, 2015Applied Discrete Mathematics Week 10: Equivalence Relations 1 Properties of Relations Definition: A relation R on a set A is called transitive.
Language: Set of Strings
Discrete Mathematics Relation.
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
MAT 2720 Discrete Mathematics Section 3.1 Functions
Copyright © Cengage Learning. All rights reserved.
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.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
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.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
SECTION 9 Orbits, Cycles, and the Alternating Groups Given a set A, a relation in A is defined by : For a, b  A, let a  b if and only if b =  n (a)
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
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.
MAT 2720 Discrete Mathematics Section 3.3 Relations
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.
Week 8 - Monday.  What did we talk about last time?  Properties of functions  One-to-one  Onto  Inverses  Cardinality.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
Discrete Mathematics Lecture # 17 Function. Relations and Functions  A function F from a set X to a set Y is a relation from X to Y that satisfies the.
“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.
Discrete Mathematics Lecture # 13 Applications of Venn Diagram.
Functions Goals Introduce the concept of function
The Relation Induced by a Partition
The Language of Sets If S is a set, then
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.
CSNB 143 Discrete Mathematical Structures
CS201: Data Structures and Discrete Mathematics I
Chapter 2 Sets and Functions.
Yet another important mathematical concept
Mathematical Background 1
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Presentation transcript:

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations(Using RODIN).1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson, A207 Sets and Relations (Using RODIN) …/~gibson/Teaching/MAT7003/L3-SetsAndRelations(Using RODIN).pdf

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations(Using RODIN).2 Have you installed RODIN on your PC?

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations(Using RODIN).3 Unzip in a suitable location and run the executable

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations(Using RODIN).4 Follow the Instructions on the Welcome Page … and restart … and check for updates

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations(Using RODIN).5 After installing RODIN and checking for updates you should have a clean workspace, which looks something like this: A CLEAN WORKSPACE

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations( Using RODIN).6 A NEW PROJECT Now we wish to create a new project; and there are multiple ways of doing this (as there always is in RODIN – and Eclipse): Here: using shortcut New Event-B project

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsAndRelations( Using RODIN).7 Give the Project a Name ( Introduction )

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).8 Now add a Context component – SomeSets - to our project (in order to do some mathematics using set notation)

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).9 Check that the SomeSets context is empty

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).10 Now, try and write the following context specification … how intuitive is the RODIN user interface for beginners? Can you explain what it means (in English)?

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).11 There is a second kind of editor/view that is popular Right click SomeSets and select Open With Event-B context editor This is the pretty print view of the Event-B context editor

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).12 Use the editor view to add English comments documenting the specification

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).13 Use the editor view to add English comments documenting the specification NOTE: Both the different editor views get updated

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).14 Now, can you specify that if you are male then you cannot be female There are lots of different axioms that you could write. Can you find one that you think is correct? But, our specification is incomplete: it allows male and female sets to overlap

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).15 Male ∩ Female = ∅ Female = PERSON ∖ Male Male = PERSON \ Female QUESTION: Are these axioms equivalent? Let’s see using RODIN: Does Male ∩ Female = ∅ imply Female = PERSON ∖ Male

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).16 Add Male ∩ Female = ∅ as an axiom (non theorem) Add Female = PERSON ∖ Male as a theorem QUESTION: What do you notice about the SomeSets context properties ?

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).17 We have some proof obligations to discharge with the prover

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).18 We can open the Proving perspective to try to prove axm5

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).19 This shouldnt be so hard for a prover to Prove automatically Launch PP (with all hypotheses)

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).20 Don’t forget to save the proof

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).21 Can you use RODIN to check equivalence of these axioms? 1.Male ∩ Female = ∅ 2.Female = PERSON ∖ Male 3.Male = PERSON \ Female We have already proven that 1 => 2 Question: what else do we need to prove?

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).22 Let’s add some more sets to our context. Imagine that we wish to build a context that models family relations The types of concepts that we need are: Mother, Father, Parent, Child, Brother, Sister, Sibling, Ancestor, Descendant TO DO: See how many of these you can model using just sets

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).23 Parents – the set of people who are mothers or fathers is pretty easy, eg: But, it is not clear how to model the other concepts (if it is indeed possible) without introducing relations between sets

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.24 RELATIONS If a set A is given explicitly, it is immaterial in which order the elements of A are listed, e.g. the set {x, y} is the same as the set {y, x}. In many instances, however, one would like, and, indeed, needs, to have some order in the appearance of the elements. We need to capture the notion of ordering using Set syntax and semantics.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.25 RELATIONS Definition Let A be a set: 1. A is called a singleton if A = {x} for some x, i.e. if A has exactly one element. 2. A is called an unordered pair, if A = {x, y} for some x, y, if A has exactly two elements. 3. A is called an ordered pair if A = {{x}, {x, y}} for some x, y. We shall usually abbreviate the right hand expression by = {{x}, {x, y}}

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.26 RELATIONS The decisive property of ordered pairs is that two ordered pairs are equal if the respective components are the same. Theorem Let and be ordered pairs. Then = if and only if a = c and b = d. Remark. The expression “if and only if” means that 1. If =, then a = c and b = d. 2. If a = c and b = d, then = So, we have to prove two directions, namely 1. and 2. Usually, “if and only if” is abbreviated as simply “iff”. QUESTION: Can you prove this?

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.27 RELATIONS Definition The Cartesian (or cross-) product A × B of two sets is defined as: A × B = { : a ∈ A, b ∈ B} This definition can be generalised to more than 2 sets (but we wont do this at the moment) QUESTION: Is it possible that A × B = B × A? If A has n elements and B has m elements, how many elements does A × B have?

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.28 RELATIONS Definition Any subset of A × B is called a relation between A and B Any subset of A × A is called a relation on A Since a relation R on A is a subset of A × A, it is an element of the powerset of A × A, i.e. R ⊆ Þ(A × A). If R is a relation on A and ∈ R, then we also write: xRy, read as “x is in R-relation to y”, or simply x is in relation to y, if R is understood.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.29 RELATIONS: pictorial representations For small sets we can use a pictorial representation of relation R on A Sketch two copies of A and, if xRy then draw an arrow from the x in the left sketch to the y in the right sketch. Example, Let A = {a, b, c, d, e}, and R = {,,,, } abcdeabcde abcdeabcde

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.30 RELATIONS: definitions Definition. Let R be a relation on A. Then, domR = {x ∈ A : There exists some y ∈ A such that ∈ R}. domR is called the domain of R. ranR = {y ∈ A : There exists some x ∈ A such that hx, yi ∈ R} is called the range of R. Finally, fldR = domR ∪ ranR is called the field of R. Note: domR, ranR, and fldR are all subsets of A. Sometimes they are written dom, ran and fld (when R is implicit in context of use)

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.31 RELATIONS: definitions Definition. Let R be a relation on A. Then, R˘ = { : ∈ R} is called the converse of R. We obtain the converse R˘ of R if we turn around all the ordered pairs of R, ie if we have a pictorial representation of R, this means that all existing arrows are reversed. abcdeabcde abcdeabcde R R˘ abcdeabcde abcdeabcde

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.32 RELATIONS: definitions Definition: composition Let R and S be relations on A; then R ◦ S = { : there is a y ∈ A such that xRy and ySz}. The operation ◦ is called the composition or the relative product of R and S.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.33 RELATIONS: Ordering relation example let A = N and let R be the relation defined by ∈ R iff x ≤ y; we note that ≤ (or R) has the properties that for all x, y, z ∈ N: 1. x ≤ x, 2. If x ≤ y and y ≤ x then x = y, 3. If x ≤ y and y ≤ z then x ≤ z, 4. x ≤ y or y ≤ x, i.e. any two elements of N are comparable with respect to ≤.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.34 RELATIONS: ordering definitions 1. R is reflexive if ∈ R for all x ∈ A. 2. R is antisymmetric if for all x, y ∈ A, ∈ R and ∈ R implies x = y. 3. R is transitive if for all x, y, z ∈ A, ∈ R and ∈ R implies ∈ R. 4. R is a partial order on A, if R is reflexive, antisymmetric, and transitive. Sometimes we will call a partial order on A just an order on A, or an ordering of A. 5. R is a linear order on A if R is a partial order, and xRy or yRx for all x, y ∈ A, i.e. if any two elements of A are comparable with respect to R.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.35 RELATIONS: ordering definitions If R is an ordering relation on A, then we usually write ≤ (or a similar symbol) for R, i.e. x ≤ y iff xRy If ≤ is a partial order on A, then we call the pair a partially ordered set, or just an ordered set. Furthermore, if ≤ is a linear order, then is called a linearly ordered set or a chain. PROBLEM: Let A = {1, 2,..., 10} and define the relation # on A by x#y iff x is a multiple of y. Show that # is a partial order on A and draw its diagram

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.36 RELATIONS: Equivalence Relations Definition: A relation R on a set A is called symmetric if ∈ R implies R for all a, b ∈ A; in other words, R is symmetric if R = R˘. Definition R is called an equivalence relation if R is reflexive, transitive and symmetric The importance of equivalence relations lies in the fact that they induce a grouping of the base set into subsets.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.37 RELATIONS: Equivalence Relations Definition: Let A be a non-empty set. A family P of non-empty subsets of A is called a partition of A, if every element of A is in exactly one element of P. In other words, 1. For all S, T ∈ P we have S ∩ T = ∅, 2. The union of all elements of P is A. The elements of the partition are called the classes of P. A partition of A is also called a classification. If P is a partition of A, and if its classes are defined by certain properties, then each element of a specific class has the property which defines the class; in other words all the elements of a class are indistinguishable or equivalent with respect to the defining property of the class.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.38 FUNCTIONS Definition: A function is an ordered triple such that: 1. A and B are sets, and f ⊆ A × B, 2. For every x ∈ A there is some y ∈ B such that ∈ f 3. If ∈ f and ∈ f, then y = z; in other words, the assignment is unique in the sense that an x ∈ A is assigned at most one element of B. A is called the domain of f, and B its codomain.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.39 FUNCTIONS Definition: A partial function from X to Y is a function f: X' → Y, where X' is a subset of X. It generalizes the concept of a function by not forcing f to map every element of X to an element of Y (only some subset X’ ⊆ X). If X' = X, then f is called a total function and is equivalent to a function (as defined previously). Partial functions are often used when the exact domain, X', is not known.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.40 FUNCTIONS Notation: It is customary to write the function as f : A → B Also, if ∈ f, then we will usually write y = f(x) and call y the image of x under f. The set {y ∈ B : There is an x ∈ A such that y = f(x)} is called the range of f.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.41 FUNCTIONS If for a function f : A → B it is clear what A and B are, we sometimes call the function simply f, but we must keep in mind that a function is only properly defined if we also give a domain and a codomain! Definition Let f : A → B be a function. 1. If A = B and f(x) = x for all x ∈ A, the f is called the identity function on A, and it is denoted by id A

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.42 FUNCTIONS Definition Let f : A → B be a function. If A ⊆ B and f(x) = x for all x ∈ A, then f is called the inclusion function from A to B, or, if no confusion can arise, simply the inclusion. If A = B and f is the inclusion, then f is in fact the identity on A.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.43 FUNCTIONS Definitions Let f : A → B be a function. If f(x) = x for some x ∈ A, then x is called a fixed point of f. If f(x) = b for all x ∈ A, then f is called a constant function. If g : C → D is a function such that A ⊆ C, B ⊆ D, and f ⊆ g, then g is called an extension of f over C, and f is called the restriction of g to A.

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.44 FUNCTIONS Definition Let f : A → B and g : C → D be functions such that ran f ⊆ dom g. Then the function g ◦f : A → C defined by (g ◦ f )(x) = g(f(x)) is called the (functional) composition of f and g. Lemma Let f : A → B, g : B → C, h : C → D be functions. Then, h ◦ (g ◦ f) = (h ◦ g) ◦ f, i.e. the composition of functions is associative

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.45 FUNCTIONS Definitions Let f : A → B f is called onto or surjective if codom f = ran f. If f is surjective, we sometimes indicate this by writing f is called one–one or injective if for all x, y ∈ A, f(x) = f(y) implies x = y. If f is injective, we sometimes indicate this by writing f is called bijective if f is onto and one-one

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.46 FUNCTIONS QUESTION: Give an example of these types of function over the sets of people

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.47 FUNCTIONS Definition Let f : A → B and g : B → A be functions; g is called the inverse of f, if g(f(x)) = x for all x ∈ A. It is often written as: In other words, g is an inverse of f, if and only if g ◦ f = id A Theorem f : A → B has an inverse if and only if f is injective

2009: J Paul GibsonTSP: Mathematical FoundationsMAT7003/SetsFnsRelations.48 FUNCTIONS Definition Let A = {1, 2, 3,..., n}, and f : A → A be a bijective function; then f is called a permutation on n. QUESTION: for a set with N elements then how many permutations exist? CODING TASK: Write a program to generate all the permutations of a set of integers, and to count the number generated. Does your program verify your answer to the question, above?

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).49 Let us return to the family in RODIN to try and model the relationships

2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Sets And Relations (Using Event-B).50 TO DO (before next week): Attempt to add new family relations to the axioms Attempt to introduce new theorems Can the RODIN prover discharge the proof obligations automatically? A sample solution to this problem will be put on-line before the next session; but you should try it for yourselves.