Refinement Type Inference via Horn Constraint Optimization Kodai Hashimoto and Hiroshi Unno (University of Tsukuba, Japan)

Slides:



Advertisements
Similar presentations
Constraint-based Invariant Inference over Predicate Abstraction Sumit Gulwani Ramarathnam Venkatesan Microsoft Research, Redmond Saurabh Srivastava University.
Advertisements

Auto-Generation of Test Cases for Infinite States Reactive Systems Based on Symbolic Execution and Formula Rewriting Donghuo Chen School of Computer Science.
Technology from seed Automatic Equivalence Checking of UF+IA Programs Nuno Lopes and José Monteiro.
Masahiro Fujita Yoshihisa Kojima University of Tokyo May 2, 2008
Introduction to Formal Methods for SW and HW Development 09: SAT Based Abstraction/Refinement in Model-Checking Roberto Sebastiani Based on work and slides.
A Program Transformation For Faster Goal-Directed Search Akash Lal, Shaz Qadeer Microsoft Research.
Verification of Functional Programs in Scala Philippe Suter (joint work w/ Ali Sinan Köksal and Viktor Kuncak) ÉCOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE,
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
HIP/SLEEK11 HIP/SLEEK :Automatic Verification and Specification Inference System Wei-Ngan Chin & Asankhaya Sharma Dept of Computer Science National University.
Automating Relatively Complete Verification of Higher-Order Functional Programs Hiroshi Unno (University of Tsukuba) Tachio Terauchi (Nagoya University)
Logic as the lingua franca of software verification Ken McMillan Microsoft Research TexPoint fonts used in EMF: A A A A A Joint work with Andrey Rybalchenko.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
Optimization of thermal processes2007/2008 Optimization of thermal processes Maciej Marek Czestochowa University of Technology Institute of Thermal Machinery.
Program Analysis as Constraint Solving Sumit Gulwani (MSR Redmond) Ramarathnam Venkatesan (MSR Redmond) Saurabh Srivastava (Univ. of Maryland) TexPoint.
Technology from seed Weakest Precondition Synthesis for Compiler Optimizations Nuno Lopes and José Monteiro.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
Relatively Complete Verification of Higher- Order Programs (via Automated Refinement Type Inference) Tachio Terauchi Nagoya University TexPoint fonts used.
Rahul Sharma Işil Dillig, Thomas Dillig, and Alex Aiken Stanford University Simplifying Loop Invariant Generation Using Splitter Predicates.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Termination Proofs for Systems Code Andrey Rybalchenko, EPFL/MPI joint work with Byron Cook, MSR and Andreas Podelski, MPI PLDI’2006, Ottawa.
Permissive Interfaces Tom Henzinger Ranjit Jhala Rupak Majumdar.
Interpolants [Craig 1957] G(y,z) F(x,y)
1 Predicate Abstraction of ANSI-C Programs using SAT Edmund Clarke Daniel Kroening Natalia Sharygina Karen Yorav (modified by Zaher Andraus for presentation.
Verification and Data Structures int kmp_search(char str[], char pat[]){ p = 0; s = 0; while (p
Chapter 3 Describing Syntax and Semantics Sections 1-3.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Fundamentals (Chapter 4) Axiomatic Semantics ICS 535.
VS 3 : Verification and Synthesis using SMT Solvers SMT Solvers for Program Verification Saurabh Srivastava * Sumit Gulwani ** Jeffrey S. Foster * * University.
1 Combining verification and analysis. 2 CONCLUSIONS ON VERIFICATION  denotational abstract interpreters have the extra-value of being easily transformed.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
Program Verification using Templates over Predicate Abstraction Saurabh Srivastava University of Maryland, College Park Sumit Gulwani Microsoft Research,
Lazy Abstraction Lecture 3 : Partial Analysis Ranjit Jhala UC San Diego With: Tom Henzinger, Rupak Majumdar, Ken McMillan, Gregoire Sutre.
Finding Minimum Type Error Sources Zvonimir Pavlinovic Tim King Thomas Wies New York University.
By D. Beyer et. al. Simon Fraser University (Spring 09) Presentation By: Pashootan Vaezipoor.
From Program Verification to Program Synthesis Saurabh Srivastava * Sumit Gulwani ♯ Jeffrey S. Foster * * University of Maryland, College Park ♯ Microsoft.
Automatic Abstraction Refinement for GSTE Yan Chen, Yujing He, and Fei Xie Portland State University Jin Yang Intel Nov 13, 2007.
 1  Outline  stages and topics in simulation  generation of random variates.
An Algebra for Composing Access Control Policies (2002) Author: PIERO BONATTI, SABRINA DE CAPITANI DI, PIERANGELA SAMARATI Presenter: Siqing Du Date:
A Template-based Approach to Complete Predicate Refinement Tachio Terauchi (Nagoya University) Hiroshi Unno (University of Tsukuba) Naoki Kobayashi (University.
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
Inferring Specifications to Detect Errors in Code Mana Taghdiri Presented by: Robert Seater MIT Computer Science & AI Lab.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
Goal Programming Linear program has multiple objectives, often conflicting in nature Target values or goals can be set for each objective identified Not.
Recursive Algorithms &
Formal verification of skiplist algorithms Student: Trinh Cong Quy Supervisor: Bengt Jonsson Reviewer: Parosh Abdulla.
CAS 721 Course Project Implementing Branch and Bound, and Tabu search for combinatorial computing problem By Ho Fai Ko ( )
A Framework on Synchronization Verification in System-Level Design Thanyapat Sakunkonchak Satoshi Komatsu Masahiro Fujita Fujita Laboratory University.
Semantics In Text: Chapter 3.
Proving Non-Termination Gupta, Henzinger, Majumdar, Rybalchenko, Ru-Gang Xu presentation by erkan.
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.
DAY 9: MICROSOFT EXCEL – CHAPTER 6 Sravanthi Lakkimsetty Sept 16, 2015.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
Student: Shaobo He, Advisor: Zvonimir Rakamarić TOWARDS AUTOMATED DIFFERENTIAL PROGRAM VERIFICATION FOR APPROXIMATE COMPUTING.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Model Checking Early Requirements Specifications in Tropos Presented by Chin-Yi Tsai.
Automating Induction for Solving Horn Clauses
B (The language of B-Method )
MoCHi: Software Model Checker for a Higher-Order Functional Language
Relatively Complete Refinement Type System for Verification of Higher-Order Non-deterministic Programs Hiroshi Unno (University of Tsukuba) Yuki Satake.
Inferring Simple Solutions to Recursion-free Horn Clauses via Sampling
Lecture 5 Floyd-Hoare Style Verification
Programming Languages 2nd edition Tucker and Noonan
Semantics In Text: Chapter 3.
Formal Methods in software development
Model Checking and Its Applications
Gradual Verification Seamlessly and flexibly combine static and dynamic verification by drawing on the general principles from abstract interpretation.
BLAST: A Software Verification Tool for C programs
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

Refinement Type Inference via Horn Constraint Optimization Kodai Hashimoto and Hiroshi Unno (University of Tsukuba, Japan)

Our Goal: Path-Sensitive Program Analysis of Higher-order Non-det. Functional Programs 2015/9/10SAS Refinement type optimization a generalization of ordinary refinement type inference Precondition inference Bug finding (Conditional) termination analysis Non-termination analysis Modular verification …

Refinement Type Inference 2015/9/10SAS Program let rec sum x = … Infer Refinement types can precisely express program behaviors FOL predicates (e.g., QFLIA)

A Challenge in Refinement Type Inference Which refinement type should be inferred? let rec sum x = if x = 0 then 0 else x + sum (x-1) 2015/9/10SAS … contradiction The most general types are often not expressible in the underlying logic (e.g., QFLIA) incomparable

Existing Refinement Type Inference Tools Infer refinement types precise enough to verify a given safety specification Refinement Caml [Unno+ ’08, ’09, ’13, ’15] Liquid Types [Jhala+ ’08, ’09, …, ’15] MoCHi [Kobayashi+ ’11, ’13, ’14, ’15, ’15] Depcegar [Terauchi ’10] HMC [Jhala+ ’11] Popeye [Zhu & Jagannathan ’13] 2015/9/10SAS Inferred types are often too specific to the spec. → Limited applications

Our Approach: Refinement Type Optimization 2015/9/10SAS Infer maximally preferred (i.e. Pareto optimal) refinement types with respect to a user-specified preference order … … … … … … …… … … … … high low

How to Specify Preference Orders (1/3) Refinement type template 2015/9/10SAS Predicate variables

How to Specify Preference Orders (2/3) 2015/9/10SAS max/min optimization constraints Precondition Postcondition

How to Specify Preference Orders (3/3) 2015/9/10SAS 20159

Outline Refinement Type Optimization Applications Our Type Optimization Method Implementation & Experiments Summary 2015/9/10SAS

Applications of Refinement Type Optimization Non-termination analysis Conditional termination analysis Precondition inference Bug finding Modular verification … 2015/9/10SAS

Non-Termination Analysis Find a program input that violates the termination property 2015/9/10SAS No return value = Non-terminating

Non-Termination Analysis of Non-Deterministic Programs 2015/9/10SAS infer a maximally-weak condition = read_int() in non-determinism

2015/9/10SAS Non-Termination Analysis of Higher-Order Programs infer a maximally-weak precondition

Applications of Refinement Type Optimization Non-termination analysis Conditional termination analysis Precondition inference Bug finding Modular verification … 2015/9/10SAS

let rec sum_t x i c = if x = 0 then 0 else x + sum_t (x-1) i (c+1) Conditional Termination Analysis (1/2) Infer a sufficient condition for termination Our approach is inspired by a program transformation approach to termination analysis of imperative programs [Gulwani+ ’08, ’09] 2015/9/10SAS let rec sum x = if x = 0 then 0 else x + sum (x-1) the number of recursive calls the initial value of x

Conditional Termination Analysis (2/2) 2015/9/10SAS Infer a sufficient condition for termination

Outline Refinement Type Optimization Applications Our Type Optimization Method Implementation & Experiments Summary 2015/9/10SAS

Overall Structure 2015/9/10SAS Constraint Generation Horn Constraint Optimization Functional Program Horn Clause Constraints user-specified preference order (max/min opt. constraints + a priority order) additional Horn Clause constraints Refinement Types

Example: Type Optimization by Our Method 2015/9/10SAS Constraint Generation Horn Constraint Optimization

Example: Horn Constraint Optimization 2015/9/10SAS Solve Gen. Horn Constraints for improved Sols. Solve Gen.Solve Converge (No Solution) repeatedly improves a current solution until convergence … Solve

Horn Constraint Solver Solve Extended template-based invariant generation techniques [Colon+ ’03, Gulwani+ ’08] to solve existentially-quantified Horn clause constraints Extend the reach from imperative programs w/o recursion to higher-order non-det. programs Any other solver for the class of constraints can be used instead [Unno+ ’13, Beyene+ ’14, Kuwahara+ ’15] 2015/9/10SAS

Outline Refinement Type Optimization Applications Our Type Optimization Method Implementation & Experiments Summary 2015/9/10SAS

Implementation & Experiments Implemented in Refinement Caml [Unno+ ’08, ’09, …] Z3 [Moura+ ’08] as a backend SMT solver Two preliminary experiments: Various program analysis problems for higher-order non-deterministic programs (partly obtained from [Kuwahara+ ’14, Kuwahara+ ’15] ) Non-termination verification problems for first-order non-deterministic programs (obtained from [Chen+ ’14, Larraz+’14, Kuwahara+ ’15, …] ) 2015/9/10SAS A refinement type checking and inference tool for OCaml

Results of the Various Program Analysis Problems (excerpt) 2015/9/10SAS Environment: Intel Core i (3.40GHz), 16 GB of RAM ProgramApplication#Iter.Time (sec) Opt. foldr_nonterm [Kuwahara+ ’15] Non-termination48.04 ✔ fixpoint_nonterm [Kuwahara+ ’15] Non-termination20.30 ✔ indirectHO_e [Kuwahara+ ’15] Non-termination20.31 ✔ zip [Kuwahara+ ’14] Conditional Termination Analysis sum Conditional Termination Analysis ✔ append [Kuwahara+ ’14] Conditional Termination Analysis ✔

VerifiedTime OutOther Our tool CppInv [Larraz+ ’14] 7065 T2-TACAS [Chen+ ’14] MoCHi [Kuwahara+ ’15] TNT [Emmes+ ’12] /9/10SAS Results of the First-Order Non-Termination Verification Problems

Summary Refinement type optimization problems Infer Pareto-optimal refinement types with respect to a user-specified preference order Has applications to various program analysis problems of higher-order and non-deterministic functional programs Refinement type optimization method Reduction to a Horn constraint optimization problem Horn constraint optimization method Repeatedly improve the current solution until convergence Prototype implementation and preliminary experiments Thank you! 2015/9/10SAS