Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chair of Software Engineering Automatic Verification of Computer Programs.

Similar presentations


Presentation on theme: "Chair of Software Engineering Automatic Verification of Computer Programs."— Presentation transcript:

1 Chair of Software Engineering Automatic Verification of Computer Programs

2 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

3 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

4 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

5 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

6 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

7 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

8 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

9 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

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

11 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

12 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

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

14 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

15 Demo VAMOC video 15

16 References EVE: http://se.inf.ethz.ch/research/eve/http://se.inf.ethz.ch/research/eve/ AutoTest, AutoProof, AutoFix, CITADEL, …: http://se.inf.ethz.ch/research/ http://se.inf.ethz.ch/research/ CodeContracts: http://research.microsoft.com/en- us/projects/contracts/ http://research.microsoft.com/en- us/projects/contracts/ JML: http://www.cs.ucf.edu/~leavens/JML/http://www.cs.ucf.edu/~leavens/JML/ 16


Download ppt "Chair of Software Engineering Automatic Verification of Computer Programs."

Similar presentations


Ads by Google