Gennaro Parlato (LIAFA, Paris, France) Joint work with P. Madhusudan Xiaokang Qie University of Illinois at Urbana-Champaign.

Slides:



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

Synthesis, Analysis, and Verification Lecture 04c Lectures: Viktor Kuncak VC Generation for Programs with Data Structures “Beyond Integers”
Automated Verification with HIP and SLEEK Asankhaya Sharma.
SLD-resolution Introduction Most general unifiers SLD-resolution
Gennaro Parlato (LIAFA, Paris, France) Joint work with P. Madhusudan Xiaokang Qie University of Illinois at Urbana-Champaign.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
Linked List Implementation class List { private List next; private Object data; private static List root; private static int size; public static void addNew(Object.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Getting started with ML ML is a functional programming language. ML is statically typed: The types of literals, values, expressions and functions in a.
Hybrid Systems Presented by: Arnab De Anand S. An Intuitive Introduction to Hybrid Systems Discrete program with an analog environment. What does it mean?
Timed Automata.
AVL Trees1 Part-F2 AVL Trees v z. AVL Trees2 AVL Tree Definition (§ 9.2) AVL trees are balanced. An AVL Tree is a binary search tree such that.
A Fixpoint Calculus for Local and Global Program Flows Swarat Chaudhuri, U.Penn (with Rajeev Alur and P. Madhusudan)
1 A Logic of Reachable Patterns in Linked Data-Structures Greta Yorsh joint work with Alexander Rabinovich, Mooly Sagiv Tel Aviv University Antoine Meyer,
Binary Trees, Binary Search Trees CMPS 2133 Spring 2008.
CS 171: Introduction to Computer Science II
1 Conditional XPath, the first order complete XPath dialect Maarten Marx Presented by: Einav Bar-Ner.
On Sequentializing Concurrent Programs Ahmed Bouajjani LIAFA, University of Paris 7, France LIAFA, University of Paris 7, France Michael Emmi LIAFA, University.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
On the Use of Automata Techniques to Decide Satisfiability Mia Minnes May 3, 2005.
Tirgul 10 Rehearsal about Universal Hashing Solving two problems from theoretical exercises: –T2 q. 1 –T3 q. 2.
The Theory of NP-Completeness
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Flavio Lerda 1 LTL Model Checking Flavio Lerda. 2 LTL Model Checking LTL –Subset of CTL* of the form: A f where f is a path formula LTL model checking.
1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Cristian Gherghina Joint work with: Wei-Ngan Chin, Razvan Voicu, Quang Loc Le Florin Craciun, Shengchao Qin TexPoint fonts used in EMF. Read the TexPoint.
Comp 249 Programming Methodology Chapter 15 Linked Data Structure - Part B Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Data Structures - CSCI 102 Binary Tree In binary trees, each Node can point to two other Nodes and looks something like this: template class BTNode { public:
Advanced Algorithms Analysis and Design Lecture 8 (Continue Lecture 7…..) Elementry Data Structures By Engr Huma Ayub Vine.
Dagstuhl Seminar "Applied Deductive Verification" November Symbolically Computing Most-Precise Abstract Operations for Shape.
Languages of nested trees Swarat Chaudhuri University of Pennsylvania (with Rajeev Alur and P. Madhusudan)
INTRODUCTION TO THE THEORY OF COMPUTATION INTRODUCTION MICHAEL SIPSER, SECOND EDITION 1.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Searching: Binary Trees and Hash Tables CHAPTER 12 6/4/15 Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education,
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Inferring Specifications to Detect Errors in Code Mana Taghdiri Presented by: Robert Seater MIT Computer Science & AI Lab.
Checking Reachability using Matching Logic Grigore Rosu and Andrei Stefanescu University of Illinois, USA.
CS 361 – Chapter 3 Sorted dictionary ADT Implementation –Sorted array –Binary search tree.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
1 Chapter 7 Objectives Upon completion you will be able to: Create and implement binary search trees Understand the operation of the binary search tree.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
Compositionality Entails Sequentializability Pranav Garg, P. Madhusudan University of Illinois at Urbana-Champaign.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Learning Universally Quantified Invariants of Linear Data Structures Pranav Garg 1, Christof Loding, 2 P. Madhusudan 1 and Daniel Neider 2 1 University.
1. Iterative Preorder Traversal Rpreorder(T) 1. [process the root node] if T!= NULL then Write Data(T) else Write “empty Tree” 2. [process the left subtree]
This Week Lecture on relational semantics Exercises on logic and relations Labs on using Isabelle to do proofs.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
Quantified Data Automata on Skinny Trees: an Abstract Domain for Lists Pranav Garg 1, P. Madhusudan 1 and Gennaro Parlato 2 1 University of Illinois at.
1 Finite Model Theory Lecture 5 Turing Machines and Finite Models.
(c) University of Washington20c-1 CSC 143 Binary Search Trees.
Mostly-Automated Verification of Low-Level Programs in Computational Separation Logic Adam Chlipala Harvard University PLDI 2011.
On Sequentializing Concurrent Programs
Review: Discrete Mathematics and Its Applications
Lecture 22 Binary Search Trees Chapter 10 of textbook
Binary Trees, Binary Search Trees
Arithmetic Constraints and Automata
Over-Approximating Boolean Programs with Unbounded Thread Creation
Review: Discrete Mathematics and Its Applications
Binary Trees, Binary Search Trees
CSC 143 Binary Search Trees.
Switching Lemmas and Proof Complexity
Binary Trees, Binary Search Trees
Sharing Set Operations
Program Verification with Graph Types and Monadic Second-order Logic
Presentation transcript:

Gennaro Parlato (LIAFA, Paris, France) Joint work with P. Madhusudan Xiaokang Qie University of Illinois at Urbana-Champaign

A new logic to reason with programs that manipulate heap + data using  deductive verification  SMT solvers Program … new(x); … x->next=y->next->next; … y=nil; … x->data = y->data +1; … free(x); …

 One of the least understood class of theories  Both structures and data can be unbounded  This roles out immidiately classical combination of theories, like Nelson-Oppen scheme  Undecidable (even meaningful restrictions)

A logic that is:  Decidable  Expressive enough to state useful properties  Efficient in practice on real-wold programs We try to give a solution that has a good balance overall the goals!

 HAVOC (Lahiri, Qadeer: POPL’08)  Decidable: YES  Expressive: NO (doubly-linked lists cannot be expressed)  Efficient: YES on simple programs  CSL (Bouajjani, Dragoi, Enea, Sighireanu: CONCUR’09)  Decidable: YES  Expressive: NO ▪ extends HAVAC to handle constraints on sizes of structures ▪ still weak (properties of binary trees of unbounded depth cannot be expressed)  Efficient: ? (no implementation is provided) The technique to decide the logic is encoded in the syntax  Hard to extend or generalize

Defines a set of graphs that which are interpreted over regular trees R = ( ψ Tr, validnode, {node a } a ∈ Lv, {edge b } b ∈ Le ) MSO formula on k-ary Σ-lab trees Unary predicate Family of unary predicates. Lv is a finite set of node labels Family of binary predicates Le is a finite set of edge labels R defines a class of graphs For every tree T=(V,->) accepted by ψ Tr, graph(T) = ( N, E, labnode a, labedge b ) { v ∈ V | validnode(v) }{(u,v) | b ∈ Le & edge b (u,v) } labnode a (v) =true v ∈ N ∧ node a (v)=true labedge b (u,v) =true u,v ∈ N ∧ edge b (u,v)=true

E n (s,t)= leaf(s) ∧ leaf(t) ∧∃ z 1, z 2, z 3. ( E l (z 3,z 1 ) ∧ RightMostPath( z 1, s) ∧ E r (z 3,z 2 ) ∧ LeftMostPath( z 2, t) ) s t z3z3 z1z1 z2z2 Some data structures that can be expressed: Nested lists Cyclic and doubly-linked lists Threaded trees

∃ x n. ∀ y m. φ(x n,y m ) φ is an Monadic Second Order (MSO) formula that combines  heap structures and  data, where the data-constraints are only allowed to refer to x n and y m Syntax of S TRAND  DATAExpression e::= data(x) | data(y) | c | g(e 1,...,e n )  φ Formula φ::= γ(e 1,...,e n ) | α(v 1,...,v n ) | ¬φ | φ 1 ∧ φ 2 | φ 1 ∨ φ 2 | z ∈ S | ∃ z. φ | ∀ z. φ | ∃ S. φ | ∀ S. φ  ∀ Formula ω::= φ | ∀ y.ω  S TRAND ψ::= ω| ∃ x.ψ

leftbranch(y1, y2) ≡ ∃ z. (left(y1, z) ∧ z → ∗ y2) rightbranch(y1, y2) ≡ ∃ z. (right(y1, z) ∧ z → ∗ y2) ψ bst ≡ ∀ y1 ∀ y2. ( leftbranch(y1,y2) ⇒ data(y2) < data(y1) ) ∧ ( rightbranch(y1,y2) ⇒ data(y1) ≤ data(y2) ) left right

bstSearch (pre: ψ bst ∧ ∃ x.(key(root) = k)) Node curr = root; (loop-inv: ψ bst ∧∃ x.(reach(curr,x) ∧ key(curr)=k)) while ( curr.key != k && curr != null ){ if (curr.key > k) curr = curr.left; else curr = curr.right; } (post: ψ bst ∧ key(curr) = k)

Given  a linear block of statements s  a S TRAND pre-condition P and a post-condition Q expressed as a Boolean combination of S TRAND formulas of the form ▪ ∃ x n. φ(x n ), ∀ y m. φ( y m ) checking the validity of the Hoare triple {P} s {Q} reduces to the satisfiability of STRAND  Satisfiability of S TRAND is undecidable  We identify a decidable fragment of S TRAND semantically defined by using the notion of satisfiability-preseving embeddings

For two structure T, S (with no data) S satisfiability-preservingly embeds into T w.r.t. ψ if there is an embeddings of the nodes of S in T such that no mutter how the data-logic constraints are interpreted if T satisfies ψ then also S satisfies ψ by inhering the data-values T T S S

Checking the satisfiability we ignore T and check only S Satisfiability is done only on the minimal models S TRAND dec is the class of the formulas that has a finite set of minimal models Satisfiability reduces to the satisfiability of the quantifier- free theory of the data-logic

Let ψ= ∃ x n. ∀ y m. φ(x n, y m ) be a S TRAND formula over a recursively data-structure R  define a new rec. data-structure R ’ that encoperates the existentally quantified variables of x n as pointers in R ’ (unary predicate Val i for the var x i )  define ψ’ = ∀ x n ∀ y m. (( ∧ i=1,…,n Val i (x i )) => φ(x n, y m )) Claim: ψ’ is satisfiable on R ’ iff ψ is satisfiable on R

Let ψ = ∀ y n. φ(y n ) be a S TRAND formula, and γ 1, …,γ r be the atomic relational formulas of the data-logic. Define the pure MSO formula ψ’ = ∀ y n. ∃ b 1, …, b r. φ’ (y n, b 1, …, b r ) where φ’ is obtained by φ replacing γ i with the predicate b i  Example: ψ sorted : ∀ y 1,y 2. ( (y 1 ->*y 2 ) => data(y 1 ) ≤ data(y 2 )) ψ ’ sorted : ∀ y 1,y 2. ( (y 1 ->*y 2 ) => b 1 ) Claim: if ψ is satisfiable on a recursive data-structure R then ψ’ is also satisfiable on R. The other direction does not hold OVER-APPROXIMATION

Let T be a tree defining a graph of the given Rec. Data-structure A subset S of nodes of T is valid :  Not-empty & least-ancestor closed  The subtree defined by S also defines a RDS Submodels can be defined in MSO

S satisfiability-preservingly embeds in T iff no matter how T satisfies the formula using some valuation of the atomic data-relations, S will be able to satisfy the formula using the same valuation of the atomic data- relations T T S S MinModel = \* pure MSO formula *\ ∀ y n. ∃ b 1, …, b r. φ’ (y n, b 1, …, b r ) ∧ ¬ ∃ X. ( NonEmpty(X) ∧ ValidSubModel(X) ∧ ( ∀ y m. ∀ b 1, …, b r. ( ∧ i ∈ [m] (y ∈ S) ∧ interpret( φ’ (y n, b 1, …, b r )) => tailor(φ’ (y n, b 1, …, b r )) ) )

 Transform MinModels to tree-automaton TA  Check finiteness for TA  Extract all trees accepted by TA: ρ 1, …, ρ t  For each ρ i build the finite graph g i  Create a quantifier-free formula λ i for g i  Create a data-variable for each node  ∀ ’s are “expanded” in conjunctions  ∃ ’s are “expanded” in disjunctions  Data-constraints in S TRAND are directly written in the data-logic  The quantifier-free formula ∨ i=1,…,t λ i is a pure data-logic formula that is satisfiable iff the original formula ψ is satisfiable on R

Hoare-triples: ( ( R, Pre), P, Post ) R Pre ∈ S TRAND ∃, ∀ P: Node t = newhead; newhead = head; head = head.next; newhead.next = t; Post ∈ S TRAND ∃, ∀ Idea: capture the entire computation of P starting from a particular recursive data-structure R using a single data-structure R P ⇒ Is ψ ∈ Strand Satisfiable over R P ?

Error = ∨ i ∈ [m] (Pre R p ∧ ∧ j ∈ [i −1] π j ∧ error i ) Violate Post = Pre R p ∧ ∧ j ∈ [m] π j ∧ ¬Post R p Theorem The Hoare-triple ( R, Pre, P, Post) does not hold iff the S TRAND formula Error ∨ ViolatePost is satisfiable on the trail R P

Programs Verification Condition Structural Solving (MONA)Data Constraint Solving (Z3) In S TRAND dec ? # states Final BDD size Time (sec) Graph model Exists? Bound #nodes Formula size (kB) Satisfiabl e ? Time (sec) sorted- list-search before-loop in-loop after-loop Yes No sorted- List-insert before-head before-loop in-loop after-loop Yes Yes No Yes No - No sorted-list- insert -err before-loopYes Yes79.5Yes0.02 sorted-list- reverse before-loop in-loop after-loop Yes No Bst-search before-loop in-loop after-loop Yes No Yes No N Bst-insert before-loop in-loop after-loop Yes No

bstSearch (pre: ψ bst ∧ ∃ x.(key(root) = k)) Node curr = root; (loop-inv: ψ bst ∧∃ x.(reach(curr,x) ∧ key(curr)=k)) while ( curr.key != k && curr != null ){ if (curr.key > k) curr = curr.left; else curr = curr.right; } (post: ψ bst ∧ key(curr) = k)

 Code  Experiments  Table of the experiments

We have presented S TRAND a logic for reasoning about structures and data which has good balance among  Decidability  Expressiveness  Efficiency  We believe this work  breaks new ground in combining structures and data  may pave the way for defining decidable fragments of other logics

 Powerful and decidable syntactic fragments  Back-and-forth connection between the structural part and the data part  Extend Separation logic with data