Termination Analysis of Loops

Size: px
Start display at page:

Download "Termination Analysis of Loops"

Transcription

1 Termination Analysis of Loops Zohar Manna with Aaron R. Bradley Computer Science Department Stanford University 1

2 Example: GCD Algorithm gcd(y 1, y 2 ) = gcd(y 1 y 2, y 2 ) if y 1 > y 2 gcd(y 1, y 2 y 1 ) if y 1 < y 2 y 1 if y 1 = y 2 Example: gcd(77, 112) = gcd(77, 35) = gcd(42, 35) = gcd(7, 35) = gcd(7, 28) = gcd(7, 21) = gcd(7, 14) = gcd(7, 7) = 7 2

3 Example: GCD Program int gcd(int y 1 > 0, int y 2 > 0) while y 1 y 2 do if y 1 > y 2 then y 1 := y 1 y 2 else y 2 := y 2 y 1 done return y 1 Abstract program: Θ : {y 1 1, y 2 1} τ 1 : {y 1 y 2 + 1} {y 1 = y 1 y 2, y 2 = y 2 } τ 2 : {y 2 y 1 + 1} {y 2 = y 2 y 1, y 1 = y 1 } for y 1, y 2 R 3

4 Example: Termination of GCD δ(y 1, y 2 ) = y 1 + y 2 Θ : {y 1 1, y 2 1} τ 1 : {y 1 y 2 + 1} {y 1 = y 1 y 2, y 2 = y 2 } τ 2 : {y 2 y 1 + 1} {y 2 = y 2 y 1, y 1 = y 1 } is a ranking function y 1 1 y 2 1 is a loop invariant δ is bounded from below: if τ 1 or τ 2 can be taken, δ(y 1, y 2 ) 0 δ decreases on each iteration: if τ 1 or τ 2 is taken, δ(y 1, y 2) δ(y 1, y 2 ) 1 Therefore, GCD terminates. Goal: Find ranking functions and supporting invariants automatically. 4

5 Ranking Functions 5

6 Loops Loop Abstraction: L : Θ, T over V: GCD variables V range over R {y 1, y 2 } initial condition Θ is assertion over V y 1 1 y 2 1 transitions τ T are assertions {τ 1, τ 2 } τ(v, V ) over V V Loop Validity: Assertion ϕ is valid over loop L L = ϕ if ϕ holds on all reachable states S L of L. values of (y 1, y 2 ) In practice, replace L = with loop invariants. y 1 1 y 2 1 6

7 Well-founded Relation (D, ): is well-founded if there is no infinite sequence d 1, d 2, d 3,... where d i D such that ( i) d i d i+1 (d 2 d 1 d 1 d 2 ) Examples: (Z +, <) (R +, ɛ ) for ɛ > 0 x ɛ y x y ɛ (L, ) for lists L l 1 l 2 l 1 < l 2 7

8 Ranking Function Consider loop L : Θ, T over V. δ : S L R is a ranking function of L if (Bounded) ( τ T ) (Ranking) ( ɛ > 0)( τ T ) L = τ(v, V ) δ(v) 0 L = τ(v, V ) δ(v ) δ(v) ɛ δ, ɛ induce a well-founded relation over S L : for s, t S L, Thus, L always terminates. s t δ(s) δ(t) ɛ 8

