3.6.2008 Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.

Slides:



Advertisements
Similar presentations
Technologies for finding errors in object-oriented software K. Rustan M. Leino Microsoft Research, Redmond, WA Lecture 1 Summer school on Formal Models.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
© Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn 2.4 The Z Notation [Reference: M. Spivey: The Z Notation, Prentice Hall]
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
LIFE CYCLE MODELS FORMAL TRANSFORMATION
August Moscow meeting1August Moscow meeting1August Moscow meeting11 Deductive tools in insertion modeling verification A.Letichevsky.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
ISBN Chapter 3 Describing Syntax and Semantics.
Copyright © 2006 Addison-Wesley. All rights reserved. 3.5 Dynamic Semantics Meanings of expressions, statements, and program units Static semantics – type.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Program Proving Notes Ellen L. Walker.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
Weakest pre-conditions and towards machine consistency Saima Zareen.
CS 355 – Programming Languages
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.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Information Security of Embedded Systems : Public Key Cryptosystems, Communication Prof. Dr. Holger Schlingloff Institut für Informatik und Fraunhofer.
Knowledge and Systems Research Group, University of Huddersfield B vs OCL: Comparing Specification Languages for Planning Domains Diane Kitchin, Lee McCluskey,
Software Verification Bertrand Meyer Chair of Software Engineering Lecture 2: Axiomatic semantics.
Formal methods Basic concepts. Introduction  Just as models, formal methods is a complement to other specification methods.  Standard is model-based.
Describing Syntax and Semantics
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Formal Verification Lecture 9. Formal Verification Formal verification relies on Descriptions of the properties or requirements Descriptions of systems.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Verification of behavioural elements of UML models using B Truong, Ninh-Thuan and Souquieres, Jeanine In Proceedings of the 2005 ACM Symposium on.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
ISBN Chapter 3 Describing Semantics.
Semantics In Text: Chapter 3.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
1 “B is a method for specifying, designing, and coding software systems.” J.R. Abrial, The B-Book, Cambridge University Press.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
C HAPTER 3 Describing Syntax and Semantics. D YNAMIC S EMANTICS Describing syntax is relatively simple There is no single widely acceptable notation or.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Program Analysis and Verification
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
SS 2017 Software Verification Timed Automata
SS 2017 Software Verification Bounded Model Checking, Outlook
Software Verification 2 Automated Verification
B (The language of B-Method )
SS 2018 Software Verification LTL Satisfiability applied
SS 2018 Software Verification ML, state machines
Software Verification 2 Automated Verification
Software Verification 2 Automated Verification
Programming Languages and Compilers (CS 421)
COP4020 Programming Languages
Logic for Program Call chapter 7
Presentation transcript:

Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für Rechnerarchitektur und Softwaretechnik

Slide 2 H. Schlingloff, Logical Specification Question from last week Q.: Is there anything which can not be specified with Z?  anything = a function from Nat to Nat A.: The number of possible Z specifications is at most countable, while there are uncountably many such functions  More general, the number of possible specifications in any well-defined specification formalism is at most countable  yet, it is hard to find a „natural“ function which is not specifiable, since the formalism is designed especially to formulate all „natural“ functions…

Slide 3 H. Schlingloff, Logical Specification repetition: Z Basic building blocks: Z schemes  declarations (signature)  predicates (formulas constraining variable values) High expressiveness by set theory and logic Possibility of under-specification in Z Modularity (but no object orientation) Well-suited for program verification Not well-suited for refinement (transformational program development) and/or test generation

Slide 4 H. Schlingloff, Logical Specification B-method Tries to overcome this shortcoming Aiming at program development and proof  refinement, implementation, code generation  generalized substitution The B method was developed by J.-R. Abrial (co- author of Z) as an extension of Z Several commercial and university tools Various case-studies in safety-critical systems

