Formal Methods: Z CS 415, Software Engineering II Mark Ardis, Rose-Hulman Institute March 18, 2003.

Slides:



Advertisements
Similar presentations
© Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn 2.4 The Z Notation [Reference: M. Spivey: The Z Notation, Prentice Hall]
Advertisements

Friday, April 17, PTR: A Probabilistic Transaction Logic Julian Fogel A logic for reasoning about action under uncertainty. A mathematically sound.
ISBN Chapter 3 Describing Syntax and Semantics.
The Z Specification Language
Shaoying Liu Department of Computer Science
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Course Summary. © Katz, 2003 Formal Specifications of Complex Systems-- Real-time 2 Topics (1) Families of specification methods, evaluation criteria.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
1 CS 501 Spring 2005 CS 501: Software Engineering Lecture 10 Requirements 4.
Refinements in Z Shmuel Katz The Technion Formal Specifications of Complex Systems (CS236368)
The Schema Calculus. Schemas A notation specifying both system states and operations One way: S = [ declarations | predicate ] Means: The state components.
CS5371 Theory of Computation Lecture 1: Mathematics Review I (Basic Terminology)
Course Summary. © Katz, 2007 Formal Specifications of Complex Systems-- Real-time 2 Topics (1) Families of specification methods, evaluation criteria.
Formal Methods: Industrial Use CS 415, Software Engineering II Mark Ardis, Rose-Hulman Institute March 21, 2003.
Discrete Mathematics Math 6A Instructor: M. Welling.
Describing Syntax and Semantics
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 10 Slide 1 Formal Specification.
Propositional Calculus Math Foundations of Computer Science.
Introduction to the Z Example Two. 2 Write Z specifications for the Birthday Book Problem  The Birthday Book system keeps track of people’s birthdays.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 10 Slide 1 Critical Systems Specification 3 Formal Specification.
Formal Methods 1. Software Engineering and Formal Methods  Every software engineering methodology is based on a recommended development process  proceeding.
ECSE Software Engineering 1I HO 3 © HY 2012 Lecture 3 Formal Methods through an Introduction to Z Formal Methods A notation for formal specification.
Compositional IS Development Framework Application Domain Application Domain Pre-existing components, legacy systems Extended for CD (ontologies) OAD Methods.
Safety Critical Systems 4 Formal Methods / Modelling T
A Brief Summary for Exam 1 Subject Topics Propositional Logic (sections 1.1, 1.2) –Propositions Statement, Truth value, Proposition, Propositional symbol,
Lecture 3 [Self Study] Relational Calculus
©Ian Sommerville 2000Software Engineering, Chapter 10 Slide 1 Chapter 10 Formal Specification.
Logic Specification and Z Schema 3K04 McMaster. Basic Logic Operators Logical negation ( ¬ ) Logical conjunction ( Λ or & ) Logical disjunction ( V or.
A Z Approach in Validating ORA-SS Data Models Scott Uk-Jin Lee Jing Sun Gillian Dobbie Yuan Fang Li.
MATH 224 – Discrete Mathematics
Introduction to Formal Methods Based on Jeannette M. Wing. A Specifier's Introduction to Formal Methods. IEEE Computer, 23(9):8-24, September,
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
CSCI 2670 Introduction to Theory of Computing Instructor: Shelby Funk.
Formal Verification Lecture 9. Formal Verification Formal verification relies on Descriptions of the properties or requirements Descriptions of systems.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
ECSE Software Engineering HO 13 © HY 2010 Lecture 13 High Quality Software For the purpose of this lecture we define high quality software.
Formal Specification and Z CS3300 Fall Formal Specification Produces a mathematical model Typically associated with analysis Differs from design.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Safety Critical Systems 4 Formal Methods / Modelling T
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Formal Methods in Software Engineering “And they made their lives bitter with hard bondage … all their service … was with rigour.” Ex 1:14.
Formal Methods.
Safety-Critical Systems 4 Formal Methods / Modelling
CS6133 Software Specification and Verification
1. Outline I. Specification and Definition II. Typed Predicate Logic III. Specification in TPL IV. Theories off Types V. Polymorphic Specifications VI.
1 Abstract Model Specification. 2 Explicitly describes behavior in terms of a model using well-defined types (viz. set, sequences, relations, functions)
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Duminda WijesekeraSWSE 623: Introduction1 Introduction to Formal and Semi- formal Methods Based on A Specifier's Introduction to Formal Methods (J. Wing)
Requirements Engineering Methods for Requirements Engineering Lecture-31.
©Ian Sommerville 2000Software Engineering, Chapter 10 Slide 1 Chapter 10 Formal Specification.
1 Introduction to Abstract Mathematics Chapter 3: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 3.1.
1 Requirements Specification and Verification Using Z A. Rasoolzadegan July, 2009 AUT CEIT.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Formal Methods. What Are Formal Methods Formal methods refers to a variety of mathematical modeling techniques that are applicable to computer system.
ALLOY: A Formal Methods Tool Glenn Gordon Indiana University of Pennsylvania COSC 481- Formal Methods Dr. W. Oblitey 26 April 2005.
The Z Specification Language Based on J. M. Spivey. An Introduction to Z and formal specifications, Software Engineering Journal, 4(1):40-50, January,
Introduction to Formal Methods
VDM: Vienna Development Method
Formal Techniques (CS340 © John C. Knight 2004)
Formal Modeling Concepts
(State) Model-Based Approaches II Software Specification Lecture 36
B (The language of B-Method )
IS 2935: Developing Secure Systems
A Brief Summary for Exam 1
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Algebraic Trace Theory
Presentation transcript:

Formal Methods: Z CS 415, Software Engineering II Mark Ardis, Rose-Hulman Institute March 18, 2003

2 Outline Types of Formal Methods Introduction to Z Examples

3 Formal Methods Specification and verification methods Have formal (mathematical) semantics  unambiguous  facilitate proofs of correctness In use since late 1970s  more popular in Europe than US  still only a niche market

4 Types of Formal Methods Model-theoretic  VDM, Z Algebraic  ACT One, Larch, OBJ Concurrent processes  CCS, CSP, Petri Nets Finite State Machines  Esterel, Statecharts Hybrid  LOTOS, SDL

5 Model-theoretic Methods Vienna Development Method (VDM)  invented at IBM Vienna lab in late 1970s  used for compilers (Denmark, Germany) and for information processing (England) Z  Invented by Jean-Raymond Abrial (France)  Developed by Programming Research Group (PRG) at Oxford  Used at IBM Hursley in mid 1980s

6 Foundations of Z Model theoretic method  abstract model is constructed  properties of the model are proven Set theory (and other discrete math) First order predicate calculus Schema calculus provides incrementality

7 Predicate Logic Variables ranging over arbitrary sets Predicates: assertions about variables Operators:  conjunction: A  B  disjunction: A  B  negation:  A  implication: A  B Quantifiers  universal:  x: T  R(…x…)  existential:  x: T  R(…x…)

8 Set Theory Membership: x  S, x  T Union: S  T Intersection: S  T

9 Functions and Relations element mapping: x y domain, range: dom(R), ran(R) overriding: R  S partial function: x y

10 Sequences definition: <>, concatenation:  length: #S functions: head(S) first element tail(S) all but the first element last(S) last element front(S) all but the last element

11 Schema Operators conjunction: S  T disjunction: S  T hiding: S \ (v 1, …, v n ) hiding: S \ T overriding: S  T

12 Names Variables  input: name?  output: name!  postcondition: name' Schema  changes state:  Name  constant state:  Name

13 Schemas Name declarations predicates

14 Birthday Book [Spivey 92] Example of use of schemas Describes a calendar with birthdates

15 BirthdayBook known: P NAME birthday: NAME DATE known = dom birthday

16 Examples known = { Mark, Cheryl, Eric, Paul } birthday = { Mark April 7, Cheryl July 9, Eric July 14, Paul April 30}

17 AddBirthday  BirthdayBook name? : NAME date? : DATE name?  known birthday' = birthday  {name? date?}

18 FindBirthday  BirthdayBook name? : NAME date! : DATE name?  known date! = birthday(name?)

19 Remind  BirthdayBook today? : DATE cards! : P NAME cards! = { n: known | birthday(n) = today? }

20 InitBirthday BirthdayBook known = Ø Initialization

21 Deriving Properties known' = dom birthday' = dom ( birthday  {name? date?} ) = dom birthday  dom {name? date?} = dom birthday  { name? } = known  { name? }

22 Cartoon of the Day

23 Cartoon of the Day (cont.)

24 Symbol Table [Hayes 87] Describes a relation between symbols and values Illustrates use of schema operators

25 Initial Definitions ST  SYM VAL st  ST st 0  Ø

26 Retrieve  ST s? : SYM v! : VAL s?  dom(st) v! = st(s?)

27 Declare  ST s? : SYM v? : VAL st' = st  { s? v? }

28 NotPresent  ST s? : SYM rep! : REPORT s?  dom(st) rep! = "Symbol not present"

29 Success rep! : REPORT rep! = "OK"

30 Combining Schemas STRetrieve  ( Retrieve  Success)  NotPresent STDeclare  Declare  Success

31 Overriding Definitions Introduce a new symbol table for each level of scope Need to override the previous definitions of symbols: { s v }  { s w } Need to introduce a distributed override operator for sequences of symbol tables

32 Block-Structured Symbol Tables BST  seq ST  / : seq ST  ST  / <> = Ø  / ( s  ) = (  / s )  t bst 0 

33 BStart 0  BST bst' = bst  BEnd 0  BST bst  bst' = front( bst )

34 Z Method 1. Introduce basic sets 2. Define an abstract state in terms of sets, functions, relations, sequences, etc. 3. Specify the initial state 4. Define pre- and post-conditions of operations 5. State and prove theorems

35 References Ian Hayes (editor), Specification Case Studies, Prentice-Hall International, 1987, ISBN J.M. Spivey, The Z Notation: A Reference Manual, Prentice-Hall International, 1992, ISBN