9 Example: GCD Prove δ(y 1, y 2 ) = y 1 + y 2 is a ranking function for GCD. Take loop invariant y 1 1 y 2 1. Choose ɛ = 1. Bounded τ 1 Ranking τ 1 y 2 1 }{{} y 1 y }{{} y 1 + y 2 0 invariant guard of τ 1 y 2 1 }{{} invariant (y 1 y 2 ) + (y 2 ) y 1 + y 2 }{{}}{{} 1 ɛ substitution by τ 1 9

10 Example: GCD Bounded τ 2 Ranking τ 2 y 1 1 }{{} y 2 y }{{} y 1 + y 2 0 invariant guard of τ 2 y 1 1 }{{} invariant (y 1 ) + (y 2 y 1 ) y 1 + y 2 }{{}}{{} 1 ɛ substitution by τ 2 Assertions are valid, so GCD always terminates. 10

11 Lexicographic Well-founded Relation Given well-founded relations over domains (D 1, 1 ), (D 2, 2 ),..., (D k, k ) define lexicographic well-founded relation over D = D 1 D 2 D k For d = d 1, d 2,..., d k, e = e 1, e 2,..., e k D d e ( i) [d i i e i ( j < i) d j = e j ] d 1,..., d i,..., d k = = i e 1,..., e i,..., e k 11

12 Lexicographic Ranking Function Consider loop L : Θ, T. Tuple of functions δ : δ 1, δ 2,..., δ k where δ i : S L R and map π : T {1,..., k} comprise a lexicographic ranking function for L if (Bounded) ( τ T ) (Ranking) ( ɛ > 0)( τ T ) L = τ(v, V ) δ π(τ) (V) 0 L = τ(v, V ) δ π(τ) (V ) δ π(τ) (V) ɛ (Nonincreasing) ( τ T ) L = ( j < π(τ))[τ(v, V ) δ j (V ) δ j (V)] 12

13 Induced Lexicographic Well-founded Relation δ, ɛ induce a lexicographic well-founded relation over S L : for s, t S L, s t ( i) [δ i (s) δ i (t) ɛ ( j < i) δ j (s) = δ j (t)] Thus, L always terminates. 13

14 Example: McCarthy 91 For n Z +, f(n) = f(f(n + 11)) if n 100 n 10 if n > 100 For every 1 n 92, f(n) = 91, if it terminates. We prove termination for all n Z +. Example: f(89) = f(f(100)) = f(f(f(111))) = f(f(101)) = f(91) = f(f(102)) = = 91 14

15 Example: Imperative McCarthy 91 int f(int x) int s = 1 while true do if x > 100 then if s = 1 then return x 10 else x := x 10 s := s 1 else x := x + 11 s := s + 1 done Abstract program: for x, s R Θ : {s = 1} τ 1 : {x 101, s 1} {x = x 10, s = s 1} τ 2 : {x 100} {x = x + 11, s = s + 1} 15

16 Example: McCarthy 91 Prove 10s x + 90 }{{}, }{{} x δ 1 δ 2 π(τ 1 ) = 2, π(τ 2 ) = 1 is a lexicographic ranking function for McCarthy 91. Take loop invariant s 1. Choose ɛ = 1. Show τ 1 δ 2 0 τ 2 δ 1 0 τ 1 δ 2 δ 2 ɛ τ 2 δ 1 δ 1 ɛ τ 1 δ 1 δ 1 16

17 Example: McCarthy 91 Bounded τ 1 : π(τ 1 ) = 2 Ranking τ 1 : π(τ 1 ) = 2 x 101 }{{} }{{} x 0 guard of τ 1 δ 2 x 101 (x 10) }{{}}{{}}{{} x }{{} 1 guard of τ δ 1 substitution into δ 2 by τ 2 ɛ 1 Nonincreasing τ 1 : 1 < π(τ 1 ) = 2 x (s 1) (x 10) s x + 90 }{{}}{{}}{{} guard of τ 1 substitution into δ 1 by τ δ

18 Example: McCarthy 91 Bounded τ 2 : π(τ 2 ) = 1 Ranking τ 2 : π(τ 2 ) = 1 s 1 x s x }{{}}{{}}{{} invariant guard of τ 2 δ 1 10(s + 1) (x + 11) s }{{}} {{ x + 90 } }{{} 1 substitution into δ 1 by τ δ 1 ɛ 2 Assertions are valid, so McCarthy 91 always terminates. 18

19 The Theoretical Landscape 19

20 Ranking Functions Theorem Every terminating loop has a ranking function. But in general, expressing a ranking function requires FOL with fixpoints, which is incomplete. Therefore, termination is not necessarily semi-decidable. In fact, we show that termination is not semi-decidable for a simple class of loops. 20

21 Interlude: Linear Loops Consider variables V = {x 1, x 2,..., x m }. homogenous vector: x = (x 1,..., x m, 1) T linear assertion: Ax 0 a 1,1 a 1,m a 1,m+1... a k,1 a k,m a k,m+1 x 1... x m i {1,...,k} (a i,1 x a i,m x m + a i,m+1 ) 0 21

22 Interlude: Linear Loops Consider variables V = {x 1, x 2,..., x m }. linear loop: L : Θ, T in which all assertions are linear let (xx ) = (x 1,..., x m, x 1,..., x m, 1) T initial condition: Θx 0 transitions: τ i (xx ) 0 22

23 Theoretical Limitation Consider loops of form: Θ : x i V V for x R n. Restricted subset of linear loops. x i = c i while g T x 0 do x := (A 1 A 2 A k ) }{{} x nondeterministic choice done Theorem Termination of such loops is not semi-decidable (not recursively enumerable). No complete method. 23

24 Synthesis Problem Identify class of loops Y and class of ranking functions Z such that synthesis of ranking functions of form Z is complete for Y. Examples: Linear ranking functions for linear loops. Lexicographic linear ranking functions for linear loops. 24

25 Recent Works Colón & Sipma 2001 Synthesis of linear ranking functions for linear loops. Colón & Sipma 2002 Extension to nested loops and multiple paths. Colón, Sankaranarayanan & Sipma 2003 Constraint-based linear invariant generation. Podelski & Rybalchenko 2004 Complete method for linear loops with one transition and no initial condition. Based on linear programming. Bradley, Manna & Sipma 2005 Polyranking-based analysis for polynomial loops with assignment. Bradley, Manna & Sipma 2005 Synthesis of lexicographic linear ranking functions with supporting invariants. 25

26 Synthesis of Linear Ranking Functions with Supporting Invariants 26

27 Linear Ranking Function Constraint-based approach: templates with unknown coefficients. Consider linear loop L : Θ, T. For r T x a template (r i are unknown coefficients), r T x is a linear ranking function if (Bounded) ( τ T ) L = τ(xx ) 0 r T x }{{} δ 0 (Ranking) ( ɛ > 0)( τ T ) L = τ(xx ) 0 r T x r T x ɛ 27

28 Lexicographic Linear Ranking Function Consider linear loop L : Θ, T. T x r T 1 x,..., r }{{} k and π : T {1,..., k} }{{} δ 1 δ k for unknown coefficients r ij and unknown π, is a k-component lexicographic linear ranking function if (Bounded) ( τ T ) (Ranking) ( ɛ > 0)( τ T ) L = τ(xx ) 0 r T π(τ) x 0 L = τ(xx ) 0 r T π(τ) x rt π(τ) x ɛ (Nonincreasing) ( τ T ) L = ( j < π(τ))[τ(xx ) 0 r T j x r T j x 0] 28

29 Linear Supporting Invariant Ranking functions often require supporting invariants. Consider linear loop L : Θ, T. For Ix 0 a template (I ij are unknown coefficients), Ix 0 is an l-conjunct linear invariant if (Initiation) Θx 0 Ix 0 (Consecution) ( τ T ) Inductive assertion invariant Ix 0 τ(xx ) 0 Ix 0 How do we find the unknown coefficients in the template? 29

30 Farkas Lemma (1894) System of linear inequalities over real variables x = {x 1,..., x n }: a 1,1 x a 1,n x n + b 1 0 S :... a m,1 x a m,n x n + b m 0 S entails linear inequality ψ : c 1 x c n x n + d 0 if and only if there exist real numbers λ 1,..., λ m 0 such that ( m m m ) c 1 = λ i a i,1 c n = λ i a i,n d λ i b i i=1 i=1 i=1 30

31 Synthesis Overview Consider loop L : Θ, T over V = {x 1, x 2,..., x m }. Templates: expression c T x, unknown coefficient vector c assertion Cx 0, unknown coefficient matrix C Given templates l-conjunct invariant template Ix 0 (I has l rows) k-component lexicographic ranking function templates {c 1 T x,..., c k T x} Apply Farkas Lemma rules to encode ranking function and supporting invariant conditions. Either use given π or synthesize it. 31

32 Farkas Lemma Rules: Invariant (Initiation) (Consecution) (Disabled) C i : D i : I : Θx 0 Ix 0 Ix 0 τ i (xx ) 0 Ix 0 Ix 0 τ i (xx ) false 32

33 Farkas Lemma Rules: Ranking Function (Bounded) B i : Ix 0 τ i (xx ) 0 c T x 0 (Ranking) R i : Ix 0 τ i (xx ) 0 c T x c T x ɛ 0 33

34 Example: R 1 for GCD τ 1 : {y 1 y 2 + 1} {y 1 = y 1 y 2, y 2 = y 2 } λ 1 i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 λ 2 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 λ 3 y 1 y λ 4 y 1 y 2 y 1 = 0 λ 5 y 2 + y 2 = 0 c 1 y 1 + c 2 y 2 c 1 y 1 c 2 y 2 ɛ 0 λ 1 i 1,1 + λ 2 i 2,1 + λ 3 + λ 4 = c 1 λ 1 i 1,3 + λ 2 i 2,3 λ 3 ɛ λ 1 i 1,2 + λ 2 i 2,2 λ 3 λ 4 λ 5 = c 2 λ 1, λ 2, λ 3 0 λ 4 = c 1 ɛ > 0 λ 5 = c 2 Constraints are over {c 1, c 2, ɛ, λ 1,..., λ 5, i 1,1,..., i 2,3 }. 34

35 Generated Constraints Constraints are linear if no invariant template is given. Constraints are parametric linear otherwise. Linear, except for a few bilinear quadratic terms (a λ and a supporting invariant template coefficient, e.g., λ 1 i 1,1 ) Decidable [Tarski 1951] Generic solvers based on CAD [Collins 1975] (e.g., Mathematica, Redlog) Specialized solvers [Sankaranarayanan et al. 2004], [Bradley et al. 2005] 35

36 Synthesis: Soundness and Completeness Special Case Linear loop L : Θ, T has a linear ranking function supported by an l-conjunct linear invariant the constraint system generated by I (D i (C i B i R i )) is satisfiable. τ i T 36

37 Example: GCD Find Θ : {y 1 1, y 2 1} τ 1 : {y 1 y 2 + 1} {y 1 = y 1 y 2, y 2 = y 2 } τ 2 : {y 2 y 1 + 1} {y 2 = y 2 y 1, y 1 = y 1 } a linear ranking function c T x c 1 y 1 + c 2 y 2 + c 3 with a 2-conjunct supporting invariant Ix 0 y 1 y 2 i 1,1 i 1,2 i 1,3 i 2,1 i 2,2 i 2,

38 Example: GCD Invariant Initiation Consecution I : y 1 1 y 2 1 i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 C 1 : i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 y 1 y y 1 = y 1 y 2 y 2 = y 2 i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 C 2 : i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 y 2 y y 2 = y 2 y 1 y 1 = y 1 i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 38

39 Example: GCD Ranking Function Bounded B 1 : i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 y 1 y c 1 y 1 + c 2 y 2 + c 3 0 B 2 : i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 y 2 y c 1 y 1 + c 2 y 2 + c 3 0 Ranking R 1 : R 2 : i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 y 1 y y 1 = y 1 y 2 y 2 = y 2 c 1 y 1 + c 2 y 2 c 1 y 1 + c 2 y 2 + ɛ i 1,1 y 1 + i 1,2 y 2 + i 1,3 0 i 2,1 y 1 + i 2,2 y 2 + i 2,3 0 y 2 y y 2 = y 2 y 1 y 1 = y 1 c 1 y 1 + c 2 y 2 c 1 y 1 + c 2 y 2 + ɛ 39

40 Example: GCD Synthesis Θ : {y 1 1, y 2 1} τ 1 : {y 1 y 2 + 1} {y 1 = y 1 y 2, y 2 = y 2 } τ 2 : {y 2 y 1 + 1} {y 2 = y 2 y 1, y 1 = y 1 } Solving the constraint system induced by reveals ranking function I C 1 C 2 B 1 B 2 R 1 R 2 c 1 = c 2 = 1, c 3 = 0 y 1 + y 2 with ɛ = 1, supported by the invariants i 1,1 = 1, i 1,2 = 0, i 1,3 = 1 i 2,1 = 0, i 2,2 = 1, i 2,3 = 1 y 1 1 y 2 1 which proves that GCD always terminates. 40

41 Synthesis of Linear Lexicographic Ranking Functions with Supporting Invariants 41

42 Farkas Lemma Rules: Invariant (Initiation) (Consecution) (Disabled) C i : D i : I : Θx 0 Ix 0 Ix 0 τ i (xx ) 0 Ix 0 Ix 0 τ i (xx ) false 42

43 Farkas Lemma Rules: Ranking Function (Bounded) B ij : Ix 0 τ i (xx ) 0 c j T x 0 (Ranking) (Nonincreasing) R ij : N ij : Ix 0 τ i (xx ) 0 c T j x c T j x ɛ 0 Ix 0 τ i (xx ) 0 c T j x c T j x 0 43

44 Synthesis: Soundness and Completeness Theorem (General Case) Linear loop L : Θ, T has a k-lexicographic linear ranking function supported by an l-conjunct linear invariant the constraint system generated by I ( Di ( )) C i B i,π(i) R i,π(i) τ i T is satisfiable for some π : T {1,..., k}. τ i T, j<π(i) (D i N ij ) 44

45 Synthesizing Lexicographic Ranking Functions The theorem asks for a map π. Can we efficiently find the map? Overview: Initially propose one template component per transition {c 1 T x,..., c n T x} Inexpensive because template coefficients c i appear only linearly in generated constraints. Incrementally build linear order over T. Linear order gives π. Use intermediate partial orders to generate and solve constraint systems to guide search. 45

46 Simplified Farkas Lemma Rules One component per transition. (Bounded) B i : Ix 0 τ i (xx ) 0 c i T x 0 (Ranking) R i : Ix 0 τ i (xx ) 0 c i T x c i T x ɛ 0 46

47 Synthesizing Lexicographic Ranking Functions Incrementally build over T : 1. Guess τ i τ j :..., c i T x,..., c j T x, Generate constraint system and solve. I, C i, D i, B i, R i are fixed. τ i τ j induces N ji : τ j should not increase c i T x Satisfiable Continue search Unsatisfiable Try τ i τ j Satisfiable Continue search Unsatisfiable Backtrack 3. Finished when order is linear and generated constraint system is satisfiable. 47

48 One Constraint System per Component Given lexicographic template components {c T 1 x,..., c T n x} and partial order over T, solve n constraint systems induced by I τ i (D i C i ) } {{ } Invariant (D j (B j R j )) }{{} τ j ranked by c j T τ i s.t. τ j τ i (D i N ij ) }{{} τ i does not increase c j T if τ j τ i..., c T j x,..., c T i x,... τ j τ i for j {1,..., n}. 48

49 One Constraint System per Component Advantages: Multiple smaller constraint systems are easier to solve in practice. Invariant template may be instantiated differently for each constraint system. 49

50 Example: McCarthy 91 Θ : {s = 1} τ 1 : {x 101, s 0} {x = x 10, s = s 1} τ 2 : {x 101, s 2} {x = x 10, s = s 1} split of s 1 τ 3 : {x 100} {x = x + 11, s = s + 1} Find a 3-component lexicographic linear ranking function r T 1 x, r T 2 x, r T 3 x π : T {1, 2, 3} with a 1-conjunct supporting invariant Ix 0 50

51 Example: McCarthy 91 Iteration 1: One template per transition. {c T 1 x, c T 2 x, c T 3 x} No order assumed between transitions. Three sets of conditions: c T 1 x : I C 1 C 2 C 3 B 1 R 1 c T 2 x : I C 1 C 2 C 3 B 2 R 2 c T 3 x : I C 1 C 2 C 3 B 3 R 3 Induced constraint systems are satisfiable. 51

52 Example: McCarthy 91 Constraints on c 1 T x: Initiation Consecution I : s = 1 i 1 s + i 2 x + i 3 0 C 1 : C 2 : C 3 : i 1 s + i 2 x + i 3 0 x 101 s 2 x = x 10 s = s 1 i 1 s + i 2 x + i 3 0 i 1 s + i 2 x + i 3 0 x 101 s 0 x = x 10 s = s 1 i 1 s + i 2 x + i 3 0 i 1 s + i 2 x + i 3 0 x 100 x = x + 11 s = s + 1 i 1 s + i 2 x + i

53 Example: McCarthy 91 Bounded B 1 : i 1 s + i 2 x + i 3 0 x 101 s 0 c 1,1 s + c 1,2 x + c 1,3 0 Ranking R 1 : i 1 s + i 2 x + i 3 0 x 101 s 0 x = x 10 s = s 1 c 1,1 s + c 1,2 x c 1,1 s + c 1,2 x + ɛ 53

54 Example: McCarthy 91 Iteration 2: Guess τ 3 τ 2...., c 3 T x,..., c 2 T x,... τ 2 should not increase c T 3 x. Three sets of conditions: c T 1 x : I C 1 C 2 C 3 B 1 R 1 c T 2 x : I C 1 C 2 C 3 B 2 R 2 c T 3 x : I C 1 C 2 C 3 B 3 R 3 N 2,3 Induced constraint systems are satisfiable. 54

55 Example: McCarthy 91 Iteration 3: Guess τ 1 τ 3...., c 1 T x,..., c 3 T x,... τ 3 should not increase c T 1 x. Three sets of conditions: c T 1 x : I C 1 C 2 C 3 B 1 R 1 N 3,1 c T 2 x : I C 1 C 2 C 3 B 2 R 2 c T 3 x : I C 1 C 2 C 3 B 3 R 3 N 2,3 Induced constraint system for c T 1 x is unsatisfiable. 55

56 Example: McCarthy 91 Iteration 3: Try τ 3 τ 1 instead...., c T 3 x,..., c T 1 x,... τ 1 should not increase c T 3 x. Three sets of conditions: c T 1 x : I C 1 C 2 C 3 B 1 R 1 c T 2 x : I C 1 C 2 C 3 B 2 R 2 c T 3 x : I C 1 C 2 C 3 B 3 R 3 N 2,3 N 1,3 Induced constraint systems are satisfiable. 56

57 Example: McCarthy 91 Iteration 4: Guess τ 2 τ 1 (but τ 1 τ 2 works, too)...., c T 2 x,..., c T 1 x,... τ 1 should not increase c T 2 x. Three sets of conditions: c T 1 x : I C 1 C 2 C 3 B 1 R 1 c T 2 x : I C 1 C 2 C 3 B 2 R 2 N 1,2 c T 3 x : I C 1 C 2 C 3 B 3 R 3 N 2,3 N 1,3 Induced constraint systems are satisfiable. 57

58 Example: McCarthy 91 Iteration 4: is a linear order: c T 3 x, c T 2 x, c T 1 x τ 3 τ 2 τ 1 gives π: π(τ 1 ) = 3, π(τ 2 ) = 2, π(τ 3 ) = 1 58

59 Example: McCarthy 91 Θ : {s = 1} τ 1 : {x 101, s 0} {x = x 10, s = s 1} τ 2 : {x 101, s 2} {x = x 10, s = s 1} τ 3 : {x 100} {x = x + 11, s = s + 1} Solving the final constraint systems reveals ranking function 10s x + 90, x, x π(τ 1 ) = 3, π(τ 2 ) = 2, π(τ 3 ) = 1 supported by the invariant s 1 which proves that McCarthy 91 always terminates. 59

60 In Practice Name LOC L A P P/A P/L Sec meschach 28K % 83% 64 gnuplot 50K % 36% 88 gaim 57K % 8% 94 ffmpeg 108K % 78% 198 Prototype unsound abstraction of C loops, using cil. Why unsound? Overflows, unsigned, doubles abstracted as Rs, etc. Aliasing, globals changed by function calls, etc. In principle, can be sound an engineering task. Synthesis of lexicographic linear ranking functions. Lexicographic function needed for 10 loops. 60

61 Example of Failed Abstraction List * iter = items; while (iter!= NULL) {... iter = iter->next; } Proving termination requires: proving that items is noncircular (nontrivial); abstracting iteration to counting down (trivial). 61

62 Example of Failed Abstraction char * ptr = input; while (*ptr!= \0 ) {... ptr++; } Proving termination requires: proving that input is a well-formed C string (nontrivial). abstracting pointer arithmetic to counting down (trivial). 62

63 Reasons for Failed Proofs 1. Prototype abstracter! 2. Need for invariants. Examples: i = 2 * i; i = i + k; i 0 to deduce increase in i k > 0 to deduce increase in i 3. Need for summarizing embedded loops. Example: while (i < n) { while (...) { i++; } summarize with i i i++; } 4. Need for function invariants. Example: i = i + strlen(str); 5. Loop does not terminate. knowledge about str and strlen 63

64 Appendix 64

65 Expanding a Farkas Lemma Rule R ij : Ix 0 τ i (xx ) 0 c T j x c T j x ɛ 0 λ I Ix + i 0 λ G G i x + g i 0 λ U U i x + V i x + u i 0 c j T x c j T x ɛ 0 λ T I I + λt G G i + λ T U U i = c j λ T U V i = c j λ T I i + λt G g i + λ T U u i ɛ λ I, λ G, λ U 0 ɛ > 0 x = (x 1,..., x m, 1) T (xx ) = (x 1,..., x m, x 1,..., x m, 1) T Expand assertions: x = (x 1,..., x m ) T x = (x 1,..., x m) T I, i define Θ G i, g i, U i, V i, u i define τ i Constraints over {λ I, λ G, λ U, c j, ɛ} 65

66 Lexicographic Synthesis let lex L : Θ, T = let sat o = ( τ T )(satisfiable L τ o) in let rec search o = sat o and match choose o with None true (search (o (τ τ ))) Some (τ, τ ) or (search (o (τ τ))) in search {} 66

67 Lexicographic Synthesis Calling satisfiable L τ j o generates and solves a constraint system for L, τ, and o, in which N ij is imposed iff (τ j τ i ) o Solving partial constraint systems guides the construction of lexicographic ranking functions. 67

The Polyranking Principle

The Polyranking Principle The Polyranking Principle Aaron R. Bradley, Zohar Manna, and Henny B. Sipma Computer Science Department Stanford University Stanford, CA 94305-9045 {arbrad,zm,sipma}@theory.stanford.edu Abstract. Although

More information

Linear Ranking with Reachability

Linear Ranking with Reachability Linear Ranking with Reachability Aaron R. Bradley, Zohar Manna, and Henny B. Sipma Computer Science Department Stanford University Stanford, CA 94305-9045 {arbrad,zm,sipma}@theory.stanford.edu Abstract.

More information

Verification Constraint Problems with Strengthening

Verification Constraint Problems with Strengthening Verification Constraint Problems with Strengthening Aaron R. Bradley and Zohar Manna Computer Science Department Stanford University Stanford, CA 94305-9045 {arbrad,manna}@cs.stanford.edu Abstract. The

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

Termination of Polynomial Programs

Termination of Polynomial Programs Termination of Polynomial Programs Aaron R. Bradley, Zohar Manna, and Henny B. Sipma Computer Science Department Stanford University Stanford, CA 94305-9045 {arbrad,zm,sipma}@theory.stanford.edu Abstract.

More information

Proving Unsatisfiability in Non-linear Arithmetic by Duality

Proving Unsatisfiability in Non-linear Arithmetic by Duality Proving Unsatisfiability in Non-linear Arithmetic by Duality [work in progress] Daniel Larraz, Albert Oliveras, Enric Rodríguez-Carbonell and Albert Rubio Universitat Politècnica de Catalunya, Barcelona,

More information

Constraint-Based Static Analysis of Programs

Constraint-Based Static Analysis of Programs Constraint-Based Static Analysis of Programs Joint work with Michael Colon, Sriram Sankaranarayanan, Aaron Bradley and Zohar Manna Henny Sipma Stanford University Master Class Seminar at Washington University

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

CS156: The Calculus of Computation

CS156: The Calculus of Computation CS156: The Calculus of Computation Zohar Manna Winter 2010 It is reasonable to hope that the relationship between computation and mathematical logic will be as fruitful in the next century as that between

More information

Eventual Linear Ranking Functions

Eventual Linear Ranking Functions Eventual Linear Ranking Functions Roberto BAGNARA 1 Fred MESNARD 2 1 BUGSENG & Dipartimento di Matematica e Informatica, Università di Parma, Italy 2 LIM, université de la Réunion, France PPDP 2013 Bagnara,

More information

What s Decidable About Arrays?

What s Decidable About Arrays? What s Decidable About Arrays? Aaron R. Bradley Zohar Manna Henny B. Sipma Computer Science Department Stanford University 1 Outline 0. Motivation 1. Theories of Arrays 2. SAT A 4. Undecidable Problems

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

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna The Calculus of Computation: Decision Procedures with Applications to Verification Part I: FOUNDATIONS by Aaron Bradley Zohar Manna 1. Propositional Logic(PL) Springer 2007 1-1 1-2 Propositional Logic(PL)

More information

Discovering Non-Linear Ranking Functions by Solving Semi-Algebraic Systems

Discovering Non-Linear Ranking Functions by Solving Semi-Algebraic Systems Discovering Non-Linear Ranking Functions by Solving Semi-Algebraic Systems Yinghua Chen 1, Bican Xia 1, Lu Yang 2, Naijun Zhan 3, and Chaochen Zhou 3 1 LMAM & School of Mathematical Sciences, Peking University

More information

Stability and Stabilization of polynomial dynamical systems. Hadi Ravanbakhsh Sriram Sankaranarayanan University of Colorado, Boulder

Stability and Stabilization of polynomial dynamical systems. Hadi Ravanbakhsh Sriram Sankaranarayanan University of Colorado, Boulder Stability and Stabilization of polynomial dynamical systems Hadi Ravanbakhsh Sriram Sankaranarayanan University of Colorado, Boulder Proving Asymptotic Stability: Lyapunov Functions Lyapunov Function:

More information

CS156: The Calculus of Computation Zohar Manna Autumn 2008

CS156: The Calculus of Computation Zohar Manna Autumn 2008 Page 3 of 52 Page 4 of 52 CS156: The Calculus of Computation Zohar Manna Autumn 2008 Lecturer: Zohar Manna (manna@cs.stanford.edu) Office Hours: MW 12:30-1:00 at Gates 481 TAs: Boyu Wang (wangboyu@stanford.edu)

More information

Constructing Invariants for Hybrid Systems

Constructing Invariants for Hybrid Systems Constructing Invariants for Hybrid Systems Sriram Sankaranarayanan, Henny B. Sipma and Zohar Manna Computer Science Department, Stanford University, Stanford, CA 94305, USA Abstract. We present a new method

More information

A QUANTIFIER-ELIMINATION BASED HEURISTIC FOR AUTOMATICALLY GENERATING INDUCTIVE ASSERTIONS FOR PROGRAMS

A QUANTIFIER-ELIMINATION BASED HEURISTIC FOR AUTOMATICALLY GENERATING INDUCTIVE ASSERTIONS FOR PROGRAMS Jrl Syst Sci & Complexity (2006) 19: 1 24 A QUANTIFIER-ELIMINATION BASED HEURISTIC FOR AUTOMATICALLY GENERATING INDUCTIVE ASSERTIONS FOR PROGRAMS Deepak KAPUR Received: 8 June 2006 c 2006 Springer Science

More information

Model Based Theory Combination

Model Based Theory Combination Model Based Theory Combination SMT 2007 Leonardo de Moura and Nikolaj Bjørner {leonardo, nbjorner}@microsoft.com. Microsoft Research Model Based Theory Combination p.1/20 Combination of Theories In practice,

More information

Formally Analyzing Adaptive Flight Control

Formally Analyzing Adaptive Flight Control Formally Analyzing Adaptive Flight Control Ashish Tiwari SRI International 333 Ravenswood Ave Menlo Park, CA 94025 Supported in part by NASA IRAC NRA grant number: NNX08AB95A Ashish Tiwari Symbolic Verification

More information

Automatic Generation of Polynomial Invariants for System Verification

Automatic Generation of Polynomial Invariants for System Verification Automatic Generation of Polynomial Invariants for System Verification Enric Rodríguez-Carbonell Technical University of Catalonia Talk at EPFL Nov. 2006 p.1/60 Plan of the Talk Introduction Need for program

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181. Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

More information

Chapter 3 Deterministic planning

Chapter 3 Deterministic planning Chapter 3 Deterministic planning In this chapter we describe a number of algorithms for solving the historically most important and most basic type of planning problem. Two rather strong simplifying assumptions

More information

Synthesizing Switching Logic using Constraint Solving

Synthesizing Switching Logic using Constraint Solving Synthesizing Switching Logic using Constraint Solving Ankur Taly 1, Sumit Gulwani 2, and Ashish Tiwari 3 1 Computer Science Dept., Stanford University ataly@stanford.edu 2 Microsoft Research, Redmond,

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

Section Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional)

