Program Analysis and Verification
|
|
- Jean McKinney
- 5 years ago
- Views:
Transcription
1 Program Analysis and Verification Noam Rinetzky Lecture 4: Axiomatic Semantics Slides credit: Tom Ball, Dawson Engler, Roman Manevich, Erik Poll, Mooly Sagiv, Jean Souyris, Eran Tromer, Avishai Wool, Eran Yahav
2 Natural semantics for While [ass ns ] [skip ns ] x := a, s s[x A a s] skip, s s [comp ns ] S 1, s s, S 2, s s S 1 ; S 2, s s [if tt ns] S 1, s s if b then S 1 else S 2, s s if B b s = tt [if ff ns] S 2, s s if b then S 1 else S 2, s s if B b s = ff 2
3 Natural semantics for While [while ff ns] while b do S, s s if B b s = ff [while tt ns] S, s s, while b do S, s s while b do S, s s if B b s = tt 3
4 Axiomatic semantics for While [ass p ] [skip p ] { P[a/x] } x := a { P } { P } skip { P } [comp p ] { P } S 1 { Q }, { Q } S 2 { R } { P } S 1 ; S 2 { R } [if p ] { b P } S 1 { Q }, { b P } S 2 { Q } { P } if b then S 1 else S 2 { Q } [while p ] { b P } S { P } { P } while b do S { b P } [cons p ] { P } S { Q } { P } S { Q } if P P and Q Q 4
5 Assertions, a.k.a Hoare triples { P } C { Q } precondition statement a.k.a command postcondition P and Q are state predicates Example: x>0 If P holds in the initial state, and if execution of C terminates on that state, then Q will hold in the state in which C halts C is not required to always terminate {true} while true do skip {false} 5
6 Valid assertions We say that { P } C { Q } is valid if for all states s, if s P and C, s s then s Q Denoted by p { P } C { Q } Q P s C C(P) s 6
7 Assignment rule [ass p ] { P[a/x] } x := a { P } A backwards rule x := a always finishes Why is this true? Recall operational semantics: s[x A a s] P [ass ns ] x := a, s s[x A a s] Example: {y*z<9} x:=y*z {x<9} What about {y*z<9 w=5} x:=y*z {w=5}? 7
8 Assignment rule [ass p ] { P} x := a { v.p[v/x] x=a[v/x] } A forward rule x := a always finishes Why is this true? s P s[v sx] P[v/x] 8
9 skip rule [skip p ] { P } skip { P } [skip ns ] skip, s s 9
10 Composition rule [comp p ] { P } S 1 { Q }, { Q } S 2 { R } { P } S 1 ; S 2 { R } [comp ns ] S 1, s s, S 2, s s S 1 ; S 2, s s Holds when S 1 terminates in every state where P holds and then Q holds and S 2 terminates in every state where Q holds and then R holds 10
11 Condition rule [if p ] { b P } S 1 { Q }, { b P } S 2 { Q } { P } if b then S 1 else S 2 { Q } [if tt ns] [if ff ns] S 1, s s if b then S 1 else S 2, s s S 2, s s if b then S 1 else S 2, s s if B b s = tt if B b s = ff 11
12 Loop rule [while p ] { b P } S { P } { P } while b do S { b P } [while ff ns] [while tt ns] while b do S, s s S, s s, while b do S, s s while b do S, s s if B b s = ff if B b s = tt Here P is called an invariant for the loop Holds before and after each loop iteration Finding loop invariants most challenging part of proofs When loop finishes, b is false 12
13 Rule of consequence [cons p ] { P } S { Q } { P } S { Q } if P P and Q Q Allows strengthening the precondition and weakening the postcondition The only rule that is not sensitive to the form of the statement 13
14 Rule of consequence [cons p ] { P } S { Q } { P } S { Q } if P P and Q Q Why do we need it? Allows the following {y*z<9} x:=y*z {x<9} {y*z<9 w=5} x:=y*z {x<10} 14
15 Axiomatic semantics for While Axiom for every primitive statement [ass p ] { P[a/x] } x := a { P } [skip p ] { P } skip { P } [comp p ] { P } S 1 { Q }, { Q } S 2 { R } { P } S 1 ; S 2 { R } Inference rule for every composed statement [if p ] [while p ] { b P } S 1 { Q }, { b P } S 2 { Q } { P } if b then S 1 else S 2 { Q } { b P } S { P } { P } while b do S { b P } [cons p ] { P } S { Q } { P } S { Q } if P P and Q Q 15
16 Properties of the semantics Equivalence What is the analog of program equivalence in axiomatic verification? Soundness Can we prove incorrect properties? Completeness Is there something we can t prove? 16
17 Valid assertions We say that { P } C { Q } is valid if for all states s, if s P and C, s s then s Q Denoted by p { P } C { Q } Q P s C C(P) s 17
18 Soundness and completeness The inference system is sound: p { P } C { Q } implies p { P } C { Q } The inference system is complete: p { P } C { Q } implies p { P } C { Q } 18
19 Soundness: Hoare logic is sound and (relatively) complete p { P } C { Q } implies p { P } C { Q } (Relative) completeness: p { P } C { Q } implies p { P } C { Q } Provided we can prove any implication R R 19
20 Soundness: Hoare logic is sound and (relatively) complete p { P } C { Q } implies p { P } C { Q } (Relative) completeness: p { P } C { Q } implies p { P } C { Q } Provided we can prove any implication R R FYI, nobody tells us how to find a proof 20
21 Is there an Algorithm? { x=n } y := 1; { x>0 y*x!=n! n x } while (x=1) do { x-1>0 (y*x)*(x-1)!=n! n (x-1) } y := y*x; { x-1>0 y*(x-1)!=n! n (x-1) } x := x 1 { y*x!=n! n>0 } Annotated programs provides a compact representation of inference trees 21
22 ? 22
23 Predicate Transformers 23
24 Weakest liberal precondition A backward-going predicate transformer The weakest liberal precondition for Q is s wlp(c, Q) if and only if for all states s if C, s s then s Q Propositions: 1. p { wlp(c, Q) } C { Q } 2. If p { P } C { Q } then P wlp(c, Q) 24
25 Strongest postcondition A forward-going predicate transformer The strongest postcondition for P is s sp(p, C) if and only if there exists s such that if C, s s and s P 1. p { P } C { sp(p, C) } 2. If p { P } C { Q } then sp(p, C) Q 25
26 Predicate transformer semantics wlp and sp can be seen functions that transform predicates to other predicates wlp C : Predicate Predicate { P } C { Q } if and only if wlp C Q = P sp C : Predicate Predicate { P } C { Q } if and only if sp C P = Q 26
27 Hoare logic is (relatively) complete Proving p { P } C { Q } implies p { P } C { Q } is the same as proving p { wlp(c, Q) } C { Q } Suppose that p { P } C { Q } then (from proposition 2) P { wlp(c, Q) } [cons p ] { P } S { Q } { wlp(c, Q) } S { Q } 27
28 Calculating wlp 1. wlp(skip, Q) = Q 2. wlp(x := a, Q) = Q[a/x] 3. wlp(s 1 ; S 2, Q) = wlp(s 1, wlp(s 2, Q)) 4. wlp(if b then S 1 else S 2, Q) = (b wlp(s 1, Q)) ( b wlp(s 2, Q)) 5. wlp(while b do S, Q) =? hard to capture 28
29 Calculating wlp of a loop Idea: we know the following statements are semantically equivalent while b do S if b do (S; while b do S) else skip Let s try to substitute and calculate on wlp(while b do S, Q) = wlp(if b do (S; while b do S) else skip, Q) = (b wlp(s; while b do S, Q)) ( b wlp(skip, Q)) = (b wlp(s, wlp(while b do S, Q))) ( b Q) LoopInv = (b wlp(s, LoopInv)) ( b Q) We have a recurrence The loop invariant 29
30 Prove the following triple { timer 0 } while (timer > 0) do timer := timer 1 { timer = 0 } LoopInv = (b wlp(s, LoopInv)) ( b Q) Let s substitute LoopInv with timer 0 Show that timer 0 is equal to (timer>0 wlp(timer:=timer-1, timer 0)) (timer 0 timer=0) = (timer>0 (timer 0)[timer-1/timer]) (timer 0 timer=0) = (timer>0 timer-1 0) (timer 0 timer=0) = timer>0 timer=0 = timer 0 30
31 Issues with wlp-based proofs Requires backwards reasoning not very intuitive Backward reasoning is non-deterministic causes problems when While is extended with dynamically allocated heaps (aliasing) Also, a few more rules will be helpful 31
32 Conjunction rule [conj p ] { P } S { Q } { P } S { Q } { P P } S {Q Q } Not necessary (for completeness) but practically useful Starting point of extending Hoare logic to handle parallelism Related to Cartesian abstraction Will point this out when we learn it 32
33 Structural Rules [disj p ] { P } C { Q } { P } C { Q } { P P } C {Q Q } [exist p ] [univ p ] { P } C { Q } { v. P } C { v. Q } { P } C { Q } { v. P } C { v. Q } v FV(C) v FV(C) [Inv p ] { F } C { F } Mod(C) FV(F)={} Mod(C) = set of variables assigned to in sub-statements of C FV(F) = free variables of F 33
34 Invariance + Conjunction = Constancy [constancy p ] { P } C { Q } { F P } C { F Q } Mod(C) FV(F)={} Mod(C) = set of variables assigned to in sub-statements of C FV(F) = free variables of F 34
35 Floyd s strongest postcondition rule [ass Floyd ] { P } x := a { v. x=a[v/x] P[v/x] } where v is a fresh variable Example { z=x } x:=x+1 {? v. x=v+1 z=v } This rule is often considered problematic because it introduces a quantifier needs to be eliminated further on We will now see a variant of this rule 35
36 Small assignment axiom Create an explicit Skolem variable in precondition Then assign the resulting value to x First evaluate a in the precondition state (as a may access x) [ass floyd ] { x=v } x:=a { x=a[v/x] } where v FV(a) Examples: {x=n} x:=5*y {x=5*y} {x=n} x:=x+1 {x=n+1} {x=y} x:=y+1 {x=y+1} {x=n} x:=y+1 {x=y+1} [exist p ] { n. x=n} x:=y+1 { n. x=y+1} therefore {true} x:=y+1 {x=y+1} [constancy p ] {z=9} x:=y+1 {z=9 x=y+1} 36
37 Small assignment axiom [ass { x=v } x:=a { x=a[v/x] } floyd ] Examples: {x=n} x:=5*y {x=5*y} {x=n} x:=x+1 {x=n+1} where v FV(a) {x=n} x:=y+1 {x=y+1} [exist p ] { n. x=n} x:=y+1 { n. x=y+1} therefore {true} x:=y+1 {x=y+1} [constancy p ] {z=9} x:=y+1 {z=9 x=y+1} 43
38 Small assignment axiom [ass { x=v } x:=a { x=a[v/x] } floyd ] Examples: {x=n} x:=5*y {x=5*y} {x=n} x:=x+1 {x=n+1} where v FV(a) {x=n} x:=y+1 {x=y+1} [exist p ] { n. x=n} x:=y+1 { n. x=y+1} therefore {true} x:=y+1 {x=y+1} [constancy p ] {z=9} x:=y+1 {z=9 x=y+1} 44
39 Example 1: Absolute value program { } if x<0 then x := -x else skip { } 48
40 Absolute value program { x=v } if x<0 then { x=v x<0 } x := -x { x=-v x>0 } else { x=v x 0 } skip { x=v x 0 } { v<0 x=-v v 0 x=v} { x= v } 49
41 Example 2: Variable swap program { } t := x x := y y := t { } 50
42 Variable swap program { x=a y=b } t := x { x=a y=b t=a } x := y { x=b y=b t=a } y := t { x=b y=a t=a } { x=b y=a } // cons 51
43 Example 3: Axiomatizing data types S ::= x := a x := y[a] y[a] := x skip S 1 ; S 2 if b then S 1 else S 2 while b do S We added a new type of variables array variables Model array variable as a function y : Z Z We need the two following axioms: { y[x a](x) = a } { z x y[x a](z) = y(z) } 52
44 Array update rules (wp) S ::= x := a x := y[a] y[a] := x skip S 1 ; S 2 if b then S 1 else S 2 A very general approach allows handling many data types while b do S Treat an array assignment y[a] := x as an update to the array function y y := y[a x] meaning y = v. v=a? X : y(v) [array-update] { P[y[a x]/y] } y[a] := x { P } [array-load] { P[y(a)/x] } x := y[a] { P } 53
45 Array update rules (wp) example Treat an array assignment y[a] := x as an update to the array function y y := y[a x] meaning y = v. v=a? x : y(v) [array-update] { P[y[a x]/y] } y[a] := x { P } {x=y[i 7](i)} y[i]:=7 {x=y(i)} {x=7} y[i]:=7 {x=y(i)} [array-load] { P[y(a)/x] } x := y[a] { P } {y(a)=7} x:=y[a] {x=7} 54
46 Array update rules (sp) In both rules v, g, and b are fresh [array-update F ] { x=v y=g a=b } y[a] := x { y=g[b v] } [array-load F ] { y=g a=b } x := y[a] { x=g(b) } 55
47 Array-max program nums : array N : int // N stands for num s length { N 0 nums=orig_nums } x := 0 res := nums[0] while x < N if nums[x] > res then res := nums[x] x := x { x=n } 2. { m. (m 0 m<n) nums(m) res } 3. { m. m 0 m<n nums(m)=res } 4. { nums=orig_nums } 56
48 Array-max program nums : array N : int // N stands for num s length { N 0 nums=orig_nums } x := 0 res := nums[0] while x < N if nums[x] > res then res := nums[x] x := x + 1 Post 1 : { x=n } Post 2 : { nums=orig_nums } Post 3 : { m. 0 m<n nums(m) res } Post 4 : { m. 0 m<n nums(m)=res } 57
49 Summary C programming language P assertions {P} C {Q} judgments { P[a/x] } x := a { P } proof Rules Soundness Completeness {x = N} y:=factorial(x){ y = N!} proofs 58
50 Extensions to axiomatic semantics Procedures Total correctness assertions Assertions for execution time Exact time Order of magnitude time Assertions for dynamic memory Separation Logic Assertions for parallelism Owicki-Gries Concurrent Separation Logic Rely-guarantee 59
51 Concurrency Operational Semantics
52 While + Concurrency Abstract syntax: a ::= n x a 1 + a 2 a 1 a 2 a 1 a 2 b ::= true false a 1 = a 2 a 1 a 2 b b 1 b 2 S ::= x := a skip S 1 ; S 2 if b then S 1 else S 2 while b do S cobegin S 1 S n coend 69
53 While + Concurrency cobegin S 1 S n coend All the interleaving of S 1 S n are executed Example: cobegin x:=1 (x:=2; x:=x+2) Possible outcomes for x: 1, 3, 4 70
54 While + parallelism: structural semantics [par 1 sos] S 1, s S 1, s S 1 S 2, s S 1 S 2, s [par 2 sos] S 1, s s S 1 S 2, s S 2, s [par 3 sos] S 2, s S 2, s S 1 S 2, s S 1 S 2, s [par 4 sos] S 2, s s S 1 S 2, s S 1, s 71
55 Example: derivation sequences of a parallel statement x:=1 (x:=2; x:=x+2), s 72
56 Concurrency Axiomatic Semantics
57 Axiomatic semantics for While Axiom for every primitive statement [ass p ] { P[a/x] } x := a { P } [skip p ] { P } skip { P } [comp p ] { P } S 1 { Q }, { Q } S 2 { R } { P } S 1 ; S 2 { R } Inference rule for every composed statement [if p ] [while p ] { b P } S 1 { Q }, { b P } S 2 { Q } { P } if b then S 1 else S 2 { Q } { b P } S { P } { P } while b do S { b P } [cons p ] { P } S { Q } { P } S { Q } if P P and Q Q 75
58 Proofs { P 1 } S 1 { Q 2 } { P 2 } S 2 { Q 2 } {P 1 Λ P 1 } S 1 S 2 { Q 2 Λ Q 2 } Challenge: Interference 76
59 Axiomatic Semantics (Hoare Logic) Disjoint parallelism Global invariant Owicky Gries [PhD. 76] { P } S 1 S 2 { Q } Rely/Guarantee [Jones. ] 77
60 Disjoint Parallelism { P 1 } S 1 { Q 2 } { P 2 } S 2 { Q 2 } {P 1 Λ P 1 } S 1 S 2 { Q 2 Λ Q 2 } FV(P 1,S 1,Q 1 ) FV(P 2,S 2,Q 2 ) = 78
61 Global Invariant I { P 1 } S 1 { Q 2 } I { P 2 } S 2 { Q 2 } I {P 1 Λ P 1 } S 1 S 2 { Q 2 Λ Q 2 } FV(P 1,S 1,Q 1 ) FV(P 2,S 2,Q 2 ) = FV(I) FV(P 1,Q 1 ) FV(P 2,Q 2 ) = FV(P i,q i ) FV(I) = i=1,2 79
62 Meaning of (atomic) Commands A relation between pre-states and post-states c c 0 c 1 c k S 0, s 0 S 1, s 1 s k+1 80
63 Meaning of (atomic) Commands A relation between pre-states and post-states c c 0 c 1 c k S 0, s 0 S 1, s 1 s k+1 81
64 Meaning of (atomic) Commands A relation between pre-states and post-states c 0 c 1 c k c k+1 c k+2 c k+3 c k+3 c n S 0, s 0 s 1 s k+1 s k+2 s k+3 s k+3 s k+4 s n+1 82
65 Intuition: Global Invariant Every (intermediate) state satisfies invariant I c 0 c 1 c k c k+1 c k+2 c k+3 c k+3 c n S 0, s 0 s 1 s k+1 s k+2 s k+3 s k+3 s k+4 s n+1 I= 83
66 Intuition: Global Invariant Thread-view c 0 c 1 c k c k+1 c k+2 c k+3 c k+3 c n S 0, s 0 s 1 s k+1 s k+2 s k+3 s k+3 s k+4 s n+1 I= 84
67 Global Invariant I { P } S 1 { R } I { R } S 2 { Q } I { P } S 1 ; S 2 { Q } I { P 1 } S 1 { Q 2 } I { P 2 } S 2 { Q 2 } I {P 1 Λ P 1 } S 1 S 2 { Q 2 Λ Q 2 } 85
68 Global Invariant I { P } S 1 { R } I { R } S 2 { Q } I { P } S 1 ; S 2 { Q } { P Λ I } S { Q Λ I } I { P } S { Q } I { P 1 } S 1 { Q 2 } I { P 2 } S 2 { Q 2 } I {P 1 Λ P 1 } S 1 S 2 { Q 2 Λ Q 2 } FV(P 1,S 1,Q 1 ) FV(P 2,S 2,Q 2 ) = FV(I) FV(P 1,Q 1 ) FV(P 2,Q 2 ) = FV(P i,q i ) FV(I) = i=1,2 86
69 Owicki-Gries Reasoning Susan Owicki David Gries 87
70 Owicky-Gries: Interference in Proofs A command C with a precondition pre(c) does not interfere with the proof of {P} S {Q} if: {Q pre(c) } C {Q} For any S S: {pre(s ) pre(c) } C {pre(s )} {P 1 } C 1 {Q 1 }... {P k } C k {Q k } are interference free if i j and x:=a C i, x:=a does not interfere with {P j } C j {Q j } 88
71 Parallel Composition Rule I { P 1 } S 1 { Q 2 } I { P 2 } S 2 { Q 2 } I {P 1 Λ P 1 } S 1 S 2 { Q 2 Λ Q 2 } {P 1 } C 1 {Q 1 }... {P k } C k {Q k } are interference free 89
72 90
73 91
74 92
75 93
76 94
77 95
78 96
79 97
80 98
81 99
82 10
83 101
84 102
85 103
86 104
87 105
88 Owicky-Gries: Limiations Checking interference can be hard Non-compositionality Until you finished the local proofs cannot check interference Proofs need to be saved Hard to handle libraries and missing code A non-standard meaning of Hoare triples Depends on the interference of other threads with the proof Soundness is non-trivial Completeness depends on auxiliary variables 106
89 Rely/Guarantee Reasoning Cliff Jones 107
90 Rely / Guarantee Aka assume Guarantee Cliff Jones Main idea: Modular capture of interference Compositional proofs 108
91 Commands as relations It is convenient to view the meaning of commands as relations between pre-states and post-states In {P} C {Q} P is a one state predicate Q is a two-state predicate Recall auxiliary variables Example {true} x := x + 1 {x= x + 1} 109
92 Intuition: Rely Guarantee Thread-view c 0 c 1 c k c k+1 c k+2 c k+3 c k+3 c n S 0, s 0 s 1 s k+1 s k+2 s k+3 s k+3 s k+4 s n+1 110
93 Intuition: Rely Guarantee Thread-view c 0 c 1 c k c k+1 c k+2 c k+3 c k+3 c n S 0, s 0 s 1 s k+1 s k+2 s k+3 s k+3 s k+4 s n+1 G RRRR G G R G RRRR 111
94 Intuition: Rely Guarantee Thread-view c 0 c 1 c k c k+1 c k+2 c k+3 c k+3 c n S 0, s 0 s 1 s k+1 s k+2 s k+3 s k+3 s k+4 s n+1 G R * G G R * G R * 112
95 Relational Post-Conditions meaning of commands a relations between pre-states and post-states Option I: {P} C {Q} P is a one state predicate Q is a two-state predicate Example {true} x := x + 1 {x= x + 1} 113
96 Relational Post-Conditions meaning of commands a relations between pre-states and post-states Option II: {P} C {Q} P is a one state predicate P is a one-state predicate Use logical variables to record pre-state Example {x = X} x := x + 1 {x= X + 1} 114
97 Intuition (again) Hoare: { P } S { Q } ~ {P} {Q} R/G: R,G { P } S { Q } ~ {P} {Q} C C R G R R G G G 115
98 Goal: Parallel Composition R G 2, G 1 { P } S 1 S 2 { Q } R G 1, G 2 { P } S 1 S 2 { Q } (PAR) R, G 1 G 2 { P } S 1 S 2 { Q } 116
99 Relational Post-Conditions meaning of commands a relations between pre-states and post-states Option I: {P} C {Q} P is a one state predicate Q is a two-state predicate Example {true} x := x + 1 {x= x + 1} 117
100 From one- to two-state relations p(, ) =p( ) p(, ) =p( ) A single state predicate p is preserved by a two-state relation R if p R p, : p( ) R(, ) p( ) 118
101 Operations on Relations (P;Q)(, )= :P(, ) Q(, ) ID(, )= ( = ) R * =ID R (R;R) (R;R;R) 119
102 Formulas ID(x) = (x = x) ID(p) =(p p) Preserve (p)= p p 120
103 Informal Semantics c (p, R, G, Q) For every state such that p: Every execution of c on state with (potential) interventions which satisfy R results in a state such that (, ) Q The execution of every atomic sub-command of c on any possible intermediate state satisfies G 121
104 Informal Semantics c (p, R, G, Q) For every state such that p: Every execution of c on state with (potential) interventions which satisfy R results in a state such that (, ) Q The execution of every atomic sub-command of c on any possible intermediate state satisfies G c [p, R, G, Q] For every state such that p: Every execution of c on state with (potential) interventions which satisfy R must terminate in a state such that (, ) Q The execution of every atomic sub-command of c on any possible intermediate state satisfies G 122
105 A Formal Semantics Let C R denotes the set of quadruples < 1, 2, 3, 4 > s.t. that when c executes on 1 with potential interferences by R it yields an intermediate state 2 followed by an intermediate state 3 and a final state 4 as usual 4 = when c does not terminate C R = {< 1, 2, 3, 4 > : : < 1, > R ( <C, > * 2 2 = 3 = 4, C : <C, > * <C, > ( ( 2 = 1 2 = ) ( 3 = 3 = ) 4 = ) <, 2, 3, 4 > C R ) c (p, R, G, Q) For every < 1, 2, 3, 4 > C R such that 1 p < 2, 3 > G If 4 : < 1, 4 > Q 123
106 Simple Examples X := X + 1 (true, X=X, X =X+1 X=X, X =X+1) X := X + 1 (X 0, X X, X>0 X=X, X>0) X := X + 1 ; Y := Y + 1 (X 0 Y 0, X X Y Y, G, X>0 Y>0) 124
107 Inference Rules Define c (p, R, G, Q) by structural induction on c Soundness If c (p, R, G, Q) then c (p, R, G, Q) 125
108 Atomic Command {p} c {Q} (Atomic) atomic {c} (p, preserve(p), Q ID, Q) 126
109 Conditional Critical Section {p b} c {Q} (Critical) await b then c (p, preserve(p), Q ID, Q) 127
110 Sequential Composition c 1 (p 1, R, G, Q 1 ) c 2 (p 2, R, G, Q 2 ) Q 1 p 2 (SEQ) c 1 ; c 2 (p 1, R, G, (Q 1 ; R * ; Q 2 )) 128
111 Conditionals c 1 (p b 1, R, G, Q) p b R * b 1 c 2 (p b 2, R, G, Q) p b R* b 2 (IF) if atomic {b} then c 1 else c 2 (p, R, G, Q) 129
112 Loops c (j b 1, R, G, j) j b R * b 1 R Preserve(j) (WHILE) while atomic {b} do c (j, R, G, b j) 130
113 Refinement c (p, R, G, Q) p p Q Q R R G G (REFINE) c (p, R, G, Q ) 131
114 Parallel Composition c 1 (p 1, R 1, G 1, Q 1 ) c 2 (p 2, R 2, G 2, Q 2 ) G 1 R 2 G 2 R 1 (PAR) c 1 c 2 (p 1 p 1, (R 1 R2), (G 1 G 2 ), Q) where Q= (Q 1 ; (R 1 R 2 )*; Q 2 ) (Q 2 ; (R 1 R 2 )*; Q 1 ) 132
115 13
116 13
117 13
118 13
119 13
120 13
121 13
122 14
123 14
124 14
125 14
126 14
127 14
128 14
129 14
130 Issues in R/G Total correctness is trickier Restrict the structure of the proofs Sometimes global proofs are preferable Many design choices Transitivity and Reflexivity of Rely/Guarantee No standard set of rules Suitable for designs 148
Spring 2014 Program Analysis and Verification. Lecture 6: Axiomatic Semantics III. Roman Manevich Ben-Gurion University
Spring 2014 Program Analysis and Verification Lecture 6: Axiomatic Semantics III Roman Manevich Ben-Gurion University Syllabus Semantics Static Analysis Abstract Interpretation fundamentals Analysis Techniques
More informationSpring 2015 Program Analysis and Verification. Lecture 6: Axiomatic Semantics III. Roman Manevich Ben-Gurion University
Spring 2015 Program Analysis and Verification Lecture 6: Axiomatic Semantics III Roman Manevich Ben-Gurion University Tentative syllabus Semantics Static Analysis Abstract Interpretation fundamentals Analysis
More informationSpring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University
Spring 2015 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University Agenda Basic concepts of correctness Axiomatic semantics (pages 175-183) Hoare Logic
More informationSpring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University
Spring 2016 Program Analysis and Verification Lecture 3: Axiomatic Semantics I Roman Manevich Ben-Gurion University Warm-up exercises 1. Define program state: 2. Define structural semantics configurations:
More informationProgramming Languages and Compilers (CS 421)
Programming Languages and Compilers (CS 421) Sasa Misailovic 4110 SC, UIUC https://courses.engr.illinois.edu/cs421/fa2017/cs421a Based in part on slides by Mattox Beckman, as updated by Vikram Adve, Gul
More informationClassical Program Logics: Hoare Logic, Weakest Liberal Preconditions
Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will
More informationAxiomatic semantics. Semantics and Application to Program Verification. Antoine Miné. École normale supérieure, Paris year
Axiomatic semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 6 18 March 2016 Course 6 Axiomatic semantics Antoine Miné p. 1 /
More informationProgram Analysis Part I : Sequential Programs
Program Analysis Part I : Sequential Programs IN5170/IN9170 Models of concurrency Program Analysis, lecture 5 Fall 2018 26. 9. 2018 2 / 44 Program correctness Is my program correct? Central question for
More informationHoare Logic (I): Axiomatic Semantics and Program Correctness
Hoare Logic (I): Axiomatic Semantics and Program Correctness (Based on [Apt and Olderog 1991; Gries 1981; Hoare 1969; Kleymann 1999; Sethi 199]) Yih-Kuen Tsay Dept. of Information Management National Taiwan
More informationAxiomatic Semantics. Lecture 9 CS 565 2/12/08
Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics
More informationLecture Notes: Axiomatic Semantics and Hoare-style Verification
Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has
More informationHoare Logic and Model Checking
Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the
More informationWhat happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z )
Starter Questions Feel free to discuss these with your neighbour: Consider two states s 1 and s 2 such that s 1, x := x + 1 s 2 If predicate P (x = y + 1) is true for s 2 then what does that tell us about
More informationThe Assignment Axiom (Hoare)
The Assignment Axiom (Hoare) Syntax: V := E Semantics: value of V in final state is value of E in initial state Example: X:=X+ (adds one to the value of the variable X) The Assignment Axiom {Q[E/V ]} V
More informationProgram verification. 18 October 2017
Program verification 18 October 2017 Example revisited // assume(n>2); void partition(int a[], int n) { int pivot = a[0]; int lo = 1, hi = n-1; while (lo
More informationReasoning About Imperative Programs. COS 441 Slides 10b
Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program
More informationProof Rules for Correctness Triples
Proof Rules for Correctness Triples CS 536: Science of Programming, Fall 2018 A. Why? We can t generally prove that correctness triples are valid using truth tables. We need proof axioms for atomic statements
More informationHoare Calculus and Predicate Transformers
Hoare Calculus and Predicate Transformers Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at
More informationHoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples
Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic
More informationA Short Introduction to Hoare Logic
A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking
More informationDeterministic Program The While Program
Deterministic Program The While Program Shangping Ren Department of Computer Science Illinois Institute of Technology February 24, 2014 Shangping Ren Deterministic Program The While Program February 24,
More informationVerifying Properties of Parallel Programs: An Axiomatic Approach
Verifying Properties of Parallel Programs: An Axiomatic Approach By Susan Owicki and David Gries (1976) Nathan Wetzler nwetzler@cs.utexas.edu University of Texas, Austin November 3, 2009 Outline Introduction
More informationFloyd-Hoare Style Program Verification
Floyd-Hoare Style Program Verification Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 9 Feb 2017 Outline of this talk 1 Overview 2 Hoare Triples 3
More informationAxiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements
Axiomatic Semantics: Verification Conditions Meeting 12, CSCI 5535, Spring 2009 Announcements Homework 4 is due tonight Wed forum: papers on automated testing using symbolic execution 2 Questions? Review
More informationProgram verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program
Program verification Assertional semantics of a program Meaning of a program: relation between its inputs and outputs; specified by input assertions (pre-conditions) and output assertions (post-conditions)
More informationDynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics
Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated
More informationHoare Logic: Reasoning About Imperative Programs
Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Programming Paradigms Functional. (Haskell, SML, OCaml,... ) main paradigm:
More informationDeductive Verification
Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant
More informationFirst Order Logic vs Propositional Logic CS477 Formal Software Dev Methods
First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods Elsa L Gunter 2112 SC, UIUC egunter@illinois.edu http://courses.engr.illinois.edu/cs477 Slides based in part on previous lectures
More informationAxiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare
Axiomatic Semantics Semantics of Programming Languages course Joosep Rõõmusaare 2014 Direct Proofs of Program Correctness Partial correctness properties are properties expressing that if a given program
More informationProgram verification using Hoare Logic¹
Program verification using Hoare Logic¹ Automated Reasoning - Guest Lecture Petros Papapanagiotou Part 2 of 2 ¹Contains material from Mike Gordon s slides: Previously on Hoare Logic A simple while language
More informationPredicate Transforms I
Predicate Transforms I Software Testing and Verification Lecture Notes 19 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Predicate Transforms I 1. Introduction: weakest pre-conditions (wp
More informationAxiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE
Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE 6341 1 Outline Introduction What are axiomatic semantics? First-order logic & assertions about states Results (triples)
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2017 Lecture 2b Andrew Tolmach Portland State University 1994-2017 Semantics Informal vs. Formal Informal semantics Descriptions in English (or other natural language)
More informationIn this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and
In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and shows how a program can sometimes be systematically constructed
More informationAxiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs
Review Operational semantics relatively l simple many flavors (small vs. big) not compositional (rule for while) Good for describing language implementation reasoning about properties of the language eg.
More informationAxiomatic Semantics. Hoare s Correctness Triplets Dijkstra s Predicate Transformers
Axiomatic Semantics Hoare s Correctness Triplets Dijkstra s Predicate Transformers Goal of a program = IO Relation Problem Specification Properties satisfied by the input and expected of the output (usually
More informationWeakest Precondition Calculus
Weakest Precondition Calculus COMP2600 Formal Methods for Software Engineering Rajeev Goré Australian National University Semester 2, 2016 (Most lecture slides due to Ranald Clouston) COMP 2600 Weakest
More informationProofs of Correctness: Introduction to Axiomatic Verification
Proofs of Correctness: Introduction to Axiomatic Verification Introduction Weak correctness predicate Assignment statements Sequencing Selection statements Iteration 1 Introduction What is Axiomatic Verification?
More informationCSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.
Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify
More informationSolutions to exercises for the Hoare logic (based on material written by Mark Staples)
Solutions to exercises for the Hoare logic (based on material written by Mark Staples) Exercise 1 We are interested in termination, so that means we need to use the terminology of total correctness, i.e.
More informationHoare Logic: Reasoning About Imperative Programs
Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017 Catch Up / Drop in Lab When Fridays, 15.00-17.00 Where N335, CSIT Building
More informationCalculating axiomatic semantics from program equations by means of functional predicate calculus
Calculating axiomatic semantics from program equations by means of functional predicate calculus (Some initial results of recent work not for dissemination) Raymond Boute INTEC Ghent University 2004/02
More informationCOMP2111 Glossary. Kai Engelhardt. Contents. 1 Symbols. 1 Symbols 1. 2 Hoare Logic 3. 3 Refinement Calculus 5. rational numbers Q, real numbers R.
COMP2111 Glossary Kai Engelhardt Revision: 1.3, May 18, 2018 Contents 1 Symbols 1 2 Hoare Logic 3 3 Refinement Calculus 5 1 Symbols Booleans B = {false, true}, natural numbers N = {0, 1, 2,...}, integers
More informationVerification Frameworks and Hoare Logic
CMSC 630 February 11, 2015 1 Verification Frameworks and Hoare Logic Sources K. Apt and E.-R. Olderog. Verification of Sequential and Concurrent Programs (Second Edition). Springer-Verlag, Berlin, 1997.
More informationAxiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements
Axiomatic Semantics: Verification Conditions Meeting 18, CSCI 5535, Spring 2010 Announcements Homework 6 is due tonight Today s forum: papers on automated testing using symbolic execution Anyone looking
More informationLearning Goals of CS245 Logic and Computation
Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction
More informationIntroduction to Axiomatic Semantics
#1 Introduction to Axiomatic Semantics #2 How s The Homework Going? Remember that you can t just define a meaning function in terms of itself you must use some fixed point machinery. #3 Observations A
More informationProgramming Languages
CSE 230: Winter 2008 Principles of Programming Languages Lecture 6: Axiomatic Semantics Deriv. Rules for Hoare Logic `{A} c {B} Rules for each language construct ` {A} c 1 {B} ` {B} c 2 {C} ` {A} skip
More informationFoundations of Computation
The Australian National University Semester 2, 2018 Research School of Computer Science Tutorial 6 Dirk Pattinson Foundations of Computation The tutorial contains a number of exercises designed for the
More informationHoare Logic: Part II
Hoare Logic: Part II COMP2600 Formal Methods for Software Engineering Jinbo Huang Australian National University COMP 2600 Hoare Logic II 1 Factorial {n 0} fact := 1; i := n; while (i >0) do fact := fact
More informationControl Predicates Are Better Than Dummy Variables For Reasoning About Program Control
Control Predicates Are Better Than Dummy Variables For Reasoning About Program Control LESLIE LAMPORT Digital Equipment Corporation When explicit control predicates rather than dummy variables are used,
More informationHoare Examples & Proof Theory. COS 441 Slides 11
Hoare Examples & Proof Theory COS 441 Slides 11 The last several lectures: Agenda Denotational semantics of formulae in Haskell Reasoning using Hoare Logic This lecture: Exercises A further introduction
More informationProof Calculus for Partial Correctness
Proof Calculus for Partial Correctness Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 7, 2016 Bow-Yaw Wang (Academia Sinica) Proof Calculus for Partial Correctness September
More informationCOP4020 Programming Languages. Introduction to Axiomatic Semantics Prof. Robert van Engelen
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen Assertions and Preconditions Assertions are used by programmers to verify run-time execution An assertion is a
More informationLast Time. Inference Rules
Last Time When program S executes it switches to a different state We need to express assertions on the states of the program S before and after its execution We can do it using a Hoare triple written
More informationBilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft)
Bilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft) Jayadev Misra December 18, 2015 Contents 1 Introduction 3 2 Program and Execution Model 4 2.1 Program Structure..........................
More informationDesign of Distributed Systems Melinda Tóth, Zoltán Horváth
Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Publication date 2014 Copyright 2014 Melinda Tóth, Zoltán Horváth Supported by TÁMOP-412A/1-11/1-2011-0052
More informationProbabilistic Guarded Commands Mechanized in HOL
Probabilistic Guarded Commands Mechanized in HOL Joe Hurd joe.hurd@comlab.ox.ac.uk Oxford University Joint work with Annabelle McIver (Macquarie University) and Carroll Morgan (University of New South
More informationViews: Compositional Reasoning for Concurrent Programs
Views: Compositional Reasoning for Concurrent Programs Thomas Dinsdale-Young Imperial College td202@doc.ic.ac.uk Lars Birkedal IT University of Copenhagen birkedal@itu.dk Philippa Gardner Imperial College
More informationIris: Higher-Order Concurrent Separation Logic. Lecture 9: Concurrency Intro and Invariants
1 Iris: Higher-Order Concurrent Separation Logic Lecture 9: Concurrency Intro and Invariants Lars Birkedal Aarhus University, Denmark November 21, 2017 Overview Earlier: Operational Semantics of λ ref,conc
More informationIntroduction to Permission-Based Program Logics Part II Concurrent Programs
Introduction to Permission-Based Program Logics Part II Concurrent Programs Thomas Wies New York University Example: Lock-Coupling List 2 3 5 7 8 9 There is one lock per node; threads acquire locks in
More informationDenotational Semantics of Programs. : SimpleExp N.
Models of Computation, 2010 1 Denotational Semantics of Programs Denotational Semantics of SimpleExp We will define the denotational semantics of simple expressions using a function : SimpleExp N. Denotational
More informationLecture 17: Floyd-Hoare Logic for Partial Correctness
Lecture 17: Floyd-Hoare Logic for Partial Correctness Aims: To look at the following inference rules Page 1 of 9 sequence; assignment and consequence. 17.1. The Deduction System for Partial Correctness
More informationLecture 2: Axiomatic semantics
Chair of Software Engineering Trusted Components Prof. Dr. Bertrand Meyer Lecture 2: Axiomatic semantics Reading assignment for next week Ariane paper and response (see course page) Axiomatic semantics
More informationSoundness and Completeness of Axiomatic Semantics
#1 Soundness and Completeness of Axiomatic Semantics #2 One-Slide Summary A system of axiomatic semantics is sound if everything we can prove is also true: if ` { A } c { B } then ² { A } c { B } We prove
More informationCSE 331 Winter 2018 Reasoning About Code I
CSE 331 Winter 2018 Reasoning About Code I Notes by Krysta Yousoufian Original lectures by Hal Perkins Additional contributions from Michael Ernst, David Notkin, and Dan Grossman These notes cover most
More informationInductive Data Flow Graphs
Inductive Data Flow Graphs Azadeh Farzan University of Toronto Zachary Kincaid Andreas Podelski University of Freiburg Abstract The correctness of a sequential program can be shown by the annotation of
More informationPropositional Logic: Syntax
Logic Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about time (and programs) epistemic
More informationChapter 3. Specifications. 3.1 Hoare Triples. An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011
Chapter 3 An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011 Specifications From assertions, we move on to specifications, which describe the behavior of commands. In this chapter,
More informationStatic Program Analysis
Static Program Analysis Lecture 16: Abstract Interpretation VI (Counterexample-Guided Abstraction Refinement) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de
More informationExtending the theory of Owicki and Gries with a logic of progress
Extending the theory of Owicki and Gries with a logic of progress Brijesh Dongol Doug Goldson August 2005 Technical Report SSE-2005-03 Division of Systems and Software Engineering Research School of Information
More informationStrength; Weakest Preconditions
12/14: solved Strength; Weakest Preconditions CS 536: Science of Programming, Spring 2018 A. Why To combine correctness triples, we need to weaken and strengthen conditions. A weakest precondition is the
More informationLogic. Propositional Logic: Syntax
Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about
More information1 Introduction. 2 First Order Logic. 3 SPL Syntax. 4 Hoare Logic. 5 Exercises
Contents 1 Introduction INF5140: Lecture 2 Espen H. Lian Institutt for informatikk, Universitetet i Oslo January 28, 2009 2 Proof System 3 SPL 4 GCD 5 Exercises Institutt for informatikk (UiO) INF5140:
More informationRecent developments in concurrent program logics
Recent developments in concurrent program logics Viktor Vafeiadis University of Cambridge PSPL 2010 Why program logic? Reasoning framework Capture common reasoning principles Reduce accidental proof complexity
More informationFormal Methods in Software Engineering
Formal Methods in Software Engineering An Introduction to Model-Based Analyis and Testing Vesal Vojdani Department of Computer Science University of Tartu Fall 2014 Vesal Vojdani (University of Tartu)
More informationSoftwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany
Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationAutomata-Theoretic Model Checking of Reactive Systems
Automata-Theoretic Model Checking of Reactive Systems Radu Iosif Verimag/CNRS (Grenoble, France) Thanks to Tom Henzinger (IST, Austria), Barbara Jobstmann (CNRS, Grenoble) and Doron Peled (Bar-Ilan University,
More informationEDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach
EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types
More informationA Humble Introduction to DIJKSTRA S A A DISCIPLINE OF PROGRAMMING
A Humble Introduction to DIJKSTRA S A A DISCIPLINE OF PROGRAMMING Do-Hyung Kim School of Computer Science and Engineering Sungshin Women s s University CONTENTS Bibliographic Information and Organization
More informationVerifying Concurrent Memory Reclamation Algorithms with Grace
Verifying Concurrent Memory Reclamation Algorithms with Grace Alexey Gotsman, Noam Rinetzky, and Hongseok Yang 1 IMDEA Software Institute 2 Tel-Aviv University 3 University of Oxford Abstract. Memory management
More informationAxiomatic Verification II
Axiomatic Verification II Software Testing and Verification Lecture Notes 18 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Axiomatic Verification II Reasoning about iteration (while loops)
More informationLogic. Propositional Logic: Syntax. Wffs
Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about
More informationSoftware Engineering
Software Engineering Lecture 07: Design by Contract Peter Thiemann University of Freiburg, Germany 02.06.2014 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationarxiv: v1 [cs.pl] 5 Apr 2017
arxiv:1704.01814v1 [cs.pl] 5 Apr 2017 Bilateral Proofs of Safety and Progress Properties of Concurrent Programs Jayadev Misra University of Texas at Austin, misra@utexas.edu April 5, 2017 Abstract This
More informationFormal Specification and Verification. Specifications
Formal Specification and Verification Specifications Imprecise specifications can cause serious problems downstream Lots of interpretations even with technicaloriented natural language The value returned
More informationSoftwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany
Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationFormal Reasoning CSE 331. Lecture 2 Formal Reasoning. Announcements. Formalization and Reasoning. Software Design and Implementation
CSE 331 Software Design and Implementation Lecture 2 Formal Reasoning Announcements Homework 0 due Friday at 5 PM Heads up: no late days for this one! Homework 1 due Wednesday at 11 PM Using program logic
More informationConcurrent separation logic and operational semantics
MFPS 2011 Concurrent separation logic and operational semantics Viktor Vafeiadis Max Planck Institute for Software Systems (MPI-SWS), Germany Abstract This paper presents a new soundness proof for concurrent
More informationTHE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600/COMP6260 (Formal Methods for Software Engineering)
THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2016 COMP2600/COMP6260 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials:
More informationMarie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group
EXAMINING REFINEMENT: THEORY, TOOLS AND MATHEMATICS Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group PROBLEM Different formalisms do not integrate
More informationUnifying Theories of Programming
1&2 Unifying Theories of Programming Unifying Theories of Programming 3&4 Theories Unifying Theories of Programming designs predicates relations reactive CSP processes Jim Woodcock University of York May
More informationStructuring the verification of heap-manipulating programs
Structuring the verification of heap-manipulating programs Aleksandar Nanevski (IMDEA Madrid) Viktor Vafeiadis (MSR / Univ. of Cambridge) Josh Berdine (MSR Cambridge) Hoare/Separation Logic Hoare logic
More informationTheories of Programming Languages Assignment 5
Theories of Programming Languages Assignment 5 December 17, 2012 1. Lambda-Calculus (see Fig. 1 for initions of = β, normal order evaluation and eager evaluation). (a) Let Ω = ((λx. x x) (λx. x x)), and
More informationA Logic for Information Flow Analysis with an Application to Forward Slicing of Simple Imperative Programs
A Logic for Information Flow Analysis with an Application to Forward Slicing of Simple Imperative Programs Torben Amtoft and Anindya Banerjee a,1,2 a Department of Computing and Information Sciences Kansas
More informationCSE 331 Software Design & Implementation
CSE 331 Software Design & Implementation Kevin Zatloukal Summer 2017 Lecture 2 Reasoning About Code With Logic (Based on slides by Mike Ernst, Dan Grossman, David Notkin, Hal Perkins, Zach Tatlock) Recall
More informationTechnical Report. A safety proof of a lazy concurrent list-based set implementation. Viktor Vafeiadis, Maurice Herlihy, Tony Hoare, Marc Shapiro
Technical Report UCAM-CL-TR-659 ISSN 1476-2986 Number 659 Computer Laboratory A safety proof of a lazy concurrent list-based set implementation Viktor Vafeiadis, Maurice Herlihy, Tony Hoare, Marc Shapiro
More informationAsynchronous Communication 2
Asynchronous Communication 2 INF4140 22.11.12 Lecture 11 INF4140 (22.11.12) Asynchronous Communication 2 Lecture 11 1 / 37 Overview: Last time semantics: histories and trace sets specification: invariants
More informationAN INTRODUCTION TO SEPARATION LOGIC. 2. Assertions
AN INTRODUCTION TO SEPARATION LOGIC 2. Assertions John C. Reynolds Carnegie Mellon University January 7, 2011 c 2011 John C. Reynolds Pure Assertions An assertion p is pure iff, for all stores s and all
More information