Schemas-Formal Specification Methods in Software Development-Lecture Slides, Slides of Software Development Methodologies

This lecture was delivered by Sharman Munjha Jadeja at Birla Institute of Technology and Science for Formal Specification Methods in Software Development course. It includes: Schemas, Introduction, Z, Notation, Mathematical, Language, Variables, Concert, Hall

Typology: Slides

2011/2012

Uploaded on 07/09/2012

chand
chand 🇮🇳

4.4

(7)

31 documents

1 / 62

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter No. 11
Schemas
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e

Partial preview of the text

Download Schemas-Formal Specification Methods in Software Development-Lecture Slides and more Slides Software Development Methodologies in PDF only on Docsity!

Chapter No. 11

Schemas

Introduction

  • In the Z notation there are two languages
    • the mathematical language and
    • the schema language.
  • The mathematical language is used to describe various aspects of a design - objects, and - the relationships between them.
  • The schema language is used to structure and compose descriptions - collating pieces of information, encapsulating them, and naming them for re-use. docsity.com

Introduction

  • We believe that the use of schemas helps to promote a good specification style.
  • However, as with any notation, the language of schemas requires careful and judicious application if it is not to be abused.
  • We should take care to develop simple theories and to use schemas to present them in an elegant and comprehensible fashion.

Introduction

  • This chapter is an introduction to schemas their appearance, and information it contain
  • We see how they may be used as types, as declarations, and as predicates.
  • In subsequent chapters, we present a language of schema operators, and show how schemas may be used in reasoning about formal descriptions.

The Schema

  • One of the most basic things that we can do to help the reader or indeed the writer of a specification is to identify commonly used concepts and factor them out from the mathematical description of a system.
  • In this way, we can encapsulate an important concept and give it a name, thus increasing our vocabulary and our mental power.

The Schema

  • In formal specifications, we see a pattern occurring over and over again: a piece of mathematical text which is a structure describing some variables whose values are constrained in some way.
  • We call this introduction of variables under some constraint a schema.

Example: Concert Hall

  • The box office maintains a record of which seats have been sold, and to whom.
  • This relationship is a functional because no seat can be sold to two different customers: sold ³ Seat © Customer
  • To allow for the possibility that seats may be added to or removed from, we introduce a set seating, a subset of Seat, to represent the seating allocated for the performance.

Example: Concert Hall

  • It should not be possible to book seating that has not been allocated; the following predicate should be true at all times dom sold º seating
  • That is, the domain of sold should be a subset of seating.
  • This property, together with the declarations of sold and seating, forms a schema which we shall call BoxOffice.

Formalizing Box Office

Example 11.3 We can write the box office schema in horizontal form, as

[Seating : ¡ Seat; sold : Seat © Customer | dom sold º seating]

Or in vertical form as

[Seating : ¡ Seat; sold : Seat © Customer

dom sold º seating]

Associating Names with Schema

  • The schema language includes a special operator for associating names with it.
  • Horizontal

Name á [declaration | predicate

  • Vertical

Name declaration

predicate

Constraint as a Part of Predicate

  • Declaration part of box office includes constraint that relation sold between Seat and Customer must be functional.
  • The following schema, in which this constraint appears as part of the predicate, is entirely equivalent:

BoxOffice [Seating : ¡ Seat; sold : Seat ¨ Customer

dom sold º seating]^ sold ³ Seat © Customer

Another Way of Defining Schema

Example : 11.6 The schema of Example 11.5 could be written in the following form:

BoxOffice Seating : ¡ Seat sold : Seat ¨ Customer

dom sold º seating sold ³ Seat © Customer

Schemas as Type

  • Schema below corresponds to a composite data type with two components: an integer called a, and a set of integers called c.

SchemaOne a : ¤ c : ¡ ¤

  • We may introduce elements of this type in the usual way: the declaration s : SchemaOne introduces an object s of schema type SchemaOne.

Binding in a Schema

  • To write an object of schema type in extension, we list the component names and the values to which they are bound. This requires a new piece of notation:

Ýa â 2, c â {1, 2, 3}Þ

is a binding in which a is bound to 2 and c is bound to the set {1, 2, 3}