Section Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional) Section 2.4 Section Summary Sequences. o Examples: Geometric Progression, Arithmetic Progression Recurrence Relations o Example: Fibonacci Sequence Summations Special Integer Sequences (optional) Sequences

More information

An Abstract Domain to Infer Ordinal-Valued Ranking Functions

An Abstract Domain to Infer Ordinal-Valued Ranking Functions An Abstract Domain to Infer Ordinal-Valued Ranking Functions Caterina Urban and Antoine Miné ÉNS & CNRS & INRIA, Paris, France urban@di.ens.fr, mine@di.ens.fr Abstract. The traditional method for proving

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

Computability and Complexity Theory: An Introduction

Computability and Complexity Theory: An Introduction Computability and Complexity Theory: An Introduction meena@imsc.res.in http://www.imsc.res.in/ meena IMI-IISc, 20 July 2006 p. 1 Understanding Computation Kinds of questions we seek answers to: Is a given

More information

Notes for Lecture Notes 2

Notes for Lecture Notes 2 Stanford University CS254: Computational Complexity Notes 2 Luca Trevisan January 11, 2012 Notes for Lecture Notes 2 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

More information

An Introduction to SAT Solving

An Introduction to SAT Solving An Introduction to SAT Solving Applied Logic for Computer Science UWO December 3, 2017 Applied Logic for Computer Science An Introduction to SAT Solving UWO December 3, 2017 1 / 46 Plan 1 The Boolean satisfiability

