Principles of Object-Oriented Software Development Behavioral refinement.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

2/11/2014 8:44 AM The CDA Release 3 Specification Stack September 2009 HL7 Services-Aware Enterprise Architecture Framework (SAEAF)
Giving a formal meaning to “Specialization” In these note we try to give a formal meaning to specifications, implementations, their comparisons. We define.
The Substitution Principle SWE 332 – Fall Liskov Substitution Principle In any client code, if subtype object is substituted for supertype object,
August Moscow meeting1August Moscow meeting1August Moscow meeting11 Deductive tools in insertion modeling verification A.Letichevsky.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
(c) 2007 Mauro Pezzè & Michal Young Ch 7, slide 1 Symbolic Execution and Proof of Properties.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 330 Programming Languages 09 / 19 / 2006 Instructor: Michael Eckmann.
1/22 Programs : Semantics and Verification Charngki PSWLAB Programs: Semantics and Verification Mordechai Ben-Ari Mathematical Logic for Computer.
CS 355 – Programming Languages
Automated creation of verification models for C-programs Yury Yusupov Saint-Petersburg State Polytechnic University The Second Spring Young Researchers.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
Software Testing and Quality Assurance
Principles of Object-Oriented Software Development The language Eiffel.
Static and Dynamic Contract Verifiers For Java Hongming Liu.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Principles of Object-Oriented Software Development Software Engineering Perspectives.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Harvey SiyPrinciples of Object-Oriented Software Development by Eliens Slide 1 Behavioral Refinement Principles of Object-Oriented Software Development.
Describing Syntax and Semantics
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
The chapter will address the following questions:
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 A Discipline of Software Design.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
Mathematical Modeling and Formal Specification Languages CIS 376 Bruce R. Maxim UM-Dearborn.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Semantics In Text: Chapter 3.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Protocols Software Engineering II Wirfs Brock et al, Designing Object-Oriented Software, Prentice Hall, Mitchell, R., and McKim, Design by Contract,
Ukrprog Formal requirement language and its applications A.Letichevsky Glushkov Institute of Cybernetics.
L13: Design by Contract Definition Reliability Correctness Pre- and post-condition Asserts and Exceptions Weak & Strong Conditions Class invariants Conditions.
CS412/413 Introduction to Compilers Radu Rugina Lecture 13 : Static Semantics 18 Feb 02.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
CSSE501 Object-Oriented Development. Chapter 10: Subclasses and Subtypes  In this chapter we will explore the relationships between the two concepts.
Topics in OO, Design Patterns, Reasoning About Program Behavior... (part 2) Neelam Soundarajan Computer Sc. & Eng.
Requirements Engineering Methods for Requirements Engineering Lecture-31.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
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.
DBC NOTES. Design By Contract l A contract carries mutual obligations and benefits. l The client should only call a routine when the routine’s pre-condition.
Interpreting the Object Constraint Presented by: Ed Kausmeyer.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
A UML-Based Pattern Specification Technique Presented by Chin-Yi Tsai IEEE TRANSACTION ON SOFTWARE ENGINEERING, VOL. 30, NO. 3, MARCH 2004 Robert B. France,
619 Final Review Last updated Fall 2011 Paul Ammann.
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Formal Methods in Software Engineering 1
Logical architecture refinement
Programming Languages 2nd edition Tucker and Noonan
Semantics In Text: Chapter 3.
SWE 619 Software Construction Last Modified, Fall 2015 Paul Ammann
619 Final Review Last updated Spring 2010 © : Paul Ammann.
Predicate Transformers
Programming Languages 2nd edition Tucker and Noonan
COP4020 Programming Languages
Presentation transcript:

Principles of Object-Oriented Software Development Behavioral refinement

Introduction Types as behavior Verifying behavioral properties On the notion of behavior Objects as behavioral types Specifying behavioral compositions Summary Q/A Literature

Behavioral refinement types as behavior verification abstraction and representation behavioral compositions Additional keywords and phrases: behavioral subtypes, state transformers, correctness formulae, assertion logic, transition systems, invariants, formal specification

