Top Banner
1 April 2009 Instructor: Tasneem Darwi sh 1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal Methods Relations
9

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

Jan 04, 2016

Download

Documents

Gerald Davis
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Formal.

1 April 2009 Instructor: Tasneem Darwish 1

University of PalestineFaculty of Applied Engineering and Urban Planning

Software Engineering Department

Formal Methods

Relations

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

1 April 2009 Instructor: Tasneem Darwish 2

Outlines

Binary relations.

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

1 April 2009 Instructor: Tasneem Darwish 3

Introduction

In a formal specification, it is often necessary to describe relationships between Objects.

Example:1.This object is greater than that.2.This action takes priority over that one.

These relationships can be described using simple mathematical objects called relations.

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

1 April 2009 Instructor: Tasneem Darwish 4

Binary RelationsWe can define relations between a finite number of objects, but

its enough to define binary relations.

Binary relations are relations that express links between pairs of objects.

In our mathematical language a relation is a set of ordered pairs, a subset of a Cartesian product.

If X and Y are sets, then X ↔Y denotes the set of all relations between X and Y.

The relation symbol can be defined using generic abbreviation:

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

1 April 2009 Instructor: Tasneem Darwish 5

Binary RelationsExample 7.1 The set of relations {a, b} ↔ {0, 1} is the set of sets of pairs

The relation that associates a with 0, a with 1, and b with 0 is the set

The expression is another way of writing (x,y)

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

1 April 2009 Instructor: Tasneem Darwish 6

Binary RelationsExample 7.2 The relation drives is used to record which makes of car are driven by the members of a small group of people.

If the group of people is defined by:

and the choice of cars is defined by

Then drives is an element of , and the statement `Kate drives a cortina' could be formalised as:

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

1 April 2009 Instructor: Tasneem Darwish 7

Binary RelationsWe may also choose to introduce a relation as an infix symbol: a

symbol that sits between its arguments.

Many familiar relations are written in this way:the less-than-or-equal-to relation on numbers; the subset relation on sets.

If the pair (x, y) is an element of the infix relation R, then we may write x R y.

When we define an infix relation, we include underscores to indicate where the arguments should go.

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

1 April 2009 Instructor: Tasneem Darwish 8

Binary RelationsExample 7.3 The relation drives could be defined by

•Simple relations can be illustrated using diagrams with arrows, or graphs.

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

1 April 2009 Instructor: Tasneem Darwish 9

Binary RelationsExample 7.3 The relation drives could be defined by

•Simple relations can be illustrated using diagrams with arrows, or graphs.