Compiled Code Verification Survey and Prospects

Size: px
Start display at page:

Download "Compiled Code Verification Survey and Prospects"

Transcription

1 Compiled Code Verification Survey and Prospects Amitabha Sanyal Department of Computer Science & Engineering IIT Bombay (Copyright c 2004 Amitabha Sanyal)

2 Acknowledgements Achyut Jagtap Aditya Kanade Abhijat Vichare Supratim Biswas Uday Khedker Compiled Code Verification Survey and Prospects : Amitabha Sanyal 1

3 So you thought compilers were always right? Programmers place a large amount of trust on the correctness of compilers. Is this trust justifiable? Yes, because Compiling algorithms are well studied. Have sound theoretical foundations. Large parts of compilers are automatically generated by tools which have become trustworthy by usage. However... Compiled Code Verification Survey and Prospects : Amitabha Sanyal 2

4 So you thought compilers were always right? Compiled Code Verification Survey and Prospects : Amitabha Sanyal 3

5 So you thought compilers were always right? Bug #15549 int lessthan (_Bool b, unsigned char c) { return b < c; } int main () { if (!lessthan(1, a )) abort (); } Problem: b < c is compiled as (b == 0) & (c!= 0). From release of GCC to 3.4.3, the number of open bugs increased from 1400 to Compiled Code Verification Survey and Prospects : Amitabha Sanyal 4

6 Increasing Trustworthiness through Compiler Verification Compiled Code Verification Survey and Prospects : Amitabha Sanyal 5

7 Increasing Trustworthiness through Compiler Verification Formalize and verify the following diagram for every source program P.: P comp comp(p) smean tmean smean(p) abstract tmean(comp(p)) comp represents the transformations due to a compiler (harder problem), or a model of a compiler (easier). Is the model faithful? Compiled Code Verification Survey and Prospects : Amitabha Sanyal 6

8 Compiler Verification P: y = 5 x = y + 1 smean comp push 5 store a0 push a0 push 1 add store a1 tmean y = 5 x = 6 abstract a0 = 5 a1 = 6 stack = [...] Compiled Code Verification Survey and Prospects : Amitabha Sanyal 7

9 Compiler Verification History J. McCarthy and J. Painter, Correctness of a Compiler for Arithmetic Expressions, Mathematical Aspects of Computer Science, R. M. Burstall, Proving Properties of Programs by Structural Induction, Computer Journal R. Milner and R. W. Weyhrauch, Proving compiler correctness in a mechanized logic, Machine Intelligence 7, Edinburgh University Press, F. Lockwood Morris, Advice on structuring compilers and proving them correct, Proceedings of the 1st annual ACM SIGACT-SIGPLAN symposium on Principles of programming languages, J. W. Thatcher, E. G. Wagner, J. B. Wright, More on advice on structuring compilers and proving them correct, Lecture Notes In Computer Science - Volume 94, Wolfgang Polak, Compiler verification and Specification, Lecture Notes in Computer Science - Volume 124, L. M. Chirica and D. F. Martin, Toward Compiler Implementation Correctness Proofs, ACM TOPLAS, C.A.R. Hoare and He Jifeng Refinement algebra proves correctness of a compiler. Proceedings of International Summer School on Programming and Mathematical Method, Editor - M. Broy, Compiled Code Verification Survey and Prospects : Amitabha Sanyal 8

10 Compiler Verification - Polak Verifies an actual compiler and not a model. Source language Pascal. Target machine realistic stack machine. Compiler written by author. No optimization phase. Machine aided proof (Uses Stanford Verifier). Compiled Code Verification Survey and Prospects : Amitabha Sanyal 9

11 Compiler Verification - Drawbacks Complexity. 1. Requires reasoning about actual compiler implementation. 2. Requires reasoning about the behaviour of the compiler for an infinite number of programs and their translations. Automation - unlikely Proof reuse? Compiled Code Verification Survey and Prospects : Amitabha Sanyal 10

12 Increasing Trustworthiness Through Compile Code Verification Compiled Code Verification Survey and Prospects : Amitabha Sanyal 11

13 Increasing trustworthiness Through Compiled Code Verification Formalize and verify the following diagram for a given source program: P: y = 5 x = y + 1 comp push 5 store a0 push a0 push 1 add store a1 smean tmean y = 5 x = 6 abstract a0 = 5 a1 = 6 stack = [...] Compiled Code Verification Survey and Prospects : Amitabha Sanyal 12

14 Compiled Code Verification Less complex Involves reasoning about a given pair of programs The compiler can be made to provide information to help verification. Automation - likely. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 13

15 Compiled code verification - major approaches Martin. C. Rinard Credible Compilation, Technical Report of MIT Lab for Computer Science 776, G. Necula, Translation Validation of an Optimizing Compiler. In Proceedings of PLDI L. Zuck, Amir Pnueli, Yi Fang and Benjamin Goldberg, VOC: A Translation Validator for Optimizing Compilers, Electronic Notes in Theoretical Computer Science 65 No. 2(2002). A.P.Heffter and M. Gawkoski, Towards Proof Generating Compilers, Proceedings of COCV Compiled Code Verification Survey and Prospects : Amitabha Sanyal 14

