Invariant Generation via Genetic Programming

Size: px
Start display at page:

Download "Invariant Generation via Genetic Programming"

Transcription

1 Invariant Generation via Genetic Programming Soonho Kong 12 Mar 2010 ROPAS Show&Tell

2 Problem: Inductive Invariant Generation For the annotated loop {δ} while ρ do S end {} Find an invariant I satisfying the following conditions: (A) ( holds when entering the loop) δ ι (B) ι ρ Pre(ι, S) ( holds at each iteration) ι ρ (C) ( gives after leaving the loop) ι ι ι ι strongest under-approximation of an invariant δ I ρ ι weakest over-approximation of an invariant

3 Precondition Loop Body Postcondition { phase = F success = F give up = F cutoff =0 count =0} 1 while (success give up) do 2 entered phase := F; 3 if phase then 4 if cutoff = 0 then cutoff := 1; 5 else if cutoff =1 maxcost > 1 then cutoff := maxcost; 6 else phase := T; entered phase := T; cutoff := 1000; 7 if cutoff = maxcost search then give up := T; 8 else 9 count := count + 1; 10 if count > words then give up := T; 11 if entered phase then count := 1; 12 linkages := nondet; 13 if linkages > 5000 then linkages := 5000; 14 canonical := 0; valid := 0; 15 if linkages = 0then 16 valid := nondet; assume 0 valid valid linkages; 17 canonical := linkages; 18 if valid > 0 then success := T; 19 end { (valid > 0 count > words (cutoff = maxcost search)) valid linkages canonical = linkages linkages 5000 } Fig. 3. A Sample Loop in SPEC2000 Benchmark PARSER with 20 Atomic Propositions (Building Blocks)

4 { phase = F success = F give up = F cutoff =0 count =0} 1 while (success give up) do 2 entered phase := F; 3 if phase then 4 if cutoff = 0then cutoff := 1; 5 else if cutoff =1 maxcost > 1 then cutoff := maxcost; 6 else phase := T; entered phase := T; cutoff := 1000; 7 if cutoff = maxcost search then give up := T; 8 else 9 count := count + 1; 10 if count > words then give up := T; 11 if entered phase then count := 1; 12 linkages := nondet; 13 if linkages > 5000 then linkages := 5000; 14 canonical := 0; valid := 0; 15 if linkages = 0then 16 valid := nondet; assume 0 valid valid linkages; 17 canonical := linkages; 18 if valid > 0 then success := T; 19 end { (valid > 0 count > words (cutoff = maxcost search)) valid linkages canonical = linkages linkages 5000 } with One of the found invariants is the following: success (valid linkages linkages 5000 canonical = linkages) success ( search count > words valid = 0) success (count > words cutoff = maxcost (canonical = 0 valid = 0 linkages = 0)) give up ((valid =0 linkages =0 canonical = linkages) (canonical = 0 valid linkages linkages 5000 canonical = linkages)) give up (cutoff = maxcost count > words (canonical = 0 valid = 0 linkages = 0)) give up ( search count > words valid = 0) scribes the conditions when success or give up are true. For onical = Fig. 3. A Sample Loop in SPEC2000 Benchmark PARSER with 20 Atomic Propositions (Building Blocks) An Invariant

5 Observations on Algorithmic Learning Approach Query Answer Teacher... Query Answer Algorithmic Learning ι A Loop Invariant (Propositional Formula)

6 Observations on Algorithmic Learning Approach Query Answer Teacher... Query Answer Algorithmic Learning ι A Loop Invariant (Propositional Formula) Problem #1: Active Learning Teacher can guide the learner only through the form of answers.

7 Observations on Algorithmic Learning Approach Solution Space Over Approximation Under Approximation Problem #1: Active Learning Teacher can guide the learner only through the form of answers.

8 Observations on Algorithmic Learning Approach Solution Space Over Approximation Under Approximation Yes Problem #1: Active Learning Teacher can guide the learner only through the form of answers.

9 Observations on Algorithmic Learning Approach Solution Space Over Approximation No Under Approximation Yes Problem #1: Active Learning Teacher can guide the learner only through the form of answers.

10 Observations on Algorithmic Learning Approach Solution Space No Yes Yes No Problem #1: Active Learning Teacher can guide the learner only through the form of answers.

11 Observations on Algorithmic Learning Approach Solution Space No No No No No Yes Yes Yes Yes No No Problem #1: Active Learning Teacher can guide the learner only through the form of answers.

12 Observations on Algorithmic Learning Approach Solution Space No No No No No Yes Yes Yes Yes No No Problem #1: Active Learning Invariant approximations are not directly utilized.

13 Observations on Algorithmic Learning Approach Solution Space Over Approximation Under Approximation Problem #2: Naive Randomized Mechanism Teacher solely relies on naive randomized mechanism when approximations are not helpful.

14 Observations on Algorithmic Learning Approach Solution Space? Unknown Over Approximation Under Approximation Problem #2: Naive Randomized Mechanism Teacher solely relies on naive randomized mechanism when approximations are not helpful.

