Matching Logic A New Program Verification Approach

Similar documents
Matching Logic. Grigore Rosu University of Illinois at Urbana-Champaign

K and Matching Logic

From Hoare Logic to Matching Logic Reachability. Grigore Rosu and Andrei Stefanescu University of Illinois, USA

Semantics-Based Program Verifiers for All Languages

Main Goal. Language-independent program verification framework. Derive program properties from operational semantics

An Overview of the K Framework. Grigore Rosu University of Illinois at Urbana Champaign (joint work with Traian Florin Serbanuta)

Outline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context

Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois

On Formal Analysis of OO Languages using. OO Languages and Rewriting Logic: Designing for Performance

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Design

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics

CS422 - Programming Language Design

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

What do Compilers Produce?

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics

CS252 Advanced Programming Language Principles. Prof. Tom Austin San José State University Fall 2013

Monads. Mark Hills 6 August Department of Computer Science University of Illinois at Urbana-Champaign

Page 1. Reading assignment: Reviews and Inspections. Foundations for SE Analysis. Ideally want general models. Formal models

Chapter 1. Introduction

Introduction to Formal Methods

Formal Semantics of Programming Languages

CS 6371: Advanced Programming Languages

Formal Semantics of Programming Languages

Reading assignment: Reviews and Inspections

Introduction. COMP 524: Programming Language Concepts Björn B. Brandenburg. The University of North Carolina at Chapel Hill

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

! Use of formal notations. ! in software system descriptions. ! for a broad range of effects. ! and varying levels of use. !

9/3/2016. ECE 120: Introduction to Computing. Few Programmers Write Instructions (Assembly Code) Spend a Week Learning the C Programming Language

CMSC 330: Organization of Programming Languages. Operational Semantics

Formats of Translated Programs

Semantics of programming languages

Software System Design and Implementation

Understanding and Verifying JavaScript Programs

AN EXAMPLE-BASED INTRODUCTION TO K

3.7 Denotational Semantics

Towards a Module System for K

Finding and Fixing Bugs in Liquid Haskell. Anish Tondwalkar

CS422 - Programming Language Design

Topic Formal Methods. ICS 121 Lecture Notes. What are Formal Methods? What are Formal Methods? Formal Specification in Software Development

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

CSc 520 Principles of Programming Languages

Rewriting Needs Constraints and Constraints Need Rewriting

CS422 - Programming Language Design

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

RAISE in Perspective

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

Verification of Selection and Heap Sort Using Locales

Simply-Typed Lambda Calculus

Q Body of techniques supported by. R precise mathematics. R powerful analysis tools. Q Rigorous, effective mechanisms for system.

Contents. Chapter 1 SPECIFYING SYNTAX 1

Programming Languages Third Edition

Semantics of programming languages

Formal Systems and their Applications

Computing Fundamentals 2 Introduction to CafeOBJ

Denotational Semantics. Domain Theory

Low-Level Program Verification using Matching Logic Reachability

Program analysis parameterized by the semantics in Maude

First-class Implementations

CS422 - Programming Language Design

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CS 242. Fundamentals. Reading: See last slide

The Maude LTL Model Checker and Its Implementation

The Structure of a Syntax-Directed Compiler

Compilers Project Proposals

A Certified Non-Interference Java Bytecode Verifier

CS422 - Programming Language Design

Verified compilers. Guest lecture for Compiler Construction, Spring Magnus Myréen. Chalmers University of Technology

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

CS558 Programming Languages

PROGRAM ANALYSIS & SYNTHESIS

Combining Static and Dynamic Contract Checking for Curry

COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor

Compilers. History of Compilers. A compiler allows programmers to ignore the machine-dependent details of programming.

The Chemical Abstract Machine

Software System Design and Implementation

Semantics of programming languages

The Structure of a Compiler

Formalization of Incremental Simplex Algorithm by Stepwise Refinement

History of Compilers The term

K-Maude. K-Maude. A Rewriting Based Tool for Semantics of Programming Languages. University of Illinois at Urbana-Champaign WRLA / 66

ArgoSMTExpression: an SMT-LIB 2.0 compliant expression library

