Chair of Software Engineering Automatic Verification of Computer Programs.

Slides:



Advertisements
Similar presentations
Joint work with Mike Barnett, Robert DeLine, Manuel Fahndrich, and Wolfram Schulte Verifying invariants in object-oriented programs K. Rustan M. Leino.
Advertisements

Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Extended Static Checking for Java Cormac Flanagan K. Rustan M. Leino Mark Lillibridge Greg Nelson James B. Saxe Raymie Stata Compaq SRC 18 June 2002 PLDI02,
Demand-driven inference of loop invariants in a theorem prover
Writing specifications for object-oriented programs K. Rustan M. Leino Microsoft Research, Redmond, WA, USA 21 Jan 2005 Invited talk, AIOOL 2005 Paris,
Program Verification Using the Spec# Programming System ETAPS Tutorial K. Rustan M. Leino, Microsoft Research, Redmond Rosemary Monahan, NUIM Maynooth.
Technologies for finding errors in object-oriented software K. Rustan M. Leino Microsoft Research, Redmond, WA Lecture 1 Summer school on Formal Models.
Technologies for finding errors in object-oriented software K. Rustan M. Leino Microsoft Research, Redmond, WA Lecture 0 Summer school on Formal Models.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Challenges in increasing tool support for programming K. Rustan M. Leino Microsoft Research, Redmond, WA, USA 23 Sep 2004 ICTAC Guiyang, Guizhou, PRC joint.
Using SMT solvers for program analysis Shaz Qadeer Research in Software Engineering Microsoft Research.
Semantics Static semantics Dynamic semantics attribute grammars
PZ03D Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03D - Program verification Programming Language Design.
A System to Generate Test Data and Symbolically Execute Programs Lori A. Clarke September 1976.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
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.
Copyright © 2006 Addison-Wesley. All rights reserved. 3.5 Dynamic Semantics Meanings of expressions, statements, and program units Static semantics – type.
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
K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond, WA part 0 International Summer School Marktoberdorf Marktoberdorf,
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer (Nadia Polikarpova) Verification tools.
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 OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 10: Project Presentation Ilinca.
Using and Building an Automatic Program Verifier K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond Lecture 1 LASER.
Chair of Software Engineering ATOT - Lecture 12, 12 May Advanced Topics in Object Technology Bertrand Meyer.
K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond, WA part 0 Summer School on Logic and Theorem-Proving in Programming.
Static and Dynamic Contract Verifiers For Java Hongming Liu.
Building a program verifier K. Rustan M. Leino Microsoft Research, Redmond, WA 10 May 2006 Guest lecture, Shaz Qadeer’s cse599f, Formal Verification of.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 5: Project and EiffelStudio Presentation.
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.
1 Advanced Material The following slides contain advanced material and are optional.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Well-cooked Spaghetti: Weakest-Precondition of Unstructured Programs Mike Barnett and Rustan Leino Microsoft Research Redmond, WA, USA.
Using and Building an Automatic Program Verifier K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond Lecture 5 LASER.
Describing Syntax and Semantics
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Ranga Rodrigo. Class is central to object oriented programming.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Murali Sitaraman
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Extended Static Checking for Java  ESC/Java finds common errors in Java programs: null dereferences, array index bounds errors, type cast errors, race.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Code Contracts Parameterized Unit Tests Tao Xie. Example Unit Test Case = ? Outputs Expected Outputs Program + Test inputs Test Oracles 2 void addTest()
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Joseph E. Hollingsworth
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Application: Correctness of Algorithms Lecture 22 Section 4.5 Fri, Feb 18, 2005.
Chapter 3 Part II Describing Syntax and Semantics.
Semantics In Text: Chapter 3.
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
Verificare şi Validarea Sistemelor Soft Tem ă Laborator 1 ESC/Java2 Extended Static Checker for Java Dat ă primire laborator: Lab 1 Dat ă predare laborator:
Early Detection of JML Specification Errors using ESC/Java2 Patrice Chalin Dependable Software Research Group (DSRG) Computer Science and Software Engineering.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
1 Contractual Consistency Between BON Static and Dynamic Diagrams Ali Taleghani July 30, 2004.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
Random Test Generation of Unit Tests: Randoop Experience
Software Engineering Algorithms, Compilers, & Lifecycle.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Chair of Software Engineering Void safety these slides contain advanced material and are optional.
Dafny An automatic program verifier for functional correctness
Testing Tutorial 7.
Weakest Precondition of Unstructured Programs
Programming Languages 2nd edition Tucker and Noonan
Hoare-style program verification
Dafny An automatic program verifier for functional correctness
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
CSE 1020:Software Development
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

