Symbolic Computation and Theorem Proving in Program Analysis

Size: px
Start display at page:

Download "Symbolic Computation and Theorem Proving in Program Analysis"

Transcription

1 Symbolic Computation and Theorem Proving in Program Analysis Laura Kovács Chalmers

2 Outline Part 1: Weakest Precondition for Program Analysis and Verification Part 2: Polynomial Invariant Generation (TACAS 08, LPAR 10) Part 3: Quantified Invariant Generation (FASE 09, MICAI 11) Part 4: Invariants, Interpolants and Symbol Elimination (CADE 09, POPL 12, APLAS 12)

3 Part 4: Invariants, Interpolants and Symbol Eliminatio Symbol Elimination by First-Order Theorem Proving Invariants, Interpolants and Symbol Elimination Interpolants from Proofs Interpolation in Vampire Quality of Interpolants Conclusions

4 Outline Invariants, Interpolants and Symbol Elimination Interpolants from Proofs Interpolation in Vampire Quality of Interpolants Conclusions

5 Invariants, Symbol Elimination, and Interpolation Reachability of B in ONE iteration: A(c, d) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d)

6 Invariants, Symbol Elimination, and Interpolation Reachability of B in ONE iteration: A(c, d) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d )

7 Invariants, Symbol Elimination, and Interpolation Reachability of B in ONE iteration: A(c, d) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d ) Refutation: A(c, d) T (c, d, c, d ) B(c, d ) The formula is of 2 states (c, d, c, d ). Need a state formula I(c, d ) such that: (Jhala and McMillan) A(c, d) T (c, d, c, d ) I(c, d ) and I(c, d ) B(c, d )

8 Invariants, Symbol Elimination, and Interpolation Reachability of B in ONE iteration: A(c, d) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d ) Refutation: A(c, d) T (c, d, c, d ) B(c, d ) The formula is of 2 states (c, d, c, d ). Need a state formula I(c, d ) such that: (Jhala and McMillan) A(c, d) T (c, d, c, d ) I(c, d ) and I(c, d ) B(c, d )

9 Invariants, Symbol Elimination, and Interpolation Reachability of B in ONE iteration: A(c, d) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d ) Refutation: A(c, d) T (c, d, c, d ) B(c, d ) The formula is of 2 states (c, d, c, d ). Need a state formula I(c, d ) such that: (Jhala and McMillan) A(c, d) T (c, d, c, d ) I(c, d ) and I(c, d ) B(c, d ) Taks: Compute interpolant I(c, d ) by eliminating symbols c, d.

10 Invariants, Symbol Elimination, and Interpolation Reachability of B in ONE iteration: A(c, d) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d ) I(c, d ) 0 < c = 1 C[0] = D[0] I(c, d ) 0 < c = 2 C[0] = D[0] C[1] = D[1] Taks: Compute interpolant I(c, d ) by eliminating symbols c, d.

11 Invariants, Symbol Elimination, and Interpolation Reachability of B in TWO iterations: A(c, d) T (c, d, c, d ) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d ) I(c, d ) 0 < c = 1 C[0] = D[0] I(c, d ) 0 < c = 2 C[0] = D[0] C[1] = D[1] Taks: Compute interpolant I(c, d ) by eliminating symbols c, d, c, d.