Compiler Design Spring 2018

CSC 501 Semantics of Programming Languages

Tail Calls. CMSC 330: Organization of Programming Languages. Tail Recursion. Tail Recursion (cont d) Names and Binding. Tail Recursion (cont d)

Detecting Metamorphic Computer Viruses using Supercompilation

A Trustworthy Monadic Formalization of the ARMv7 Instruction Set Architecture. Anthony Fox and Magnus O. Myreen University of Cambridge

Data Analytics and Dynamic Languages. Lee E. Edlefsen, Ph.D. VP of Engineering

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

The Haskell HOP: Higher-order Programming

CSCI-GA Scripting Languages

Crafting a Compiler with C (II) Compiler V. S. Interpreter

Paradigms of computer programming

Midwest Verification Day 2011


Chapter 3 (part 3) Describing Syntax and Semantics

Topics Covered Thus Far CMSC 330: Organization of Programming Languages

The design of a programming language for provably correct programs: success and failure

22c:111 Programming Language Concepts. Fall Syntax III

Cover Page. The handle holds various files of this Leiden University dissertation

Transcription:

Matching Logic A New Program Verification Approach Grigore Rosu and Andrei Stefanescu University of Illinois at Urbana-Champaign (work started in 2009 with Wolfram Schulte at MSR)

Usable Verification Relatively clear objectives: Better tools, more connected, more user friendly Teach students verification early Get the best from what we have But could it be that, after 40 years of program verification, we still lack the right semantically grounded program verification foundation?

Current State-of-the-Art Consider some programming language, L Formal semantics of L Typically skipped: considered expensive and useless Model checkers for L Based on some adhoc encodings of L Program verifiers for L Based on some other adhoc encodings of L Runtime verifiers for L Based on yet another adhoc encodings of L

Semantic Gap Why would I trust any of these tools for L? How do they relate to L? What is L? Example: the C (very informal) manual implies that (x=0)+(x=0) is undefined Yet, all C verifiers we looked into prove it = 0

Ideal Scenario Have one formal definition of L which serves all the semantic and verification purposes Execution of L programs (use for extensive testing) L Model checking of L programs Proving L programs correct

Our Approach Define languages using the K framework A rewrite based framework which generalizes both evaluation contexts and the CHAM A programming language is a K system Algebraic signature (syntax + configuration) K rewrite rules (make read/write parts explicit) Compile K to different back-ends To OCAML for efficient interpreters (experimental) To Maude for execution, debugging, verification

KernelC

Matching Logic Builds upon operational semantics We use K, but in principle can work with any op semantics: a formal notion of configuration is necessary With K, we do not modify anything in the original sem! Extends the PL semantics with matching logic specifications, or patterns; for example, specifies all configurations in which program variable root points to a tree T in the heap

Demo

Highlights Matching logic builds upon giants shoulders Matching and rewriting modulo have been researched extensively; efficient algorithms (Maude) despite its complexity (NP complete w/o constraints) Mathematical universe axiomatized using well understood and developed algebraic specification

Matching is Powerful The underlying rewrite machinery of K works by means of matching So programming language semantics, which is most of the matching logic rules, is matching Pattern assertion reduces to matching Framing reduces to matching Separation reduces to matching Nothing special needs to be done for separation or for framing!

K and Matching Logic Scale We defined several real languages so far Complete: C (C99), Scheme Large subsets: Verilog, Java 1.4 In work: X10, Haskell, JavaScript And tens of toy or paradigmatic languages We next give an overview of the C definition Defined by Chucky Ellison (PhD at UIUC)

Configuration of C Heap 57 leaf cells 63 nested cells

Statistics for the C definition Syntactic constructs: 173 Total number of rules: 812 Total number of lines: 4688 Has been tested on thousands of C programs (several benchmarks, including the gcc torture test passed 95% so far)

Conclusion and Future Work Formal verification should start with a formal, executable semantics of the language Once a well-tested formal semantics is available, developing program verifiers should be an easy task, available to masses Matching logic aims at the above It makes formal semantics useful! It additionally encourages developing formal semantics to languages, which in K is easy and fun