Chair of Software Engineering Automatic Verification of Computer Programs

What is verification Check correctness of the implementation given the specification Static verification – Check correctness without executing the program – E.g. static type systems, theorem provers Dynamic verification – Check correctness by executing the program – E.g. unit tests, automatic testing Automatic verification – Push-button verification 2

How to get the specification Need machine-readable specification for automatic verification (not just comments) Different variants: – Eiffel‘s „Design by Contract“ With new across construct even features quantifiers –.Net 4.0 „Code Contracts“ Implmeneted contracts as a library – JML „Java Modeling Language“ Dialect of Java featuring contracts with special comments Writing expressive specification is difficult 3

Dynamic Verification Execute program and check that execution satisfies specification Manual – Write unit tests (xUnit framework) – Execute program and click around Automatic – Random testing Generate random objects Execute random routines 4

Random Testing Select routine under test Precondition used for input validation – Test is valid if it passes precondition Postcondition used as test oracle – Test is successful if it passes postcondition Improvements to random testing by making input selection smarter (e.g. use linear solver) 5

Random Testing Create random objects – Call random creation procedure – Call random commands – For arguments, generate random input Random basic types – Interesting values: Void, (2^31-1), 1, 0, -1, … Build object pool 6

Static Verification Need a model of the programming language – What is the effect of an instruction Translate program to a mathematical representation Use an automatic or interactive theorem prover to check that specification is satisfied in every possible execution 7

Translation to Boogie 8 implementation APPLICATION.make { var temp_1; entry: havoc temp_1; assume (temp_1 != Void) && (!Heap[temp_1, $allocated]); Heap[temp_1, $allocated] := true; Heap[temp_1, $type] := ACCOUNT; call create.ACCOUNT.make(temp_1); } implementation APPLICATION.make { var temp_1; entry: havoc temp_1; assume (temp_1 != Void) && (!Heap[temp_1, $allocated]); Heap[temp_1, $allocated] := true; Heap[temp_1, $type] := ACCOUNT; call create.ACCOUNT.make(temp_1); } make local a: ACCOUNT do create a.make end make local a: ACCOUNT do create a.make end

Translation to Boogie Translates AST from EiffelStudio to Boogie Uses Boogie verifier to check Boogie files Traces verification errors back to Eiffel source 9 EiffelStudio AutoProof Boogie Eiffel AST Boogie File Boogie Errors Eiffel Errors

Verification Demo EiffelStudio: AutoTest EVE: AutoProof VisualStudio: CodeContracts 10

Automatic Fault Correction 11 Build a test suite – E.g through automatic testing Find and localize faults – Failing test cases – Static analysis Try fixes – Apply fix templates and random code changes Validate fixes – Run test suite again, now all tests have to pass

Dynamic Contract Inference Build a test suite – E.g through automatic testing Run program and store interesting values in interesting program points – E.g. argument values on feature calls Post-analyze values and recognize patterns Propose new contracts based on patterns 12

Static Contract Inference Infer precondition from postcondition or other assertions – Weakest precondition calculus Infer loop invariants from postcondition – Generate mutations from postcondition 13

Putting It All Together 14 Compiler Automatic Tests Automatic Proof Element Statically Verified Element Statically Verified Automatic Fixes Manual Proof Automatic Contract Inference Manual Fixes Element Dynamically Verified Element Dynamically Verified

Demo VAMOC video 15

References EVE: AutoTest, AutoProof, AutoFix, CITADEL, …: CodeContracts: us/projects/contracts/ us/projects/contracts/ JML: 16