12 Invariants, Symbol Elimination, and Interpolation Reachability of B in TWO iterations: A(c, d) T (c, d, c, d ) T (c, d, c, d ) B(c, d ) {c = d = 0 N > 0 ( k) (0 k < N D[k] = 0)} precondition A(c, d) while (c < N) do C[c] := D[d]; c < N C[c] = D[d] c = c + 1 d = d + 1 c N }{{} T (c,d,c,d ) c := c + 1; d := d + 1 end do {( k)(0 k < N C[k] = 0)} postcondition B(c, d ) I(c, d ) ( k)0 k < c C[k] = D[k] I(c, d ) ( k)0 k < c C[k] = D[k] Taks: Compute interpolant I(c, d ) implying invariant in any state.

13 Outline Invariants, Interpolants and Symbol Elimination Interpolants from Proofs Interpolation in Vampire Quality of Interpolants Conclusions

14 Symbol Elimination and Interpolation What is an Interpolant? Computing Interpolants Local Derivations Symbol Eliminations Building Interpolants from Proof Summary: Invariants, Symbol Elimination, Interpolants

15 Notation First-order predicate logic with equality. : always true, : always false. A: universal closure of A. Symbols: predicate symbols; function symbols; constants. Equality is part of the language equality is not a symbol. L A : the language of A: the set of all formulas built from the symbols occurring in A.

16 What is an Interpolant? Let A, B be closed formulas such that A B. Theorem (Craig s Interpolation Theorem) There exists a closed formula I L A L B such that I is an interpolant of A and B. A I and I B. Note: if A and B are ground, they also have a ground interpolant.

17 What is an Interpolant? Let A, B be closed formulas such that A B. Theorem (Craig s Interpolation Theorem) There exists a closed formula I L A L B such that I is an interpolant of A and B. A I and I B. Reverse interpolant of A and B: any formula I such that A I and I, B.

18 Interpolation with Theories Theory T : any set of closed formulas. C 1,..., C n T C means that the formula C 1... C 1 C holds in all models of T. Interpreted symbols: symbols occurring in T. Uninterpreted symbols: all other symbols. Theorem Let A, B be formulas and let A T B. Then there exists a formula I such that 1. A T I and I B; 2. every uninterpreted symbol of I occurs both in A and B; 3. every interpreted symbol of I occurs in B. Likewise, there exists a formula I such that 1. A I and I T B; 2. every uninterpreted symbol of I occurs both in A and B; 3. every interpreted symbol of I occurs in A.

19 Interpolation with Theories Theory T : any set of closed formulas. C 1,..., C n T C means that the formula C 1... C 1 C holds in all models of T. Interpreted symbols: symbols occurring in T. Uninterpreted symbols: all other symbols. Theorem Let A, B be formulas and let A T B. Then there exists a formula I such that 1. A T I and I B; 2. every uninterpreted symbol of I occurs both in A and B; 3. every interpreted symbol of I occurs in B. Likewise, there exists a formula I such that 1. A I and I T B; 2. every uninterpreted symbol of I occurs both in A and B; 3. every interpreted symbol of I occurs in A.

20 Computing Interpolants using Inference Systems Inference Rule: A 1... A n A Inference system: a set of inference rules. Axiom: an inference rule with 0 premises. Derivation of A: tree with the root A built from inferences.

21 Interpolants and Local AB-Derivations AB-derivation Let L = L A L B. A derivation Π is an AB-derivation if (AB1) For every leaf C of Π one of following conditions holds: 1. A T C and C L A or 2. B T C and C L B. (AB2) For every inference C 1... C n C of Π we have C 1,..., C n T C. We will refer to property (AB2) as soundness.

22 Interpolants and Local AB-Derivations C 1... C n C This inference is local if the following two conditions hold: (L1) Either {C 1,..., C n, C} L A or {C 1,..., C n, C} L B. (L2) If all of the formulas C 1,..., C n are colorless, then C is colorless, too. A derivation is called local if so is every inference of this derivation.

23 Shape of local derivations for A B

24 Local Derivations: Example A B [demo] A := x(x = c) B := a = b Universal interpolant I: x y(x = y) A local refutation of in the superposition calculus: x = c y = c x = y a b y b

25 Local Derivations: Example A B [demo] A := x(x = c) B := a = b Universal interpolant I: x y(x = y) A local refutation of in the superposition calculus: x = c y = c x = y a b y b

26 Interpolants and Symbol Eliminating Inference At least one of the premises colored. The conclusion is not colored. x = c y = c x = y a b y b Interpolant x y(x = y): conclusion of a symbol-eliminating inference.

27 Interpolants and Symbol Eliminating Inference At least one of the premises colored. The conclusion is not colored. x = c y = c x = y a b y b Interpolant x y(x = y): conclusion of a symbol-eliminating inference.

28 Extracting Interpolants from Local Proofs Theorem (CADE 09) Let Π be a closed local AB-refutation. Then: A reverse interpolant I of A and B can be extracted from Π in linear time. I is ground if all formulas in Π are ground. I is a boolean combination of conclusions of symbol-eliminating inferences of Π. NOTE: No restriction on the calculus (only soundness required) can be used with theories. Can generate interpolants in theories where no good interpolation algorithms exist. Shift of interest: what matters are symbol-eliminating inferences.

29 Extracting Interpolants from Local Proofs Theorem (CADE 09) Let Π be a closed local AB-refutation. Then: A reverse interpolant I of A and B can be extracted from Π in linear time. I is ground if all formulas in Π are ground. I is a boolean combination of conclusions of symbol-eliminating inferences of Π. NOTE: No restriction on the calculus (only soundness required) can be used with theories. Can generate interpolants in theories where no good interpolation algorithms exist. Shift of interest: what matters are symbol-eliminating inferences.

30 Extracting Interpolants from Local Proofs Theorem (CADE 09) Let Π be a closed local AB-refutation. Then: A reverse interpolant I of A and B can be extracted from Π in linear time. I is ground if all formulas in Π are ground. I is a boolean combination of conclusions of symbol-eliminating inferences of Π. NOTE: No restriction on the calculus (only soundness required) can be used with theories. Can generate interpolants in theories where no good interpolation algorithms exist. Shift of interest: what matters are symbol-eliminating inferences.

31 Building Interpolants from Proofs Problem: generation of proofs giving interpolants. Idea 1: look for local refutations only; Idea 2: find calculi that guarantee that local proofs exist. LASCA: Superposition + Linear Arithmetic; Separating orderings (colored symbols are the greatest). Theorem (CADE 09) If is separating, then every AB-derivation in LASCA is local. First-order interpolation implemented in Vampire.

32 Building Interpolants from Proofs Problem: generation of proofs giving interpolants. Idea 1: look for local refutations only; Idea 2: find calculi that guarantee that local proofs exist. LASCA: Superposition + Linear Arithmetic; Separating orderings (colored symbols are the greatest). Theorem (CADE 09) If is separating, then every AB-derivation in LASCA is local. First-order interpolation implemented in Vampire.

33 Building Interpolants from Proofs Problem: generation of proofs giving interpolants. Idea 1: look for local refutations only; Idea 2: find calculi that guarantee that local proofs exist. LASCA: Superposition + Linear Arithmetic; Separating orderings (colored symbols are the greatest). Theorem (CADE 09) If is separating, then every AB-derivation in LASCA is local. First-order interpolation implemented in Vampire.

34 Building Interpolants from Proofs Problem: generation of proofs giving interpolants. Idea 1: look for local refutations only; Idea 2: find calculi that guarantee that local proofs exist. LASCA: Superposition + Linear Arithmetic; Separating orderings (colored symbols are the greatest). Theorem (CADE 09) If is separating, then every AB-derivation in LASCA is local. First-order interpolation implemented in Vampire.

35 Formulas Coloring Reverse Interpolant L : z < 0 x z y x left: z R : y 0 x + y 0 right: - y x x < 0 L : g(a) = c + 5 f (g(a)) c + 1 left: g, a R : h(b) = d + 4 d = c + 1 f (h(b)) < c + 1 right: h, b c + 1 f (c + 5) L : p c c q f (c) = 1 left: c R : q d d p f (d) = 0 right: d p q (q > p f (p) = 1) L : R : f (x 1 ) + x 2 = x 3 f (y 1 ) + y 2 = y 3 y 1 x 1 x 2 = g(b) y 2 = g(b) x 1 y 1 x 3 < y 3 left: right: f g, b x 1 > y 1 x 2 y 2 x 3 = y 3 R : c 1 cons(c 2, c 3 ) right: - L : c = car(c ) c = cdr(c 1 ) (atom(c 1 )) left: car, cons atom(c 1 ) c 1 = cons(c 2, c 3 ) L : Q(f (a)) Q(f (b)) left: Q, a, b R : f (V ) = c right: c x, y : f (x) f (y) L : a = c f (c) = a left: a R : c = b (b = f (c)) right: b c = f (c) L : True a [x ] = y x = x y = y + 1 z = x left: x, y R : (y = a [z ] + 1) right: a [x ] = y x = z Table : Interpolation with Vampire, within 1 second time limit.

36 Symbol Elimination and Interpolation Invariants, Interpolants and Symbol Elimination Interpolants from Proofs Interpolation in Vampire Quality of Interpolants Conclusions

37 Interpolation Through Colors in Vampire There are three colors: blue, red and green.

38 Interpolation Through Colors in Vampire There are three colors: blue, red and green. Each symbol (function or predicate) is colored in exactly one of these colors.

39 Interpolation Through Colors in Vampire There are three colors: blue, red and green. Each symbol (function or predicate) is colored in exactly one of these colors. We have two formulas: A and B. Each symbol in A is either blue or green. Each symbol in B is either red or green.

40 Interpolation Through Colors in Vampire There are three colors: blue, red and green. Each symbol (function or predicate) is colored in exactly one of these colors. We have two formulas: A and B. Each symbol in A is either blue or green. Each symbol in B is either red or green. We know that A B. Our goal is to find a green formula I such that 1. A I; 2. I B.

41 Interpolation Example in Vampire fof(fa,axiom, q(f(a)) & q(f(b)) ). fof(fb,conjecture,?[v]: V!= c).

42 Interpolation Example in Vampire % request to generate an interpolant vampire(option,show_interpolant,on). % symbol coloring vampire(symbol,predicate,q,1,left). vampire(symbol,function,f,1,left). vampire(symbol,function,a,0,left). vampire(symbol,function,b,0,left). vampire(symbol,function,c,0,right). % formula L vampire(left_formula). fof(fa,axiom, q(f(a)) & q(f(b)) ). vampire(end_formula). % formula R vampire(right_formula). fof(fb,conjecture,?[v]: V!= c). vampire(end_formula).

43 Symbol Elimination and Interpolation Invariants, Interpolants and Symbol Elimination Interpolants from Proofs Interpolation in Vampire Quality of Interpolants Conclusions

44 Given: a problem (an interpolation problem) Generate: a formula (an interpolant) -1 + a + -a = -1 x( (x 5) -6 + x -1) -( a) = -1 x((1 x + --(-1 + a) (-1 x))) (a 6 1 a + -1) x( (-1 x) (x -2)) x(-1 x + -a (-1 + a x)) x(-1 + x = x) -a a = -1 x( (--(-1 + a) x) 1 x + -1) x(( (x 4) -5 + x -1)) x(x (x 2)) x( (x 3) -4 + x -1) x(x + -a -1 (x -1 + a)) x(-1 + x = a + -(-1 + a) + x) 6 b

45 Given: a problem (an interpolation problem) Generate: a formula (an interpolant) -1 + a + -a = -1 x( (x 5) -6 + x -1) -( a) = -1 x((1 x + --(-1 + a) (-1 x))) (a 6 1 a + -1) x( (-1 x) (x -2)) x(-1 x + -a (-1 + a x)) x(-1 + x = x) -a a = -1 x( (--(-1 + a) x) 1 x + -1) x(( (x 4) -5 + x -1)) x(x (x 2)) x( (x 3) -4 + x -1) x(x + -a -1 (x -1 + a)) x(-1 + x = a + -(-1 + a) + x) 6 b or (a 6) -a -1 (-1 -a) a = a (2 + a 6) (-1 + a 1) (a 6 (b 6))

46 Given: a problem (an interpolation problem) Generate: a formula (an interpolant) which is small -1 + a + -a = -1 x( (x 5) -6 + x -1) -( a) = -1 x((1 x + --(-1 + a) (-1 x))) (a 6 1 a + -1) x( (-1 x) (x -2)) x(-1 x + -a (-1 + a x)) x(-1 + x = x) -a a = -1 x( (--(-1 + a) x) 1 x + -1) x(( (x 4) -5 + x -1)) x(x (x 2)) x( (x 3) -4 + x -1) x(x + -a -1 (x -1 + a)) x(-1 + x = a + -(-1 + a) + x) 6 b or (a 6) -a -1 (-1 -a) a = a (2 + a 6) (-1 + a 1) (a 6 (b 6))

47 Given: a problem (an interpolation problem) Generate: a formula (an interpolant) which is small -1 + a + -a = -1 x( (x 5) -6 + x -1) -( a) = -1 x((1 x + --(-1 + a) (-1 x))) (a 6 1 a + -1) x( (-1 x) (x -2)) x(-1 x + -a (-1 + a x)) x(-1 + x = x) -a a = -1 x( (--(-1 + a) x) 1 x + -1) x(( (x 4) -5 + x -1)) x(x (x 2)) x( (x 3) -4 + x -1) x(x + -a -1 (x -1 + a)) x(-1 + x = a + -(-1 + a) + x) 6 b What is a good interpolant? logical strength [Jhala07, D Silva09, McMillan08]; small size [Kroening10, Brillout11, Griggio11]. or (a 6) -a -1 (-1 -a) a = a (2 + a 6) (-1 + a 1) (a 6 (b 6))

48 How to Make Interpolants Smaller/Nicer? in size; in weight; in the number of quantifiers;...

49 How to Make Interpolants Smaller/Nicer? in size; in weight; in the number of quantifiers;... Revised Interpolation Problem: Given R B, find a green formula I: R I; I B; I is small.

50 Extracting Interpolants from Local Proofs

51 Extracting Interpolants from Local Proofs G 1 G 2 G 3 G 4 Interpolant: boolean combination of {G 1,..., G 4 } [McMillan05, KV09]

52 Extracting Interpolants from Local Proofs G 1 G 2 G 3 G 4 Digest Interpolant: boolean combination of {G 1,..., G 4 }

53 Extracting Interpolants from Local Proofs G 1 G 2 G is in the digest: - comes from a red block - followed by a blue or green block G 3 G 4 Digest Interpolant: boolean combination of {G 1,..., G 4 }

54 Extracting Interpolants from Local Proofs G 1 G 2 G is in the digest: - comes from a red block - followed by a blue or green block or - comes from a blue block - followed by a red G 3 G 4 Digest Interpolant: boolean combination of {G 1,..., G 4 }

55 How to Make Interpolants Smaller/Nicer? Task: minimise interpolants = minimise digest

56 How to Make Interpolants Smaller/Nicer? Task: minimise interpolants = minimise digest Idea: Change the green areas of the local proof

57 How to Make Interpolants Smaller/Nicer? Task: minimise interpolants = minimise digest Idea: Change the green areas of the local proof Slicing off formulas A 1 A n A A n+1 A m A 0 slicing off A A 1 A n A n+1 A m A 0

58 How to Make Interpolants Smaller/Nicer? Task: minimise interpolants = minimise digest Idea: Change the green areas of the local proof Slicing off formulas A 1 A n A A n+1 A m A 0 slicing off A A 1 A n A n+1 A m A 0 If A is green: Green slicing

59 How to Make Interpolants Smaller/Nicer? Task: minimise interpolants = minimise digest Idea: Change the green areas of the local proof Slicing off formulas B 0 R 0 G 1 G 0 B 0 R 0 slicing off G 1 G 0 If A is green: Green slicing

60 How to Make Interpolants Smaller/Nicer? Task: minimise interpolants = minimise digest Idea: Change the green areas of the local proof, but preserve locality! Slicing off formulas B 0 R 0 G 1 G 0 B 0 R 0 slicing off G 1 G 0 If A is green: Green slicing

61 How to Make Interpolants Smaller/Nicer? R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7

62 How to Make Interpolants Smaller/Nicer? Digest: {G 4, G 7 } R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7 Reverse interpolant: G 4 G 7

63 How to Make Interpolants Smaller/Nicer? R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7

64 How to Make Interpolants Smaller/Nicer? Digest: {G 5, G 7 } R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7 Reverse interpolant: G 5 G 7

65 How to Make Interpolants Smaller/Nicer? R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7

66 How to Make Interpolants Smaller/Nicer? Digest: {G 6, G 7 } R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7 Reverse interpolant: G 6 G 7

67 How to Make Interpolants Smaller/Nicer? R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7

68 How to Make Interpolants Smaller/Nicer? Digest: {G 6 } R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7 Reverse interpolant: G 6

69 How to Make Interpolants Smaller/Nicer? R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7 Note that the interpolant has changed from G 4 G 7 to G 6.

70 How to Make Interpolants Smaller/Nicer? R 3 R 1 G 1 G 3 B 1 G 2 G 4 G 5 G 6 R 4 G 7 Note that the interpolant has changed from G 4 G 7 to G 6. There is no obvious logical relation between G 4 G 7 and G 6, for example none of these formulas implies the other one; These formulas may even have no common atoms or no common symbols.

71 How to Make Interpolants Smaller/Nicer? If green slicing gives us very different interpolants, we can use it for finding small interpolants. Problem: if the proof contains n green formulas, the number of possible different slicing off transformations is 2 n.

72 How to Make Interpolants Smaller/Nicer? If green slicing gives us very different interpolants, we can use it for finding small interpolants. Problem: if the proof contains n green formulas, the number of possible different slicing off transformations is 2 n.

73 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations

74 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2

75 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations G 3, and at most one of G 1, G 2 can be sliced off. R B G 2 G 1 G 3

76 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Some predicates on green formulas: sliced(g): G was sliced off; red(g): the trace of G contains a red formula; blue(g): the trace of G contains a blue formula; green(g): the trace of G contains only green formulas; digest(g): G belongs to the digest.

77 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Some predicates on green formulas: sliced(g): G was sliced off; red(g): the trace of G contains a red formula; blue(g): the trace of G contains a blue formula; green(g): the trace of G contains only green formulas; digest(g): G belongs to the digest. sliced(g 1 ) Green(G 1 ) sliced(g 1 ) red(g 1 )

78 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Some predicates on green formulas: sliced(g): G was sliced off; red(g): the trace of G contains a red formula; blue(g): the trace of G contains a blue formula; green(g): the trace of G contains only green formulas; digest(g): G belongs to the digest. sliced(g 3 ) Green(G 3 ) sliced(g 3 ) (Green(G 3 ) Green(G 1 ) Green(G 2 )) sliced(g 3 ) (red(g 3 ) red(g 1 ) red(g 2 )) sliced(g 3 ) (blue(g 3 ) blue(g 1 ) blue(g 2 ))

79 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Some predicates on green formulas: sliced(g): G was sliced off; red(g): the trace of G contains a red formula; blue(g): the trace of G contains a blue formula; green(g): the trace of G contains only green formulas; digest(g): G belongs to the digest. digest(g 1 ) sliced(g 1 )

80 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Some predicates on green formulas: sliced(g): G was sliced off; red(g): the trace of G contains a red formula; blue(g): the trace of G contains a blue formula; green(g): the trace of G contains only green formulas; digest(g): G belongs to the digest. sliced(g 1 ) Green(G 1 ) sliced(g 1 ) red(g 1 ) sliced(g 3 ) Green(G 3 ) sliced(g 3 ) (Green(G 3 ) Green(G 1 ) Green(G 2 )) sliced(g 3 ) (red(g 3 ) red(g 1 ) red(g 2 )) sliced(g 3 ) (blue(g 3 ) blue(g 1 ) blue(g 2 )) digest(g 1 ) sliced(g 1 )

81 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Express digest(g)

82 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Express digest(g) by considering the possibilities: G comes from a red/ blue/green formula G is followed by a red/ blue/green formula

83 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Express digest(g) by considering the possibilities: G comes from a red/ blue/green formula rc(g)/bc(g) G is followed by a red/ blue/green formula bf(g)/rf(g)

84 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Express digest(g) by considering the possibilities: G comes from a red/ blue/green formula rc(g)/bc(g) G is followed by a red/ blue/green formula bf(g)/rf(g) digest(g 3 ) (rc(g 3 ) rf(g 3 )) (bc(g 3 ) bf(g 3 )) rc(g 3 ) ( sliced(g 3 ) (red(g 1 ) red(g 2 ))

85 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Express digest(g) by considering the possibilities: G comes from a red/ blue/green formula rc(g)/bc(g) G is followed by a red/ blue/green formula bf(g)/rf(g) sliced(g 1 ) Green(G 1 ) sliced(g 1 ) red(g 1 ) sliced(g 3 ) Green(G 3 ) sliced(g 3 ) (Green(G 3 ) Green(G 1 ) Green(G 2 )) sliced(g 3 ) (red(g 3 ) red(g 1 ) red(g 2 )) sliced(g 3 ) (blue(g 3 ) blue(g 1 ) blue(g 2 )) digest(g 1 ) sliced(g 1 ) digest(g 3 ) (rc(g 3 ) rf(g 3 )) (bc(g 3 ) bf(g 3 )) rc(g 3 ) ( sliced(g 3 ) (red(g 1 ) red(g 2 ))

86 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT solutions encode all slicing off transformations R G 1 G 3 B G 2 Express digest(g) by considering the possibilities: G comes from a red/ blue/green formula rc(g)/bc(g) G is followed by a red/ blue/green formula bf(g)/rf(g) sliced(g 1 ) Green(G 1 ) sliced(g 1 ) red(g 1 ) sliced(g 3 ) Green(G 3 ) sliced(g 3 ) (Green(G 3 ) Green(G 1 ) Green(G 2 )) sliced(g 3 ) (red(g 3 ) red(g 1 ) red(g 2 )) sliced(g 3 ) (blue(g 3 ) blue(g 1 ) blue(g 2 )) digest(g 1 ) sliced(g 1 ) digest(g 3 ) (rc(g 3 ) rf(g 3 )) (bc(g 3 ) bf(g 3 )) rc(g 3 ) ( sliced(g 3 ) (red(g 1 ) red(g 2 ))

87 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT; solutions encode all slicing off transformations; compute small interpolants: smallest digest of green formulas; ( ) min {Gi1,...,G in } digest(g i ) G i use a pseudo-boolean optimisation tool or an SMT solver to minimise interpolants; minimising interpolants is an NP-complete problem.

88 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT; solutions encode all slicing off transformations; compute small interpolants: smallest digest of green formulas; ( ) min {Gi1,...,G in } digest(g i ) G i use a pseudo-boolean optimisation tool or an SMT solver to minimise interpolants; minimising interpolants is an NP-complete problem.

89 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT; solutions encode all slicing off transformations; compute small interpolants: smallest digest of green formulas; ( ) min {Gi1,...,G in } digest(g i ) G i ( ) min {Gi1,...,G in } quantifier number(g i ) digest(g i ) G i use a pseudo-boolean optimisation tool or an SMT solver to minimise interpolants; minimising interpolants is an NP-complete problem.

90 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT; solutions encode all slicing off transformations; compute small interpolants: smallest digest of green formulas; ( ) min {Gi1,...,G in } digest(g i ) G i ( ) min {Gi1,...,G in } quantifier number(g i ) digest(g i ) G i use a pseudo-boolean optimisation tool or an SMT solver to minimise interpolants; minimising interpolants is an NP-complete problem.

91 How to Make Interpolants Smaller/Nicer? Solution: encode all sequences of transformations as an instance of SAT; solutions encode all slicing off transformations; compute small interpolants: smallest digest of green formulas; ( ) min {Gi1,...,G in } digest(g i ) G i ( ) min {Gi1,...,G in } quantifier number(g i ) digest(g i ) G i use a pseudo-boolean optimisation tool or an SMT solver to minimise interpolants; minimising interpolants is an NP-complete problem.

92 Experiments with Minimising Interpolants Experimental results: 9632 first-order examples from the TPTP library: for example, for 2000 problems the size of the interpolants became times smaller; 4347 SMT examples: we used Z3 for proving SMT examples; Z3 proofs were localised in Vampire; minimal interpolants were generated for 2123 SMT examples.

93 Experiments with Minimising Interpolants Experimental results: 9632 first-order examples from the TPTP library: for example, for 2000 problems the size of the interpolants became times smaller; 4347 SMT examples: we used Z3 for proving SMT examples; Z3 proofs were localised in Vampire; minimal interpolants were generated for 2123 SMT examples.

94 Experiments with Minimising Interpolants More realistic benchmarks: 4048 problems coming from CPAchecker; we used Vampire to generate local proofs; minimal interpolants were generated for 1903 CPAchecker examples: for 296 examples the size of the interpolant has decreased by a factor of 5; for 6 examples the size of the interpolant has decreased by a factor of 500.

95 Symbol Elimination and Interpolation Invariants, Interpolants and Symbol Elimination Interpolants from Proofs Interpolation in Vampire Quality of Interpolants Conclusions

96 Summary: Invariant Generation, Interpolation, Symbol Elimination Given the proof obligation A B: 1. Run a theorem prover and eliminate extra symbols; 2. Generate a (reverse) interpolant from a refutation; 3. Interpolant is a boolean combination of consequences of symbol-eliminating inferences. Given a loop: 1. Express loop properties in a language containing extra symbols; 2. Every logical consequence of these properties is a valid loop property, but not an invariant; 3. Run a theorem prover for eliminating extra symbols; 4. Every derived formula in the language of the loop is a loop invariant; 5. Invariants are consequences of symbol-eliminating inferences.

97 Summary: Invariant Generation, Interpolation, Symbol Elimination Given the proof obligation A B: 1. Run a theorem prover and eliminate extra symbols; 2. Generate a (reverse) interpolant from a refutation; 3. Interpolant is a boolean combination of consequences of symbol-eliminating inferences. Given a loop: 1. Express loop properties in a language containing extra symbols; 2. Every logical consequence of these properties is a valid loop property, but not an invariant; 3. Run a theorem prover for eliminating extra symbols; 4. Every derived formula in the language of the loop is a loop invariant; 5. Invariants are consequences of symbol-eliminating inferences.

98 End of Session 4 Slides for session 4 ended here...

Vinter: A Vampire-Based Tool for Interpolation

Vinter: A Vampire-Based Tool for Interpolation Vinter: A Vampire-Based Tool for Interpolation Kryštof Hoder 1, Andreas Holzer 2, Laura Kovács 2, and Andrei Voronkov 1 1 University of Manchester 2 TU Vienna Abstract. This paper describes the Vinter

More information

Interpolation and Symbol Elimination in Vampire

Interpolation and Symbol Elimination in Vampire Interpolation and Symbol Elimination in Vampire Kryštof Hoder 1, Laura Kovács 2, and Andrei Voronkov 1 1 University of Manchester 2 TU Vienna Abstract. It has recently been shown that proofs in which some

More information

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) First-Order Theorem Proving and Vampire Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) Outline Introduction First-Order Logic and TPTP Inference Systems

More information

First-Order Theorem Proving and Vampire

First-Order Theorem Proving and Vampire First-Order Theorem Proving and Vampire Laura Kovács 1,2 and Martin Suda 2 1 TU Wien 2 Chalmers Outline Introduction First-Order Logic and TPTP Inference Systems Saturation Algorithms Redundancy Elimination

More information

Beyond Quantifier-Free Interpolation in Extensions of Presburger Arithmetic

Beyond Quantifier-Free Interpolation in Extensions of Presburger Arithmetic Beyond Quantifier-Free Interpolation in Extensions of Presburger Arithmetic Angelo Brillout, 1 Daniel Kroening, 2 Philipp Rümmer, 3 Thomas Wahl 2 1 ETH Zurich 2 Oxford University 3 Uppsala University Deduction

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

Interpolation. Seminar Slides. Betim Musa. 27 th June Albert-Ludwigs-Universität Freiburg

Interpolation. Seminar Slides. Betim Musa. 27 th June Albert-Ludwigs-Universität Freiburg Interpolation Seminar Slides Albert-Ludwigs-Universität Freiburg Betim Musa 27 th June 2015 Motivation program add(int a, int b) { var x,i : int; l 0 assume(b 0); l 1 x := a; l 2 i := 0; while(i < b) {

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

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

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

Program Analysis Part I : Sequential Programs

Program Analysis Part I : Sequential Programs Program Analysis Part I : Sequential Programs IN5170/IN9170 Models of concurrency Program Analysis, lecture 5 Fall 2018 26. 9. 2018 2 / 44 Program correctness Is my program correct? Central question for

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

Applications of Craig Interpolants in Model Checking

Applications of Craig Interpolants in Model Checking Applications of Craig Interpolants in Model Checking K. L. McMillan Cadence Berkeley Labs Abstract. A Craig interpolant for a mutually inconsistent pair of formulas (A, B) is a formula that is (1) implied

More information

Topics in Model-Based Reasoning

Topics in Model-Based Reasoning Towards Integration of Proving and Solving Dipartimento di Informatica Università degli Studi di Verona Verona, Italy March, 2014 Automated reasoning Artificial Intelligence Automated Reasoning Computational

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

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. 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

Beyond Quantifier-Free Interpolation in Extensions of Presburger Arithmetic

Beyond Quantifier-Free Interpolation in Extensions of Presburger Arithmetic Beyond Quantifier-Free Interpolation in Extensions of Presburger Arithmetic Angelo Brillout 1, Daniel Kroening 2, Philipp Rümmer 2, and Thomas Wahl 2 1 ETH Zurich, Switzerland 2 Oxford University Computing

More information

The Eager Approach to SMT. Eager Approach to SMT

The Eager Approach to SMT. Eager Approach to SMT The Eager Approach to SMT Sanjit A. Seshia UC Berkeley Slides based on ICCAD 09 Tutorial Eager Approach to SMT Input Formula Satisfiability-preserving Boolean Encoder Boolean Formula SAT Solver SAT Solver

More information

Existence and Consistency in Bounded Arithmetic

Existence and Consistency in Bounded Arithmetic Existence and Consistency in Bounded Arithmetic Yoriyuki Yamagata National Institute of Advanced Science and Technology (AIST) Kusatsu, August 30, 2011 Outline Self introduction Summary Theories of PV

More information

Lecture 11: Measuring the Complexity of Proofs

Lecture 11: Measuring the Complexity of Proofs IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 11: Measuring the Complexity of Proofs David Mix Barrington and Alexis Maciel July

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

Interpolants from Z3 proofs

Interpolants from Z3 proofs 1 Interpolants from Z3 proofs Kenneth L. McMillan Microsoft Research Abstract Interpolating provers have a number of applications in formal verification, including abstraction refinement and invariant

More information

Solving Constrained Horn Clauses using Interpolation

Solving Constrained Horn Clauses using Interpolation Solving Constrained Horn Clauses using Interpolation MSR-TR-2013-6 Kenneth L. McMillan Micrsoft Research Andrey Rybalchenko Technische Universität München Abstract We present an interpolation-based method

More information

LOGIC PROPOSITIONAL REASONING

LOGIC PROPOSITIONAL REASONING LOGIC PROPOSITIONAL REASONING WS 2017/2018 (342.208) Armin Biere Martina Seidl biere@jku.at martina.seidl@jku.at Institute for Formal Models and Verification Johannes Kepler Universität Linz Version 2018.1

More information

SAT/SMT/AR Introduction and Applications

SAT/SMT/AR Introduction and Applications SAT/SMT/AR Introduction and Applications Ákos Hajdu Budapest University of Technology and Economics Department of Measurement and Information Systems 1 Ákos Hajdu About me o PhD student at BME MIT (2016

More information

arxiv: v1 [cs.lo] 29 May 2014

arxiv: v1 [cs.lo] 29 May 2014 Under consideration for publication in Theory and Practice of Logic Programming 1 arxiv:1405.7739v1 [cs.lo] 29 May 2014 (Quantified) Horn Constraint Solving for Program Verification and Synthesis Andrey

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

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

Hierarchic Superposition With Weak Abstraction and the Beagle Theorem Prover

Hierarchic Superposition With Weak Abstraction and the Beagle Theorem Prover Hierarchic Superposition With Weak Abstraction and the Beagle Theorem Prover Peter Baumgartner NICTA and ANU, Canberra Uwe Waldmann MPI für Informatik, Saarbrücken Goal Automated deduction in hierarchic

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

Last Time. Inference Rules

Last Time. Inference Rules Last Time When program S executes it switches to a different state We need to express assertions on the states of the program S before and after its execution We can do it using a Hoare triple written

More information

Explain: A Tool for Performing Abductive Inference

Explain: A Tool for Performing Abductive Inference Explain: A Tool for Performing Abductive Inference Isil Dillig and Thomas Dillig {idillig, tdillig}@cs.wm.edu Computer Science Department, College of William & Mary Abstract. This paper describes a tool

More information

A Practical and Complete Approach to Predicate Refinement

A Practical and Complete Approach to Predicate Refinement A Practical and Complete Approach to Predicate Refinement Ranjit Jhala and K.L. McMillan 1 University of California, San Diego 2 Cadence Berkeley Labs Abstract. Predicate abstraction is a method of synthesizing

More information

Interpolation: Theory and Applications

Interpolation: Theory and Applications Interpolation: Theory and Applications Vijay D Silva Google Inc., San Francisco SAT/SMT Summer School 2015 1 Conceptual Overview 2 A Brief History of Interpolation 3 Interpolant Construction 4 Verification

More information

Verification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation. Himanshu Jain THESIS ORAL TALK

Verification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation. Himanshu Jain THESIS ORAL TALK Verification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation Himanshu Jain THESIS ORAL TALK 1 Computer Systems are Pervasive Computer Systems = Software + Hardware Software/Hardware

More information

Exploring Interpolants

Exploring Interpolants Exploring Interpolants Philipp Rümmer, Pavle Subotić Department of Information Technology, Uppsala University, Sweden Abstract Craig Interpolation is a standard method to construct and refine abstractions

More information

The Impact of Craig s Interpolation Theorem. in Computer Science

The Impact of Craig s Interpolation Theorem. in Computer Science The Impact of Craig s Interpolation Theorem in Computer Science Cesare Tinelli tinelli@cs.uiowa.edu The University of Iowa Berkeley, May 2007 p.1/28 The Role of Logic in Computer Science Mathematical logic

More information

Pretending to be an SMT Solver with Vampire (and How We Do Instantiation)

Pretending to be an SMT Solver with Vampire (and How We Do Instantiation) Pretending to be an SMT Solver with Vampire (and How We Do Instantiation) Giles Reger 1, Martin Suda 2, and Andrei Voronkov 1,2 1 School of Computer Science, University of Manchester, UK 2 TU Wien, Vienna,

More information

Combining Decision Procedures

Combining Decision Procedures Combining Decision Procedures Ashish Tiwari tiwari@csl.sri.com http://www.csl.sri.com/. Computer Science Laboratory SRI International 333 Ravenswood Menlo Park, CA 94025 Combining Decision Procedures (p.1

More information

Complexity and algorithms for monomial and clausal predicate abstraction

Complexity and algorithms for monomial and clausal predicate abstraction Complexity and algorithms for monomial and clausal predicate abstraction Shuvendu K. Lahiri and Shaz Qadeer Microsoft Research Abstract. In this paper, we investigate the asymptotic complexity of various

More information

An Interpolating Sequent Calculus for Quantifier-Free Presburger Arithmetic

An Interpolating Sequent Calculus for Quantifier-Free Presburger Arithmetic An Interpolating Sequent Calculus for Quantifier-Free Presburger Arithmetic Angelo Brillout 1, Daniel Kroening 2, Philipp Rümmer 2, and Thomas Wahl 2 1 ETH Zurich, Switzerland 2 Oxford University Computing

More information

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008 WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008 WHAT I LL TALK ABOUT Propositional Logic Terminology, Satisfiability, Decision Procedure First-Order Logic Terminology, Background Theories Satisfiability

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

Design of Distributed Systems Melinda Tóth, Zoltán Horváth

Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Publication date 2014 Copyright 2014 Melinda Tóth, Zoltán Horváth Supported by TÁMOP-412A/1-11/1-2011-0052

More information

Horn Clauses and Beyond for Relational and Temporal Program Verification

Horn Clauses and Beyond for Relational and Temporal Program Verification First-Order Fixpoint Constraints Horn Clauses and Beyond for Relational and Temporal Program Verification Hiroshi Unno (University of Tsukuba, Japan) part of this is joint work with Tachio Terauchi, Eric

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

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

Predicate Abstraction via Symbolic Decision Procedures

Predicate Abstraction via Symbolic Decision Procedures Predicate Abstraction via Symbolic Decision Procedures Shuvendu K. Lahiri Thomas Ball Byron Cook May 26, 2005 Technical Report MSR-TR-2005-53 Microsoft Research Microsoft Corporation One Microsoft Way

More information

Hoare Logic and Model Checking

Hoare Logic and Model Checking Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the

More information

In Class Problem Set #15

In Class Problem Set #15 In Class Problem Set #15 CSE 1400 and MTH 2051 Fall 2012 Relations Definitions A relation is a set of ordered pairs (x, y) where x is related to y. Let denote a relational symbol. Write x y to express

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

Leonardo de Moura Microsoft Research

Leonardo de Moura Microsoft Research Leonardo de Moura Microsoft Research Logic is The Calculus of Computer Science (Z. Manna). High computational complexity Naïve solutions will not scale Is formula F satisfiable modulo theory T? SMT solvers

More information

Propositional Logic: Evaluating the Formulas

Propositional Logic: Evaluating the Formulas Institute for Formal Models and Verification Johannes Kepler University Linz VL Logik (LVA-Nr. 342208) Winter Semester 2015/2016 Propositional Logic: Evaluating the Formulas Version 2015.2 Armin Biere

More information

Nested Interpolants. Matthias Heizmann Jochen Hoenicke Andreas Podelski POPL University of Freiburg, Germany

Nested Interpolants. Matthias Heizmann Jochen Hoenicke Andreas Podelski POPL University of Freiburg, Germany Nested Interpolants Matthias Heizmann Jochen Hoenicke Andreas Podelski University of Freiburg, Germany POPL 2010 Result Interpolant-based software model checking for recursive programs avoid construction

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

Quantifiers. Leonardo de Moura Microsoft Research

Quantifiers. Leonardo de Moura Microsoft Research Quantifiers Leonardo de Moura Microsoft Research Satisfiability a > b + 2, a = 2c + 10, c + b 1000 SAT a = 0, b = 3, c = 5 Model 0 > 3 + 2, 0 = 2 5 + 10, 5 + ( 3) 1000 Quantifiers x y x > 0 f x, y = 0

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

Propositional and Predicate Logic - V

Propositional and Predicate Logic - V Propositional and Predicate Logic - V Petr Gregor KTIML MFF UK WS 2016/2017 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - V WS 2016/2017 1 / 21 Formal proof systems Hilbert s calculus

More information

The Potential and Challenges of CAD with Equational Constraints for SC-Square

The Potential and Challenges of CAD with Equational Constraints for SC-Square The Potential and Challenges of with Equational Constraints for SC-Square Matthew England (Coventry University) Joint work with: James H. Davenport (University of Bath) 7th International Conference on

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

Constraint Solving for Program Verification: Theory and Practice by Example

Constraint Solving for Program Verification: Theory and Practice by Example Constraint Solving for Program Verification: Theory and Practice by Example Andrey Rybalchenko Technische Universität München Abstract. Program verification relies on the construction of auxiliary assertions

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. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE 6341 1 Outline Introduction What are axiomatic semantics? First-order logic & assertions about states Results (triples)

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

An Interpolating Theorem Prover

An Interpolating Theorem Prover An Interpolating Theorem Prover K.L. McMillan Cadence Berkeley Labs Abstract. We present a method of deriving Craig interpolants from proofs in the quantifier-free theory of linear inequality and uninterpreted

More information

Constraint Solving for Program Verification: Theory and Practice by Example

Constraint Solving for Program Verification: Theory and Practice by Example Constraint Solving for Program Verification: Theory and Practice by Example Andrey Rybalchenko Technische Universität München Abstract. Program verification relies on the construction of auxiliary assertions

More information

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11. Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify

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

Efficient Interpolant Generation in Satisfiability Modulo Linear Integer Arithmetic

Efficient Interpolant Generation in Satisfiability Modulo Linear Integer Arithmetic Efficient Interpolant Generation in Satisfiability Modulo Linear Integer Arithmetic Alberto Griggio, Thi Thieu Hoa Le 2, and Roberto Sebastiani 2 FBK-Irst, Trento, Italy 2 DISI, University of Trento, Italy

More information

FMCAD 2013 Parameter Synthesis with IC3

FMCAD 2013 Parameter Synthesis with IC3 FMCAD 2013 Parameter Synthesis with IC3 A. Cimatti, A. Griggio, S. Mover, S. Tonetta FBK, Trento, Italy Motivations and Contributions Parametric descriptions of systems arise in many domains E.g. software,

More information

UCLID: Deciding Combinations of Theories via Eager Translation to SAT. SAT-based Decision Procedures

UCLID: Deciding Combinations of Theories via Eager Translation to SAT. SAT-based Decision Procedures UCLID: Deciding Combinations of Theories via Eager Translation to SAT Sanjit A. Seshia SAT-based Decision Procedures Input Formula Input Formula Satisfiability-preserving Boolean Encoder Boolean Formula

More information

Finite model finding in satisfiability modulo theories

Finite model finding in satisfiability modulo theories University of Iowa Iowa Research Online Theses and Dissertations Fall 2013 Finite model finding in satisfiability modulo theories Andrew Joseph Reynolds University of Iowa Copyright 2013 Andrew J. Reynolds

More information

Notes. Corneliu Popeea. May 3, 2013

Notes. Corneliu Popeea. May 3, 2013 Notes Corneliu Popeea May 3, 2013 1 Propositional logic Syntax We rely on a set of atomic propositions, AP, containing atoms like p, q. A propositional logic formula φ Formula is then defined by the following

More information

Propositional Logic: Models and Proofs

Propositional Logic: Models and Proofs Propositional Logic: Models and Proofs C. R. Ramakrishnan CSE 505 1 Syntax 2 Model Theory 3 Proof Theory and Resolution Compiled at 11:51 on 2016/11/02 Computing with Logic Propositional Logic CSE 505

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

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

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

Propositional Logic: Syntax

Propositional Logic: Syntax Logic Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about time (and programs) epistemic

More information

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics Introduction Arnd Poetzsch-Heffter Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern Sommersemester 2010 Arnd Poetzsch-Heffter ( Software Technology Group Fachbereich

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

Satisfiability Modulo Theories (SMT)

Satisfiability Modulo Theories (SMT) CS510 Software Engineering Satisfiability Modulo Theories (SMT) Slides modified from those by Aarti Gupta Textbook: The Calculus of Computation by A. Bradley and Z. Manna 1 Satisfiability Modulo Theory

More information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and

In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and shows how a program can sometimes be systematically constructed

More information

LRA Interpolants from No Man s Land. Leonardo Alt, Antti E. J. Hyvärinen, and Natasha Sharygina University of Lugano, Switzerland

LRA Interpolants from No Man s Land. Leonardo Alt, Antti E. J. Hyvärinen, and Natasha Sharygina University of Lugano, Switzerland LR Interpolants from No Man s Land Leonardo lt, ntti E. J. Hyvärinen, and Natasha Sharygina University of Lugano, Switzerland Motivation The goal: Finding the right proof The tool: Make interpolation

More information

Reasoning with Quantified Boolean Formulas

Reasoning with Quantified Boolean Formulas Reasoning with Quantified Boolean Formulas Martina Seidl Institute for Formal Models and Verification Johannes Kepler University Linz 1 What are QBF? Quantified Boolean formulas (QBF) are formulas of propositional

More information

Learning Goals of CS245 Logic and Computation

Learning Goals of CS245 Logic and Computation Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction

More information

Monitoring Distributed Controllers

Monitoring Distributed Controllers Monitoring Distributed Controllers When an Efficient LTL Algorithm on Sequences is Needed to Model-Check Traces A. Genon T. Massart C. Meuter Université Libre de Bruxelles Département d Informatique August

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

An Interpolating Sequent Calculus for Quantifier-Free Presburger Arithmetic

An Interpolating Sequent Calculus for Quantifier-Free Presburger Arithmetic J Autom Reasoning (2011) 47:341 367 DOI 10.1007/s10817-011-9237-y An Interpolating Sequent Calculus for Quantifier-Free Presburger Arithmetic Angelo Brillout Daniel Kroening Philipp Rümmer Thomas Wahl

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

CSE507. Satisfiability Modulo Theories. Computer-Aided Reasoning for Software. Emina Torlak

CSE507. Satisfiability Modulo Theories. Computer-Aided Reasoning for Software. Emina Torlak Computer-Aided Reasoning for Software CSE507 Satisfiability Modulo Theories courses.cs.washington.edu/courses/cse507/18sp/ Emina Torlak emina@cs.washington.edu Today Last lecture Practical applications

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

Property-Directed k-induction

Property-Directed k-induction Property-Directed k-induction Dejan Jovanović SRI International dejan.jovanovic@sri.com Bruno Dutertre SRI International bruno.dutertre@sri.com Abstract IC3 and k-induction are commonly used in automated

More information

Discrete Mathematics and Logic II. Predicate Calculus

Discrete Mathematics and Logic II. Predicate Calculus Discrete Mathematics and Logic II. Predicate Calculus SFWR ENG 2FA3 Ryszard Janicki Winter 2014 Acknowledgments: Material based on A Logical Approach to Discrete Math by David Gries and Fred B. Schneider

More information

On the Complexity of the Reflected Logic of Proofs

On the Complexity of the Reflected Logic of Proofs On the Complexity of the Reflected Logic of Proofs Nikolai V. Krupski Department of Math. Logic and the Theory of Algorithms, Faculty of Mechanics and Mathematics, Moscow State University, Moscow 119899,

More information

The TLA + proof system

The TLA + proof system The TLA + proof system Stephan Merz Kaustuv Chaudhuri, Damien Doligez, Leslie Lamport INRIA Nancy & INRIA-MSR Joint Centre, France Amir Pnueli Memorial Symposium New York University, May 8, 2010 Stephan

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

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

Decision Procedures for Satisfiability and Validity in Propositional Logic

Decision Procedures for Satisfiability and Validity in Propositional Logic Decision Procedures for Satisfiability and Validity in Propositional Logic Meghdad Ghari Institute for Research in Fundamental Sciences (IPM) School of Mathematics-Isfahan Branch Logic Group http://math.ipm.ac.ir/isfahan/logic-group.htm

More information