More information

NP-Complete Reductions 2

NP-Complete Reductions 2 x 1 x 1 x 2 x 2 x 3 x 3 x 4 x 4 12 22 32 CS 447 11 13 21 23 31 33 Algorithms NP-Complete Reductions 2 Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline NP-Complete

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

Generation of. Polynomial Equality Invariants. by Abstract Interpretation

Generation of. Polynomial Equality Invariants. by Abstract Interpretation Generation of Polynomial Equality Invariants by Abstract Interpretation Enric Rodríguez-Carbonell Universitat Politècnica de Catalunya (UPC) Barcelona Joint work with Deepak Kapur (UNM) 1 Introduction

More information

Formal Methods in Software Engineering

Formal Methods in Software Engineering Formal Methods in Software Engineering An Introduction to Model-Based Analyis and Testing Vesal Vojdani Department of Computer Science University of Tartu Fall 2014 Vesal Vojdani (University of Tartu)

More information

The L-depth Eventual Linear Ranking Functions for Single-path Linear Constraint Loops

The L-depth Eventual Linear Ranking Functions for Single-path Linear Constraint Loops The L-depth Eventual Linear Ranking Functions for Single-path Linear Constraint Loops Yi Li, Guang Zhu and Yong Feng Key Laboratory of Automated Reasoning and Cognition CIGIT, CAS, Chongqing, China 4714