15 Observations on Algorithmic Learning Approach Solution Space Over Approximation? Random Answer Under Approximation Problem #2: Naive Randomized Mechanism Teacher solely relies on naive randomized mechanism when approximations are not helpful.

16 Observations on Algorithmic Learning Approach Query Answer Teacher... Query Answer Algorithmic Learning Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult.

17 Observations on Algorithmic Learning Approach Query Answer Teacher... Query Answer Algorithmic Learning Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult.

18 Genetic Programming

19 Genetic Programming Initial Population

20 Genetic Programming Initial Population Crossover

21 Genetic Programming Initial Population Crossover Mutation

22 Genetic Programming Initial Population Crossover Mutation Fitness

23 Genetic Programming Initial Population Crossover Mutation Fitness Selection X

24 Genetic Programming Previous Population Crossover Mutation Fitness Selection X

25 Genetic Programming as a Solution Problem #1: Active Learning Teacher can guide the learner only through the form of answers. Query Answer Teacher... Query Answer Algorithmic Learning

26 Genetic Programming as a Solution Problem #1: Active Learning Teacher can guide the learner only through the form of answers. Solution: Active Teaching In genetic programming, we can manipulate the formula directly: Solution Space c (c ι) ι Solution Space Over Approximation Candidate Under Approximation Local optimization Over Approximation Candidate Under Approximation

27 Genetic Programming as a Solution Problem #2: Naive Randomized Mechanism Teacher solely relies on naive randomized mechanism when approximations are not helpful.

28 Genetic Programming as a Solution Problem #2: Naive Randomized Mechanism Teacher solely relies on naive randomized mechanism when approximations are not helpful. Solution: Natural Selection Genetic programming favors better solutions. Fitness Selection X

29 Genetic Programming as a Solution Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult. Query Answer Teacher... Query Answer Algorithmic Learning

30 Genetic Programming as a Solution Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult. Solution: Crossover Mutation Fitness Selection X

31 Genetic Programming as a Solution Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult. Solution: Crossover Mutation Fitness Selection X

32 Genetic Programming as a Solution Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult. Solution: Crossover Mutation Fitness Selection X

33 Genetic Programming as a Solution Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult. Solution: Crossover Mutation Fitness Selection X

34 Genetic Programming as a Solution Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult. Solution: Crossover Mutation Fitness Parallelizable! Selection X

35 Genetic Programming as a Solution Problem #3: Serialized Query-Answer Process Queries are dependent on the previous query/ answer pairs and make parallelization difficult. Solution: Crossover Mutation Fitness Parallelizable! Selection X

36 Key Issue: How to define Fitness Function? Fitness

37 Role of Fitness Function For the annotated loop {δ} while ρ do S end {} Find an invariant I satisfying the following conditions: (A) ι ι ( holds when entering the loop) (B) ι ρ Pre(ι, S) ( holds at each iteration) (C) ι ι ( gives after leaving the loop) ι ι ι

38 Role of Fitness Function For the annotated loop {δ} while ρ do S end {} Find an invariant I satisfying the following conditions: (A) ι ι ( holds when entering the loop) (B) ι ρ Pre(ι, S) ( holds at each iteration) (C) ι ι ( gives after leaving the loop) ι ι ι Solution Space Solution Space Over Approximation Candidate Under Approximation Local optimization Over Approximation Candidate Under Approximation

39 Role of Fitness Function For the annotated loop {δ} while ρ do S end {} Find an invariant I satisfying the following conditions: (A) ι ι ( holds when entering the loop) (B) ι ρ Pre(ι, S) ( holds at each iteration) (C) ι ι ( gives after leaving the loop) ι ι ι Solution Space Solution Space Over Approximation Candidate Under Approximation Local optimization Over Approximation Candidate Under Approximation

40 Role of Fitness Function For the annotated loop {δ} while ρ do S end {} Find an invariant I satisfying the following conditions: (A) ι ι ( holds when entering the loop) (B) ι ρ Pre(ι, S) ( holds at each iteration) (C) ι ι ( gives after leaving the loop) ι ι ι Solution Space Solution Space Over Approximation Candidate Under Approximation Local optimization Over Approximation Candidate Under Approximation

41 Role of Fitness Function (B) ι ρ Pre(ι, S) ( ι holds at each iteration) If (B) holds, then we find an invariant. Pre(ι, S) ι ρ

42 Role of Fitness Function (B) ι ρ Pre(ι, S) ( ι holds at each iteration) If (B) does not hold, we need to quantify how bad the candidate is. Pre(ι, S) ι ρ

43 Role of Fitness Function (B) ι ρ Pre(ι, S) ( ι holds at each iteration) If (B) does not hold, we need to quantify how bad the candidate is. ι ρ Pre(ι, S) Fitness Function Property Diff (ι) =ι ρ \ Pre(ι, S) Diff (ι 1 ) Diff (ι 2 ) Fit(ι 1 ) Fit(ι 2 )

44 Infeasible Fitness Function Count the number of models in concrete domain. Example Diff (ι) =x<3 y>10 Fit(ι) = {(2, 11), (10, 15), (0, 0),} y 10 3 x Can not count them all in general.

