(One-Path) Reachability Logic

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
Semantics Static semantics Dynamic semantics attribute grammars
ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Constraint Semantics for Abstract Read Permissions 28 th July 2014, FTfJP, Uppsala John Tang Boyland (UW-Milwaukee/ETH Zurich) Peter Müller, Malte Schwerhoff,
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
1 How to transform an analyzer into a verifier. 2 OUTLINE OF THE LECTURE a verification technique which combines abstract interpretation and Park’s fixpoint.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
1 Dependent Types for Termination Verification Hongwei Xi University of Cincinnati.
Formal Semantics of Programming Languages 虞慧群 Topic 5: Axiomatic Semantics.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 19: Minding Ps & Qs: Axiomatic.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
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
An Integration of Program Analysis and Automated Theorem Proving Bill J. Ellis & Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.
1 Basic abstract interpretation theory. 2 The general idea §a semantics l any definition style, from a denotational definition to a detailed interpreter.
PSUCS322 HM 1 Languages and Compiler Design II Formal Semantics Material provided by Prof. Jingke Li Stolen with pride and modified by Herb Mayer PSU Spring.
A Type System for Expressive Security Policies David Walker Cornell University.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Describing Syntax and Semantics
Mechanized Metatheory for User- Defined Type Extensions Dan Marino, Brian Chin, Todd Millstein UCLA Gang Tan Boston College Robert J. Simmons, David Walker.
Matching Logic Grigore Rosu University of Illinois at Urbana-Champaign, USA 1.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
CS 363 Comparative Programming Languages Semantics.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Joseph E. Hollingsworth
Checking Reachability using Matching Logic Grigore Rosu and Andrei Stefanescu University of Illinois, USA.
Chapter 3 Part II Describing Syntax and Semantics.
From Hoare Logic to Matching Logic Reachability Grigore Rosu and Andrei Stefanescu University of Illinois, USA.
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.
All-Path Reachability Logic Andrei Stefanescu 1, Stefan Ciobaca 2, Radu Mereuta 1,2, Brandon Moore 1, Traian Serbanuta 3, Grigore Rosu 1 1 University of.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
Specify and Verify Your Language using K Grigore Rosu University of Illinois at Urbana-Champaign Joint project between the FSL group at UIUC (USA) and.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
Duminda WijesekeraSWSE 623: Introduction1 Introduction to Formal and Semi- formal Methods Based on A Specifier's Introduction to Formal Methods (J. Wing)
1 Lecture 3 The Languages of K, T, B and S4. 2 Last time we extended the language PC to the language S5 by adding two new symbols ‘□’ (for ‘It is necessary.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
June 21, Reasoning about explicit strictness in a lazy language using mixed lazy/strict semantics Marko van Eekelen Maarten de Mol Nijmegen University,
K Framework Grigore Rosu University of Illinois at Urbana-Champaign, USA Traian-Florin Serbanuta Alexandru Ioan-Cuza University, Iasi, Romania Joint work.
Certifying and Synthesizing Membership Equational Proofs Patrick Lincoln (SRI) joint work with Steven Eker (SRI), Jose Meseguer (Urbana) and Grigore Rosu.
Spring 2017 Program Analysis and Verification
Grigore Rosu University of Illinois at Urbana-Champaign, USA
Textbook: Principles of Program Analysis
Sparkle a functional theorem prover
Proof Carrying Code and Proof Preserving Program Transformations
Matching Logic An Alternative to Hoare/Floyd Logic
Towards trustworthy refactoring in Erlang
Behavioral Rewrite Systems and Behavioral Productivity
runtime verification Brief Overview Grigore Rosu
Formal Methods in Software Engineering 1
Jared Davis The University of Texas at Austin April 6, 2006
Matching Logic - A New Program Verification Approach -
Logical architecture refinement
Lecture 5 Floyd-Hoare Style Verification
Axiomatic semantics Points to discuss: The assignment statement
Programming Languages and Compilers (CS 421)
IS 2935: Developing Secure Systems
Internet of Things A Process Calculus Approach
Reduction in End-User Shape Analysis
Logic for Computer Security Protocols
Semantics In Text: Chapter 3.
Finite-Trace Linear Temporal Logic: Coinductive Completeness
Towards a Unified Theory of Operational and Axiomatic Semantics
Language-Independent Verification Framework
Program correctness Axiomatic semantics
Programming Languages and Compilers (CS 421)
Presentation transcript:

(One-Path) Reachability Logic Grigore Rosu, Andrei Stefanescu, Brandon Moore University of Illinois at Urbana-Champaign, USA Stefan Ciobaca University Alexadru Ioan Cuza, Romania

Long-Standing Dream Deductive program verifier Parser Interpreter Formal Language Definition (Syntax and Semantics) Model checker Symbolic execution (semantic) Debugger One long-standing dream of the programming language community is to have a framework that allows and encourages the language designers to formally define their languages once and for all, using an intuitive and attractive notation, and then obtain essentially for free implementations as well as analysis tools for the defined languages. Compiler

Language Frameworks PLT-Redex/Racket (Findler et al.) OTT (Sewell et al.) PLanComps (Mosses et al.) Raskal (Klint et al.) RLS-Maude (Meseguer et al.) K (Rosu et al.) … All based on operational semantics Defined semantics serve as language reference models of languages, but are close to useless for verification Takes 1-2 years to define a language

C Semantics (in K) C configuration … plus ~1200 user-defined rules To give an idea what it takes to define a large language, here is, for example, the configuration of C. It has more than 70 cells! The heap, which is the subject of so many debates in program verification, is just one of them. … plus ~1200 user-defined rules … plus ~1500 automatically generated rules

Operational Semantics Virtually all operational semantics can be defined with rewrite rules of the form We would like to reason about programs using precisely such operational semantics!

State-of-the-Art Many different program logics for “state” properties: FOL, HOL, Separation logic… Redefine the language using a different semantic approach (Hoare/separation/dynamic logic) Very language specific, error-prone; e.g.:

State-of-the-Art Thus, these semantics need to be proved sound, sometimes also relatively complete, wrt trusted, operational semantics of the language Verification tools developed using them So we have an inherent gap between trusted, operational semantics, and the semantics currently used for program verification

Our Proposal Use directly the trusted operational semantics! Has been done before (ACL2), but proofs are low-level (induction on the structure of program or on steps in transition system) and language-specific We give a language-independent proof system Takes unchanged operational semantics as axioms Derives reachability rules Both operational semantics rules and program properties stated as reachability rules Is sound (partially correct) and relatively complete

Need a means to specify static and dynamic program properties Deductive program verifier Parser Interpreter Formal Language Definition (Syntax and Semantics) Model checker Symbolic execution (semantic) Debugger Compiler

Matching Logic [Rosu, Ellison, Schulte 2010] Logic for specifying static properties about program configurations and reason with them Key insight: Configuration terms with variables are allowed to be used as predicates, called patterns Semantically, their satisfaction means matching Matching logic is parametric in a (first-order) configuration model: typically the underlying model of the operational semantics

Configurations For concreteness, assume configurations having the following syntax: (matching logic works with any configurations) Examples of concrete (ground) configurations:

Patterns Concrete configurations are already patterns, but very simple ones, ground patterns Example of more complex pattern Thus, patterns generalize both terms and [FOL]

Matching Logic Reasoning We can now prove (using [FOL] reasoning) properties about configurations, such as

Matching Logic vs. Separation Logic Matching logic achieves separation through matching at the structural (term) level, not through special logical connectives (*). Separation logic = Matching logic [heap] SL: ML: Matching logic realizes separation at all levels of the configuration, not only in the heap the heap was only 1 out of the 75 cells in C’s def. [OOPSLA’12]

Need a means to specify static and dynamic program properties Deductive program verifier Parser Interpreter Formal Language Definition (Syntax and Semantics) Model checker Symbolic execution (semantic) Debugger Compiler

Reachability Rules - Syntax “Rewrite” rules over matching logic patterns: Since patterns generalize terms, matching logic reachability rules capture term rewriting rules Moreover, deals naturally with side conditions: turn into

Conditional Reachability Rules The involved patterns can share free variables Generalize conditional rewrite rules

Reachability Rules - Semantics In the transition system generated by the operational semantics on the configuration model, any terminating configuration that matches reaches a configuration that matches (patterns can share free variables) That is, partial correctness

Expressivity of Reachability Rules Capture operational semantics rules: Capture Hoare Triples:

Hoare Triple = Syntactic Sugar This is a code fragment from a program reversing a singly-linked list verified by MatchC (which we will discuss later). The invariant, states that p points to the part of the list already reversed, and x points to the part of the list yet to be reversed. This Hoare-style invariant is just syntactic sugar for a reachability rule. The LHS combines the code of the loop (shown in red) and the invariant, while in the RHS the code has been executed, and the condition of the loop has been evaluated with the semantics and its negation added as a constraint (shown in blue).

Reachability Logic Language-independent proof system that derives reachability rules from other reachability rules: The main result of the paper is a language-independent proof system which derives reachability rules specifying program properties from trusted reachability rules. In the beginning the trusted rules are just the operational semantics rules. During the proof one can claim additional reachability rules, which cannot be used right away. They can be used only after taking at least one step with the trusted rules in A. // The rules in C are added to those on A only after taking at least one step with the trusted rules in A. Trusted reachability rules (starts with operational semantics) Target reachability rule Intuitively: symbolic execution with operational semantics + reasoning with cyclic behaviors Claimed reachability rules

7 Proof Rules for Reachability

Traditional Verification vs. Our Approach Traditional proof systems: language-specific Our proof system: language-independent

Results Soundness (partial correctness): Under weak well-definedness conditions on (see paper) Mechanized in Coq, for verification certificates Relative completeness: Under weak assumptions on the configuration model (e.g., it can express Godel’s beta predicate)

Implementation Being implemented within the K framework Symbolic execution using the operational semantic rules; custom solver for the matching part + Z3 solver for the model reasoning part (for the Consequence rule) Circularity steps given by user (via pre/post/inv annotations), everything else automatic Online interface available for fragment of C at http://matching-logic.org

Related Work and Limitations Hoare logic: already explained Dynamic logic: need to redefine language semantics (invariant rules, etc.), but more expressive: CTL*: expressive, but not clear how to integrate with operational semantics; maybe CTL* over ML patterns? Currently we only support one-path reachability for conditional rules. We have a similar proof system for all-path reachability, but only with unconditional rules Previous one-path attempts: [ICALP’12] , [OOPSLA’12]

Conclusion Program verification using the language operational semantics is possible and feasible Language-independent 7-rule reachability proof system, which is sound and complete Circularity generalizes the invariant rules Being implemented in the K programming language design framework