More information

EE5120 Linear Algebra: Tutorial 3, July-Dec

EE5120 Linear Algebra: Tutorial 3, July-Dec EE5120 Linear Algebra: Tutorial 3, July-Dec 2017-18 1. Let S 1 and S 2 be two subsets of a vector space V such that S 1 S 2. Say True/False for each of the following. If True, prove it. If False, justify

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

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig First-Order Logic First-Order Theories Roopsha Samanta Partly based on slides by Aaron Bradley and Isil Dillig Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic

More information

Ranking Abstractions

Ranking Abstractions Ranking Abstractions Aziem Chawdhary 1, Byron Cook 2, Sumit Gulwani 2, Mooly Sagiv 3, and Hongseok Yang 1 1 Queen Mary, University of London 2 Microsoft Research 3 Tel Aviv University Abstract. We propose

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

A Termination Checker for Isabelle Hoare Logic

A Termination Checker for Isabelle Hoare Logic A Termination Checker for Isabelle Hoare Logic Jia Meng 1, Lawrence C. Paulson 2, and Gerwin Klein 3 1 National ICT Australia jia.meng@nicta.com.au 2 Computer Laboratory, University of Cambridge lp15@cam.ac.uk

More information

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms First-Order Logic 1 Syntax Domain of Discourse The domain of discourse for first order logic is FO structures or models. A FO structure contains Relations Functions Constants (functions of arity 0) FO