45 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 y x

46 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT: (10, 15) = Diff (ι) y x

47 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT: (10, 15) = Diff (ι) y x

48 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT: ( 3, 7) = Diff (ι) [(x >5) (y >5)] y x

49 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT: ( 3, 7) = Diff (ι) [(x >5) (y >5)] y x

50 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT: ( 5, 5) = Diff (ι) [(x >5) (y >5)] [(x <= 5) (y >5)] y x

51 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT: ( 5, 5) = Diff (ι) [(x >5) (y >5)] [(x <= 5) (y >5)] y x

52 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT (Diff (ι) [(x >5) (y >5)] [(x <= 5) (y >5)] [(x <= 5) (y <= 5)]) = UNSAT y x

53 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT (Diff (ι) [(x >5) (y >5)] [(x <= 5) (y >5)] [(x <= 5) (y <= 5)]) = UNSAT y x Fit(ι) =3

54 Feasible Fitness Function Count the number of models in abstract domain. Example Diff (ι) =x<3 y>10 SMT (Diff (ι) [(x >5) (y >5)] [(x <= 5) (y >5)] [(x <= 5) (y <= 5)]) = UNSAT y x Fitness Function Property Diff (ι 1 ) Diff (ι 2 ) Fit(ι 1 ) Fit(ι 2 )

55 Complexity of Fitness Function Number of SMT calls could raise up to 2 n if we have n atomic propositions in predicate abstraction.

56 Complexity of Fitness Function Number of SMT calls could raise up to 2 n if we have n atomic propositions in predicate abstraction. In practice, that is not the case because of dependencies among atomic propositions.

57 Complexity of Fitness Function Number of SMT calls could raise up to 2 n if we have n atomic propositions in predicate abstraction. In practice, that is not the case because of dependencies among atomic propositions. y 1 x

58 Complexity of Fitness Function Number of SMT calls could raise up to 2 n if we have n atomic propositions in predicate abstraction. In practice, that is not the case because of dependencies among atomic propositions. y x =

59 Issue: Formula Size Formula size can grow infinitely. 1. Crossover operation 2. Fitness Function SMT: (10, 15) = Diff (ι) ( 3, 7) = Diff (ι) [(x >5) (y >5)] ( 5, 5) = Diff (ι) [(x >5) (y >5)] [(x <= 5) (y >5)] Solution: Simplify formulae.

60 Progress 1. Design and implement abstract data type for formula to share subformulae (Heejae Shin & Wonchan Lee) Initial Population Crossover

61 Plan Initial Population Crossover Mutation Fitness Selection X

62 ank you

Automatically Inferring Loop Invariants via Algorithmic Learning

Automatically Inferring Loop Invariants via Algorithmic Learning Under consideration for publication in Math. Struct. in Comp. Science Automatically Inferring Loop Invariants via Algorithmic Learning Y U N G B U M J U N G 1, S O O N H O K O N G, C R I S T I N A D A

More information

Inferring Quantified Invariants via Algorithmic Learning, Decision Procedures, and Predicate Abstraction

Inferring Quantified Invariants via Algorithmic Learning, Decision Procedures, and Predicate Abstraction Inferring Quantified Invariants via Algorithmic Learning, Decision Procedures, and Predicate Abstraction ROSAEC MEMO 2010-007 January 17, 2010 Cristina David National University of Singapore davidcri@comp.nus.edu.sg

More information

Floyd-Hoare Style Program Verification

Floyd-Hoare Style Program Verification Floyd-Hoare Style Program Verification Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 9 Feb 2017 Outline of this talk 1 Overview 2 Hoare Triples 3

More information

Teaching vs. Learning, and Course Wrap-Up

Teaching vs. Learning, and Course Wrap-Up Teaching vs. Learning, and Course Wrap-Up Sanjit A. Seshia EECS 219C EECS Department UC Berkeley Teaching vs. Learning Learning: Examples Concept Teaching: Concept Examples Given a concept, give a good

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2016 Program Analysis and Verification Lecture 3: Axiomatic Semantics I Roman Manevich Ben-Gurion University Warm-up exercises 1. Define program state: 2. Define structural semantics configurations:

More information

Program verification. 18 October 2017

Program verification. 18 October 2017 Program verification 18 October 2017 Example revisited // assume(n>2); void partition(int a[], int n) { int pivot = a[0]; int lo = 1, hi = n-1; while (lo

More information

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated

More information

Synthesis and Inductive Learning Part 3

Synthesis and Inductive Learning Part 3 Synthesis and Inductive Learning Part 3 Sanjit A. Seshia EECS Department UC Berkeley Acknowledgments: Susmit Jha, Alexandre Donze, Edward Lee NSF ExCAPE Summer School June 23-25, 2015 Questions of Interest

More information

SAT-Based Verification with IC3: Foundations and Demands

SAT-Based Verification with IC3: Foundations and Demands SAT-Based Verification with IC3: Foundations and Demands Aaron R. Bradley ECEE, CU Boulder & Summit Middle School SAT-Based Verification with IC3:Foundations and Demands 1/55 Induction Foundation of verification

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements Axiomatic Semantics: Verification Conditions Meeting 18, CSCI 5535, Spring 2010 Announcements Homework 6 is due tonight Today s forum: papers on automated testing using symbolic execution Anyone looking

