You are on page 1of 15

Formal Methods

REHMAT ULLAH
Formal Methods Notations

 Z,
 Object-Z,
 VDM,
 Larch
Specification Language Z

 Jean-Raymond Abrial, late 1970s/early 1980s


 Under continuing development at the Programming Research Group,
Oxford University
 A state-based modeling/specification language
 Set theory, predicate logic
 Object-oriented variations
 Most popular formal methods notation
Z Schema

There are mainly three components In z Schema

1. Schema Name
2. Variable Declarations
3. Predicate
Z Schema

 Introduced, Schema Name will be associated with the schema


proper, which is the contents of the box

 The declarations part of the schema will contain:


1. a list of variable declarations;
2. and – references to other schemas (this is called schema
inclusion).

3. Variable declarations have the usual form: x1, x2, . . . , x n : T;


Z Schema

 The predicate part of a schema contains a list of predicates,


separated either by semi-colons or new lines.
Z Schemas

The building-block for structuring specifications


Z Schemas

The Z schema is a 2-dimensional graphical notation for describing:


 state spaces
 operations.
Identifiers in Z

Identifiers may be composed of upper and lower case letters,


digits, and the underscore character; must begin with a letter
Identifiers may have suffixes:
? means an input variable
! means an output variable
′ means a new value (i.e., the after-operation value)
Identifiers in Z

Schema identifiers may have prefixes:

 ∆ means the state has changed (described later)

 Ξ means no change in the state (described later)


Examples
Examples
SETS

Sets are the most basic types in Z. Examples of sets include:


SETS

Set Membership:

Set Equality:
{ 3, 6, 7 } = { 7, 6, 3, 6 }
SETS

 The following operators may be applied to sets:


 Union: S ∪ T
 Intersection: S ∩ T
 Difference: S \ T
 Subset: S ⊆ T E.g., {c, b} ⊆ {a, b, c}.
 Power Set: P S (set of subsets of S).
P{a, b, c} = { {}, {a}, {b}, {c}, {a, b}, {b, c}, {a, c}, {a, b, c} }

You might also like