Slide 5 H. Schlingloff, Logical Specification Substitution in Predicate Logic Needs distinction between free and bound variable occurrences  occurrences of x in t(… x…) and p(… x …) are free  every occurrence of x in  is bound in  x   a variables can have free and bound occurrences in a formula  [x:=t] is the formula derived from  by replacing every free occurrence of x with term t  substitution may not create new bound occurrences of variables; e.g. ((  x  )  [x:=t])  x  y p(x,y)  (  y p(x,y))[x:=y]  x  y p(x,y)   y p(y,y)  inductive definition of „t is free for y in  “

Slide 6 H. Schlingloff, Logical Specification Substitutions in B Written in prefix notation  [x:=t]  instead of  [x:=t]  [x:=2](x  5) is (2  5), a true statement Substitution as assignment („predicate transformer“)  read as: if x is assigned 2, then x is less or equal to 5  [  ]  can be interpreted as “  establishes  ”  Derived from E.Dijkstra‘s wp- (weakest precondition-) calculus Program specification  admissible starting states specified by formula , desired final states specified by formula   a program is a generalized substitution  such that (  [  ]  )

Slide 7 H. Schlingloff, Logical Specification B Based on abstract machines  don‘t confuse with abstract state machines (ASM) Predicates define properties of abstract machines (states of interest)  a state is a valuation of variables Substitutions define value changes, allow to transform predicates  generalized substitutions can be seen as operations on states Invariants are properties which hold in all states  similar to Z formulas  often used to define type constraints Initialization is by a special substitution Refinements define transformations between abstract machines

Slide 8 H. Schlingloff, Logical Specification Global View Reference: Most of the following material is taken from Moreira, Deharbe, Software Engineering with the B method; 8th Braz. Sym. on FM,

Slide 9 H. Schlingloff, Logical Specification Basic Structure of an Abstract Machine MACHINE Name (Parameters) VARIABLES list of variables INVARIANT invariant predicate INITIALISATION initialization substitution OPERATIONS outputs  name(inputs) ≙ substitution END

Slide 10 H. Schlingloff, Logical Specification Example MACHINE BirthdayAgenda (NAME, DATE) VARIABLES known, birthday INVARIANT known  NAME  birthday  known  DATE INITIALISATION known, birthday := ,  OPERATIONS Register (n, d) ≙ PRE n  NAME  d  DATE  n  known THENknown := known  {n} || birthday := birthday  {n ↦ d} END d  FindBirthday (n) ≙ PRE n  NAME  n  known THEN d := birthday(n) END; END a  FindParty (d) ≙ PRE d  DATE THEN a := birthday -1 (d) END

Slide 11 H. Schlingloff, Logical Specification Verification of a Specification The initialization shall establish the invariant  The machine shall initiate in a valid state  Proof obligation: [  ] , where  is the initialization substitution, and  is the invariant predicate The operations shall preserve the invariant  The operations of the machine shall not take it into an invalid state, assuming that their pre-conditions are respected  Proof obligation: (     [  ]  ), where -  is the invariant predicate, -  is the pre-condition of the operation, and -  is the substitution of the operation

Slide 12 H. Schlingloff, Logical Specification Example

Slide 13 H. Schlingloff, Logical Specification Generalized Substitutions [  1 ;  2 ]  is [  2 ][  1 ]  [  1 ||  2 ]  is [  1 ][  2 ]  (disjoint sets of variables) [x,y:=s,t]  is [tmp:=t][x:=s][y:=tmp]  [IF  THEN  1 ELSE  2 END]  is ((  [  1 ]  )  (¬  [  2 ]  )) [SELECT  1 THEN  1 WHEN  2 THEN  2 END]  is ((  1  [  1 ]  )  (  2  [  2 ]  )) [SKIP]  is  [ANY x WHERE  THEN  END]  is  x (  [  ]  ) [CHOICE  1 OR  2 END]  is ([  1 ]   [  2 ]  ) [PRE  THEN  END]  is (   [  ]  ) …

Slide 14 H. Schlingloff, Logical Specification Modularization An abstract B machine can  USE  SEE  INCLUDE  PROMOTE  EXTEND other abstract machines That way, it is possible to build complex libraries of abstract machines Rich libraries are available for most basic types