More information

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2015 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University Agenda Basic concepts of correctness Axiomatic semantics (pages 175-183) Hoare Logic

More information

IC3 and Beyond: Incremental, Inductive Verification

IC3 and Beyond: Incremental, Inductive Verification IC3 and Beyond: Incremental, Inductive Verification Aaron R. Bradley ECEE, CU Boulder & Summit Middle School IC3 and Beyond: Incremental, Inductive Verification 1/62 Induction Foundation of verification

More information

Proof Rules for Correctness Triples

Proof Rules for Correctness Triples Proof Rules for Correctness Triples CS 536: Science of Programming, Fall 2018 A. Why? We can t generally prove that correctness triples are valid using truth tables. We need proof axioms for atomic statements

More information

Proofs of Correctness: Introduction to Axiomatic Verification

Proofs of Correctness: Introduction to Axiomatic Verification Proofs of Correctness: Introduction to Axiomatic Verification Introduction Weak correctness predicate Assignment statements Sequencing Selection statements Iteration 1 Introduction What is Axiomatic Verification?

More information

or simply: IC3 A Simplified Description

or simply: IC3 A Simplified Description Incremental Construction of Inductive Clauses for Indubitable Correctness or simply: IC3 A Simplified Description Based on SAT-Based Model Checking without Unrolling Aaron Bradley, VMCAI 2011 Efficient

More information

Understanding IC3. Aaron R. Bradley. ECEE, CU Boulder & Summit Middle School. Understanding IC3 1/55

Understanding IC3. Aaron R. Bradley. ECEE, CU Boulder & Summit Middle School. Understanding IC3 1/55 Understanding IC3 Aaron R. Bradley ECEE, CU Boulder & Summit Middle School Understanding IC3 1/55 Further Reading This presentation is based on Bradley, A. R. Understanding IC3. In SAT, June 2012. http://theory.stanford.edu/~arbrad

More information

Non-linear Interpolant Generation and Its Application to Program Verification

Non-linear Interpolant Generation and Its Application to Program Verification Non-linear Interpolant Generation and Its Application to Program Verification Naijun Zhan State Key Laboratory of Computer Science, Institute of Software, CAS Joint work with Liyun Dai, Ting Gan, Bow-Yaw

More information

Software Verification using Predicate Abstraction and Iterative Refinement: Part 1

Software Verification using Predicate Abstraction and Iterative Refinement: Part 1 using Predicate Abstraction and Iterative Refinement: Part 1 15-414 Bug Catching: Automated Program Verification and Testing Sagar Chaki November 28, 2011 Outline Overview of Model Checking Creating Models

More information

Program verification using Hoare Logic¹

Program verification using Hoare Logic¹ Program verification using Hoare Logic¹ Automated Reasoning - Guest Lecture Petros Papapanagiotou Part 2 of 2 ¹Contains material from Mike Gordon s slides: Previously on Hoare Logic A simple while language

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements Axiomatic Semantics: Verification Conditions Meeting 12, CSCI 5535, Spring 2009 Announcements Homework 4 is due tonight Wed forum: papers on automated testing using symbolic execution 2 Questions? Review

More information

Model Checking, Theorem Proving, and Abstract Interpretation: The Convergence of Formal Verification Technologies

Model Checking, Theorem Proving, and Abstract Interpretation: The Convergence of Formal Verification Technologies Model Checking, Theorem Proving, and Abstract Interpretation: The Convergence of Formal Verification Technologies Tom Henzinger EPFL Three Verification Communities Model checking: -automatic, but inefficient

More information

The Chameleons of Camelot

The Chameleons of Camelot The Chameleons of Camelot João F. Ferreira joao@joaoff.com Last changed: July 27, 2009 Brief description and goals This scenario presents a generalization of the problem The Chameleons of Camelot, found

More information

Integrating Induction, Deduction and Structure for Synthesis

Integrating Induction, Deduction and Structure for Synthesis Integrating Induction, Deduction and Structure for Synthesis Sanjit A. Seshia Associate Professor EECS Department UC Berkeley Students & Postdocs: S. Jha, W.Li, A. Donze, L. Dworkin, B. Brady, D. Holcomb,

More information

A Short Introduction to Hoare Logic

A Short Introduction to Hoare Logic A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking

More information

Galois Connections. Roland Backhouse 3rd December, 2002

Galois Connections. Roland Backhouse 3rd December, 2002 1 Galois Connections Roland Backhouse 3rd December, 2002 Fusion 2 Many problems are expressed in the form evaluate generate where generate generates a (possibly infinite) candidate set of solutions, and

More information

Interpolant-based Transition Relation Approximation

Interpolant-based Transition Relation Approximation Interpolant-based Transition Relation Approximation Ranjit Jhala and K. L. McMillan 1 University of California, San Diego 2 Cadence Berkeley Labs Abstract. In predicate abstraction, exact image computation