Types as behavior

Subtype requirements -- signature and behavior preservation of behavioral properties Safety properties -- nothing bad invariant properties -- true of all states history properties -- true of all execution sequences Subtyping and behavior

Example -- IntSet \not<= FatSet FatSet -- insert, select, size IntSet -- insert, delete, select, size History property -- not satisfied by IntSet History properties -- example

Types and behavioral constraints

Verifying behavioral properties Subsections: State transformers Assertion logic

State transformers

The verification of state transformations

Assertion logic

The correctness calculus

On the notion of behavior The syntax of a simple OO language

Transition system -- rules

Transition system -- compound statement

Transitions -- example

Objects as behavioral types Subsections: Abstraction and representation Correspondence

Abstraction and representation

Abstract Data Types representation function Representation function

The specification of a stack

template implementation class as { int t; T a[MAX]; public: as() { t = 0; } void push(T e) { require(t0); return a[--t]; } invariant: 0 <= t && t < MAX; }; The realization of a stack

Abstraction function and representation invariant

The correspondence relation The subtype correspondence mapping

Behavioral subtyping constraints

Behavioral subtypes -- example

Behavioral subtypes -- correspondence

Behavioral subtypes -- proof obligations

Specifying behavioral compositions

Problem -- dynamic aliasing

class A { public: A() { forward = 0; } attach(B* b) { forward = b; b->attach(this); } bool invariant() { return !forward || forward->backward == this; } private: B* forward; }; class B { public: B() { backward = 0; } attach(A* a) { backward = a; } bool invariant() { return !backward || backward->forward == this; } private: A* backward; };

A a1, a2; B b; a1.attach(b); a2.attach(b); // violates invariant a1

Contracts -- behavioral compositions interaction specification, refinement, conformance declarations Scripts -- cooperation by enrollment roles, initialization/termination protocols, critical role set Multiparty interactions -- communication primitive frozen state, fault-tolerance, weakening synchrony Joint action systems -- action-oriented state charts, refinement, superposition Specifying interactions

Joint action systems action service() by client c; server s is when c.requesting && s.free do Specifying actions -- example

The Model-View contract

Summary

Types as behavior subtype requirements -- preservation of behavioral properties behavioral properties -- invariance, history duality -- static versus dynamic constraints 1

Verifying behavioral properties states -- transformations verification -- correctness formulae axioms -- consequence rules, abstraction 2

On the notion of behavior syntax -- expressions, statements rules -- assignment, object creation, method call compound rules -- composition, conditional, iteration 3

Objects as behavioral types abstract data types -- representation function correspondence -- abstraction, renaming, extension behavioral subtypes -- correspondence 4

Specifying behavioral compositions global invariants -- dynamic aliasing model-based specification -- state and operations compositions -- contracts, scripts, interaction, joint actions 5

Questions 1.How would you characterize the conformance requirements for subtyping? Explain what properties are involved. 2. Give an example of signature compatible types not satisfying the history property. 3. Explain the duality between imposing constraints statically and dynamically. 4. How would you formally characterize program states and state transformations? 5. Explain how you may verify the behavior of a program by means of correctness formulae. 6. Characterize how the behavior of objects may be modeled by means of a transition system and specify a transition system for a simple object- oriented language. 7. How would you characterize the relation between an abstract data type and its realizations?

8. Give an example of an abstract specification of a stack. Define a realization and show that the realization is correct with respect to its abstract specification. 9. Explain the notion of correspondence for behavioral subtypes. 10. Show that a stack is a behavioral subtype of a bag by defining an appropriate correspondence relation. What proof obligations must be met? 11. Discuss the problems involved in satisfying global invariance properties. 12. What formal methods do you know that deal with specifying the behavior of collections of objects?

Further reading As further reading with respect to the verification of programs, I recommend [AptO] and [Dahl92]. An assertion logic for a parallel object-oriented language is presented in [AmBo93].