Docsity

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

Partial preview of the text

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

Course Title

Formal Specification Methods

in Software Development

Introduction to Formal Approaches

  • One way to improve the quality of software

is changing the software design

  • Existing methods offer large amounts of

text, pictures, and diagrams, but these are often imprecise and ambiguous.

  • Important information is hidden amongst

irrelevant detail, and design flaws are discovered too late, making them expensive or impossible to correct.

Introduction to Formal Approaches

  • An alternative is using Formal Approaches at all stages of software development.
  • Formal methods, elementary mathematics, can be used to produce precise, unambiguous specification at design level
  • Information is structured and presented at an appropriate level of abstraction.
  • Same approaches can be used to subsequent processes i.e., testing, and maintenance.

Introduction to Formal Approaches

  • Formal methods can be applied in any area of computer science and engineering
  • Example are:
    • software engineering, information security,
    • Data bases e.g. use of the relational calculus in database theory
  • It is intended for the description of state and state-based properties
  • It includes a theory of refinement that allows mathematics to be used at every stage of program development

Introduction to Formal Approaches

  • Approaches based on mathematical tools

for specifying properties of software systems

  • These techniques usually drawn from areas

of discrete mathematics, such as

  • Logic,
  • Set theory,
  • Graph theory etc.
  • Formal Methods have rigorous tool support
  • Formal methods increase quality of software

Software Development using Formal Methods

  • Validation: Are we building the right system?
  • Verification: Are we building the system right?

Requirements

Specification 1

Specification n

Specification 2

Formalization

Refinement

Further Refinement

Validation

Verification

Verification

An Introduction to Z Notations

  • Based on set theory, Propositional and

first order logic

  • Abstract data types and sequential

programs

  • Describes state space of a system and

operations over states

  • Operation are relations over pair of state

spaces

  • Advancing to object oriented-ness

An Introduction to Z Notations

  • Another aspect is the way in which the mathematics can be structured.
  • Mathematical objects and their properties can be collected together in schemas which are patterns of declaration and constraint.
  • The schema language can be used to describe the state of a system, and the ways in which that state may change.
  • It is also used to describe system properties, and to reason about possible refinements

An Introduction to Z Notations

  • A characteristic feature of Z is: types
  • Every object in the mathematical language has a unique type, represented as a maximal set in the current specification.
  • This provides a useful link to programming
  • Notion of types means, in an algorithm, type of object can be checked in specification
  • Several type-checking tools exist to support the practical use of Z e.g. Z/eves

An Introduction to Z Notations

  • A fourth aspect is refinement.
  • We may develop a system by constructing a model of a design, using simple mathematical data types to identify the desired behavior.
  • We may then refine this description by constructing another model which respects the design decisions made, and yet is closer to implementation.
  • This process of refinement can be continued until executable code is produced.

An Introduction to Z Notations

  • The Z notation, then, is a mathematical

language with a powerful structuring mechanism.

  • In combination with natural languages, it can

be used to produce formal specifications.

  • We may reason about the specifications using

proof techniques of mathematical logic.

  • We may also refine a specification, yielding

another description closer to executable code.

An Example : Designing A Birthday Book

NAME, DATE 

BirthdayBook known :  NAME birthday : NAME  DATE

known = dom birthday

AddBirthday known :  NAME birthday : NAME  DATE Known’ :  NAME Birthday ’ : NAME  DATE name? : NAME date? : DATE

known = dom birthday Known’ = dom birthday’ name?  known birthday’ = birthday U {name?  date?}

Recording Birthday of a New Comer