16 Execution trace A source program... int a[100]; int g; int foo(int n) { int i = 0; while (i < n) { a[i] =g *i + 3; i = i + 1 } return i; } int main () { foo(50); return 0; }... and its execution trace. main (); foo(50); i = 0; (i < n) a[i] =g *i + 3; i = i + 1 (i < n) a[i] =g *i + 3; i = i + 1 (i < n) a[i] =g *i + 3; i = i return i; return 0; Compiled Code Verification Survey and Prospects : Amitabha Sanyal 15

17 Observation points and observables For a given input, the source program will give rise to an execution trace. Similarly for the target program. Observation points: Where the correspondence of source and target is ensured. 1. At every assignment statement. 2. At call-return boundaries 3. At print statements Observables: Things which must correspond. 1. Every variable and its value. 2. Arguments and return values 3. Arguments of print statements Equivalent traces: If two traces have the same sequence of observation points, and at each observation point the observables correspond. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 16

18 Correctness Criterion Correctness criterion: equivalent execution traces. For any input, the source and the target should have Compiled Code Verification Survey and Prospects : Amitabha Sanyal 17

19 The Necula method Compiled Code Verification Survey and Prospects : Amitabha Sanyal 18

20 The Necula method An example program body of a function while if; repeat code hoisting strength reduction Compiled Code Verification Survey and Prospects : Amitabha Sanyal 19

21 Data Space Source params mem n i &g &a t u v locals Compiled Code Verification Survey and Prospects : Amitabha Sanyal 20

22 Data Space Target regs r0 mem r2 &g &a bp 8 bp 4 stack Compiled Code Verification Survey and Prospects : Amitabha Sanyal 21

23 Data Mapping Mapping 1. Globals globals. 2. locals and params stack and regs. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 22

24 Observation points and Observables Observation points: Call-return boundaries Observables: At call point arguments and global memory. At return point return values and global memory. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 23

25 Key question If we want the condition i = r0 and m = m at b2 and b5... Compiled Code Verification Survey and Prospects : Amitabha Sanyal 24

26 Key question how should the variables be related at b0 and b4? Compiled Code Verification Survey and Prospects : Amitabha Sanyal 25

27 Key question How does one express the values of variables at b2 in terms of variables at b0?... Through symbolic evaluation. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 26

28 Symbolic Evaluation m = m i = i+1 t = t u = t i v = t i+3 b0(m,i,t,u,v) b1(m, i+1, t, t i, t i+3) b0(m,i,t) b1(m, i+1, t i+3) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 27

29 Symbolic Evaluation b0(m, i) i < n? b1(m, 0) : b2(m, n) b0(m, i) = b1( upd(m, (&a+i), sel(m,&g) i + 3), i+1) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 28

30 Generating and Solving Constraints Constraints are generated to represent the condition that observables at observation points correspond. Solution of constraints actually establishes this correspondence. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 29

31 Generating and Solving Constraints b0(m,n) b4(m, [BP-4]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 30

32 Generating and Solving Constraints b0(m,n) b4(m, [BP-4]) b0(m,n) = 0 < n? b2(m,0) : b3(m,0,n) b4(m,[bp-4]) = 0 < [BP-4]? b5(m,0) : b6(m,0,[bp-4]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 31

33 Generating and Solving Constraints b0(m,n) b4(m, [BP-4]) n =[BP-4] constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0, [BP-4])) b0(m,n) = 0 < n? b2(m,0) : b3(m,0,n) b4(m,[bp-4]) = 0 < [BP-4]? b5(m,0) : b6(m,0,[bp-4]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 32

34 Generating and Solving Constraints b0(m,n) b1(m, [BP-4]) n =[BP-4] constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0, [BP-4])) b2(m,i) b5(m, r0) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 33

35 Generating and Solving Constraints b0(m,n) b4(m, [BP-4]) n =[BP-4] constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0, [BP-4])) b2(m,i) b5(m, r0) b2(m,i) = ret(m,i) b5(m,r0) = ret(m,r0) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 34

36 Generating and Solving Constraints b0(m,n) b4(m, [BP-4]) n =[BP-4] constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b2(m,i) b5(m, r0) m = m i = r0 b2(m,i) = ret(m,i) b5(m,r0) = ret(m,r0) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 35

37 Generating and Solving Constraints b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) b3(m,i,n) = i+1 < n? b2(upd(m,&a+i, sel(m,&g) i+3), i+1) : b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n) b6(m,r0,[bp-4]) = r0+1 < [BP-4]? b5(upd(m,&a+r0, 3), r0+1) : b7(upd(m,&a+r0, 3), r0+1, [BP-4]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 36

38 Generating and Solving Constraints b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4],bp-8]) b3(m,i,n) = i+1 < n? b2(upd(m,&a+i, sel(m,&g) i+3), i+1) : b3(upd(m,&a+i, sel(m,&g) i+3), i+1,n) b7(m,r0,[bp-4]) = r0+1 < [BP-4]? b5(upd(m,&a+r0, r2), r0+1) : b7(upd(m,&a+r0, r2), r0+1, r2+[bp-8], [BP-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 37

39 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) n =[BP-4] constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b2(m,i) b5(m, r0) i = r0 m = m b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1,n), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1,n), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 38

