Reasoning about Multiple Related Abstractions with MultiStar Stephan van Staden, Cristiano Calcagno Chair of Software Engineering.

Slides:



Advertisements
Similar presentations
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Advertisements

Addressing the Challenges of Current Software. Questions to Address Why? What? Where? How?
Verifying Executable Object-Oriented Specifications with Separation Logic Stephan van Staden, Cristiano Calcagno, Bertrand Meyer.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
Separation logic for OO Stephan van Staden. Introduction OO languages are popular and widely used We need to reason about OO programs Some (problematic)
Principles of Object-Oriented Software Development Behavioral refinement.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Lecture 9: Contracts and Inheritance (based on work with.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Chapter 1 Principles of Programming and Software Engineering.
© Copyright Eliyahu Brutman Programming Techniques Course.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Describing Syntax and Semantics
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Abstract Data Types and Encapsulation Concepts
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
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.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Lecture 16 March 22, 2011 Formal Methods CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Mathematical Modeling and Formal Specification Languages CIS 376 Bruce R. Maxim UM-Dearborn.
VERIFICATION OF ASPECT ORIENTED MODELS BY DON MARTIN JAYASHREE VENKIPURAM PATHANGI PIYUSH SRIVASTAVA REFERENCES F. Mostefaoui and J. Vachon,” Design level.
Tammy Dahlgren with Tom Epperly, Scott Kohn, and Gary Kumfert Center for Applied Scientific Computing Common Component Architecture Working Group October.
Freefinement Stephan van Staden, Cristiano Calcagno, Bertrand Meyer Chair of Software Engineering.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Contracts for Concurrency - Contracts & Inheritance Aryabrata Basu University of Georgia.
1 Class Diagrams: Advanced Concepts. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are the most commonly used diagrams.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
Software Debugging, Testing, and Verification Presented by Chris Hundersmarck November 10, 2004 Dr. Bi’s SE516.
Chapter 3 Part II Describing Syntax and Semantics.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering Zhang Shuang
Lightweight Support for Magic Wands in an Automatic Verifier Malte Schwerhoff and Alexander J. Summers 10 th July 2015, ECOOP, Prague.
Understanding ADTs CSE 331 University of Washington.
1 Chapter 11 © 1998 by Addison Wesley Longman, Inc The Concept of Abstraction - The concept of abstraction is fundamental in programming - Nearly.
1 CS Programming Languages Class 22 November 14, 2000.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 10 Abstraction - The concept of abstraction is fundamental in programming - Nearly all programming.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Object-Oriented Parsing and Transformation Kenneth Baclawski Northeastern University Scott A. DeLoach Air Force Institute of Technology Mieczyslaw Kokar.
Properties as Processes : FORTE slide Properties as Processes: their Specification and Verification Joel Kelso and George Milne School of Computer.
An Introduction to Automated Program Verification with Permission Logics 15 th May 2015, Systems Group, ETH Zurich Uri Juhasz, Ioannis Kassios, Peter Müller,
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.
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
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.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Proof And Strategies Chapter 2. Lecturer: Amani Mahajoub Omer Department of Computer Science and Software Engineering Discrete Structures Definition Discrete.
Principles of Programming & Software Engineering
UNIT-IV Designing Classes – Access Layer ‐ Object Storage ‐ Object Interoperability.
Unit - 3 OBJECT ORIENTED DESIGN PROCESS AND AXIOMS
Programming paradigms
11.1 The Concept of Abstraction
Types of Programming Languages
Logical architecture refinement
Programming Languages 2nd edition Tucker and Noonan
Programming Languages 2nd edition Tucker and Noonan
Formal Methods Lecture 16 March 22, 2011 CS 315 Spring 2011
11.1 The Concept of Abstraction
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

Reasoning about Multiple Related Abstractions with MultiStar Stephan van Staden, Cristiano Calcagno Chair of Software Engineering

Introduction Broad topic: reasoning about the correctness of OO programs In particular: well-behaved invariants Data abstractions pervade OO programs: Language constructs: classes Concepts: account, counter, person, stack 2

Abstract Predicate Families (APF) Purpose: data abstraction E.g. d < b x.deposits = d ˄ x.balance = b APF predicate x.A(deps: d, bal: b) Logical abstractions of data APF predicate arguments are the only visible properties of the abstraction Think in terms of interface and implementation. This enforces high-level reasoning APF predicates can have different implementations in different classes Inheritance-aware 3

Related abstractions Abstractions are often related: x.A(deps: d, bal: b)  x.C(cnt: d) * x.R(bal: b) Possible implementations: One class Client Inheritance 4 Account Counter c: int Balance b: int Counter c: int Balance b: int Account d: Counter b: Balance Account d: int b: int

The opportunity Correctness of code often depends on such relationships, but the original proof system allows only to pass APF predicates around Assume library routine use_counter(x) {x.C(cnt: d)}_{x.C(cnt: d+20)} Client reasoning: {x.A(deps: d, bal: b)} {x.C(cnt: d) * x.R(bal: b)} use_counter(x) {x.C(cnt: d+20) * x.R(bal: b)} // Code that assumes x.A(deps: d+20, bal: b) Client infers an A -based specification for use_counter Access control & call protocols: x.A(deps: d, bal: b)  x.C(cnt: d) * x.R(bal: b) 5 x.A(deps: d, bal: b)  x.C(cnt: d) * x.R(bal: b)

The problem Original APF system lacks ways to Specify relationships among abstractions Verify them Reason about code that relies on them Solutions must be flexible, since a property may apply to Instances of particular classes A whole class hierarchy Further requirements: soundness, modularity, simplicity 6

Our approach We use two new specification mechanisms Export clauses for properties of individual classes Axiom clauses for properties of entire class hierarchies Export clauses Class C contains export P Verification checks whether P follows from the APF assumptions of C Clients can assume P The paper contains examples 7

Our approach Axiom clauses Class C contains axiom l: P C and all its subclasses must implement axiom l Subclasses can refine (i.e. strengthen) an axiom Clients can assume ∀ x <: C  P[x / Current] Dynamic type information is not necessary to use this axiom information E.g. axiom a1: A(deps: d, bal: b)  C(cnt: d) * R(bal: b) Method body verification can use export and axiom information of all classes 8

More examples Impose representation constraints on subclasses axiom C(cnt: c)  C Account (cnt: c) All subclasses are forced to implement the C abstraction in the same way as class Account Diamond inheritance & view shifting In class StudentMusician : axiom S(age: a, exm: e) * R1(pfm: p)  M(age: a, pfm: p) * R2(exm: e) Ownership transfer rule Separation logic can express disjointness and sharing 9 Person age: int Student exm: int Musician pfm: int StudentMusician

More examples Relationships between predicate arguments axiom A(deps: d, bal: b)  d < b Properties of predicate arguments E.g. The number of deposits is non-negative axiom A(deps: d, bal: b)  0 ≤ d Include 0 ≤ d in A predicate definitions: define x.A Account (deps: d, bal: b) as 0 ≤ d ˄ … 10

More examples Axioms for aggregate structures that rely on other axioms For the Counter hierarchy: axiom cnt_non_neg: C(cnt: c)  0 ≤ c In class Account : define x.A Account (deps: d, bal: b) as ∃ y  x.f ↦ y * y.C(cnt: d) * … axiom deps_nn: A(deps: d, bal: b)  0 ≤ d relies on Counter.cnt_non_neg 11 Counter c: int Account f: Counter …

Observations Export/axiom information can be seen as well-behaved, operation-independent invariants of OO programs They are universal invariants – always hold Logical, not operational: cannot be violated by adding new methods (cf. class invariants) Idea is not to impose a methodology Only use exports and axioms where you really want them 12

MultiStar Automated tool for verification Part of EVE, the Eiffel Verification Environment Front-end for Eiffel and back-end based on jStar Back-end reasoning enhancements Export and axiom clauses Shared multiple inheritance (including interface inheritance, handling abstract classes and methods) Demonstration 13

Case study with MultiStar Gobo data structure library’s iterator hierarchy Axiom of container hierarchy: 14 ElementAt(iter: i1, elem: e1, content: c1, iters: i) * ElementAt(iter: i2, elem: e2, content: c1, iters: i) * Replaced(iter: i1, value: e2, newcontent: c2, oldcontent: c1, iters: i) * Replaced(iter: i2, value: e1, newcontent: c3, oldcontent: c2, iters: i)  Swapped(iter1: i1, iter2: i2, newcontent: c3, oldcontent: c1, iters: i)

Other work Other work in the paper: MultiStar implementation details Formalization, proof of soundness Related work 15

In conclusion Two new specification mechanisms: export and axiom clauses Simple, well-behaved and powerful Sound proof system incorporating exports and axioms, based on separation logic and APFs Accommodates shared multiple inheritance and interfaces Implementation: MultiStar verification tool 16

Axioms are universal representation invariants Class invariants are properties which methods must preserve Further comparison: What about class invariants? 17