26-27/05/2016 An incremental approach to Formal verification for Java applications Teodor Parvanov May 26-27 ‘16, Sofia 1.

Slides:



Advertisements
Similar presentations
Copyright W. Howden1 Programming by Contract CSE 111 6/4/2014.
Advertisements

PZ03D Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03D - Program verification Programming Language Design.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
The Java Modeling Language JML Erik Poll Digital Security Radboud University Nijmegen.
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
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1.
SEERE, Neum 2009 Runtime verification of Java programs using ITL Vladimir Valkanov, Damyan Mitev Plovdiv, Bulgaria.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
Static and Dynamic Contract Verifiers For Java Hongming Liu.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Operational Semantics.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
Chair of Software Engineering Automatic Verification of Computer Programs.
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
What Exactly are the Techniques of Software Verification and Validation A Storehouse of Vast Knowledge on Software Testing.
02/06/05 “Investigating a Finite–State Machine Notation for Discrete–Event Systems” Nikolay Stoimenov.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Verification and Validation Overview References: Shach, Object Oriented and Classical Software Engineering Pressman, Software Engineering: a Practitioner’s.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
ISBN Chapter 3 Describing Semantics.
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.
1 / 48 Formal a Language Theory and Describing Semantics Principles of Programming Languages 4.
Verification & Validation By: Amir Masoud Gharehbaghi
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Course: Software Engineering – Design I IntroductionSlide Number 1 What is a specification Description of a (computer) system, which:  is precise;  defines.
Copyright 1999 G.v. Bochmann ELG 7186C ch.1 1 Course Notes ELG 7186C Formal Methods for the Development of Real-Time System Applications Gregor v. Bochmann.
Principles of Programming & Software Engineering
ICS 3UI - Introduction to Computer Science
Arab Open University 2nd Semester, M301 Unit 5
Verification and Validation Overview
Reasoning About Code.
Reasoning about code CSE 331 University of Washington.
Partial Differential Equations and Applied Mathematics Seminar
Accessible Formal Methods A Study of the Java Modeling Language
Testing & Testing Tools
Formal Methods in Software Engineering 1
Algorithm and Ambiguity
Turing Machines, Busy Beavers, and Big Questions about Computing
B (The language of B-Method )
TRANSLATORS AND IDEs Key Revision Points.
Copyright © Cengage Learning. All rights reserved.
Lecture 5 Floyd-Hoare Style Verification
IS 2935: Developing Secure Systems
Programming Languages 2nd edition Tucker and Noonan
ITEC452 Distributed Computing Lecture 5 Program Correctness
Semantics In Text: Chapter 3.
Algorithm and Ambiguity
The Programming Language L
Software Verification and Validation
Software Verification and Validation
Java Programming Loops
Java Modeling Language (JML)
The Programming Language L
Software Verification and Validation
Computer Science 340 Software Design & Testing
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

26-27/05/2016 An incremental approach to Formal verification for Java applications Teodor Parvanov May ‘16, Sofia 1

26-27/05/2016 About me I currently work at VMware Bulgaria, working on standing up the fully automated Software-Defined Data Center (SDDC) University background in Maths/Physics & Computer science “made in France” => Unhealthy tendency towards modelling stuff using mathematical equations Computer programs being also “stuff”, why not try and model them with equations too (a.k.a Formal verification) ? 2

26-27/05/2016 Even deepest philosophical questions… 3

26-27/05/2016 An example from aerodynamics Longitudinal stability Required so that the pilot (and underlying electronic and mechanical systems) can keep the aircraft stable without significant intervention => simulation based on the laws of mechanics and aerodynamics 4

26-27/05/2016 Mathematical equations of stability 5

26-27/05/2016 So why not computer programs ? Formal verification is successfully applied in: HW industry Embedded SW Transportation systems Energy production Manufacturing “Mainstream” software is lagging behind: Banking, finance, insurance Healthcare Flight ticket reservations Electronic voting 6

26-27/05/2016 Java - let’s start simple ! 7

26-27/05/2016 Correct ? 8

26-27/05/2016 Can we specify this in mathematical terms? 9

26-27/05/2016 Disclaimer ! Use of mild mathematical language follows 10

26-27/05/2016 A calculus for computation? 11 We need a formal system (a calculus) to reason about correctness Logically proven correctness provides quality guarantees far beyond what any amount of testing can

26-27/05/2016 First-order logic (FOL) 12

26-27/05/2016 FOL examples 13

26-27/05/2016 Well, you know … 14

26-27/05/2016 Program correctness Specification The precise statement of the properties a program should exhibit Translates into a set of program annotations asserting properties over program variables The language of FOL provides precision Partial correctness (safety properties) If a program halts, then its output satisfies some relation with its input “Nothing bad happens” Total correctness (progress properties) Certain states are eventually reached during program execution “Something good eventually happens” 15

26-27/05/2016 Program correctness Specification The precise statement of the properties a program should exhibit Translates into a set of program annotations asserting properties over program variables The language of FOL provides precision Partial correctness (safety properties) If a program halts, then its output satisfies some relation with its input “Nothing bad happens” Total correctness (progress properties) Certain states are eventually reached during program execution “Something good eventually happens” 16

26-27/05/2016 Partial correctness notation 17

26-27/05/2016 First-Order Logic for Java JML (Java Modelling Language) Embedded as Java comments with or */ Java-like syntax extended with new keywords for specification: forall, exists, requires, ensures, \invariant, \loop_invariant, \pure… Implemented by the OpenJML library Supported annotations Method pre-/post-condition (e.g. requires x >= 0) Class invariant (e.g. this.accountBalance >= 0) 18

26-27/05/2016 Can we make all this a bit more precise ? 19

26-27/05/2016 Our first JML specification ! 20

26-27/05/2016 Incrementally leveraging JML annotations Very precise code documentation Actually such a specification exists for key parts of the JDK ! Javadoc can also be generated out of JML annotations Test suite generation (using JML as a test oracle) JMLUnitNG Jartege, Tobias Formal proof of correctness (could be justified for certain core components) manual automated (KeY, OpenJML) 21

26-27/05/2016 Demo time ! 22

26-27/05/2016 Key takeaways Formal specification is not that hard (and fun !) And Java supports it (via OpenJML) Formal specification can be introduced incrementally Possible areas of application Core project libraries Frameworks Mission-critical business logic (“pure” methods) 23

26-27/05/2016 Q & A 24

26-27/05/2016 THANK YOU :) You can find me at: Teodor Parvanov May ’16, Sofia 25