













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to sets, a fundamental concept in mathematics and important for understanding formal specification and design in software engineering. The basics of set theory, including set membership, extension, comprehension, power sets, and cartesian products. It also introduces the z notation, a formal specification language based on set theory, and explains how sets are used in z specifications.
Typology: Slides
1 / 21
This page cannot be seen from the preview
Don't miss anything!














a system of types based upon maximal sets, a system used throughout the rest of the book.
and variables are used consistently in a specification
Definition of a Set:
A set is a well-defined an un-ordered collection of distinct objects docsity.com
The following are all examples of sets
Oceans == {Atlantic, Arctic, Indian, Pacific}
post of secretary-general of the United Nations Secretaries == {Trygve Lie,.. ., Koffi Annan}
lower-case letters
Primes == {2, 3, 5, 7,... }
Example 5.4 : If we define
s == { 2 , 2 , 5 , 5 , 3} and t == { 2 , 3, 5} then s = t
Example 5.5 : If we let Rockallers be the set
of people who live and work on Rockall, which is a small uninhabited island in the Atlantic Ocean, then
new set by considering only those elements of s that satisfy some property p.
comprehension. We write {x : s | p x} = {x : s | p}
It denotes the set of all elements x in s that
satisfy predicate p
It we are interested in expression formed from the values satisfying the predicate p, and not in the values themselves, then { x : s | p e} denotes the set of all expressions e such that x is drawn from s and satisfies p.
Example 5.9 (Example 5.8) To investigate the crime, the authorities require a set of addresses to visit. { x : Person | x drives a red car address (x)}
Example 5.10 : Without the information that a red car was involved, the authorities would be left with the following set of addresses: { x : Person address (x)}
It is to be noted that above expression can be written as { x : Person | true address (x)}
In general
Example 5.12 :
There is nothing special about the names chosen for the driver and his or her accomplice. The set in Example 5.11 could equally well have been written as
{v : Person; w : Person | v is associated with w
v drives a red car w reads the Daily Mail v}
Definition :
If a is a set, then the set of all subsets of a is called the power set of a, and written ¡a. For example, if a is the set {x, y} then a = { , {x}, {y}, {x, y} }
Note :
Then the set of possible solutions is given by the Cartesian product: Guests Rooms Weapons
And a typical guess would be
(Colonel Mustard, Library, Revolver)
It was Colonel Mustard, in the library, with the revolver.
If guess is an element of:
Guests Rooms Weapons, then guess.1 is the name of the murderer guess.2 is the suggested location guess.3 is the weapon used
If guess is the tuple
(Colonel Mustard, Library, Revolver) above results
Colonel Mustard, Library, and Revolver, respectively.
Example 5.18 : If there are 6 guests, 9 rooms, and 6 weapons in Cluedo. Then there are 6 9 6 = 324 elements in the above set