Applications of Logic in Software Engineering. CS402, Spring 2016 Shin Yoo

Size: px
Start display at page:

Download "Applications of Logic in Software Engineering. CS402, Spring 2016 Shin Yoo"

Transcription

1 Applications of Logic in Software Engineering CS402, Spring 2016 Shin Yoo

2 Acknowledgements I borrow slides from: Moonzoo Kim Theo C. Ruys ( SpinTutorial.pdf) CBMC & Daniel Kroening (

3 What are computers good at? Logical arguments? Fast computation?

4 What is the battlefront in AI? Prolog? Big data + machine learning?

5 (a rhetorical) Question You are given a very long, very complex formula in propositional logic. You have to show its validity. How do you proceed? Preprocess(?) the formula as much as possible to make it simpler; try proof calculus. Start constructing the truth table.

6 How do you check whether your program is correct? Prove its correctness. That is, the program has to be correct (with respect to a set of specifications). This is called verification. Check its behaviour as thoroughly as possible. That is, execute the program with as many inputs as possible, and check that the behaviour conforms to the expectation. This is called validation (also, more commonly, testing). Check its behaviour with the input you had in mind. That is, execute the program with the given example input, and check that it does not crash. This is called.. umm

7 2 Solving Various Problems using SAT Solver Sudoku Puzzle Encoding 1 Encoding 2 Verify/Testing C Programs Encoding 3 Optimal Path Planning Encoding CNF SAT Formula SAT Solver Latin Square Problem Traveling Salesmen Probelm Encoding n Moonzoo Kim, CS402, Spring 2013

8 Operational Semantics of Software A system execution is a sequence of s s 0 s 1 s 0 s 1 x:0,y:0 x:0,y:1 A has an environment s :Var-> Val s 2 x:1,y:2 s 11 x:5,y:1 A system has its semantics as a set of system executions s 3 s 4 x:1,y:3 x:2,y:4 s 12 s 13 x:5,y:2 x:5,y:3 s 21 x:7,y:3 s 14 x:5,y:4 s 22 x:7,y:4 3 Moonzoo Kim, CS402, Spring 2013

9 What is Model Checking? [Clarke & Emerson 1981]: Model checking is an automated technique that, given a finite- model of a system and a logical property, systematically checks whether this property holds for (a given initial in) that model. Model checking tools automatically verify whether M = φ holds, where M is a (finite-) model of a system and property φ is d in some formal notation. Problem: space explosion! SPIN [Holzmann 1991] is one of the most powerful model checkers. Based on [Vardi & Wolper 1986]. Although finite-, the model of a system typically grows exponentially. Thursday 11-Apr-2002 Theo C. Ruys - SPIN Beginners' Tutorial 5 Theo C. Ruys (

10 Pros and Cons of Model Checking Pros Fully automated and provide complete coverage Concrete counter examples Full control over every detail of system behavior Highly effective for analyzing embedded software multi-threaded systems Cons State explosion problem An abstracted model may not fully reflect a real system Needs to use a specialized modeling language Modeling languages are similar to programming languages, but simpler and clearer 5

11 Example of Model Checking thread A() { unsigned char x; again: x++; goto again; x:0 x:1 x:2 x:255 thread A() { unsigned char x; again: x++; goto again; x:0,y:0 x:1,y:0 x:0,y:1 x:1,y:1 x:0,y:255 x:1,y:255 thread B() { unsigned char y; again: y++; goto again; x:2,y:0 x:255,y:0 x:2,y:1 x:2,y:255 x:255,y:255 4

12 But wait what? CS402 dealt with greek alphabets, not C code. How do we reason about arbitrary programming languages using what we have learnt so far? My answer: but you also did not expect to solve Nonogram in CS402 - that has nothing to do with greek alphabets either :)

13 Example. Sort (1/2) Suppose that we have an array of 4 elements each of which is 1 byte long unsigned char a[4]; We wants to verify sort.c works correctly main() { sort(); assert(a[0]<= a[1]<= a[2]<=a[3]); Hash table based explicit model checker (ex. Spin) generates at least 2 32 (= 4x10 9 = 4G) s 4G s x 4 bytes = 16 Gbytes, no way Binary Decision Diagram (BDD) based symbolic model checker (ex. NuSMV) takes 200 MB in 400 sec 8/23

14 Example. Sort (2/2) 1. #include <stdio.h> 2. #define N 5 3. int main(){ 4. int data[n], i, j, tmp; 5. /* Assign random values to the array*/ 6. for (i=0; i<n; i++){ 7. data[i] = nondet_int(); /* It misses the last element, i.e., data[n-1]*/ 10. for (i=0; i<n-1; i++) 11. for (j=i+1; j<n-1; j++) 12. if (data[i] > data[j]){ 13. tmp = data[i]; 14. data[i] = data[j]; 15. data[j] = tmp; /* Check the array is sorted */ 18. for (i=0; i<n-1; i++){ 19. assert(data[i] <= data[i+1]); SAT-based Bounded Model Checker Total CNF clause with 6224 boolean propositional variables Theoretically, choices should be evaluated!!! SAT UNSAT VSIDS Conflicts 73 Decisions 2435 Time(sec) VSIDS Conflicts Decisions Time(sec) /23

15 Overview of SAT-based Bounded Model Checking Requirements Formal Requirement Properties (F W) C Program Abstract Model Requirements Formal Requirement Properties in C (ex. assert( x < a[i]); ) C Program Model Checker Translation to SAT formula Satisfied Not satisfied SAT Solver Okay Counter example Satisfied Okay Not satisfied Counter example 10/23

16 Software Model Checking as a SAT problem (1/4) Control-flow simplification All side effect are removed i++ => i=i+1; Control flow is made explicit continue, break => goto Loop simplification for(;;), do { while() => while() 11/23

17 Software Model Checking as a SAT problem (2/4) Unwinding Loop Original code x=0; while(x < 2){ y=y+x; x++; Unwinding the loop 1 times x=0; if (x < 2) { y=y+x; x++; /* Unwinding assertion */ assert(!(x < 2)) Unwinding the loop 3 times x=0; if (x < 2) { y=y+x; x++; if (x < 2) { y=y+x; x++; if (x < 2) { y=y+x; x++; /*Unwinding assertion*/ assert (! (x < 2)) 12/23

18 Scalability of Path Search Let s consider the following CFG: L1 L2 L3 L4 This is a loop with an if inside. CBMC: Bounded Model Checking for ANSI-C 14

19 Scalability of Path Search Let s consider the following CFG: L1 L2 L3 L4 This is a loop with an if inside. Q: how many paths for n iterations? CBMC: Bounded Model Checking for ANSI-C 14

20 Bounded Model Checking I Bounded Model Checking (BMC) is the most successful formal validation technique in the hardware industry I Advantages: 4 Fully automatic 4 Robust 4 Lots of subtle bugs found I Idea: only look for bugs up to specific depth I Good for many applications, e.g., embedded systems CBMC: Bounded Model Checking for ANSI-C 15

21 Model Checking as a SAT problem (3/4) From C Code to SAT Formula Original code x=x+y; if (x!=1) x=2; else x++; assert(x<=3); Generate constraints Convert to static single assignment (SSA) x 1 =x 0 +y 0 ; if (x 1!=1) x 2 =2; else x 3 =x 1 +1; x 4 =(x 1!=1)?x 2 :x 3 ; assert(x 4 <=3); C x 1 =x 0 +y 0 x 2 =2 x 3 =x 1 +1 (x 1!=1 x 4 =x 2 x 1 =1 x 4 =x 3 ) P x 4 <= 3 Check if C P is satisfiable, if it is then the assertion is violated C P is converted to Boolean logic using a bit vector representation for the integer variables y 0,x 0,x 1,x 2,x 3,x 4 14/23

22 Model Checking as a SAT problem (4/4) Example of arithmetic encoding into pure propositional formula Assume that x,y,z are three bits positive integers represented by propositions x 0 x 1 x 2, y 0 y 1 y 2, z 0 z 1 z 2 C z=x+y (z 0 $(x 0 y 0 ) ( (x 1 Æy 1 ) Ç (((x 1 y 1 )Æ(x 2 Æy 2 ))) Æ (z 1 $(x 1 y 1 ) (x 2 Æy 2 )) Æ (z 2 $(x 2 y 2 )) 15/23 Eventually, everything is Boolean.

23 Classic Model Checking (initial) Design (manual) abstractions Abstract Verification Model Model Checker refinement techniques Implementation Thursday 11-Apr-2002 Theo C. Ruys - SPIN Beginners' Tutorial 7

24 Modern Model Checking Implementation systematic abstraction techniques Verification Model Model Checker Abstraction is the key activity in both approaches. This talk deals with pure SPIN, i.e., the classic model checking approach. To cope with the space explosion. Thursday 11-Apr-2002 Theo C. Ruys - SPIN Beginners' Tutorial 8

25 But that looks extremely painful to do manually every time we want to prove something, doesn t it?

26 SMT: Satisfiability Modulo Theories SMT problem: decision problem for logical formulas with respect to background theories in classical first-order-logic. SMT instance is a predicate logic formula; the aim is to determine whether such a formula is satisfiable. The underlying problem is still one of Boolean Satisfiability problem.

27 SMT: The Eager Approach Immediately encode the first order formulas into Boolean SAT, and invoke SAT solvers. Can rely on advances in Boolean SAT solvers However, loss of high-level semantics means sometimes it struggles with obvious ments, such as x + y = y + x.

28 Enabling Technology: SAT 1,000, ,000 10,000 1, number of variables of a typical, practical SAT instance that can be solved by the best solvers in that decade CBMC: Bounded Model Checking for ANSI-C 9

29 SMT: The Lazy Approach Davis-Putnam-Logemann-Loveland algorithm (DPLL) (1962) is a backtracking-based search algorithm that is used to determine satisfiability of propositional logic formulas in CNF form (i.e. CNF- SAT). Theory solver is concerned with feasibility of conjunctions of theory-specific predicates, infers new facts from known facts, and interacts with the SAT solver with respect to propagation and backtracking.

30 Concolic Testing Suppose we can solve satisfiability problems, extended with theories about integers, lists, arrays, etc. What can we use it for in order to check our programs?

31 void testme(int[] a) { if(a == null) return; if(a.length > 0) { if(a[0] == 42) throw new Exception( bug ); Solve false a==null false true a.length > 0 false true a[0] == 42 Execute true Constraints to Solve Data Observed Path Condition null a==null a!=null a!=null && a.length > 0 a!=null && a.length > 0 && a[0] == 42 { {0 {42 a!=null &&!(a.length > 0) a!=null && a.length > 0 && a[0]!= 42 No more path! ` Negate last condition and choose another path

32 Example typedef struct cell { int v; struct cell *next; cell; int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; Random Test Driver: random memory graph reachable from p random value for x Probability of reaching Error( ) is extremely low 11/42 Example from the slides CUTE: A Concolic Unit Testing Engine for C by K.Sen 2005

33 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p NULL, x=236 p=p 0, x=x 0 12/42

34 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p NULL, x=236 p=p 0, x=x 0 13/42

35 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p NULL, x=236 p=p 0, x=x 0 x 0 >0 14/42

36 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p NULL, x=236 p=p 0, x=x 0 x 0 >0!(p 0!=NULL) 15/42

37 Concolic Testing typedef struct cell { int v; struct cell *next; cell; int f(int v) { return 2*v + 1; Concrete concrete symbolic solve: x 0 >0 and p 0 NULL Symbolic constraints int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p NULL, x=236 p=p 0, x=x 0 x 0 >0 p 0 =NULL 16/42

38 Concolic Testing typedef struct cell { int v; struct cell *next; cell; int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p Concrete concrete symbolic solve: x 0 >0 and p 0 NULL x 0 =236, p 0 NULL, x= NULL p=p 0, x=x 0 Symbolic constraints x 0 >0 p 0 =NULL 17/42

39 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 634 NULL, x=236 p=p 0, x=x 0, p->v =v 0, p->next=n 0 18/42

40 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 634 NULL, x=236 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 19/42

41 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 634 NULL, x=236 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 20/42

42 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 634 NULL, x=236 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1 v 0 21/42

43 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 634 NULL, x=236 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1 v 0 22/42

44 Concolic Testing typedef struct cell { int v; struct cell *next; cell; int f(int v) { return 2*v + 1; Concrete concrete symbolic solve: x 0 >0 and p 0 NULL and 2x 0 +1=v 0 Symbolic constraints int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 634 NULL, x=236 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1 v 0 23/42

45 Concolic Testing typedef struct cell { int v; struct cell *next; cell; int f(int v) { return 2*v + 1; Concrete concrete symbolic solve: x 0 >0 and p 0 NULL and 2x 0 +1=v 0 x 0 =1, p 0 NULL Symbolic constraints int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p NULL, x=236 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1 v 0 24/42

46 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 NULL, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 25/42

47 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 NULL, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 26/42

48 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 NULL, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 27/42

49 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 NULL, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1=v 0 28/42

50 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 NULL, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1=v 0 n 0 p 0 29/42

51 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 NULL, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1=v 0 n 0 p 0 30/42

52 Concolic Testing typedef struct cell { int v; struct cell *next; cell; int f(int v) { return 2*v + 1; concrete Concrete symbolic solve: x 0 >0 and p 0 NULL and 2x 0 +1=v 0 and n 0 =p 0 Symbolic constraints int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 NULL, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1=v 0 n 0 p 0 31/42

53 Concolic Testing typedef struct cell { int v; struct cell *next; cell; int f(int v) { return 2*v + 1; concrete Concrete symbolic solve: x 0 >0 and p 0 NULL and 2x 0 +1=v 0 and n 0 =p 0 Symbolic constraints int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; x 0 =1, p 0 p NULL 3, x=1 3 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1=v 0 n 0 p 0 32/42

54 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 33/42

55 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 34/42

56 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 35/42

57 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1=v 0 36/42

58 Concolic Testing typedef struct cell { int v; struct cell *next; cell; concrete Concrete symbolic Symbolic constraints int f(int v) { return 2*v + 1; int testme(cell *p, int x) { if (x > 0) if (p!= NULL) if (f(x) == p->v) if (p->next == p) Error(); return 0; p 3 Error() reached, x=1 p=p 0, x=x 0, p->v =v 0, p->next=n 0 x 0 >0 p 0 NULL 2x 0 +1=v 0 n 0 =p 0 37/42

59 Limitations Unlike model checking, we operate directly on top of program source code: no abstraction. There may exist formulas that SMT solvers cannot handle: for example, if( sin(x) + cos(x) == 0.3) { error(); Some limitations on complex pointer and array operations. What if the aim of testing is not about logical correctness, such as execution time or memory usage?

60 Relative Strength Model checking: specify a property that needs to be checked, prove that either it is not violated, or there exists a counterexample Concolic testing: IF there is an explicit condition that you can check (e.g. assertions or exeptions), can try to reach them. Otherwise, produces a test input.

61

62 Teacher: add all numbers from 1 to 100! Young Gauss: = = 101 * 50 = 5050 Metaheuristic: Is it 1000? Teacher: No. Metaheuristic: Is it 1001? Teacher: No.. (after a while) Metaheuristic: Is it 5050? Teacher: Yes!

63 Metaheuristic Essentially smart trial and error Tries a solution Get feedback on how good it was Move the solution towards a better direction Repeat until problem is solved

64 Test Data Generation Fitness function (for branch coverage) = [approximation level] + normalise([branch distance]) path We want to execute a specific branch, but the current input value does not follow the required path. Then: Approximation Level = 2 Approximation level: number of nesting levels between current path and our target branch Branch Distance? Branch distance: distance in the current predicate between desired and current status

65 Branch Distance Wait, predicates are Boolean. What do you mean, distance? To satisfy x == y, convert it to b = x - y and minimise b: when it becomes 0, x becomes equal to y. To satisfy y >= x, convert it to b = x - y + K and minimise b: when it becomes 0, y is greater than x by K. Normalise: b norm = ^(-b)

66 Branch Distance Predicate f minimise until.. a > b b - a + K f < 0 a >= b b - a + K f <= 0 a < b a - b + K f < 0 a <= b a - b + K f <= 0 a == b a - b f == 0 a!= b - a - b f < 0 B. Korel, Automated software test data generation, IEEE Trans. Softw. Eng., vol. 16, pp , August 1990.

67 Fitness Function (11, 2, 1) app. lvl = 2 b. dist = 4 - c +1 f = 2 + ( ^-4) = False (11, 2, 11) app. lvl = 1 b. dist = c f = 1 + ( ^-2) = if(c >= 4) False True if(c <= 10) (11, 2, 9) app. lvl =0 b. dist = 11-2 f = 0 + ( ^-9) = False True if(a == b) app. lvl =0 b. dist = 2-2 f = 0 + ( ^0) = 0 True (2, 2, 9) target Test input (a, b, c), K = 1

68 Metaheuristics and Learning We arrive at the conclusion (i.e. qualifying test data) by observing individual instances (roughly speaking, individual assignments). This is, in a way, opposite to model checking. Advances in computational power empowers both verification and validation. More about metaheuristic and learning in CS492 in Autumn 2016 (Search-Based Software Engineering)

Application of Propositional Logic II - How to Test/Verify my C program? Moonzoo Kim

Application of Propositional Logic II - How to Test/Verify my C program? Moonzoo Kim Application of Propositional Logic II - How to Test/Verify my C program? Moonzoo Kim 2 Solving Various Problems using SAT Solver Sudoku Puzzle Encoding 1 Encoding 2 Verify/Testing C Programs Encoding 3

More information

SAT-based Model Checking for C programs

SAT-based Model Checking for C programs SAT-based Model Checking for C programs Moonzoo Kim Provable Software Lab. CS Division of EE 1 Formal Methods Definition in Wikepedia Formal methods are mathematically-based techniques for the specification,

More information

CUTE: A Concolic Unit Testing Engine for C

CUTE: A Concolic Unit Testing Engine for C CUTE: A Concolic Unit Testing Engine for C Koushik Sen Darko Marinov Gul Agha University of Illinois Urbana-Champaign Goal Automated Scalable Unit Testing of real-world C Programs Generate test inputs

More information

CS 267: Automated Verification. Lecture 13: Bounded Model Checking. Instructor: Tevfik Bultan

CS 267: Automated Verification. Lecture 13: Bounded Model Checking. Instructor: Tevfik Bultan CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan Remember Symbolic Model Checking Represent sets of states and the transition relation as Boolean logic formulas

More information

Symbolic and Concolic Execution of Programs

Symbolic and Concolic Execution of Programs Symbolic and Concolic Execution of Programs Information Security, CS 526 Omar Chowdhury 10/7/2015 Information Security, CS 526 1 Reading for this lecture Symbolic execution and program testing - James

More information

BITCOIN MINING IN A SAT FRAMEWORK

BITCOIN MINING IN A SAT FRAMEWORK BITCOIN MINING IN A SAT FRAMEWORK Jonathan Heusser @jonathanheusser DISCLAIMER JUST TO BE CLEAR.. This is research! Not saying ASICs suck I am not a cryptographer, nor SAT solver guy WTF REALISED PHD RESEARCH

More information

Introduction to CBMC: Part 1

Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213 Arie Gurfinkel, Sagar Chaki October 2, 2007 Many slides are courtesy of Daniel Kroening Bug Catching with SAT Solvers Main

More information

Deductive Methods, Bounded Model Checking

Deductive Methods, Bounded Model Checking Deductive Methods, Bounded Model Checking http://d3s.mff.cuni.cz Pavel Parízek CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Deductive methods Pavel Parízek Deductive Methods, Bounded

More information

Automated Software Analysis Techniques For High Reliability: A Concolic Testing Approach. Moonzoo Kim

Automated Software Analysis Techniques For High Reliability: A Concolic Testing Approach. Moonzoo Kim Automated Software Analysis Techniques For High Reliability: A Concolic Testing Approach Moonzoo Kim Contents Automated Software Analysis Techniques Background Concolic testing process Example of concolic

More information

Seminar in Software Engineering Presented by Dima Pavlov, November 2010

Seminar in Software Engineering Presented by Dima Pavlov, November 2010 Seminar in Software Engineering-236800 Presented by Dima Pavlov, November 2010 1. Introduction 2. Overview CBMC and SAT 3. CBMC Loop Unwinding 4. Running CBMC 5. Lets Compare 6. How does it work? 7. Conclusions

More information

4.1 Review - the DPLL procedure

4.1 Review - the DPLL procedure Applied Logic Lecture 4: Efficient SAT solving CS 4860 Spring 2009 Thursday, January 29, 2009 The main purpose of these notes is to help me organize the material that I used to teach today s lecture. They

More information

Bounded Model Checking Of C Programs: CBMC Tool Overview

Bounded Model Checking Of C Programs: CBMC Tool Overview Workshop on Formal Verification and Analysis Tools, CFDVS, IIT-Bombay - Feb 21,2017 Bounded Model Checking Of C Programs: CBMC Tool Overview Prateek Saxena CBMC Developed and Maintained by Dr Daniel Kröning

More information

Finite Model Generation for Isabelle/HOL Using a SAT Solver

Finite Model Generation for Isabelle/HOL Using a SAT Solver Finite Model Generation for / Using a SAT Solver Tjark Weber webertj@in.tum.de Technische Universität München Winterhütte, März 2004 Finite Model Generation for / p.1/21 is a generic proof assistant: Highly

More information

Software Model Checking. Xiangyu Zhang

Software Model Checking. Xiangyu Zhang Software Model Checking Xiangyu Zhang Symbolic Software Model Checking CS510 S o f t w a r e E n g i n e e r i n g Symbolic analysis explicitly explores individual paths, encodes and resolves path conditions

More information

Finite State Verification. CSCE Lecture 14-02/25/2016

Finite State Verification. CSCE Lecture 14-02/25/2016 Finite State Verification CSCE 747 - Lecture 14-02/25/2016 So, You Want to Perform Verification... You have a property that you want your program to obey. Great! Let s write some tests! Does testing guarantee

More information

PROPOSITIONAL LOGIC (2)

PROPOSITIONAL LOGIC (2) PROPOSITIONAL LOGIC (2) based on Huth & Ruan Logic in Computer Science: Modelling and Reasoning about Systems Cambridge University Press, 2004 Russell & Norvig Artificial Intelligence: A Modern Approach

More information

Boolean Representations and Combinatorial Equivalence

Boolean Representations and Combinatorial Equivalence Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discusses the applications of these representations for proving

More information

SAT Solver. CS 680 Formal Methods Jeremy Johnson

SAT Solver. CS 680 Formal Methods Jeremy Johnson SAT Solver CS 680 Formal Methods Jeremy Johnson Disjunctive Normal Form A Boolean expression is a Boolean function Any Boolean function can be written as a Boolean expression s x 0 x 1 f Disjunctive normal

More information

More on Verification and Model Checking

More on Verification and Model Checking More on Verification and Model Checking Wednesday Oct 07, 2015 Philipp Rümmer Uppsala University Philipp.Ruemmer@it.uu.se 1/60 Course fair! 2/60 Exam st October 21, 8:00 13:00 If you want to participate,

More information

Finite State Verification. CSCE Lecture 21-03/28/2017

Finite State Verification. CSCE Lecture 21-03/28/2017 Finite State Verification CSCE 747 - Lecture 21-03/28/2017 So, You Want to Perform Verification... You have a property that you want your program to obey. Great! Let s write some tests! Does testing guarantee

More information

Normal Forms for Boolean Expressions

Normal Forms for Boolean Expressions Normal Forms for Boolean Expressions A NORMAL FORM defines a class expressions s.t. a. Satisfy certain structural properties b. Are usually universal: able to express every boolean function 1. Disjunctive

More information

Lecture 2: Symbolic Model Checking With SAT

Lecture 2: Symbolic Model Checking With SAT Lecture 2: Symbolic Model Checking With SAT Edmund M. Clarke, Jr. School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 (Joint work over several years with: A. Biere, A. Cimatti, Y.

More information

CSE507. Practical Applications of SAT. Computer-Aided Reasoning for Software. Emina Torlak

CSE507. Practical Applications of SAT. Computer-Aided Reasoning for Software. Emina Torlak Computer-Aided Reasoning for Software CSE507 Practical Applications of SAT courses.cs.washington.edu/courses/cse507/18sp/ Emina Torlak emina@cs.washington.edu Today Past 2 lectures The theory and mechanics

More information

Automated Test Generation using CBMC

Automated Test Generation using CBMC Automated Test Generation using CBMC Rui Gonçalo CROSS Project Computer Science Department University of Minho December 2012 Automated Test Generation using CBMC Summary 2/61 Summary 1 Software Testing

More information

Introduction to CBMC. Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel December 5, 2011

Introduction to CBMC. Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel December 5, 2011 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213 December 5, 2011 based on slides by Daniel Kroening Bug Catching with SAT-Solvers Main Idea: Given a program and a claim use

More information

The Spin Model Checker : Part I/II

The Spin Model Checker : Part I/II The Spin Model Checker : Part I/II Moonzoo Kim CS Dept. KAIST Korea Advanced Institute of Science and Technology Motivation: Tragic Accidents Caused by SW Bugs 2 Cost of Software Errors June 2002 Software

More information

Formal Verification of Embedded Software in Medical Devices Considering Stringent Hardware Constraints

Formal Verification of Embedded Software in Medical Devices Considering Stringent Hardware Constraints Formal Verification of Embedded Software in Medical Devices Considering Stringent Hardware Constraints L. Cordeiro, B. Fischer, H. Chen, J. P. Marques-Silva Lucas Cordeiro lcc08r@ecs.soton.ac.uk Agenda

More information

EECS 219C: Formal Methods Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

EECS 219C: Formal Methods Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley EECS 219C: Formal Methods Boolean Satisfiability Solving Sanjit A. Seshia EECS, UC Berkeley The Boolean Satisfiability Problem (SAT) Given: A Boolean formula F(x 1, x 2, x 3,, x n ) Can F evaluate to 1

More information

Automatic Software Verification

Automatic Software Verification Automatic Software Verification Instructor: Mooly Sagiv TA: Oded Padon Slides from Eran Yahav and the Noun Project, Wikipedia Course Requirements Summarize one lecture 10% one lecture notes 45% homework

More information

Handling Loops in Bounded Model Checking of C Programs via k-induction

Handling Loops in Bounded Model Checking of C Programs via k-induction Software Tools for Technology Transfer manuscript No. (will be inserted by the editor) Handling Loops in Bounded Model Checking of C Programs via k-induction Mikhail Y. R. Gadelha, Hussama I. Ismail, and

More information

Incremental Proof Development in Dafny

Incremental Proof Development in Dafny 15-414 Lecture 17 1 Instructor: Matt Fredrikson Incremental Proof Development in Dafny TA: Ryan Wagner In this discussion, we ll see in more detail how to go about proving the total correctness of imperative

More information

Model Checking and Its Applications

Model Checking and Its Applications Model Checking and Its Applications Orna Grumberg Technion, Israel Verification and Deduction Mentoring Workshop July 13, 2018 1 Personal data Ph.d. in (non-automated) verification Postdoc in Model Checking

More information

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving Sanjit A. Seshia EECS, UC Berkeley Project Proposals Due Friday, February 13 on bcourses Will discuss project topics on Monday Instructions

More information

Boolean Functions (Formulas) and Propositional Logic

Boolean Functions (Formulas) and Propositional Logic EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving Part I: Basics Sanjit A. Seshia EECS, UC Berkeley Boolean Functions (Formulas) and Propositional Logic Variables: x 1, x 2, x 3,, x

More information

SAT/SMT Solvers and Applications

SAT/SMT Solvers and Applications SAT/SMT Solvers and Applications University of Waterloo Winter 2013 Today s Lecture Lessons learnt so far Implementation-related attacks (control-hazard, malware,...) Program analysis techniques can detect

More information

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements System Correctness EEC 421/521: Software Engineering A Whirlwind Intro to Software Model Checking A system is correct when it meets its requirements a design without requirements cannot be right or wrong,

More information

Satisfiability Solvers

Satisfiability Solvers Satisfiability Solvers Part 1: Systematic Solvers 600.325/425 Declarative Methods - J. Eisner 1 Vars SAT solving has made some progress 100000 10000 1000 100 10 1 1960 1970 1980 1990 2000 2010 Year slide

More information

4/6/2011. Model Checking. Encoding test specifications. Model Checking. Encoding test specifications. Model Checking CS 4271

4/6/2011. Model Checking. Encoding test specifications. Model Checking. Encoding test specifications. Model Checking CS 4271 Mel Checking LTL Property System Mel Mel Checking CS 4271 Mel Checking OR Abhik Roychoudhury http://www.comp.nus.edu.sg/~abhik Yes No, with Counter-example trace 2 Recap: Mel Checking for mel-based testing

More information

CODE ANALYSIS CARPENTRY

CODE ANALYSIS CARPENTRY SEAN HEELAN THE (IN)COMPLETE GUIDE TO CODE ANALYSIS CARPENTRY ( Or how to avoid braining yourself when handed an SMT solving hammer Immunity Inc. Part I: Down the Rabbit Hole Propositional Logic Mechanical

More information

Lecture1: Symbolic Model Checking with BDDs. Edmund M. Clarke, Jr. Computer Science Department Carnegie Mellon University Pittsburgh, PA 15213

Lecture1: Symbolic Model Checking with BDDs. Edmund M. Clarke, Jr. Computer Science Department Carnegie Mellon University Pittsburgh, PA 15213 Lecture: Symbolic Model Checking with BDDs Edmund M Clarke, Jr Computer Science Department Carnegie Mellon University Pittsburgh, PA 523 Temporal Logic Model Checking Specification Language: A propositional

More information

UNDERSTANDING PROGRAMMING BUGS IN ANSI-C SOFTWARE USING BOUNDED MODEL CHECKING COUNTER-EXAMPLES

UNDERSTANDING PROGRAMMING BUGS IN ANSI-C SOFTWARE USING BOUNDED MODEL CHECKING COUNTER-EXAMPLES FEDERAL UNIVERSITY OF AMAZONAS INSTITUTE OF COMPUTING GRADUATE PROGRAM IN COMPUTER SCIENCE UNDERSTANDING PROGRAMMING BUGS IN ANSI-C SOFTWARE USING BOUNDED MODEL CHECKING COUNTER-EXAMPLES Herbert Oliveira

More information

Symbolic Execu.on. Suman Jana

Symbolic Execu.on. Suman Jana Symbolic Execu.on Suman Jana Acknowledgement: Baishakhi Ray (Uva), Omar Chowdhury (Purdue), Saswat Anand (GA Tech), Rupak Majumdar (UCLA), Koushik Sen (UCB) What is the goal? Tes.ng Tes%ng approaches are

More information

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine No model may be available Programmer Software Abstractions Tests Coverage Code Abhik Roychoudhury CS 5219 National University of Singapore Testing Debug Today s lecture Abstract model (Boolean pgm.) Desirable

More information

Static Analysis and Bugfinding

Static Analysis and Bugfinding Static Analysis and Bugfinding Alex Kantchelian 09/12/2011 Last week we talked about runtime checking methods: tools for detecting vulnerabilities being exploited in deployment. So far, these tools have

More information

Static Program Checking

Static Program Checking Bounded Verification Jalloy Automated Software Analysis Group, Institute of Theoretical Informatics Jun.-prof. Mana Taghdiri June 5, 2014 KIT University of the State of Baden-Wuerttemberg and National

More information

Minimum Satisfying Assignments for SMT. Işıl Dillig, Tom Dillig Ken McMillan Alex Aiken College of William & Mary Microsoft Research Stanford U.

Minimum Satisfying Assignments for SMT. Işıl Dillig, Tom Dillig Ken McMillan Alex Aiken College of William & Mary Microsoft Research Stanford U. Minimum Satisfying Assignments for SMT Işıl Dillig, Tom Dillig Ken McMillan Alex Aiken College of William & Mary Microsoft Research Stanford U. 1 / 20 Satisfiability Modulo Theories (SMT) Today, SMT solvers

More information

Model Checking Embedded C Software using k-induction and Invariants

Model Checking Embedded C Software using k-induction and Invariants FEDERAL UNIVERSITY OF RORAIMA and FEDERAL UNIVESITY OF AMAZONAS Model Checking Embedded C Software using k-induction and Invariants Herbert Rocha, Hussama Ismail, Lucas Cordeiro and Raimundo Barreto Agenda

More information

Xuandong Li. BACH: Path-oriented Reachability Checker of Linear Hybrid Automata

Xuandong Li. BACH: Path-oriented Reachability Checker of Linear Hybrid Automata BACH: Path-oriented Reachability Checker of Linear Hybrid Automata Xuandong Li Department of Computer Science and Technology, Nanjing University, P.R.China Outline Preliminary Knowledge Path-oriented Reachability

More information

Research Collection. Formal background and algorithms. Other Conference Item. ETH Library. Author(s): Biere, Armin. Publication Date: 2001

Research Collection. Formal background and algorithms. Other Conference Item. ETH Library. Author(s): Biere, Armin. Publication Date: 2001 Research Collection Other Conference Item Formal background and algorithms Author(s): Biere, Armin Publication Date: 2001 Permanent Link: https://doi.org/10.3929/ethz-a-004239730 Rights / License: In Copyright

More information

Course Summary! What have we learned and what are we expected to know?

Course Summary! What have we learned and what are we expected to know? Course Summary! What have we learned and what are we expected to know? Overview! Introduction Modelling in MiniZinc Finite Domain Constraint Solving Search Linear Programming and Network Flow Mixed Integer

More information

Computer-Aided Program Design

Computer-Aided Program Design Computer-Aided Program Design Spring 2015, Rice University Unit 1 Swarat Chaudhuri January 22, 2015 Reasoning about programs A program is a mathematical object with rigorous meaning. It should be possible

More information

ESBMC 1.22 (Competition Contribution) Jeremy Morse, Mikhail Ramalho, Lucas Cordeiro, Denis Nicole, Bernd Fischer

ESBMC 1.22 (Competition Contribution) Jeremy Morse, Mikhail Ramalho, Lucas Cordeiro, Denis Nicole, Bernd Fischer ESBMC 1.22 (Competition Contribution) Jeremy Morse, Mikhail Ramalho, Lucas Cordeiro, Denis Nicole, Bernd Fischer ESBMC: SMT-based BMC of single- and multi-threaded software exploits SMT solvers and their

More information

: A Bounded Model Checking Tool to Verify Qt Applications

: A Bounded Model Checking Tool to Verify Qt Applications 23 rd International SPIN symposium on Model Checking of Software : A Bounded Model Checking Tool to Verify Qt Applications Mário A. P. Garcia, Felipe R. Monteiro, Lucas C. Cordeiro, and Eddie B. de Lima

More information

Verifying Temporal Properties via Dynamic Program Execution. Zhenhua Duan Xidian University, China

Verifying Temporal Properties via Dynamic Program Execution. Zhenhua Duan Xidian University, China Verifying Temporal Properties via Dynamic Program Execution Zhenhua Duan Xidian University, China Main Points Background & Motivation MSVL and Compiler PPTL Unified Program Verification Tool Demo Conclusion

More information

Satisfiability (SAT) Applications. Extensions/Related Problems. An Aside: Example Proof by Machine. Annual Competitions 12/3/2008

Satisfiability (SAT) Applications. Extensions/Related Problems. An Aside: Example Proof by Machine. Annual Competitions 12/3/2008 15 53:Algorithms in the Real World Satisfiability Solvers (Lectures 1 & 2) 1 Satisfiability (SAT) The original NP Complete Problem. Input: Variables V = {x 1, x 2,, x n }, Boolean Formula Φ (typically

More information

Solving 3-SAT. Radboud University Nijmegen. Bachelor Thesis. Supervisors: Henk Barendregt Alexandra Silva. Author: Peter Maandag s

Solving 3-SAT. Radboud University Nijmegen. Bachelor Thesis. Supervisors: Henk Barendregt Alexandra Silva. Author: Peter Maandag s Solving 3-SAT Radboud University Nijmegen Bachelor Thesis Author: Peter Maandag s3047121 Supervisors: Henk Barendregt Alexandra Silva July 2, 2012 Contents 1 Introduction 2 1.1 Problem context............................

More information

On Reasoning about Finite Sets in Software Checking

On Reasoning about Finite Sets in Software Checking On Reasoning about Finite Sets in Software Model Checking Pavel Shved Institute for System Programming, RAS SYRCoSE 2 June 2010 Static Program Verification Static Verification checking programs against

More information

Combinational Equivalence Checking

Combinational Equivalence Checking Combinational Equivalence Checking Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab. Dept. of Electrical Engineering Indian Institute of Technology Bombay viren@ee.iitb.ac.in

More information

On Search Strategies for Constraint-Based Bounded Model Checking. Michel RUEHER

On Search Strategies for Constraint-Based Bounded Model Checking. Michel RUEHER raft On Search Strategies for Constraint-Based Bounded Model Checking Michel RUEHER Joined work with Hélène Collavizza, Nguyen Le Vinh, Olivier Ponsini and Pascal Van Hentenryck University Nice Sophia-Antipolis

More information

Symbolic Execution. Wei Le April

Symbolic Execution. Wei Le April Symbolic Execution Wei Le 2016 April Agenda What is symbolic execution? Applications History Interal Design: The three challenges Path explosion Modeling statements and environments Constraint solving

More information

Decision Procedures for Equality Logic. Daniel Kroening and Ofer Strichman 1

Decision Procedures for Equality Logic. Daniel Kroening and Ofer Strichman 1 in First Order Logic for Equality Logic Daniel Kroening and Ofer Strichman 1 Outline Introduction Definition, complexity Reducing Uninterpreted Functions to Equality Logic Using Uninterpreted Functions

More information

On Resolution Proofs for Combinational Equivalence Checking

On Resolution Proofs for Combinational Equivalence Checking On Resolution Proofs for Combinational Equivalence Checking Satrajit Chatterjee Alan Mishchenko Robert Brayton Department of EECS U. C. Berkeley {satrajit, alanmi, brayton}@eecs.berkeley.edu Andreas Kuehlmann

More information

Bug Finding with Under-approximating Static Analyses. Daniel Kroening, Matt Lewis, Georg Weissenbacher

Bug Finding with Under-approximating Static Analyses. Daniel Kroening, Matt Lewis, Georg Weissenbacher Bug Finding with Under-approximating Static Analyses Daniel Kroening, Matt Lewis, Georg Weissenbacher Overview Over- vs. underapproximating static analysis Path-based symbolic simulation Path merging Acceleration

More information

Dipartimento di Elettronica Informazione e Bioingegneria. Cognitive Robotics. SATplan. Act1. Pre1. Fact. G. Gini Act2

Dipartimento di Elettronica Informazione e Bioingegneria. Cognitive Robotics. SATplan. Act1. Pre1. Fact. G. Gini Act2 Dipartimento di Elettronica Informazione e Bioingegneria Cognitive Robotics SATplan Pre1 Pre2 @ 2015 Act1 Act2 Fact why SAT (satisfability)? 2 Classical planning has been observed as a form of logical

More information

Parallelizing SAT Solver With specific application on solving Sudoku Puzzles

Parallelizing SAT Solver With specific application on solving Sudoku Puzzles 6.338 Applied Parallel Computing Final Report Parallelizing SAT Solver With specific application on solving Sudoku Puzzles Hank Huang May 13, 2009 This project was focused on parallelizing a SAT solver

More information

Embedded Software Verification Challenges and Solutions. Static Program Analysis

Embedded Software Verification Challenges and Solutions. Static Program Analysis Embedded Software Verification Challenges and Solutions Static Program Analysis Chao Wang chaowang@nec-labs.com NEC Labs America Princeton, NJ ICCAD Tutorial November 11, 2008 www.nec-labs.com 1 Outline

More information

SMT-Based Bounded Model Checking for Embedded ANSI-C Software. Lucas Cordeiro, Bernd Fischer, Joao Marques-Silva

SMT-Based Bounded Model Checking for Embedded ANSI-C Software. Lucas Cordeiro, Bernd Fischer, Joao Marques-Silva SMT-Based Bounded Model Checking for Embedded ANSI-C Software Lucas Cordeiro, Bernd Fischer, Joao Marques-Silva b.fischer@ecs.soton.ac.uk Bounded Model Checking (BMC) Basic Idea: check negation of given

More information

Verifying C & C++ with ESBMC

Verifying C & C++ with ESBMC Verifying C & C++ with ESBMC Denis A Nicole dan@ecs.soton.ac.uk CyberSecuritySoton.org [w] @CybSecSoton [fb & tw] ESBMC ESBMC, the Efficient SMT-Based Context-Bounded Model Checker was originally developed

More information

Introduction to Axiomatic Semantics

Introduction to Axiomatic Semantics Introduction to Axiomatic Semantics Meeting 10, CSCI 5535, Spring 2009 Announcements Homework 3 due tonight Homework 2 is graded 13 (mean), 14 (median), out of 21 total, but Graduate class: final project

More information

DART: Directed Automated Random Testing. CUTE: Concolic Unit Testing Engine. Slide Source: Koushik Sen from Berkeley

DART: Directed Automated Random Testing. CUTE: Concolic Unit Testing Engine. Slide Source: Koushik Sen from Berkeley DAR: Directed Automated Random esting CUE: Concolic Unit esting Engine Slide Source: Koushik Sen from Berkeley Verification and esting We would like to prove programs correct Verification and esting We

More information

A Pearl on SAT Solving in Prolog (extended abstract)

A Pearl on SAT Solving in Prolog (extended abstract) A Pearl on SAT Solving in Prolog (extended abstract) Jacob M. Howe and Andy King 1 Introduction The Boolean satisfiability problem, SAT, is of continuing interest because a variety of problems are naturally

More information

DPLL(Γ+T): a new style of reasoning for program checking

DPLL(Γ+T): a new style of reasoning for program checking DPLL(Γ+T ): a new style of reasoning for program checking Dipartimento di Informatica Università degli Studi di Verona Verona, Italy June, 2011 Motivation: reasoning for program checking Program checking

More information

Decision Procedures in the Theory of Bit-Vectors

Decision Procedures in the Theory of Bit-Vectors Decision Procedures in the Theory of Bit-Vectors Sukanya Basu Guided by: Prof. Supratik Chakraborty Department of Computer Science and Engineering, Indian Institute of Technology, Bombay May 1, 2010 Sukanya

More information

Exploring Abstraction Techniques for Scalable Bit-Precise Verification of Embedded Software

Exploring Abstraction Techniques for Scalable Bit-Precise Verification of Embedded Software Exploring Abstraction Techniques for Scalable Bit-Precise Verification of Embedded Software Nannan He Dissertation submitted to the Faculty of Virginia Polytechnic Institute and State University in partial

More information

HECTOR: Formal System-Level to RTL Equivalence Checking

HECTOR: Formal System-Level to RTL Equivalence Checking ATG SoC HECTOR: Formal System-Level to RTL Equivalence Checking Alfred Koelbl, Sergey Berezin, Reily Jacoby, Jerry Burch, William Nicholls, Carl Pixley Advanced Technology Group Synopsys, Inc. June 2008

More information

Decision Procedures in First Order Logic

Decision Procedures in First Order Logic in First Order Logic for Equality Logic Daniel Kroening and Ofer Strichman 1 Outline Introduction Definition, complexity Reducing Uninterpreted Functions to Equality Logic Using Uninterpreted Functions

More information

Implementation of a Sudoku Solver Using Reduction to SAT

Implementation of a Sudoku Solver Using Reduction to SAT Implementation of a Sudoku Solver Using Reduction to SAT For this project you will develop a Sudoku solver that receives an input puzzle and computes a solution, if one exists. Your solver will: read an

More information

CS453: Software Verification Techniques

CS453: Software Verification Techniques CS453: Software Verification Techniques Moonzoo Kim Provable Software Laboratory 1 Role of S/W: Increased in Everywhere Percent of functionality provided by software 90 80 70 60 50 40 30 20 10 0 F-22 F-4

More information

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus: Boolean Algebra and Simplification CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Topics Motivation: Simplifying Conditional Expressions

More information

Lecture Notes on Real-world SMT

Lecture Notes on Real-world SMT 15-414: Bug Catching: Automated Program Verification Lecture Notes on Real-world SMT Matt Fredrikson Ruben Martins Carnegie Mellon University Lecture 15 1 Introduction In the previous lecture we studied

More information

Polynomial SAT-Solver Algorithm Explanation

Polynomial SAT-Solver Algorithm Explanation 1 Polynomial SAT-Solver Algorithm Explanation by Matthias Mueller (a.k.a. Louis Coder) louis@louis-coder.com Explanation Version 1.0 - December 1, 2013 Abstract This document describes an algorithm that

More information

Propositional Calculus. Math Foundations of Computer Science

Propositional Calculus. Math Foundations of Computer Science Propositional Calculus Math Foundations of Computer Science Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they can use it to

More information

HySAT. what you can use it for how it works example from application domain final remarks. Christian Herde /12

HySAT. what you can use it for how it works example from application domain final remarks. Christian Herde /12 CP2007: Presentation of recent CP solvers HySAT what you can use it for how it works example from application domain final remarks Christian Herde 25.09.2007 /2 What you can use it for Satisfiability checker

More information

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 10: Asymptotic Complexity and What Makes a Good Algorithm? Suppose you have two possible algorithms or

More information

Symbolic Methods. The finite-state case. Martin Fränzle. Carl von Ossietzky Universität FK II, Dpt. Informatik Abt.

Symbolic Methods. The finite-state case. Martin Fränzle. Carl von Ossietzky Universität FK II, Dpt. Informatik Abt. Symbolic Methods The finite-state case Part I Martin Fränzle Carl von Ossietzky Universität FK II, Dpt. Informatik Abt. Hybride Systeme 02917: Symbolic Methods p.1/34 What you ll learn How to use and manipulate

More information

DM841 DISCRETE OPTIMIZATION. Part 2 Heuristics. Satisfiability. Marco Chiarandini

DM841 DISCRETE OPTIMIZATION. Part 2 Heuristics. Satisfiability. Marco Chiarandini DM841 DISCRETE OPTIMIZATION Part 2 Heuristics Satisfiability Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline 1. Mathematical Programming Constraint

More information

Quantifying Information Leaks in Software

Quantifying Information Leaks in Software Quantifying Information Leaks in Software Jonathan Heusser, Pasquale Malacaria Queen Mary University of London 11. 10. 2016 Introduction High complexity associated with quantifying precise leakage quantities

More information

Reasoning About Imperative Programs. COS 441 Slides 10

Reasoning About Imperative Programs. COS 441 Slides 10 Reasoning About Imperative Programs COS 441 Slides 10 The last few weeks Agenda reasoning about functional programming It s very simple and very uniform: substitution of equal expressions for equal expressions

More information

Practical SAT Solving

Practical SAT Solving Practical SAT Solving Lecture 5 Carsten Sinz, Tomáš Balyo May 23, 2016 INSTITUTE FOR THEORETICAL COMPUTER SCIENCE KIT University of the State of Baden-Wuerttemberg and National Laboratory of the Helmholtz

More information

DPLL(T ):Fast Decision Procedures

DPLL(T ):Fast Decision Procedures DPLL(T ):Fast Decision Procedures Harald Ganzinger George Hagen Robert Nieuwenhuis Cesare Tinelli Albert Oliveras MPI, Saarburcken The University of Iowa UPC, Barcelona Computer Aided-Verification (CAV)

More information

QuteSat. A Robust Circuit-Based SAT Solver for Complex Circuit Structure. Chung-Yang (Ric) Huang National Taiwan University

QuteSat. A Robust Circuit-Based SAT Solver for Complex Circuit Structure. Chung-Yang (Ric) Huang National Taiwan University QuteSat A Robust Circuit-Based SAT Solver for Complex Circuit Structure Chung-Yang (Ric) Huang National Taiwan University To appear: DATE 27 2/1/27 Fact Sheet (Background) Boolean Satisfiability (SAT)

More information

Decision Procedures. An Algorithmic Point of View. Bit-Vectors. D. Kroening O. Strichman. Version 1.0, ETH/Technion

Decision Procedures. An Algorithmic Point of View. Bit-Vectors. D. Kroening O. Strichman. Version 1.0, ETH/Technion Decision Procedures An Algorithmic Point of View Bit-Vectors D. Kroening O. Strichman ETH/Technion Version 1.0, 2007 Part VI Bit-Vectors Outline 1 Introduction to Bit-Vector Logic 2 Syntax 3 Semantics

More information

A Bounded Model Checker for SPARK Programs

A Bounded Model Checker for SPARK Programs A Bounded Model Checker for SPARK Programs Cláudio Belo Lourenço, Maria João Frade, and Jorge Sousa Pinto HASLab/INESC TEC & Universidade do Minho, Portugal Abstract. This paper discusses the design and

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2013 Soleymani Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition,

More information

Applications of Formal Verification

Applications of Formal Verification Applications of Formal Verification Model Checking: Introduction to PROMELA Bernhard Beckert Mattias Ulbrich SS 2017 KIT INSTITUT FÜR THEORETISCHE INFORMATIK KIT University of the State of Baden-Württemberg

More information

Formally Certified Satisfiability Solving

Formally Certified Satisfiability Solving SAT/SMT Proof Checking Verifying SAT Solver Code Future Work Computer Science, The University of Iowa, USA April 23, 2012 Seoul National University SAT/SMT Proof Checking Verifying SAT Solver Code Future

More information

Constraint Programming

Constraint Programming Constraint Programming Functional programming describes computation using functions f : A B Computation proceeds in one direction: from inputs (A) to outputs (B) e.g. f(x) = x / 2 is a function that maps

More information

Formalization of Incremental Simplex Algorithm by Stepwise Refinement

Formalization of Incremental Simplex Algorithm by Stepwise Refinement Formalization of Incremental Simplex Algorithm by Stepwise Refinement Mirko Spasić, Filip Marić Faculty of Mathematics, University of Belgrade FM2012, 30. August 2012. Overview 1 Introduction 2 Approach

More information

Chapter 2 PRELIMINARIES

Chapter 2 PRELIMINARIES 8 Chapter 2 PRELIMINARIES Throughout this thesis, we work with propositional or Boolean variables, that is, variables that take value in the set {true, false}. A propositional formula F representing a

More information

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine CS 275 Automata and Formal Language Theory Course Notes Part III: Limits of Computation Chapt. III.3: Turing Machines Anton Setzer http://www.cs.swan.ac.uk/ csetzer/lectures/ automataformallanguage/13/index.html

More information