An Integration of Program Analysis and Automated Theorem Proving Bill J. Ellis & Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.

Slides:



Advertisements
Similar presentations
Functional Decompositions for Hardware Verification With a few speculations on formal methods for embedded systems Ken McMillan.
Advertisements

Demand-driven inference of loop invariants in a theorem prover
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Design by Contract.
Omnibus: A clean language and supporting tool for integrating different assertion-based verification techniques Thomas Wilson, Savi Maharaj, Robert G.
Software Model Checking with SMT Ken McMillan Microsoft Research TexPoint fonts used in EMF: A A A A A.
Verification and Validation
Synthesis, Analysis, and Verification Lecture 04c Lectures: Viktor Kuncak VC Generation for Programs with Data Structures “Beyond Integers”
Technology from seed Automatic Equivalence Checking of UF+IA Programs Nuno Lopes and José Monteiro.
A System to Generate Test Data and Symbolically Execute Programs Lori A. Clarke September 1976.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
1 Dependent Types for Termination Verification Hongwei Xi University of Cincinnati.
LIFE CYCLE MODELS FORMAL TRANSFORMATION
B. Sharma, S.D. Dhodapkar, S. Ramesh 1 Assertion Checking Environment (ACE) for Formal Verification of C Programs Babita Sharma, S.D.Dhodapkar RCnD, BARC,
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
Linear Obfuscation to Combat Symbolic Execution Zhi Wang 1, Jiang Ming 2, Chunfu Jia 1 and Debin Gao 3 1 Nankai University 2 Pennsylvania State University.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Nikolaj Bjørner Microsoft Research Lecture 3. DayTopicsLab 1Overview of SMT and applications. SAT solving, Z3 Encoding combinatorial problems with Z3.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
A Type System for Expressive Security Policies David Walker Cornell University.
Describing Syntax and Semantics
State coverage: an empirical analysis based on a user study Dries Vanoverberghe, Emma Eyckmans, and Frank Piessens.
CS527: (Advanced) Topics in Software Engineering Overview of Software Quality Assurance Tao Xie ©D. Marinov, T. Xie.
Language Evaluation Criteria
Verification and Validation Yonsei University 2 nd Semester, 2014 Sanghyun Park.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Verification and Validation.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Is Proof More Cost-Effective Than Testing? Presented by Yin Shi.
© Andrew IrelandDependable Systems Group Proof Automation for the SPARK Approach to High Integrity Ada Andrew Ireland Computing & Electrical Engineering.
1 Program Correctness CIS 375 Bruce R. Maxim UM-Dearborn.
© Andrew IrelandDependable Systems Group. © Andrew IrelandDependable Systems Group Proof Automation for the SPARK Approach to High Integrity Ada Andrew.
© Andrew IrelandDependable Systems Group Cooperative Reasoning for Automatic Software Verification Andrew Ireland School of Mathematical & Computer Sciences.
© Andrew IrelandDependable Systems Group ITI Techmedia and Technology Transfer Andrew Ireland Dependable Systems Group School of Mathematical & Computer.
(On secondment at) Praxis High Integrity Systems Bath Dependable Systems Group School of Mathematical & Computer Sciences Heriot-Watt University Edinburgh.
© Andrew IrelandDependable Systems Group Cooperative Reasoning for Automatic Software Verification Andrew Ireland Dependable Systems Group School of Mathematical.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Joseph E. Hollingsworth
Formal Verification Lecture 9. Formal Verification Formal verification relies on Descriptions of the properties or requirements Descriptions of systems.
© Andrew IrelandDependable Systems Group Cooperative Reasoning for Automatic Software Verification Andrew Ireland School of Mathematical & Computer Sciences.
© Andrew IrelandDependable Systems Group On the Scalability of Proof Carrying Code for Software Certification Andrew Ireland School of Mathematical & Computer.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
© Gudmund Grov & Andrew Ireland Dependable Systems Group Planning for System Development Gudmund Grov & Andrew Ireland Dependable Systems Group School.
Bill J. Ellis Dependable Systems Group Heriot-Watt University (Project page: Proving Exception.
QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs By Koen Claessen, Juhn Hughes ME: Mike Izbicki.
© 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.
© Andrew IrelandDependable Systems Group Proof Automation for the SPARK Approach to High Integrity Ada Andrew Ireland Computing & Electrical Engineering.
Scientific Debugging. Errors in Software Errors are unexpected behaviors or outputs in programs As long as software is developed by humans, it will contain.
SPADEase: The Good, the Bad and the Ugly Bill J Ellis Dependable Systems Group School of Mathematical & Computer Sciences Heriot-Watt University Edinburgh.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
Combining Static and Dynamic Reasoning for Bug Detection Yannis Smaragdakis and Christoph Csallner Elnatan Reisner – April 17, 2008.
© Andrew IrelandGrand Challenges for Computing Research 2004 The Verifying Compiler Andrew Ireland Dependable Systems Group School of Mathematical & Computer.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
1 Computer Algorithms Tutorial 2 Mathematical Induction Some of these slides are courtesy of D. Plaisted et al, UNC and M. Nicolescu, UNR.
© Andrew IrelandDependable Systems Group The Use of Patterns to Guide Code Certification: A Proposal Andrew Ireland School of Mathematical & Computer Sciences.
© Andrew IrelandDependable Systems Group Increasing Automation for Exception Freedom Proofs Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.
Interface specifications At the core of each Larch interface language is a model of the state manipulated by the associated programming language. Each.
Bill J. Ellis Dependable Systems Group Heriot-Watt University (Project page: Proving Exception.
Types for Programs and Proofs
Automating Induction for Solving Horn Clauses
Levels of Software Assurance in SPARK
Cooperative Reasoning for Automatic Software Verification
A Verification Condition Visualizer
IS 2935: Developing Secure Systems
Proof Automation for the SPARK Approach to High Integrity Ada
Automatic Software Verification: A Renaissance
Presentation transcript:

An Integration of Program Analysis and Automated Theorem Proving Bill J. Ellis & Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt University Edinburgh

Context Investigate the role of proof planning within the SPARK approach to high integrity software Funded by the EPSRC Critical Systems programme (GR/R24081) in collaboration with Praxis Critical Systems Ltd.

Overview The SPARK approach Program verification in SPARK NuSPADE: Our Approach –Proof planning –Program analysis –Example Results and future work Conclusions

The SPARK Approach Developed by Praxis Critical Systems Ltd. For high integrity software: –Safety, security and mission critical software, e.g. SHOLIS - UK MoD Def Standard SPARK is a programming language: –Defined as a subset of Ada that: Eliminates ambiguities to make static analysis possible Eliminates complexities to makes static analysis feasible Can be compiled by any Ada compiler! –Specification via code level annotations

The SPARK Tools Examiner: –Checks conformance to the SPARK subset –Performs information and data flow static analysis –Generates Verification Conditions (VCs) for both: partial correctness (correct if program terminates) Exception freedom (no run time errors) SPADE proof tools: –SPADE Simplifier a special purpose theorem prover –SPADE Proof Checker an interactive theorem prover

SPARK code + specification Examiner Program Verification in SPARK Verification Conditions SPADE Simplifier Typically 93% of exception freedom VCs are discharged automatically following this process Proof!

Program Verification in SPARK But the remaining 7% still account for hundreds of VCs... SPARK code + specification Verification Conditions SPADE Simplifier Remaining Verification Conditions Examiner Proof!

Why the Simplifier can Fail VC not provable: –Bug in the code –Bug in the specification The Simplifier is not strong enough: –Stronger invariant required –Stronger proof methods required

Program Verification in SPARK Proof Script SPADE Proof Checker Strengthen invariant Discover proof User intervention SPARK code + specification Verification Conditions Proof!SPADE Simplifier Remaining Verification Conditions Examiner Proof!

NuSPADE: Our Approach Proof Script SPADE Proof Checker Strengthen invariant Discover proof SPARK code + specification Verification Conditions Proof!SPADE Simplifier Remaining Verification Conditions Examiner Proof! Still remaining Verification Conditions! NuSPADE

Increase proof automation Integrates proof and program analysis: –Proof planner –Program analysis oracle

Proof Planning Use of high-level proof outlines, known as proof plans, to guide proof search Supports middle-out reasoning, i.e. the use of meta variables to delay choice during proof search Automatic proof patching via proof failure analysis, e.g. conjecture generalization, lemma discovery, induction revision, case splitting, loop invariant discovery Inductive and non-inductive applications

Conjectures Proof checking: Methods + Critics Tactics Theory Proof planning: Proof Planning

Program Analysis Program analysis automatically finds interesting properties about source code Program analysis in practice: –Flow analysis –Performance analysis –Discovering constraints on variables (Abstract Interpretation) –Discovery code properties (invariant discovery)

NuSPADE Behaviour Strengthen invariant Discover proof SPARK code + specification SPADE Proof Checker Verification Conditions Proof!SPADE Simplifier Examiner Proof! Remaining Verification Conditions Proof Script Still remaining Verification Conditions! NuSPADE

NuSPADE Behaviour Strengthen invariant Discover proof SPARK code + specification Remaining Verification Conditions Proof Script Still remaining Verification Conditions! NuSPADE

NuSPADE Behaviour NuSPADE Remaining Verification Conditions Discover proof Proof Script Proof planner

NuSPADE Behaviour NuSPADE Remaining Verification Conditions Inequality / general reasoning tool Recurrence relation solver Strengthen invariant SPARK code + specification Program analysis oracle Proof planner

NuSPADE Behaviour NuSPADE Remaining Verification Conditions Discover proof Proof Script Proof planner

NuSPADE Behaviour NuSPADE Remaining Verification Conditions Still remaining Verification Conditions! No proof found Proof planner

Example subtype Index is Integer range 0.. 9; type D_Type is array (Index) of Integer; subtype R_Type is Integer; … R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop;

subtype Index is Integer range 0.. 9; type D_Type is array (Index) of Integer; subtype R_Type is Integer; … R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop; Integer’first  R+D(I)  Integer’last Example

Elementary: Pre: Trivial goal Effect: Assume provable in proof checker Fertilise: Pre: Part of the goal matches a hypothesis Effect: Simplify the goal Decomposition: Pre: The goal has a transitive relation Effect: Decompose the transitive relation Transitivity: Pre: The goal has a transitive relation and related hypotheses Effect: Apply transitive step Exception Freedom Proof Methods

Preconditions: there exists a conclusion of the form: Expression RelationOp Constant For every Variable i in Expression there exists a hypothesis of the form: Variable i RelationOp Expresssion i Transitivity Method and Critic Method Method applicable - apply the method! X Critic Method not applicable – critic extracts hypothesis schemas and invokes program analysis oracle

Example: Proof Failure Hypotheses: Conclusion: None of the methods are applicable. However, the transitivity critic fires as: occurs in: but there is no hypothesis of the form: (Similarly the lower bound causes the critic to fire as there is no hypothesis of the form: )

Discover a property that introduces hypotheses of the form: and Program analysis heuristics: –Type and other immediate information –Non looping code –Looping code (Involves recurrence relations) –Exiting loops (Consider loop guards) Example: Program Analysis

R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop; Example: Program Analysis

Example: Program Analysis (Variable I) R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop;

Example: Program Analysis (Variable R, first disjunct) R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop;

Example: Program Analysis (Variable R, second disjunct) R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop;

Example: Program Analysis (Variable R, combine disjuncts) R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop;

Example: Program Analysis (Eliminate n) R:=0; For I in Index loop if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop;

Revised code subtype Index is Integer range 0.. 9; type D_Type is array (Index) of Integer; subtype R_Type is Integer; … R:=0; For I in Index loop --# assert R >= 0 and R <= I*100; if D(I) >= 0 and D(I) <= 100 then R:= R+D(I); end if; end loop;

Example: Proof Planning Success Transitivity: Decomposition: Fertilise: Elementary: Hypotheses: Conclusion:

Results & Future Work Prototype system – Demo Available! Integration partial Development corpus includes programs with simple loops and conditionals, i.e. typical style of critical software applications Evaluation corpus supplied by Praxis Critical Systems – evaluation phase to begin shortly

Future Work Strengthen recurrence relation solver and experiment with other external reasoners, e.g. inequality reasoning Explore program analysis as a basis for bug finding (ongoing) Explore program analysis as a basis for reducing VC complexity

Conclusions An integrated approach to software verification: –Proof planning –Program analysis oracle –Proof checking –External reasoners Proof planning and program analysis are generic