More information

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem. 1 More on NP In this set of lecture notes, we examine the class NP in more detail. We give a characterization of NP which justifies the guess and verify paradigm, and study the complexity of solving search

More information

Lecture Notes on SAT Solvers & DPLL

Lecture Notes on SAT Solvers & DPLL 15-414: Bug Catching: Automated Program Verification Lecture Notes on SAT Solvers & DPLL Matt Fredrikson André Platzer Carnegie Mellon University Lecture 10 1 Introduction In this lecture we will switch

More information

Multiphase-Linear Ranking Functions and their Relation to Recurrent Sets arxiv: v1 [cs.pl] 18 Nov 2018

Multiphase-Linear Ranking Functions and their Relation to Recurrent Sets arxiv: v1 [cs.pl] 18 Nov 2018 Multiphase-Linear Ranking Functions and their Relation to Recurrent Sets arxiv:1811.07340v1 [cs.pl] 18 Nov 2018 Amir M. Ben-Amram 1, Jesús J. Doménech 2, and Samir Genaim 2 1 The Academic College of Tel-Aviv

More information

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes Complexity Theory 1 Complexity Theory 2 Complexity Theory Lecture 3 Complexity For any function f : IN IN, we say that a language L is in TIME(f(n)) if there is a machine M = (Q, Σ, s, δ), such that: L

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

The knapsack Problem

The knapsack Problem There is a set of n items. The knapsack Problem Item i has value v i Z + and weight w i Z +. We are given K Z + and W Z +. knapsack asks if there exists a subset S {1, 2,..., n} such that i S w i W and

More information

1 Computational Problems

1 Computational Problems Stanford University CS254: Computational Complexity Handout 2 Luca Trevisan March 31, 2010 Last revised 4/29/2010 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

More information

MAT 242 CHAPTER 4: SUBSPACES OF R n

MAT 242 CHAPTER 4: SUBSPACES OF R n MAT 242 CHAPTER 4: SUBSPACES OF R n JOHN QUIGG 1. Subspaces Recall that R n is the set of n 1 matrices, also called vectors, and satisfies the following properties: x + y = y + x x + (y + z) = (x + y)

More information

A Collection of Problems in Propositional Logic

A Collection of Problems in Propositional Logic A Collection of Problems in Propositional Logic Hans Kleine Büning SS 2016 Problem 1: SAT (respectively SAT) Instance: A propositional formula α (for SAT in CNF). Question: Is α satisfiable? The problems

More information

Lecture 20: conp and Friends, Oracles in Complexity Theory

Lecture 20: conp and Friends, Oracles in Complexity Theory 6.045 Lecture 20: conp and Friends, Oracles in Complexity Theory 1 Definition: conp = { L L NP } What does a conp computation look like? In NP algorithms, we can use a guess instruction in pseudocode:

More information

Constraint Solving for Finite Model Finding in SMT Solvers

