Www.adacore.com A Pragmatic View of Formal Methods The Hi-Lite Project Robert B K Dewar SSS ‘11 President & CEO, AdaCore Emeritus Professor of Computer.

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

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Copyright W. Howden1 Programming by Contract CSE 111 6/4/2014.
An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
LIFE CYCLE MODELS FORMAL TRANSFORMATION
Presented by David LESENS and Johannes KANIG Thursday, 16 May 2013 Astrium Space Transportation AdaCore Formal Validation of Aerospace Software DASIA 2013.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
CS 355 – Programming Languages
An Integration of Program Analysis and Automated Theorem Proving Bill J. Ellis & Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.
HCSSAS Capabilities and Limitations of Static Error Detection in Software for Critical Systems S. Tucker Taft CTO, SofCheck, Inc., Burlington, MA, USA.
ITEC200 Week02 Program Correctness and Efficiency.
Software Engineering and Design Principles Chapter 1.
Train Control Language Teaching Computers Interlocking By: J. Endresen, E. Carlson, T. Moen1, K. J. Alme, Haugen, G. K. Olsen & A. Svendsen Synthesizing.
Building Reliable Software Requirements and Methods.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
Software Reliability Methods Sorin Lerner. Software reliability methods: issues What are the issues?
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
From last time S1: l := new Cons p := l S2: t := new Cons *p := t p := t l p S1 l p tS2 l p S1 t S2 l t S1 p S2 l t S1 p S2 l t S1 p L2 l t S1 p S2 l t.
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 91 Formal Specification l Techniques for the unambiguous specification of software.
Quentin Ochem AdaCore.  Complex software are filled with bugs  OS (windows, linux, macosx…)  Webservers  Office suites  Video games  …  And in.
From Module Breakdown to Interface Specifications Completing the architectural design of Map Schematizer.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
CSC 395 – Software Engineering Lecture 21: Overview of the Term & What Goes in a Data Dictionary.
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
Computer Science 340 Software Design & Testing Design By Contract.
Formal Methods 1. Software Engineering and Formal Methods  Every software engineering methodology is based on a recommended development process  proceeding.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Course: Software Engineering © Alessandra RussoUnit 1 - Introduction, slide Number 1 Unit 1: Introduction Course: C525 Software Engineering Lecturer: Alessandra.
Invariant Based Programming in Education Tutorial, FM’08 Linda Mannila
© Andrew IrelandDependable Systems Group Cooperative Reasoning for Automatic Software Verification Andrew Ireland School of Mathematical & Computer Sciences.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
School of Computing and Mathematics, University of Huddersfield CIA2326: Week 11 LECTURE: Formal Specification TUTORIAL/PRACTICAL: Finish off last weeks.
© Andrew IrelandDependable Systems Group On the Scalability of Proof Carrying Code for Software Certification Andrew Ireland School of Mathematical & Computer.
Bill J. Ellis Dependable Systems Group Heriot-Watt University (Project page: Proving Exception.
© Andrew IrelandDependable Systems Group Static Analysis and Program Proof Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt University.
© Andrew IrelandDependable Systems Group Invariant Patterns for Program Reasoning Andrew Ireland Dependable Systems Group School of Mathematical & Computer.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.5 Application: Correctness of Algorithms 1 [P]rogramming reliability – must be an activity.
ISBN Chapter 3 Describing Semantics.
Chapter 3 Part II Describing Syntax and Semantics.
Semantics In Text: Chapter 3.
Seven Myths of Formal Methods - by Anthony Hall, Praxis Systems Presented by Shanmughapriya Senthil.
An Axiomatic Basis for Computer Programming Robert Stewart.
Formal Methods in SE Software Verification Using Formal Methods By: Qaisar Javaid, Assistant Professor Formal Methods1.
13 Aug 2013 Program Verification. Proofs about Programs Why make you study logic? Why make you do proofs? Because we want to prove properties of programs.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
CSCI1600: Embedded and Real Time Software Lecture 28: Verification I Steven Reiss, Fall 2015.
SWE 4743 Abstract Data Types Richard Gesick. SWE Abstract Data Types Object-oriented design is based on the theory of abstract data types Domain.
Aspect Oriented Security Tim Hollebeek, Ph.D.
Combining Static and Dynamic Reasoning for Bug Detection Yannis Smaragdakis and Christoph Csallner Elnatan Reisner – April 17, 2008.
Lectures 2 & 3: Software Process Models Neelam Gupta.
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.
Formal Methods. What Are Formal Methods Formal methods refers to a variety of mathematical modeling techniques that are applicable to computer system.
Types for Programs and Proofs
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
AdaCore Technologies for Cyber Security
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
Programming Languages 2nd edition Tucker and Noonan
Computer Science 340 Software Design & Testing
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

A Pragmatic View of Formal Methods The Hi-Lite Project Robert B K Dewar SSS ‘11 President & CEO, AdaCore Emeritus Professor of Computer Science, New York University Feb 10 th 2011

Slide: 2 Copyright © 2009 AdaCore An observation from Yogi Berra In theory there is no difference between theory and practice. In practice there is. Variously attributed to Yogi Berra, Einstein etc.

Slide: 3 Copyright © 2009 AdaCore

Slide: 4 Copyright © 2009 AdaCore Correctness and Reliability Not really the same thing Often merged in people’s thinking The issue of large reliable programs Correctness means adherence to some formal model Reliability means that a program works Many reasons why a correct program might be unreliable. And a reliable program may well be incorrect

Slide: 5 Copyright © 2009 AdaCore We can do Pretty Well in Practice No one has ever died on a commercial airplane as a result of a software bug. We have however had some hair raising close calls But a close call is a close call When it comes to avionics, software is not the weak link in the chain. But we could do better And most certainly best practices are not widely applied –Cars –Medical Equipment –Critical financial applications

Slide: 6 Copyright © 2009 AdaCore Safety And Security Safety means we don’t have bugs that kill people Security means bad guys can’t cause chaos We have lots of bad guys around who know a lot Any safety critical system is security critical now How vulnerable are we TV thinks we are very vulnerable –Alias and Avionics systems –24 and Air Traffic Control Don’t be too quick to dismiss fiction –Clancy crashed a plane long before 9/11

Slide: 7 Copyright © 2009 AdaCore Proving Entire Programs Correct A nice conceptual goal But definitely a case where theory and practice are not on the same page Fundamental problems stand in the way

Slide: 8 Copyright © 2009 AdaCore Producing a Full Formal Specification No use unless we find an appropriate level of abstraction. Every program is a full formal specification in some sense, but that’s not useful Every generation of programming languages has been sold as high level specification eliminating the need for programmers –Fortran, mathematicians will enter formulas directly –COBOL, people will stick business models into the computer directly –4G languages, no, honestly, they really will stick them in directly –Modeling languages, no more need for expensive programmers Expensive, but might be worth the cost if it was a panacea, but it is not.

Slide: 9 Copyright © 2009 AdaCore Difficulties in Producing Full Specifications No one understands formal specifications There are things that can’t be formally specified –Good error messages in a compiler –Intuitive user interfaces Deliberate incompleteness Difficulties of proving termination Difficulties of specifying programming languages Anyway, they will have errors A specification is basically a large program And often one that has never been tested

Slide: 10 Copyright © 2009 AdaCore Proving Properties of Programs Definitely a promising approach Not just promises, we can deliver –Freedom from run-time errors –Proof of security properties Security a particular important target –Secure programs do not have to work –But they do have to be secure

Slide: 11 Copyright © 2009 AdaCore The Role of Testing Right now, we largely rely on testing, e.g. in DO-178B Thorough testing definitely improves our confidence But testing is fundamentally incomplete DO-178B has no formal model, it just works So can we eliminate testing? Almost no one thinks we can eliminate 100% of testing I don’t care how much you have proved, I don’t want to fly on a plane with avionics that has never been tested. But if we can’t eliminate ANY testing, then bleak times ahead for formal methods, certainly in the safety area. So the idea (enshrined in DO-178C) is to figure out how to give some credit for formal methods, eliminating some testing requirements.

Slide: 12 Copyright © 2009 AdaCore Proofs Replacing Testing Specific Unit tests might be replaced by proofs, e.g. of the correctness of an algorithm, eliminating the need for complete domain testing. Object Oriented Programs and Dynamic Dispatch Thorough testing impractical (every call to every method). Require LSP in OO hierarchies OK, we can require it, but how to verify? Unit testing??? This is a place where proof techniques do make sense

Slide: 13 Copyright © 2009 AdaCore Reasoning About Existing Programs The use of static analysis Finding bugs is useful, but not so useful Guaranteeing absence of bugs is definitely useful But eliminating all false negatives can generate too many false positives Helps to start with an appropriate language, e.g. in Ada, range declarations add a focus for analysis. The Microsoft Vista story –Added 500,000 annotations –Found 100,000 potential buffer overflows Finding pre and post conditions Incremental Analysis

Slide: 14 Copyright © 2009 AdaCore Putting it All Together, the Hi-Lite Project In practice we will make use of a combination of techniques and tools –Proof of correctness and formal specification –Thorough testing –Use of static analysis tools All these tools can benefit from the addition of annotations about what should be going on. –Postconditions –Preconditions –Invariants But different tools have different views –Is a precondition something to be proved? –Or is it something to be tested? –Or is it there to give hints to a static analyzer

Slide: 15 Copyright © 2009 AdaCore Preconditions and Postconditions At one level, they are just formalizations of comments. Comments are a good thing if –They are precise –They are complete –They are kept up to date But out of date or incorrect comments are a menace So formalizing them can only help Not that much work once you get used to it But what language should be used Ada 2012 adds extensive capabilities for annotations including preconditions, postconditions, invariants, and predicates.

Slide: 16 Copyright © 2009 AdaCore Trying to Unify the Language Requirements If annotations/contracts are useful for proof, testing, and static analysis, how about we use the same annotation language, so we can integrate the different approaches within a common framework? Multiple approaches are problematic In AdaCore technology, four syntaxes for preconditions –Precondition pragma for Ada 95/2005 –Pre aspect in Ada 2012 –SPARK annotation for preconditions –CodePeer syntax for discovered precondition

Slide: 17 Copyright © 2009 AdaCore Hi-Lite One important goal of Hi-Lite is to create a unified language for annotations that can be used in all contexts. Then the second step is to create a unified development environment in which different tools can use the same source base in different contexts. The goal: to facilitate (i.e. make cheaper) the integration of formal methods and testing regimes. We need to create industrial workflows that incorporate verification on a routine basis These tools need to integrate different programming approaches as well (different languages, modeling …)

Slide: 18 Copyright © 2009 AdaCore Problems in the Unification The requirements for mathematical specifications and programming language expressions are different. Does A+B mean A+B or does it mean apply some weird programming notion of + with overflows or wrap around? –with Pre => A + B <= Integer’Last Does A or B mean A or B, or does it mean do some strange evaluation in which an overflow in B causes an exception even if A is True? Not insuperable, but such issues stand in the way of this being a simple job of getting people to agree on syntax.

Slide: 19 Copyright © 2009 AdaCore Conclusion We have a lot of industrial experience to feed in here We have creators of tools and users very interested in participating in creating a workable framework –AdaCore –Praxis –CEA –INRIA We have mportant industrial partners who need this technology now, so this is much more than just research. –Altran –Astrium –Thales –Rockwell