More information

Programming Languages and Compilers (CS 421)

Programming Languages and Compilers (CS 421) Programming Languages and Compilers (CS 421) Sasa Misailovic 4110 SC, UIUC https://courses.engr.illinois.edu/cs421/fa2017/cs421a Based in part on slides by Mattox Beckman, as updated by Vikram Adve, Gul

More information

[read Chapter 2] [suggested exercises 2.2, 2.3, 2.4, 2.6] General-to-specific ordering over hypotheses

[read Chapter 2] [suggested exercises 2.2, 2.3, 2.4, 2.6] General-to-specific ordering over hypotheses 1 CONCEPT LEARNING AND THE GENERAL-TO-SPECIFIC ORDERING [read Chapter 2] [suggested exercises 2.2, 2.3, 2.4, 2.6] Learning from examples General-to-specific ordering over hypotheses Version spaces and

More information

Top Down Design. Gunnar Gotshalks 03-1

Top Down Design. Gunnar Gotshalks 03-1 Top Down Design 03-1 Top Down Description Top down is also known as step wise refinement and functional decomposition Given an operation, there are only the following three choices for refinement» Sequence

More information

Lecture Notes: Axiomatic Semantics and Hoare-style Verification

Lecture Notes: Axiomatic Semantics and Hoare-style Verification Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has

More information

Learning to Verify Branching Time Properties

Learning to Verify Branching Time Properties Learning to Verify Branching Time Properties Abhay Vardhan and Mahesh Viswanathan Dept. of Computer Science, Univ. of Illinois at Urbana-Champaign, USA Abstract. We present a new model checking algorithm

More information

First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods

First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods Elsa L Gunter 2112 SC, UIUC egunter@illinois.edu http://courses.engr.illinois.edu/cs477 Slides based in part on previous lectures

More information

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Axiomatic Semantics. Lecture 9 CS 565 2/12/08 Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics

More information

Hoare Calculus and Predicate Transformers

Hoare Calculus and Predicate Transformers Hoare Calculus and Predicate Transformers Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Verification as Learning Geometric Concepts

Verification as Learning Geometric Concepts Verification as Learning Geometric Concepts Rahul Sharma 1, Saurabh Gupta 2, Bharath Hariharan 2, Alex Aiken 1, and Aditya V. Nori 3 1 Stanford University, {sharmar,aiken}@cs.stanford.edu 2 University

More information

Mid-Semester Quiz Second Semester, 2012

Mid-Semester Quiz Second Semester, 2012 THE AUSTRALIAN NATIONAL UNIVERSITY Mid-Semester Quiz Second Semester, 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 1 hour duration Study Period: 10 minutes duration Permitted

More information

A Tutorial on Computational Learning Theory Presented at Genetic Programming 1997 Stanford University, July 1997

A Tutorial on Computational Learning Theory Presented at Genetic Programming 1997 Stanford University, July 1997 A Tutorial on Computational Learning Theory Presented at Genetic Programming 1997 Stanford University, July 1997 Vasant Honavar Artificial Intelligence Research Laboratory Department of Computer Science

More information

Soundness and Completeness of Axiomatic Semantics

Soundness and Completeness of Axiomatic Semantics #1 Soundness and Completeness of Axiomatic Semantics #2 One-Slide Summary A system of axiomatic semantics is sound if everything we can prove is also true: if ` { A } c { B } then ² { A } c { B } We prove

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600/COMP6260 (Formal Methods for Software Engineering)

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600/COMP6260 (Formal Methods for Software Engineering) THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2016 COMP2600/COMP6260 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials:

More information

5. Program Correctness: Mechanics