Constraint Solving for Finite Model Finding in SMT Solvers myjournal manuscript No. (will be inserted by the editor) Constraint Solving for Finite Model Finding in SMT Solvers Andrew Reynolds Cesare Tinelli Clark Barrett Received: date / Accepted: date Abstract

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

The value of a problem is not so much coming up with the answer as in the ideas and attempted ideas it forces on the would be solver I.N.

The value of a problem is not so much coming up with the answer as in the ideas and attempted ideas it forces on the would be solver I.N. Math 410 Homework Problems In the following pages you will find all of the homework problems for the semester. Homework should be written out neatly and stapled and turned in at the beginning of class

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

Generalized Property Directed Reachability

Generalized Property Directed Reachability Generalized Property Directed Reachability Kryštof Hoder (1) and Nikolaj Bjørner (2) (1) The University of Manchester (2) Microsoft Research, Redmond Abstract. The IC3 algorithm was recently introduced

More information

Bjorn Poonen. MSRI Introductory Workshop on Rational and Integral Points on Higher-dimensional Varieties. January 18, 2006

Bjorn Poonen. MSRI Introductory Workshop on Rational and Integral Points on Higher-dimensional Varieties. January 18, 2006 University of California at Berkeley MSRI Introductory Workshop on Rational and Integral Points on Higher-dimensional Varieties January 18, 2006 The original problem H10: Find an algorithm that solves

More information

Geometric Quantifier Elimination Heuristics for Automatically Generating Octagonal and Max-plus Invariants

Geometric Quantifier Elimination Heuristics for Automatically Generating Octagonal and Max-plus Invariants Geometric Quantifier Elimination Heuristics for Automatically Generating Octagonal and Max-plus Invariants Deepak Kapur 1 Zhihai Zhang 2 Matthias Horbach 1 Hengjun Zhao 3 Qi Lu 1 and ThanhVu Nguyen 1 1

More information

Notes on Inductive Sets and Induction

Notes on Inductive Sets and Induction Notes on Inductive Sets and Induction Finite Automata Theory and Formal Languages TMV027/DIT21 Ana Bove, March 15th 2018 Contents 1 Induction over the Natural Numbers 2 1.1 Mathematical (Simple) Induction........................

More information

Constraint Logic Programming and Integrating Simplex with DPLL(T )

Constraint Logic Programming and Integrating Simplex with DPLL(T ) Constraint Logic Programming and Integrating Simplex with DPLL(T ) Ali Sinan Köksal December 3, 2010 Constraint Logic Programming Underlying concepts The CLP(X ) framework Comparison of CLP with LP Integrating

More information

YORK UNIVERSITY. Faculty of Science Department of Mathematics and Statistics MATH M Test #1. July 11, 2013 Solutions

YORK UNIVERSITY. Faculty of Science Department of Mathematics and Statistics MATH M Test #1. July 11, 2013 Solutions YORK UNIVERSITY Faculty of Science Department of Mathematics and Statistics MATH 222 3. M Test # July, 23 Solutions. For each statement indicate whether it is always TRUE or sometimes FALSE. Note: For

More information

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Description Logics. Deduction in Propositional Logic.   franconi. Enrico Franconi (1/20) Description Logics Deduction in Propositional Logic Enrico Franconi franconi@cs.man.ac.uk http://www.cs.man.ac.uk/ franconi Department of Computer Science, University of Manchester (2/20) Decision

More information

An Abstract Interpretation Approach. for Automatic Generation of. Polynomial Invariants

An Abstract Interpretation Approach. for Automatic Generation of. Polynomial Invariants An Abstract Interpretation Approach for Automatic Generation of Polynomial Invariants Enric Rodríguez-Carbonell Universitat Politècnica de Catalunya Barcelona Deepak Kapur University of New Mexico Albuquerque

More information

Controller Synthesis for Hybrid Systems using SMT Solving

Controller Synthesis for Hybrid Systems using SMT Solving Controller Synthesis for Hybrid Systems using SMT Solving Ulrich Loup AlgoSyn (GRK 1298) Hybrid Systems Group Prof. Dr. Erika Ábrahám GRK Workshop 2009, Schloss Dagstuhl Our model: hybrid system Discrete

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

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

Linear Programming Redux

Linear Programming Redux Linear Programming Redux Jim Bremer May 12, 2008 The purpose of these notes is to review the basics of linear programming and the simplex method in a clear, concise, and comprehensive way. The book contains

More information

MATH 3321 Sample Questions for Exam 3. 3y y, C = Perform the indicated operations, if possible: (a) AC (b) AB (c) B + AC (d) CBA

MATH 3321 Sample Questions for Exam 3. 3y y, C = Perform the indicated operations, if possible: (a) AC (b) AB (c) B + AC (d) CBA MATH 33 Sample Questions for Exam 3. Find x and y so that x 4 3 5x 3y + y = 5 5. x = 3/7, y = 49/7. Let A = 3 4, B = 3 5, C = 3 Perform the indicated operations, if possible: a AC b AB c B + AC d CBA AB

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

The Reachability-Bound Problem. Gulwani and Zuleger PLDI 10

The Reachability-Bound Problem. Gulwani and Zuleger PLDI 10 The Reachability-Bound Problem Gulwani and Zuleger PLDI 10 CS252r Spring 2011 The Reachability-Bound problem Find a symbolic worst case bound on the number of times a program point is reached Intra-procedural:

More information

Classical Propositional Logic

Classical Propositional Logic Classical Propositional Logic Peter Baumgartner http://users.cecs.anu.edu.au/~baumgart/ Ph: 02 6218 3717 Data61/CSIRO and ANU July 2017 1 / 71 Classical Logic and Reasoning Problems A 1 : Socrates is a

More information

Efficient Strongly Relational Polyhedral Analysis

Efficient Strongly Relational Polyhedral Analysis Efficient Strongly Relational Polyhedral Analysis Sriram Sankaranarayanan 1,3, Michael A. Colón 2, Henny Sipma 3, Zohar Manna 3 1 NEC Laboratories America, Princeton, NJ srirams@nec-labs.com 2 Center for

More information

From Satisfiability to Linear Algebra

From Satisfiability to Linear Algebra From Satisfiability to Linear Algebra Fangzhen Lin Department of Computer Science Hong Kong University of Science and Technology Clear Water Bay, Kowloon, Hong Kong Technical Report August 2013 1 Introduction

More information

Lecture 59 : Instance Compression and Succinct PCP s for NP

Lecture 59 : Instance Compression and Succinct PCP s for NP IITM-CS6840: Advanced Complexity Theory March 31, 2012 Lecture 59 : Instance Compression and Succinct PCP s for NP Lecturer: Sivaramakrishnan N.R. Scribe: Prashant Vasudevan 1 Introduction Classical Complexity

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

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction Math 4 Summer 01 Elementary Number Theory Notes on Mathematical Induction Principle of Mathematical Induction Recall the following axiom for the set of integers. Well-Ordering Axiom for the Integers If