40 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) n =[BP-4] constraints(b2( m,0) b5( m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b2( m,i) b5( m, r0) i = r0 m = m b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1,n), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 39

41 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) b2( m,i) b5( m, r0) n =[BP-4] m = m constraints(b2( m,0) b5( m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) i = r0 m = m b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 40

42 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) b2(m, i ) b5(m, r0 ) n =[BP-4] m = m constraints(b2(m, 0 ) b5(m, 0 )) constraints(b3(m,0,n) b6(m,0,[bp-4])) b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) i = r0 m = m b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1,n), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 41

43 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) b2(m,i) b5(m, r0) n =[BP-4] m = m constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) i = r0 m = m b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1,n), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 42

44 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) b2( m,i) b5( m, r0) n =[BP-4] m = m constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] constraints(b2( upd(m,&a+i, sel(m,&g) i+3), i+1), b5( upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) i = r0 m = m b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1, n), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 43

45 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) b2( m,i) b5( m, r0) n =[BP-4] m = m constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] m = m sel(m,&g) i = 0 constraints(b2( upd(m,&a+i, sel(m,&g) i+3), i+1), b5( upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) i = r0 m = m b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 44

46 Satisfying the Constraints b0(m,n) b4(m, [BP-4]) b2(m,i) b5(m, r0) n =[BP-4] m = m constraints(b2(m,0) b5(m,0)) constraints(b3(m,0,n) b6(m,0,[bp-4])) b3(m,i,n) b6(m, r0, [BP-4]) i = r0 n = [BP-4] m = m sel(m,&g) i = 0 constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, 3), r0+1)) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1), b7(upd(m,&a+r0, 3), r0+1, [BP-4])) i = r0 m = m b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] constraints(b2(upd(m,&a+i, sel(m,&g) i+3), i+1), b5(upd(m,&a+r0, r2), r0+1) constraints(b3(upd(m,&a+i, sel(m,&g) i+3), i+1), b7(upd(m,&a+r0,r2),r0+1,r2+[bp-8],[bp-4], [BP-8]) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 45

47 Satisfying the Constraints b0(m,n) n =[BP-4] m = m b4(m, [BP-4]) b2(m,i) b5(m, r0) i = r0 m = m b3(m,i,n) b6(m, r0, [BP-4]) b3(m,i,n) b7(m, r0, r2, [BP-4], [BP-8]) i = r0 n = [BP-4] m = m sel(m,&g) i = 0 i = r0 n = [BP-4] m = m sel(m,&g) i + 3 = r2 Compiled Code Verification Survey and Prospects : Amitabha Sanyal 46

48 Demonstrating correctness Simulation relation (b0, b4) n=[bp-4], m = m (b2, b5) i=r0, m = m (b3, b6) i=0, n=[bp-4], m = m, sel(m,&g) i = 0 (b3, b7) i=0, n=[bp-4], m = m, sel(m,&g) i + 3 = r2 Compiled Code Verification Survey and Prospects : Amitabha Sanyal 47

49 Simulation Relation (b0, b4) n=[bp-4], m = m (b2, b5) i=r0, m = m (b3, b6) i=0, n=[bp-4], m = m, sel(m,&g) i = 0 (b3, b7) i=0, n=[bp-4], m = m, sel(m,&g) i + 3 = r2 Compiled Code Verification Survey and Prospects : Amitabha Sanyal 48

50 Simulation Relation (b0, b4) n=[bp-4], m = m (b2, b5) i=r0, m = m (b3, b6) i=0, n=[bp-4], m = m, sel(m,&g) i = 0 (b3, b7) i=0, n=[bp-4], m = m, sel(m,&g) i + 3 = r2 Compiled Code Verification Survey and Prospects : Amitabha Sanyal 49

51 Simulation Relation (b0, b4) n=[bp-4], m = m (b2, b5) i=r0, m = m (b3, b6) i=0, n=[bp-4], m = m, sel(m,&g) i = 0 (b3, b7) i=0, n=[bp-4], m = m, sel(m,&g) i + 3 = r2 Compiled Code Verification Survey and Prospects : Amitabha Sanyal 50

52 Simulation Relation (b0, b4) n=[bp-4], m = m (b2, b5) i=r0, m = m (b3, b6) i=0, n=[bp-4], m = m, sel(m,&g) i = 0 (b3, b7) i=0, n=[bp-4], m = m, sel(m,&g) i + 3 = r2 Compiled Code Verification Survey and Prospects : Amitabha Sanyal 51

53 Adding procedure calls Source Target main main entry main entry main i+j=r0 m=m call foo(i+j) foo(n) entry foo n=[bp 4] m=m call foo(r0) foo([bp 4]) entry foo k = returnval k = r1 m=m return i i = r0 m=m r1 = returnval return r0 return k return r1 i + j = r0 m = m {n = [BP 4] m = m } n i+j [BP 4] r0 {i = r0 m = m } i k r0 r1 k = r1 m = m Compiled Code Verification Survey and Prospects : Amitabha Sanyal 52

54 Heffter-Gawkoski Approach Compiled Code Verification Survey and Prospects : Amitabha Sanyal 53

55 Heffter-Gawkoski Approach Compiled Code Verification Survey and Prospects : Amitabha Sanyal 54

56 Heffter-Gawkoski Approach Example Source Program: x = 7 + x; y = 8; x + y Semantics: evalprog :: (Sprogram, State) Integer Compiled Code Verification Survey and Prospects : Amitabha Sanyal 55

57 Heffter-Gawkoski Approach Example Target Program: push 7 load a0 add store a0 push 8 store a1 load a0 load a1 add Semantics: type Store = (Stack, Memory) exec :: (Tprogram, Store) Store Compiled Code Verification Survey and Prospects : Amitabha Sanyal 56

58 Heffter-Gawkoski Approach Memory map (dmap) Initialization of memory (initmem) Compiled Code Verification Survey and Prospects : Amitabha Sanyal 57

59 Heffter-Gawkoski Approach ctrans sp tp = def dmap st : evalprog sp st = top (fst (exec tp ([ ], initmem st dmap))) The value of the source program is the same as that left on the top of the stack by the target program Compiled Code Verification Survey and Prospects : Amitabha Sanyal 58

60 Heffter-Gawkoski Approach For: sp = [x = 7 + x; y = 8] x + y tp = [push 7; load a0; add; store a0; push 8; store a1; load a0; load a1; add dmap = [x a0; y a1] The compiler generates a proof script of: st : evalprog sp = top (fst (exec tp ([ ], initmem st dmap))) Proves if x = a0 = α, then both programs return α + 15 Compiled Code Verification Survey and Prospects : Amitabha Sanyal 59

61 Heffter-Gawkoski Approach Proof long and complex. Can checking of semantic equivalence be replaced by checking of syntactic equivalence? Compiled Code Verification Survey and Prospects : Amitabha Sanyal 60

62 Heffter-Gawkoski Approach S Compiler T1 S model of Compiler tr T1, T2, T3 S Compiler O1 T2 tr models the compiler as closely and S Compiler O2 T3 conveniently as possible. tr should be easily checkable. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 61

63 Heffter-Gawkoski Approach Compiler Model Correct translation Incorrect translation Compiled Code Verification Survey and Prospects : Amitabha Sanyal 62

64 Heffter-Gawkoski Approach If we additionally prove a result: ( dmap sp, tp : tr sp dmap tp) (ctrans sp tp) Compiler Model Correct translation Incorrect translation Compiled Code Verification Survey and Prospects : Amitabha Sanyal 63

65 Heffter-Gawkoski Approach Suppose T is the target produced by the compiler for a source S. Are S and T related by tr? 1. Yes T is a correct compilation of S. 2. No Either T is incorrect or false negative due to inadequate model. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 64

66 Looking Ahead Compiled Code Verification Survey and Prospects : Amitabha Sanyal 65

67 Towards More Realistic Compiled Code Verifiers Can Necula be extended to more realistic compilers? Modelling of richer source language features. Richer data types. Dynamic memory allocation. Aliasing. Expressions with multiple side effects. Functions calls and returns. Realistic modelling of target machine. Accurate modelling of target data space (aliasing in stack, heap). Addressing modes. Modelling target data types (bit, byte, word, long). Compiled Code Verification Survey and Prospects : Amitabha Sanyal 66

68 Looking Ahead Relating source to the target. Elaborate data mapping Operator mapping The constraint solver. Designing an algorithm for constraint solving. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 67

69 Our goal To build a realistic and usable compiled code verifier for MISRA C subset of GCC C. 1. No mallocs. 2. no unions. 3. Multiple side-effects in a expression not allowed. 4. No pointer arithmetic. Use Necula s method as basis with minimal compiler instrumentation. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 68

70 Conclusions Building a realistic compiled code verification system for a moderately simple language seems possible. Compiled Code Verification Survey and Prospects : Amitabha Sanyal 69

Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Functional Programming. Functional Programming Languages. Chapter 14. Introduction Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Týr: a dependent type system for spatial memory safety in LLVM

Týr: a dependent type system for spatial memory safety in LLVM Týr: a dependent type system for spatial memory safety in LLVM Vítor De Araújo Álvaro Moreira (orientador) Rodrigo Machado (co-orientador) August 13, 2015 Vítor De Araújo Álvaro Moreira (orientador) Týr:

More information

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students Eastern Washington University Department of Computer Science Questionnaire for Prospective Masters in Computer Science Students I. Personal Information Name: Last First M.I. Mailing Address: Permanent

More information

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser) High-Level Programming Languages Nell Dale & John Lewis (adaptation by Michael Goldwasser) Low-Level Languages What are disadvantages of low-level languages? (e.g., machine code or assembly code) Programming

More information

Logistics. Software Testing. Logistics. Logistics. Plan for this week. Before we begin. Project. Final exam. Questions?

Logistics. Software Testing. Logistics. Logistics. Plan for this week. Before we begin. Project. Final exam. Questions? Logistics Project Part 3 (block) due Sunday, Oct 30 Feedback by Monday Logistics Project Part 4 (clock variant) due Sunday, Nov 13 th Individual submission Recommended: Submit by Nov 6 th Scoring Functionality

More information

The CompCert verified C compiler

The CompCert verified C compiler The CompCert verified C compiler Compiler built and proved by Xavier Leroy et al. Talk given by David Pichardie - Harvard University / INRIA Rennes Slides largely inspired by Xavier Leroy own material

More information

Lecture 1: Introduction

Lecture 1: Introduction Programming Languages Lecture 1: Introduction Benjamin J. Keller Department of Computer Science, Virginia Tech Programming Languages Lecture 1 Introduction 2 Lecture Outline Preview History of Programming

More information

Properties of Real Numbers

Properties of Real Numbers 16 Chapter P Prerequisites P.2 Properties of Real Numbers What you should learn: Identify and use the basic properties of real numbers Develop and use additional properties of real numbers Why you should

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

On strong fairness in UNITY

On strong fairness in UNITY On strong fairness in UNITY H.P.Gumm, D.Zhukov Fachbereich Mathematik und Informatik Philipps Universität Marburg {gumm,shukov}@mathematik.uni-marburg.de Abstract. In [6] Tsay and Bagrodia present a correct

More information

1 Abstract Data Types Information Hiding

1 Abstract Data Types Information Hiding 1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content

More information

X86-64 Architecture Guide

X86-64 Architecture Guide X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int

More information

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages Understanding Computers Today and Tomorrow 12 th Edition Chapter 13: Program Development and Programming Languages Learning Objectives Understand the differences between structured programming, object-oriented

More information

Formal Verification and Linear-time Model Checking

Formal Verification and Linear-time Model Checking Formal Verification and Linear-time Model Checking Paul Jackson University of Edinburgh Automated Reasoning 21st and 24th October 2013 Why Automated Reasoning? Intellectually stimulating and challenging

More information

[Refer Slide Time: 05:10]

[Refer Slide Time: 05:10] Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

More information

Introduction to Formal Methods. Các Phương Pháp Hình Thức Cho Phát Triển Phần Mềm

Introduction to Formal Methods. Các Phương Pháp Hình Thức Cho Phát Triển Phần Mềm Introduction to Formal Methods Các Phương Pháp Hình Thức Cho Phát Triển Phần Mềm Outline Introduction Formal Specification Formal Verification Model Checking Theorem Proving Introduction Good papers to

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER Pierre A. von Kaenel Mathematics and Computer Science Department Skidmore College Saratoga Springs, NY 12866 (518) 580-5292 pvonk@skidmore.edu ABSTRACT This paper

More information

COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms.

COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms. COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms 1 Activation Records activation declaration location Recall that an activation

More information

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running

More information

Instruction Set Design

Instruction Set Design Instruction Set Design Instruction Set Architecture: to what purpose? ISA provides the level of abstraction between the software and the hardware One of the most important abstraction in CS It s narrow,

More information

A Static Analyzer for Large Safety-Critical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation

A Static Analyzer for Large Safety-Critical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation PLDI 03 A Static Analyzer for Large Safety-Critical Software B. Blanchet, P. Cousot, R. Cousot, J. Feret L. Mauborgne, A. Miné, D. Monniaux,. Rival CNRS École normale supérieure École polytechnique Paris

More information

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com CSCI-UA.0201-003 Computer Systems Organization Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified)

More information

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students Eastern Washington University Department of Computer Science Questionnaire for Prospective Masters in Computer Science Students I. Personal Information Name: Last First M.I. Mailing Address: Permanent

More information

Model Checking based Software Verification

Model Checking based Software Verification Model Checking based Software Verification 18.5-2006 Keijo Heljanko Keijo.Heljanko@tkk.fi Department of Computer Science and Engineering Helsinki University of Technology http://www.tcs.tkk.fi/~kepa/ 1/24

More information

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters Interpreters and virtual machines Michel Schinz 2007 03 23 Interpreters Interpreters Why interpreters? An interpreter is a program that executes another program, represented as some kind of data-structure.

More information

Lifting the Hood of the Computer: * Program Animation with the Teaching Machine

Lifting the Hood of the Computer: * Program Animation with the Teaching Machine Lifting the Hood of the Computer: * Program Animation with the Teaching Machine Michael P. Bruce-Lockhart and Theodore S. Norvell Electrical and Computer Engineering Faculty of Engineering and Applied

More information

Lumousoft Visual Programming Language and its IDE

Lumousoft Visual Programming Language and its IDE Lumousoft Visual Programming Language and its IDE Xianliang Lu Lumousoft Inc. Waterloo Ontario Canada Abstract - This paper presents a new high-level graphical programming language and its IDE (Integration

More information

Software Engineering Transfer Degree

Software Engineering Transfer Degree www.capspace.org (01/17/2015) Software Engineering Transfer Degree This program of study is designed for associate-degree students intending to transfer into baccalaureate programs awarding software engineering

More information

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages 15 th Edition Understanding Computers Today and Tomorrow Comprehensive Chapter 13: Program Development and Programming Languages Deborah Morley Charles S. Parker Copyright 2015 Cengage Learning Learning

More information

Introduction to Automated Testing

Introduction to Automated Testing Introduction to Automated Testing What is Software testing? Examination of a software unit, several integrated software units or an entire software package by running it. execution based on test cases

More information

CSC 272 - Software II: Principles of Programming Languages

CSC 272 - Software II: Principles of Programming Languages CSC 272 - Software II: Principles of Programming Languages Lecture 1 - An Introduction What is a Programming Language? A programming language is a notational system for describing computation in machine-readable

More information

The Course. http://www.cse.unsw.edu.au/~cs3153/

The Course. http://www.cse.unsw.edu.au/~cs3153/ The Course http://www.cse.unsw.edu.au/~cs3153/ Lecturers Dr Peter Höfner NICTA L5 building Prof Rob van Glabbeek NICTA L5 building Dr Ralf Huuck NICTA ATP building 2 Plan/Schedule (1) Where and When Tuesday,

More information

T-79.186 Reactive Systems: Introduction and Finite State Automata

T-79.186 Reactive Systems: Introduction and Finite State Automata T-79.186 Reactive Systems: Introduction and Finite State Automata Timo Latvala 14.1.2004 Reactive Systems: Introduction and Finite State Automata 1-1 Reactive Systems Reactive systems are a class of software

More information

InvGen: An Efficient Invariant Generator

InvGen: An Efficient Invariant Generator InvGen: An Efficient Invariant Generator Ashutosh Gupta and Andrey Rybalchenko Max Planck Institute for Software Systems (MPI-SWS) Abstract. In this paper we present InvGen, an automatic linear arithmetic

More information

Chapter 7D The Java Virtual Machine

Chapter 7D The Java Virtual Machine This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

More information

Lecture 9 verifying temporal logic

Lecture 9 verifying temporal logic Basics of advanced software systems Lecture 9 verifying temporal logic formulae with SPIN 21/01/2013 1 Outline for today 1. Introduction: motivations for formal methods, use in industry 2. Developing models

More information

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists Lecture 11 Doubly Linked Lists & Array of Linked Lists In this lecture Doubly linked lists Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for a Sparse

More information

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students Eastern Washington University Department of Computer Science Questionnaire for Prospective Masters in Computer Science Students I. Personal Information Name: Last First M.I. Mailing Address: Permanent

More information

Sample Induction Proofs

Sample Induction Proofs Math 3 Worksheet: Induction Proofs III, Sample Proofs A.J. Hildebrand Sample Induction Proofs Below are model solutions to some of the practice problems on the induction worksheets. The solutions given

More information

1 The Java Virtual Machine

1 The Java Virtual Machine 1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This

More information

Reading 13 : Finite State Automata and Regular Expressions

Reading 13 : Finite State Automata and Regular Expressions CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

More information

Regression Verification: Status Report

Regression Verification: Status Report Regression Verification: Status Report Presentation by Dennis Felsing within the Projektgruppe Formale Methoden der Softwareentwicklung 2013-12-11 1/22 Introduction How to prevent regressions in software

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

Answer Key for California State Standards: Algebra I

Answer Key for California State Standards: Algebra I Algebra I: Symbolic reasoning and calculations with symbols are central in algebra. Through the study of algebra, a student develops an understanding of the symbolic language of mathematics and the sciences.

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods Model Checking with Temporal Logic Wolfgang Ahrendt 24th September 2013 SEFM: Model Checking with Temporal Logic /GU 130924 1 / 33 Model Checking with Spin model

More information

AC 2007-2027: A PROCESSOR DESIGN PROJECT FOR A FIRST COURSE IN COMPUTER ORGANIZATION

AC 2007-2027: A PROCESSOR DESIGN PROJECT FOR A FIRST COURSE IN COMPUTER ORGANIZATION AC 2007-2027: A PROCESSOR DESIGN PROJECT FOR A FIRST COURSE IN COMPUTER ORGANIZATION Michael Black, American University Manoj Franklin, University of Maryland-College Park American Society for Engineering

More information

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() CS61: Systems Programming and Machine Organization Harvard University, Fall 2009 Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() Prof. Matt Welsh October 6, 2009 Topics for today Dynamic

More information

Software testing. Objectives

Software testing. Objectives Software testing cmsc435-1 Objectives To discuss the distinctions between validation testing and defect testing To describe the principles of system and component testing To describe strategies for generating

More information

The Model Checker SPIN

The Model Checker SPIN The Model Checker SPIN Author: Gerard J. Holzmann Presented By: Maulik Patel Outline Introduction Structure Foundation Algorithms Memory management Example/Demo SPIN-Introduction Introduction SPIN (Simple(

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

Probability Using Dice

Probability Using Dice Using Dice One Page Overview By Robert B. Brown, The Ohio State University Topics: Levels:, Statistics Grades 5 8 Problem: What are the probabilities of rolling various sums with two dice? How can you

More information

Course 395: Machine Learning

Course 395: Machine Learning Course 395: Machine Learning Lecturers: Maja Pantic (maja@doc.ic.ac.uk) Stavros Petridis (sp104@doc.ic.ac.uk) Goal (Lectures): To present basic theoretical concepts and key algorithms that form the core

More information

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8 Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8 January 22, 2013 Name: Grade /10 Introduction: In this lab you will write, test, and execute a number of simple PDP-8

More information

8 Divisibility and prime numbers

8 Divisibility and prime numbers 8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

More information

Lecture Notes on Linear Search

Lecture Notes on Linear Search Lecture Notes on Linear Search 15-122: Principles of Imperative Computation Frank Pfenning Lecture 5 January 29, 2013 1 Introduction One of the fundamental and recurring problems in computer science is

More information

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam. Compilers Spring term Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.es Lecture 1 to Compilers 1 Topic 1: What is a Compiler? 3 What is a Compiler? A compiler is a computer

More information

CIS570 Modern Programming Language Implementation. Office hours: TDB 605 Levine eclewis@cis.upenn.edu. cherylh@central.cis.upenn.

CIS570 Modern Programming Language Implementation. Office hours: TDB 605 Levine eclewis@cis.upenn.edu. cherylh@central.cis.upenn. CIS570 Modern Programming Language Implementation Instructor: Admin. Assistant: URL: E Christopher Lewis Office hours: TDB 605 Levine eclewis@cis.upenn.edu Cheryl Hickey cherylh@central.cis.upenn.edu 502

More information

Chapter 5 Instructor's Manual

Chapter 5 Instructor's Manual The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction

More information

AGENTS AND SOFTWARE ENGINEERING

AGENTS AND SOFTWARE ENGINEERING AGENTS AND SOFTWARE ENGINEERING Michael Wooldridge Queen Mary and Westfield College, University of London London E1 4NS, United Kingdom M.J.Wooldridge@qmw.ac.uk Abstract Software engineers continually

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper

More information

Formal verification of a C-like memory model and its uses for verifying program transformations

Formal verification of a C-like memory model and its uses for verifying program transformations Journal of Automated Reasoning manuscript No. (will be inserted by the editor) Formal verification of a C-like memory model and its uses for verifying program transformations Xavier Leroy Sandrine Blazy

More information

VHDL Test Bench Tutorial

VHDL Test Bench Tutorial University of Pennsylvania Department of Electrical and Systems Engineering ESE171 - Digital Design Laboratory VHDL Test Bench Tutorial Purpose The goal of this tutorial is to demonstrate how to automate

More information

Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm

Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm University of Calgary Department of Electrical and Computer Engineering ENCM 369: Computer Organization Instructors: Dr. S. A. Norman (L01) and Dr. S. Yanushkevich (L02) Winter 2002 MID-SESSION TEST Friday,

More information

Platform-independent static binary code analysis using a metaassembly

Platform-independent static binary code analysis using a metaassembly Platform-independent static binary code analysis using a metaassembly language Thomas Dullien, Sebastian Porst zynamics GmbH CanSecWest 2009 Overview The REIL Language Abstract Interpretation MonoREIL

More information

15-150 Lecture 11: Tail Recursion; Continuations

15-150 Lecture 11: Tail Recursion; Continuations 15-150 Lecture 11: Tail Recursion; Continuations Lecture by Dan Licata February 21, 2011 In this lecture we will discuss space usage: analyzing the memory it takes your program to run tail calls and tail

More information

A Memory Model for Static Analysis of C Programs

A Memory Model for Static Analysis of C Programs A Memory Model for Static Analysis of C Programs Zhongxing Xu 1, Ted Kremenek 2, and Jian Zhang 1 1 State Key Laboratory of Computer Science Institute of Software Chinese Academy of Sciences xzx@ios.ac.cn

More information

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis 1 1 Table of Contents 1 Table of Contents... 3 2 Overview... 5 3 Installation... 7 4 The CPU

More information

CS 3719 (Theory of Computation and Algorithms) Lecture 4

CS 3719 (Theory of Computation and Algorithms) Lecture 4 CS 3719 (Theory of Computation and Algorithms) Lecture 4 Antonina Kolokolova January 18, 2012 1 Undecidable languages 1.1 Church-Turing thesis Let s recap how it all started. In 1990, Hilbert stated a

More information

Comprehensive Static Analysis Using Polyspace Products. A Solution to Today s Embedded Software Verification Challenges WHITE PAPER

Comprehensive Static Analysis Using Polyspace Products. A Solution to Today s Embedded Software Verification Challenges WHITE PAPER Comprehensive Static Analysis Using Polyspace Products A Solution to Today s Embedded Software Verification Challenges WHITE PAPER Introduction Verification of embedded software is a difficult task, made

More information

Basic Components of an LP:

Basic Components of an LP: 1 Linear Programming Optimization is an important and fascinating area of management science and operations research. It helps to do less work, but gain more. Linear programming (LP) is a central topic

More information

Software Testing & Analysis (F22ST3): Static Analysis Techniques 2. Andrew Ireland

Software Testing & Analysis (F22ST3): Static Analysis Techniques 2. Andrew Ireland Software Testing & Analysis (F22ST3) Static Analysis Techniques Andrew Ireland School of Mathematical and Computer Science Heriot-Watt University Edinburgh Software Testing & Analysis (F22ST3): Static

More information

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go Debugging ESE112 Java Programming: API, Psuedo-Code, Scope It is highly unlikely that you will write code that will work on the first go Bugs or errors Syntax Fixable if you learn to read compiler error

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

More information

Advances in Programming Languages

Advances in Programming Languages Advances in Programming Languages Lecture 13: Certifying Correctness Ian Stark School of Informatics The University of Edinburgh Tuesday 4 November 2014 Semester 1 Week 8 http://www.inf.ed.ac.uk/teaching/courses/apl

More information

Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem.

Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem. Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem. Solve word problems that call for addition of three whole numbers

More information

MPI-Checker Static Analysis for MPI

MPI-Checker Static Analysis for MPI MPI-Checker Static Analysis for MPI Alexander Droste, Michael Kuhn, Thomas Ludwig November 15, 2015 Motivation 2 / 39 Why is runtime analysis in HPC challenging? Large amount of resources are used State

More information

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Kim S. Larsen Odense University Abstract For many years, regular expressions with back referencing have been used in a variety

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence ICS461 Fall 2010 1 Lecture #12B More Representations Outline Logics Rules Frames Nancy E. Reed nreed@hawaii.edu 2 Representation Agents deal with knowledge (data) Facts (believe

More information

Structure of Presentation. Stages in Teaching Formal Methods. Motivation (1) Motivation (2) The Scope of Formal Methods (1)

Structure of Presentation. Stages in Teaching Formal Methods. Motivation (1) Motivation (2) The Scope of Formal Methods (1) Stages in Teaching Formal Methods A. J. Cowling Structure of Presentation Introduction to Issues Motivation for this work. Analysis of the Role of Formal Methods Define their scope; Review their treatment

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Introduction to SPIN. Acknowledgments. Parts of the slides are based on an earlier lecture by Radu Iosif, Verimag. Ralf Huuck. Features PROMELA/SPIN

Introduction to SPIN. Acknowledgments. Parts of the slides are based on an earlier lecture by Radu Iosif, Verimag. Ralf Huuck. Features PROMELA/SPIN Acknowledgments Introduction to SPIN Parts of the slides are based on an earlier lecture by Radu Iosif, Verimag. Ralf Huuck Ralf Huuck COMP 4152 1 Ralf Huuck COMP 4152 2 PROMELA/SPIN PROMELA (PROcess MEta

More information

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

More information

Mathematical Induction

Mathematical Induction Mathematical Induction (Handout March 8, 01) The Principle of Mathematical Induction provides a means to prove infinitely many statements all at once The principle is logical rather than strictly mathematical,

More information

Introducing Formal Methods. Software Engineering and Formal Methods

Introducing Formal Methods. Software Engineering and Formal Methods Introducing Formal Methods Formal Methods for Software Specification and Analysis: An Overview 1 Software Engineering and Formal Methods Every Software engineering methodology is based on a recommended

More information

Adversary Modelling 1

Adversary Modelling 1 Adversary Modelling 1 Evaluating the Feasibility of a Symbolic Adversary Model on Smart Transport Ticketing Systems Authors Arthur Sheung Chi Chan, MSc (Royal Holloway, 2014) Keith Mayes, ISG, Royal Holloway

More information

Verifying security protocols using theorem provers

Verifying security protocols using theorem provers 1562 2007 79-86 79 Verifying security protocols using theorem provers Miki Tanaka National Institute of Information and Communications Technology Koganei, Tokyo 184-8795, Japan Email: miki.tanaka@nict.go.jp

More information

Chapter 1: Key Concepts of Programming and Software Engineering

Chapter 1: Key Concepts of Programming and Software Engineering Chapter 1: Key Concepts of Programming and Software Engineering Software Engineering Coding without a solution design increases debugging time - known fact! A team of programmers for a large software development

More information

Regular Languages and Finite Automata

Regular Languages and Finite Automata Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

More information

Instruction Set Architecture (ISA) Design. Classification Categories

Instruction Set Architecture (ISA) Design. Classification Categories Instruction Set Architecture (ISA) Design Overview» Classify Instruction set architectures» Look at how applications use ISAs» Examine a modern RISC ISA (DLX)» Measurement of ISA usage in real computers

More information

Computer Organization and Architecture

Computer Organization and Architecture Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal

More information

Instruction Set Architecture (ISA)

Instruction Set Architecture (ISA) Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine

More information

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu.

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu. Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu.tw Review Computers in mid 50 s Hardware was expensive

More information

Know or Go Practical Quest for Reliable Software

Know or Go Practical Quest for Reliable Software Know or Go Practical Quest for Reliable Software Dr.-Ing. Jörg Barrho Dr.-Ing. Ulrich Wünsche AVACS Project meeting 25.09.2014 2014 Rolls-Royce Power Systems AG The information in this document is the

More information