Crowfoot: a verifier for higher order store programs Billiejoe (Nathaniel) Charlton Ben Horsfall Bernhard Reus University of Sussex VMCAI 2012.

Slides:



Advertisements
Similar presentations
Technologies for finding errors in object-oriented software K. Rustan M. Leino Microsoft Research, Redmond, WA Lecture 1 Summer school on Formal Models.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and shows.
Semantics Static semantics Dynamic semantics attribute grammars
Verifying Executable Object-Oriented Specifications with Separation Logic Stephan van Staden, Cristiano Calcagno, Bertrand Meyer.
Automated Software Verification with a Permission-Based Logic 20 th June 2014, Zürich Malte Schwerhoff, ETH Zürich.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
The Fundamental Rule for Testing Methods Every method should be tested in a program in which every other method in the testing program has already been.
Formal reasoning about runtime code update Billiejoe (Nathaniel) Charlton Ben Horsfall Bernhard Reus HotSWUp 2011.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
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.
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
Changing perspective can be useful Relating alternative logics for automatic software verification Alex Summers (ETH Zurich) partly based on joint work.
Cmput Lecture 8 Department of Computing Science University of Alberta ©Duane Szafron 2000 Revised 1/26/00 The Java Memory Model.
ESC Java. Static Analysis Spectrum Power Cost Type checking Data-flow analysis Model checking Program verification AutomatedManual ESC.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
ESC Java. Static Analysis Spectrum Power Cost Type checking Data-flow analysis Model checking Program verification AutomatedManual ESC.
Review: forward E { P } { P && E } TF { P && ! E } { P 1 } { P 2 } { P 1 || P 2 } x = E { P } { \exists … }
1 Advanced Material The following slides contain advanced material and are optional.
Functional programming: LISP Originally developed for symbolic computing First interactive, interpreted language Dynamic typing: values have types, variables.
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
Pre/Post Condition Logic 03/06/2013. Agenda Hoare’s Logic Overview Application to Pre/Post Conditions.
Hoare logic for higher order store using simple semantics Billiejoe (Nathaniel) Charlton University of Sussex WoLLIC 2011.
JSP Java Server Pages Softsmith Infotech.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Basic Semantics Associating meaning with language entities.
© Andrew IrelandDependable Systems Group Cooperative Reasoning for Automatic Software Verification Andrew Ireland School of Mathematical & Computer Sciences.
A Universe-Type-Based Verification Technique for Mutable Static Fields and Methods Alexander J Summers Sophia Drossopoulou Imperial College London Peter.
Certifying Intermediate Programming Zhaopeng Li
RUN-Time Organization Compiler phase— Before writing a code generator, we must decide how to marshal the resources of the target machine (instructions,
ISBN Chapter 3 Describing Semantics.
Chapter 3 Part II Describing Syntax and Semantics.
Semantics In Text: Chapter 3.
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen.
12/9/20151 Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC Based in part on slides by Mattox.
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.
Introduction Program File Authorization Security Theorem Active Code Authorization Authorization Logic Implementation considerations Conclusion.
Lightweight Support for Magic Wands in an Automatic Verifier Malte Schwerhoff and Alexander J. Summers 10 th July 2015, ECOOP, Prague.
Fall 2008Programming Development Techniques 1 Topic 17 Assignment, Local State, and the Environment Model of Evaluation Section 3.1 & 3.2.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
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.
Procedure Definitions and Semantics Procedures support control abstraction in programming languages. In most programming languages, a procedure is defined.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Operational Semantics (Slides mainly.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Interface specifications At the core of each Larch interface language is a model of the state manipulated by the associated programming language. Each.
Operational Semantics of Scheme
Programming Languages and Compilers (CS 421)
Names and Attributes Names are a key programming language feature
The Relationship Between Separation Logic and Implicit Dynamic Frames
Stateful Manifest Contracts
METHODS AND BEHAVIORS AKEEL AHMED.
Mathematical Structures for Computer Science Chapter 1
Lecture 5 Floyd-Hoare Style Verification
Programming Languages and Compilers (CS 421)
Programming Languages 2nd edition Tucker and Noonan
Chapter 4 Action Routines.
UNIT V Run Time Environments.
Predicate Transformers
Predicates and Quantifiers
Learning Intention I will learn about the different types of programming errors.
RUN-TIME STORAGE Chuen-Liang Chen Department of Computer Science
Programming Languages and Compilers (CS 421)
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

Crowfoot: a verifier for higher order store programs Billiejoe (Nathaniel) Charlton Ben Horsfall Bernhard Reus University of Sussex VMCAI 2012

Outline Background on Higher Order Store (HOS) -What is HOS? Why should I care? -Reasoning about HOS programs: Hoare logic with nested triples Automated reasoning in Hoare logics with nested triples -What are the difficulties? -How we address them in our Crowfoot tool Some things we have verified using Crowfoot

What is higher order store? A programming language is said to feature HOS when: a program’s code / commands / procedures are part of the mutable store which the program manipulates as it runs

What is higher order store? A programming language is said to feature HOS when: a program’s code / commands / procedures are part of the mutable store which the program manipulates as it runs So HOS programs can modify their own code while running

What is higher order store? A programming language is said to feature HOS when: a program’s code / commands / procedures are part of the mutable store which the program manipulates as it runs So HOS programs can modify their own code while running Where does HOS occur? -in functional languages with mutable higher order state e.g. ML -dynamic loading and unloading of code e.g. Plugins, OSes -“hot update” – updating a program while it is running -runtime code generation

square brackets indicate heap access

stores procedure onto the heap, possibly doing partial application at the same time

square brackets indicate heap access stores procedure onto the heap, possibly doing partial application at the same time runs the procedure stored in the heap at address, with arguments

square brackets indicate heap access stores procedure onto the heap, possibly doing partial application at the same time runs the procedure stored in the heap at address, with arguments ordinary procedure call

But what should we write here? We need to describe the code which must be stored on the heap at address f

First attempt: says exactly which code is stored at f. But only allows us to invoke P if we’re adding 10! 

Second attempt: better. But still not really satisfying. Doesn’t seem like a generic specification.

Instead, we use a nested Hoare triple to talk about the behaviour of the code, rather than which exact code it is.

Nested triples first appear in work by Honda, Yoshida and Berger; later developments by many others.

Our tool Crowfoot Our tool Crowfoot implements (semi-) automated verification of HOS programs, using nested triples Employs symbolic execution with separation logic technique, as in Smallfoot, VeriFast, jStar... What issues did we face in implementing Crowfoot?

Issues for implementation Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible

Assertion language

This is all circular! So triples can be nested to arbitrary depth.

Issues for implementation Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap

Issues for implementation Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap Entailment prover for assertions involving nested triples

Consider the following entailment between symbolic states:

We need to find c to make this entailment between specifications hold:

Consider the following entailment between symbolic states: We need to find c to make this entailment between specifications hold: So, unlike in existing tools -Solving entailments between symbolic states requires solving entailments between specifications -And vice versa

Issues for implementation Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap Entailment prover for assertions involving nested triples Recursive specifications for programs which perform “recursion through the store”

Issues for implementation Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap Entailment prover for assertions involving nested triples Recursive specifications for programs which perform “recursion through the store” Implementing the deep frame rule

Provers: the of Crowfoot At its heart, crowfoot implements provers for five related judgements. 1.Symbolic execution:

Provers: the of Crowfoot At its heart, crowfoot implements provers for five related judgements. 1.Symbolic execution: predicate definitions, procedure context

Provers: the of Crowfoot At its heart, crowfoot implements provers for five related judgements. 1.Symbolic execution: For example: predicate definitions, procedure context

2.Entailment between symbolic states: Inferred frame I maps existentially bound variables to appropriate instance

2.Entailment between symbolic states: For example: Inferred frame I maps existentially bound variables to appropriate instance

2.Entailment between symbolic states: For example: Inferred frame I maps existentially bound variables to appropriate instance

2.Entailment between symbolic states: For example: 3.Entailment between specifications: For example: Inferred frame I maps existentially bound variables to appropriate instance

4.Computing the post-condition for a ‘call’ or ‘eval’: current symbolic state specification of routine about to be run

4.Computing the post-condition for a ‘call’ or ‘eval’: For example: current symbolic state specification of routine about to be run

4.Computing the post-condition for a ‘call’ or ‘eval’: For example: current symbolic state specification of routine about to be run

4.Computing the post-condition for a ‘call’ or ‘eval’: For example: 5.Finding a nested triple to use with ‘eval’: current symbolic state specification of routine about to be run current symbolic state address of code on heap to be run

4.Computing the post-condition for a ‘call’ or ‘eval’: For example: 5.Finding a nested triple to use with ‘eval’: For example: current symbolic state specification of routine about to be run current symbolic state address of code on heap to be run

4.Computing the post-condition for a ‘call’ or ‘eval’: For example: 5.Finding a nested triple to use with ‘eval’: For example: current symbolic state specification of routine about to be run current symbolic state address of code on heap to be run

Two of the proof rules

Recursion through the store Recursion through the store is when code on the heap invokes itself through a pointer Specifications for such code needs to appear in their own pre- conditions! Crowfoot allows the declaration of such specifications:

The deep frame rule The deep frame rule (introduced by Birkedal, Torp-Smith and Yang) allows adding invariants to a specification -like the regular frame rule -but the invariant is added at all nesting levels -allows some very nice modular proofs -we’ve implemented this in Crowfoot

The deep frame rule The deep frame rule (introduced by Birkedal, Torp-Smith and Yang) allows adding invariants to a specification -like the regular frame rule -but the invariant is added at all nesting levels: -allows some very nice modular proofs -we’ve implemented this in Crowfoot

Some things we have verified We have used Crowfoot to verify for example (models of): A generic memoiser for recursive functions (see the paper) -Makes very neat use of deep frame rule Updateable web server -A server which can be updated without stopping it running Programs that load and unload plugins as they run Higher order expression evaluator

Try Crowfoot online The End

Main rule for