More information

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic Matt Fredrikson mfredrik@cs.cmu.edu October 17, 2016 Matt Fredrikson Propositional Logic 1 / 33 Propositional

More information

NORMS ON SPACE OF MATRICES

NORMS ON SPACE OF MATRICES NORMS ON SPACE OF MATRICES. Operator Norms on Space of linear maps Let A be an n n real matrix and x 0 be a vector in R n. We would like to use the Picard iteration method to solve for the following system

More information

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

1. What is the determinant of the following matrix? a 1 a 2 4a 3 2a 2 b 1 b 2 4b 3 2b c 1. = 4, then det

1. What is the determinant of the following matrix? a 1 a 2 4a 3 2a 2 b 1 b 2 4b 3 2b c 1. = 4, then det What is the determinant of the following matrix? 3 4 3 4 3 4 4 3 A 0 B 8 C 55 D 0 E 60 If det a a a 3 b b b 3 c c c 3 = 4, then det a a 4a 3 a b b 4b 3 b c c c 3 c = A 8 B 6 C 4 D E 3 Let A be an n n matrix

More information

Scalable Analysis of Linear Systems using Mathematical Programming

Scalable Analysis of Linear Systems using Mathematical Programming Scalable Analysis of Linear Systems using Mathematical Programming Sriram Sankaranarayanan, Henny B. Sipma, and Zohar Manna Computer Science Department Stanford University Stanford, CA 94305-9045 {srirams,sipma,zm}@theory.stanford.edu

More information

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete CS125 Lecture 15 Fall 2016 15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete Already know SAT NP, so only need to show SAT is NP-hard. Let L be any language in NP. Let M be a NTM that decides L

More information

A strongly polynomial algorithm for linear systems having a binary solution

A strongly polynomial algorithm for linear systems having a binary solution A strongly polynomial algorithm for linear systems having a binary solution Sergei Chubanov Institute of Information Systems at the University of Siegen, Germany e-mail: sergei.chubanov@uni-siegen.de 7th

More information

AVACS Automatic Verification and Analysis of Complex Systems REPORTS. of SFB/TR 14 AVACS. Editors: Board of SFB/TR 14 AVACS

AVACS Automatic Verification and Analysis of Complex Systems REPORTS. of SFB/TR 14 AVACS. Editors: Board of SFB/TR 14 AVACS AVACS Automatic Verification and Analysis of Complex Systems REPORTS of SFB/TR 14 AVACS Editors: Board of SFB/TR 14 AVACS Constraint Solving for Interpolation Andrey Rybalchenko by Viorica Sofronie-Stokkermans

More information

Lecture 9: The Splitting Method for SAT

Lecture 9: The Splitting Method for SAT Lecture 9: The Splitting Method for SAT 1 Importance of SAT Cook-Levin Theorem: SAT is NP-complete. The reason why SAT is an important problem can be summarized as below: 1. A natural NP-Complete problem.

More information

Ranking Abstraction as Companion to Predicate Abstraction

Ranking Abstraction as Companion to Predicate Abstraction Ranking Abstraction as Companion to Predicate Abstraction Ittai Balaban 1, Amir Pnueli 1,2, and Lenore D. Zuck 3 1 New York University, New York {balaban, amir}@cs.nyu.edu 2 Weizmann Institute of Science

More information

The Trace Partitioning Abstract Domain

The Trace Partitioning Abstract Domain The Trace Partitioning Abstract Domain XAVIER RIVAL and LAURENT MAUBORGNE École Normale Supérieure In order to achieve better precision of abstract interpretation based static analysis, we introduce a

More information

Integrating Simplex with DPLL(T )

Integrating Simplex with DPLL(T ) CSL Technical Report SRI-CSL-06-01 May 23, 2006 Integrating Simplex with DPLL(T ) Bruno Dutertre and Leonardo de Moura This report is based upon work supported by the Defense Advanced Research Projects

More information

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT The Wumpus Game Stench Stench Gold Stench Start 1 The Wumpus Game Stench in the square containing the wumpus and in the directly adjacent squares in the squares directly adjacent to a pit Glitter in the

More information

Gödel s Incompleteness Theorem. Overview. Computability and Logic

Gödel s Incompleteness Theorem. Overview. Computability and Logic Gödel s Incompleteness Theorem Overview Computability and Logic Recap Remember what we set out to do in this course: Trying to find a systematic method (algorithm, procedure) which we can use to decide,

More information

SCICO: Model pp (col. fig: NIL) ARTICLE IN PRESS

SCICO: Model pp (col. fig: NIL) ARTICLE IN PRESS + Model pp. (col. fig: NIL) Science of Computer Programming xx (xxxx) xxx xxx www.elsevier.com/locate/scico Automatic generation of polynomial invariants of bounded degree using abstract interpretation

More information

Deductive Verification of Continuous Dynamical Systems

Deductive Verification of Continuous Dynamical Systems Deductive Verification of Continuous Dynamical Systems Dept. of Computer Science, Stanford University (Joint work with Ashish Tiwari, SRI International.) 1 Introduction What are Continuous Dynamical Systems?

More information

Automatic Generation of Polynomial Invariants of Bounded Degree using Abstract Interpretation

Automatic Generation of Polynomial Invariants of Bounded Degree using Abstract Interpretation Automatic Generation of Polynomial Invariants of Bounded Degree using Abstract Interpretation E. Rodríguez-Carbonell a,, D. Kapur b a Software Department, Technical University of Catalonia, Jordi Girona,

More information

Separating Fairness and Well-Foundedness for the Analysis of Fair Discrete Systems

Separating Fairness and Well-Foundedness for the Analysis of Fair Discrete Systems Separating Fairness and Well-Foundedness for the Analysis of Fair Discrete Systems Amir Pnueli 1, Andreas Podelski 2, and Andrey Rybalchenko 2 1 New York University, New York 2 Max-Planck-Institut für

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

Math /Foundations of Algebra/Fall 2017 Foundations of the Foundations: Proofs

Math /Foundations of Algebra/Fall 2017 Foundations of the Foundations: Proofs Math 4030-001/Foundations of Algebra/Fall 017 Foundations of the Foundations: Proofs A proof is a demonstration of the truth of a mathematical statement. We already know what a mathematical statement is.

More information

Overview, cont. Overview, cont. Logistics. Optional Reference #1. Optional Reference #2. Workload and Grading

Overview, cont. Overview, cont. Logistics. Optional Reference #1. Optional Reference #2. Workload and Grading Course staff CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics şıl Dillig nstructor: şil Dillig E-mail: isil@cs.utexas.edu Office hours: Thursday after class until 6:30 pm

More information