5. Program Correctness: Mechanics 5. Program Correctness: Mechanics Program A: LinearSearch with function specification @pre 0 l u < a @post rv i. l i u a[i] = e bool LinearSearch(int[] a, int l, int u, int e) { for @ (int i := l; i u;

More information

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented

More information

Learning Abstractions for Model Checking

Learning Abstractions for Model Checking Learning Abstractions for Model Checking Anubhav Gupta June 2006 CMU-CS-06-131 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 Submitted in partial fulfillment of the requirements

More information

Problem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26

Problem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Binary Search Introduction Problem Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Strategy 1: Random Search Randomly select a page until the page containing

More information

Information Flow Analysis via Path Condition Refinement

Information Flow Analysis via Path Condition Refinement Information Flow Analysis via Path Condition Refinement Mana Taghdiri, Gregor Snelting, Carsten Sinz Karlsruhe Institute of Technology, Germany FAST September 16, 2010 KIT University of the State of Baden-Wuerttemberg

More information

Horn-ICE Learning for Synthesizing Invariants and Contracts

Horn-ICE Learning for Synthesizing Invariants and Contracts Horn-ICE Learning for Synthesizing Invariants and Contracts P. EZUDHEEN, Indian Institute of Science, India DANIEL NEIDER, Max Planck Institute for Software Systems, Germany DEEPAK D SOUZA, Indian Institute

More information

Predicate Abstraction: A Tutorial

Predicate Abstraction: A Tutorial Predicate Abstraction: A Tutorial Predicate Abstraction Daniel Kroening May 28 2012 Outline Introduction Existential Abstraction Predicate Abstraction for Software Counterexample-Guided Abstraction Refinement

More information

Logical Abduction and its Applications in Program Verification. Isil Dillig MSR Cambridge

Logical Abduction and its Applications in Program Verification. Isil Dillig MSR Cambridge Logical Abduction and its Applications in Program Verification? Isil Dillig MSR Cambridge What is Abduction? Abduction: Opposite of deduction 2 / 21 What is Abduction? Abduction: Opposite of deduction

More information

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare Axiomatic Semantics Semantics of Programming Languages course Joosep Rõõmusaare 2014 Direct Proofs of Program Correctness Partial correctness properties are properties expressing that if a given program

More information

Loop Convergence. CS 536: Science of Programming, Fall 2018

Loop Convergence. CS 536: Science of Programming, Fall 2018 Solved Loop Convergence CS 536: Science of Programming, Fall 2018 A. Why Diverging programs aren t useful, so it s useful to know how to show that loops terminate. B. Objectives At the end of this lecture

More information

Concept Learning. Space of Versions of Concepts Learned

Concept Learning. Space of Versions of Concepts Learned Concept Learning Space of Versions of Concepts Learned 1 A Concept Learning Task Target concept: Days on which Aldo enjoys his favorite water sport Example Sky AirTemp Humidity Wind Water Forecast EnjoySport

More information

Driving Semantic Parsing from the World s Response

Driving Semantic Parsing from the World s Response Driving Semantic Parsing from the World s Response James Clarke, Dan Goldwasser, Ming-Wei Chang, Dan Roth Cognitive Computation Group University of Illinois at Urbana-Champaign CoNLL 2010 Clarke, Goldwasser,

More information

Searching Algorithms. CSE21 Winter 2017, Day 3 (B00), Day 2 (A00) January 13, 2017

Searching Algorithms. CSE21 Winter 2017, Day 3 (B00), Day 2 (A00) January 13, 2017 Searching Algorithms CSE21 Winter 2017, Day 3 (B00), Day 2 (A00) January 13, 2017 Selection Sort (MinSort) Pseudocode Rosen page 203, exercises 41-42 procedure selection sort(a 1, a 2,..., a n : real numbers

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Programming Paradigms Functional. (Haskell, SML, OCaml,... ) main paradigm:

More information

Abstractions and Decision Procedures for Effective Software Model Checking

Abstractions and Decision Procedures for Effective Software Model Checking Abstractions and Decision Procedures for Effective Software Model Checking Prof. Natasha Sharygina The University of Lugano, Carnegie Mellon University Microsoft Summer School, Moscow, July 2011 Lecture

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering)

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering) THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: One A4

More information

Hoare Logic: Part II

Hoare Logic: Part II Hoare Logic: Part II COMP2600 Formal Methods for Software Engineering Jinbo Huang Australian National University COMP 2600 Hoare Logic II 1 Factorial {n 0} fact := 1; i := n; while (i >0) do fact := fact

More information

Leonardo de Moura Microsoft Research

Leonardo de Moura Microsoft Research Leonardo de Moura Microsoft Research Is formula F satisfiable modulo theory T? SMT solvers have specialized algorithms for T b + 2 = c and f(read(write(a,b,3), c-2)) f(c-b+1) b + 2 = c and f(read(write(a,b,3),

More information

Authors Le, Q. L. (Quang Loc); Li, J. (Jiaying); Sun, J. (Jun); Li, L. (Li); Lin, S. (Shang-Wei)

Authors Le, Q. L. (Quang Loc); Li, J. (Jiaying); Sun, J. (Jun); Li, L. (Li); Lin, S. (Shang-Wei) TeesRep - Teesside's Research Repository Automatic Loop-invariant Generation and Refinement through Selective Sampling Item type Meetings and Proceedings Authors Le, Q. L. (Quang Loc); Li, J. (Jiaying);

More information

Synthesizing from Components: Building from Blocks

Synthesizing from Components: Building from Blocks Synthesizing from Components: Building from Blocks Ashish Tiwari SRI International 333 Ravenswood Ave Menlo Park, CA 94025 Joint work with Sumit Gulwani (MSR), Vijay Anand Korthikanti (UIUC), Susmit Jha

More information

Pranav Garg 1 Christof Löding 2 P. Madhusudan 1 Daniel Neider 2

Pranav Garg 1 Christof Löding 2 P. Madhusudan 1 Daniel Neider 2 Form Methods Syst Des (2015) 47:120 157 DOI 10.1007/s10703-015-0231-6 Quantified data automata for linear data structures: a register automaton model with applications to learning invariants of programs

More information

An Incremental Approach to Model Checking Progress Properties

An Incremental Approach to Model Checking Progress Properties An Incremental Approach to Model Checking Progress Properties Aaron R. Bradley, Fabio Somenzi, Zyad Hassan, Yan Zhang Dept. of Electrical, Computer, and Energy Engineering University of Colorado at Boulder

More information

An Introduction to Z3

An Introduction to Z3 An Introduction to Z3 Huixing Fang National Trusted Embedded Software Engineering Technology Research Center April 12, 2017 Outline 1 SMT 2 Z3 Huixing Fang (ECNU) An Introduction to Z3 April 12, 2017 2

More information

Deterministic Program The While Program

Deterministic Program The While Program Deterministic Program The While Program Shangping Ren Department of Computer Science Illinois Institute of Technology February 24, 2014 Shangping Ren Deterministic Program The While Program February 24,

More information

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented

More information

Ivy: Safety Verification by Interactive Generalization

Ivy: Safety Verification by Interactive Generalization Ivy: Safety Verification by Interactive Generalization Oded Padon Verification Day 1-June-2016 [PLDI 16] Oded Padon, Kenneth McMillan, Aurojit Panda, Mooly Sagiv, Sharon Shoham. Ivy: Safety Verification

More information

Scalable and Accurate Verification of Data Flow Systems. Cesare Tinelli The University of Iowa

Scalable and Accurate Verification of Data Flow Systems. Cesare Tinelli The University of Iowa Scalable and Accurate Verification of Data Flow Systems Cesare Tinelli The University of Iowa Overview AFOSR Supported Research Collaborations NYU (project partner) Chalmers University (research collaborator)

More information

Proving Programs Correct

Proving Programs Correct Proving Programs Correct Page 1 of 9 Proving Programs Correct How can we be sure that a piece of code does what we want it to do? One way is to try testing the code on a large group of data. Another is

More information

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program Program verification Assertional semantics of a program Meaning of a program: relation between its inputs and outputs; specified by input assertions (pre-conditions) and output assertions (post-conditions)

More information

Specification Construction Using SMT Solvers

Specification Construction Using SMT Solvers Specification Construction Using SMT Solvers Paul C. Attie Fadi Zaraket Mohamad Noureddine Farah El-Hariri American University of Beirut Email: {pa07,fz11,man17,fsa20}@aub.edu.lb October 30, 2013 Abstract

More information

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z )

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z ) Starter Questions Feel free to discuss these with your neighbour: Consider two states s 1 and s 2 such that s 1, x := x + 1 s 2 If predicate P (x = y + 1) is true for s 2 then what does that tell us about

More information

Model Checking: An Introduction

Model Checking: An Introduction Model Checking: An Introduction Meeting 3, CSCI 5535, Spring 2013 Announcements Homework 0 ( Preliminaries ) out, due Friday Saturday This Week Dive into research motivating CSCI 5535 Next Week Begin foundations

More information

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in Oracle Turing Machines Nondeterministic OTM defined in the same way (transition relation, rather than function) oracle is like a subroutine, or function in your favorite PL but each call counts as single

More information

Stepwise Refinement! Top Down Design!

Stepwise Refinement! Top Down Design! Stepwise Refinement Top Down Design 11-1 On Top Down Design Useful in creating a function or algorithm when the input and output data structures correspond» If the input and output data structures do not

More information

Symbolic Computation and Theorem Proving in Program Analysis

Symbolic Computation and Theorem Proving in Program Analysis Symbolic Computation and Theorem Proving in Program Analysis Laura Kovács Chalmers Outline Part 1: Weakest Precondition for Program Analysis and Verification Part 2: Polynomial Invariant Generation (TACAS

More information

Concept Learning through General-to-Specific Ordering

Concept Learning through General-to-Specific Ordering 0. Concept Learning through General-to-Specific Ordering Based on Machine Learning, T. Mitchell, McGRAW Hill, 1997, ch. 2 Acknowledgement: The present slides are an adaptation of slides drawn by T. Mitchell

More information

Rewriting for Satisfiability Modulo Theories

Rewriting for Satisfiability Modulo Theories 1 Dipartimento di Informatica Università degli Studi di Verona Verona, Italy July 10, 2010 1 Joint work with Chris Lynch (Department of Mathematics and Computer Science, Clarkson University, NY, USA) and

More information

Formal Inductive Synthesis -- Theory and Applications

Formal Inductive Synthesis -- Theory and Applications Formal Inductive Synthesis -- Theory and Applications Sanjit A. Seshia EECS Department UC Berkeley Acknowledgments to several Ph.D. students, postdoctoral researchers, and collaborators, and to the students

More information

Verification and Validation

Verification and Validation 2010-2011 Cycle Ingénieur 2 ème année Département Informatique Verification and Validation Part IV : Proof-based Verification (III) Burkhart Wolff Département Informatique Université Paris-Sud / Orsay

More information

Satisfiability Modulo Theories

Satisfiability Modulo Theories Satisfiability Modulo Theories Summer School on Formal Methods Menlo College, 2011 Bruno Dutertre and Leonardo de Moura bruno@csl.sri.com, leonardo@microsoft.com SRI International, Microsoft Research SAT/SMT

More information

Motion planning applications of Satisfiability Modulo Convex Optimization

Motion planning applications of Satisfiability Modulo Convex Optimization Motion planning applications of Satisfiability Modulo Convex Optimization Yasser Shoukry (1) and Paulo Tabuada (2) (1) Department of Electrical and Computer Engineering, UMD (2) Electrical and Computer

More information

CS156: The Calculus of Computation

CS156: The Calculus of Computation Page 1 of 61 CS156: The Calculus of Computation Zohar Manna Winter 2010 Chapter 5: Program Correctness: Mechanics Page 2 of 61 Program A: LinearSearch with function specification @pre 0 l u < a @post rv

More information

Spatial Interpolants

Spatial Interpolants Spatial Interpolants Aws Albargouthi 1, Josh Berdine 2, Byron Cook 3, and Zachary Kincaid 4 University of Wisconsin-Madison 1, Microsoft Research 2, University College London 3, University of Toronto 4

More information

Tutorial 1: Modern SMT Solvers and Verification

Tutorial 1: Modern SMT Solvers and Verification University of Illinois at Urbana-Champaign Tutorial 1: Modern SMT Solvers and Verification Sayan Mitra Electrical & Computer Engineering Coordinated Science Laboratory University of Illinois at Urbana

More information

Loop Invariants and Binary Search. Chapter 4.4, 5.1

Loop Invariants and Binary Search. Chapter 4.4, 5.1 Loop Invariants and Binary Search Chapter 4.4, 5.1 Outline Iterative Algorithms, Assertions and Proofs of Correctness Binary Search: A Case Study Outline Iterative Algorithms, Assertions and Proofs of

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017 Catch Up / Drop in Lab When Fridays, 15.00-17.00 Where N335, CSIT Building

More information

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

Proof Calculus for Partial Correctness

Proof Calculus for Partial Correctness Proof Calculus for Partial Correctness Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 7, 2016 Bow-Yaw Wang (Academia Sinica) Proof Calculus for Partial Correctness September

More information

Reasoning about Time and Reliability

Reasoning about Time and Reliability Reasoning about Time and Reliability Probabilistic CTL model checking Daniel Bruns Institut für theoretische Informatik Universität Karlsruhe 13. Juli 2007 Seminar Theorie und Anwendung von Model Checking

More information

Overview. overview / 357

Overview. overview / 357 Overview overview6.1 Introduction Modelling parallel systems Linear Time Properties Regular Properties Linear Temporal Logic (LTL) Computation Tree Logic syntax and semantics of CTL expressiveness of CTL

More information

The Assignment Axiom (Hoare)

The Assignment Axiom (Hoare) The Assignment Axiom (Hoare) Syntax: V := E Semantics: value of V in final state is value of E in initial state Example: X:=X+ (adds one to the value of the variable X) The Assignment Axiom {Q[E/V ]} V

More information

Integrating Induction and Deduction for Verification and Synthesis

Integrating Induction and Deduction for Verification and Synthesis Integrating Induction and Deduction for Verification and Synthesis Sanjit A. Seshia Associate Professor EECS Department UC Berkeley DATE 2013 Tutorial March 18, 2013 Bob s Vision: Exploit Synergies between

More information

CS 336. We use the principle of inclusion and exclusion. Let B. = {five digit decimal numbers ending with a 5}, and

CS 336. We use the principle of inclusion and exclusion. Let B. = {five digit decimal numbers ending with a 5}, and CS 336 1. The important issue is the logic you used to arrive at your answer. 2. Use extra paper to determine your solutions then neatly transcribe them onto these sheets. 3. Do not submit the scratch

More information

Inductive Data Flow Graphs

Inductive Data Flow Graphs Inductive Data Flow Graphs Azadeh Farzan University of Toronto Zachary Kincaid Andreas Podelski University of Freiburg Abstract The correctness of a sequential program can be shown by the annotation of

More information

DUBLIN CITY UNIVERSITY SEMESTER 2 SOLUTIONS 2017/2018. CA648 - Formal Programming

DUBLIN CITY UNIVERSITY SEMESTER 2 SOLUTIONS 2017/2018. CA648 - Formal Programming MODULE: PROGRAMME(S): MCM YEAR OF STUDY: 1 EXAMINER(S): TIME ALLOWED: INSTRUCTIONS: DUBLIN CITY UNIVERSITY SEMESTER 2 2017/2018 CA648 - Formal Programming M.Sc. in Computing Geoffrey Hamilton Dr. Brian

More information

Logic. Propositional Logic: Syntax. Wffs

Logic. Propositional Logic: Syntax. Wffs Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about

More information

Axiomatic Semantics. Hoare s Correctness Triplets Dijkstra s Predicate Transformers

Axiomatic Semantics. Hoare s Correctness Triplets Dijkstra s Predicate Transformers Axiomatic Semantics Hoare s Correctness Triplets Dijkstra s Predicate Transformers Goal of a program = IO Relation Problem Specification Properties satisfied by the input and expected of the output (usually

More information

Refinement of Trace Abstraction

Refinement of Trace Abstraction Refinement of Trace Abstraction Matthias Heizmann, Jochen Hoenicke, and Andreas Podelski University of Freiburg, Germany Abstract. We present a new counterexample-guided abstraction refinement scheme.

More information