Separation Logic 4/4. Chapter 18. Integration of structural rules. Definition of the local predicate (1/2)
|
|
- Gwendoline Manning
- 5 years ago
- Views:
Transcription
1 Separation Logic 4/4 Arthur Charguéraud Chapter 18 Characteristic Formulae with structural rules Febuary 22th, / 72 2 / 72 Integration of structural rules Definition of the local predicate (1/2) v local pλhq. H Ź Q vq let x t 1 in t 2 local pλhq. DQ 1. t 1 H Q 1 t 2 pq 1 xq Q if b then t 1 else t 2 local pλhq. pb true ñ t 1 H Qq ^ pb false ñ t 2 H Qq v 1 v 2 local pλhq. App v 1 v 2 H Qq let rec f λx. t 1 in t 2 local P f ñ t 2 H Qq where P f p@xh 1 Q 1. t 1 H 1 Q 1 ñ App f x H 1 Q 1 q q q To support: H H 1 H 2 t H 1 Q 1 Q 1 H 2 Q frame t H Q we would define: $ & H H 1 H 2 local F λhq. DH 1 H 2 Q 1. F H 1 Q 1 % Q 1 H 2 Q 3 / 72 4 / 72
2 Framing using the local predicate Definition of the local predicate (2/2) To prove thu t tqu, by the rule frame, it suffices to show: To support: H Ź H 1 H 2 th 1 u t tq 1 u Q 1 H 2 Ź Q GC thu t tqu combined H H 1 H 2 ^ th 1 u t tq 1 u ^ Q 1 H 2 Q To prove local t H Q, by definition of local, it suffices to thu t tqu tdx. Hu t tqu exists P ñ thu t tqu trp s Hu t tqu prop H H 1 H 2 ^ t H 1 Q 1 ^ Q 1 H 2 Q we define: $ & ph 1 H 2 q h local F H h ñ DH 1 H 2 Q 1. F H 1 Q 1 % Q 1 H 2 Ź Q GC 5 / 72 6 / 72 Iterated applications of structural rules Notation for characteristic formulae The local predicate may be duplicated as many times as needed: local t H Q local plocal t q H Q For example, to prove local t H Q, it suffices to show: H H 1 H 2 ^ local t H 1 Q 1 ^ Q 1 H 2 Q When not needed, local may be simply erased: t H Q ñ local t H Q let x t 1 in t 2 local pλhq. DQ 1. t 1 H Q 1 t 2 pq 1 xq Qq Definition of Coq notation: plet x F 1 in F 2 q local pλhq. DQ 1. F 1 H Q 1 F 2 pq 1 xq Qq With this notation: let x t 1 in t 2 plet x t 1 in t 2 q Technically: let x t 1 in t 2 plet X t 1 in prx Ñ Xs t 2 q q 7 / 72 8 / 72
3 Characteristic formulae generation, with notation Tactics for characteristic formulae What the user sees: Let x F 1 in F 2 v Ret v let x t 1 in t 2 Let x t 1 in t 2 if b then t 1 else t 2 If b then t 1 else t 2 v 1 v 2 App v 1 v 2 let rec f λx. t 1 in t 2 Let Rec f x t 1 in t 2 What is hidden behind the notation: local pλhq. DQ 1. F 1 H Q 1 F 2 pq 1 xq Qq What the user would need to execute: apply local_erase; esplit; split. What the user writes: xlet. 9 / / 72 Overview 1. Higher-order predicate: p Mlist L is generalized into p Mlistof R L Chapter 19 Higher-order representation predicates 2. Identity representation predicate: 3. Control accesses: p Mlistof Id L is the same as p Mlist L tp Mcellof Id v 1 R 2 V 2 u pp.hdq tλx. rx v 1 s...u 4. Compose recursively: p Nodeof R X pmlistof pnarytreeof Rqq L 11 / / 72
4 Mutable list of possibly-aliased lists Mutable list of disjoint mutable lists L p5::7::nilq::p8::3::3::nilq ::pnilq::p4::nilq :: nil p Mlist K æ pp i, L i q P M p i Mlist L i r@p i P K. p i P dom Ms p MlistofMlist L (to be later generalized into: p Mlistof R L) 13 / / 72 Representation using iterated star Representation using a recursive predicate L p5::7::nilq::p8::3::3::nilq ::pnilq::p4::nilq :: nil L p5::7::nilq::p8::3::3::nilq ::pnilq::p4::nilq :: nil K p 1 :: p 2 :: p 3 :: p 4 :: nil p MlistofMlist L DK. p Mlist K Æ i P r0, L q pkrisq Mlist plrisq r K L s p MlistofMlist L match L with nil ñ rp nulls X :: L 1 ñ Dxp 1. p t hd=x; tl=p 1 u p 1 MlistofMlist L 1 x Mlist X 15 / / 72
5 Generalization to a higher-order predicate p MlistofMlist L match L with nil ñ rp nulls X :: L 1 ñ Dxp 1. p t hd=x; tl=p 1 u p 1 MlistofMlist L 1 Generalization: x Mlist X p Mlistof R L match L with nil ñ rp nulls X :: L 1 ñ Dxp 1. p t hd=x; tl=p 1 u p 1 Mlistof R L 1 In particular: x R X p MlistofMlist L p Mlistof Mlist L Type-checking p Mlistof R L is a notation for Mlistof R L p pof type Hpropq x R X is a notation for R X x pof type Hpropq p Mlistof R L match L with nil ñ rp nulls X :: L 1 ñ Dxp 1. p t hd=x; tl=p 1 u p 1 Mlistof R L 1 x R X Exercise: since pp : locq and px : Valq and px : Aq for some A, what is the type of R? What is the type of Mlistof? R : A Ñ Val Ñ Hprop Mlistof pa Ñ Val Ñ Hpropq Ñ lista Ñ loc Ñ Hprop 17 / / 72 The identity representation predicate p Mlistof R L match L with nil ñ rp nulls X :: L 1 ñ Dxp 1. p t hd=x; tl=p 1 u p 1 Mlistof R L 1 x R X p Mlist L match L with nil ñ rp nulls x :: L 1 ñ Dp 1. p t hd=x; tl=p 1 u p 1 Mlist L 1 Exercise: define the identity representation predicate Id such that p Mlistof Id L p Mlist L Summary 1. Higher-order predicate: p Mlist L is generalized into p Mlistof R L 2. Identity representation predicate: p Mlistof Id L is the same as p Mlist L Definition: x Id X rx Xs 19 / / 72
6 Specification of construction, for basic values Chapter 20 Higher-order representation predicates and the access problem tp 1 Mlist Lu pcons x p 1 q tλp. p Mlist px :: Lqu 21 / / 72 Specification of construction Specification of deconstruction tx R X p 1 Mlistof R Lu pcons x p 1 q tλp. p Mlistof R px :: Lqu tp Mlistof R px :: Lqu puncons pq tλpx, p 1 q. x R X p 1 Mlistof R Lu 23 / / 72
7 Specification of accesses: the problem Specification of accesses: a partial solution Incorrect specification for head: tp Mlistof R px :: Lqu phead pq tλx. x R X p Mlistof R px :: Lqu Correct yet limited specification: tp Mlistof R px :: Lqu phead pq tλx. x R X px R X p Mlistof R px :: Lqqu Magic wand rule: H ph H 1 q H 1 25 / / 72 Specification of accesses: a brute force solution Specification of accesses: focus before read p Mlistof R L DK. p Mlist K Æ i P r0, L q pkrisq R plrisq r K L s p Mlistof R px :: Lq Dxp 1. p t hd=x; tl=p 1 u x R X p 1 Mlistof R L 1 Then read using: tp ÞÑ t hd=x; tl=p 1 uu pp.hdq tλy. ry xs p ÞÑ t hd=x; tl=p 1 uu 27 / / 72
8 Ownership transfer with a queue of mutable items Specification of queues of basic items Push: tr su pcreate()q tλp. p Queue nilu tp Queue Lu ppush x pq tλ. p Queue pl&xqu tp Queue px :: Lqu ppop pq tλr. rr xs p Queue Lu Pop: tp Queue L p 1 Queue L 1 u pconcat p p q tλ. p Queue pl``l 1 qu 29 / / 72 Specification of queues of mutable items The copy problem Exercise: specify functions over queues using a higher-order representation predicate written p Queueof R L. Shorthand: just write Q R instead of Queueof R. tr su pcreate()q tλp. p Queueof R nilu tp Queueof R L x R Xu ppush x pq tλ. p Queueof R pl&xqu tp Queueof R px :: Lqu ppop pq tλx. p Queueof R L x R Xu tp Queueof R L p 1 Queueof R L 1 u pconcat p p 1 q tλ. p Queueof R pl``l 1 qu Incorrect specification for copy: tp Queueof R Lu pcopy pq tλp 1. p Queueof R L p 1 Queueof R Lu Exercise: specify a function copy f p that duplicables a mutable queue specified using Queueof, where f is a function to duplicate items. `@xx. tx R Xu pf xq tλx 1. x R X x 1 R Xu ñ tp Queueof R Lu pcopy f pq tλp 1. p Queueof R L p 1 Queueof R Lu 31 / / 72
9 Representation for records Chapter 21 Higher-order representation predicates for records p Mcellof R 1 V 1 R 2 V 2 Dv 1 v 2. p t hd=v 1 ; tl=v 2 u v 1 R 1 V 1 v 2 R 2 V 2 33 / / 72 Representation predicate for lists, revisited Focus/unfocus for accessing a record field p Mlistof R L match L with nil ñ rp nulls X :: L 1 ñ Dxp 1. p t hd=x; tl=p 1 u x R X p 1 Mlistof R L 1 p Mcellof R 1 V 1 R 2 V 2 Dv 1 v 2. p t hd=v 1 ; tl=v 2 u v 1 R 1 V 1 v 2 R 2 V 2 Exercise: rewrite the specification of Mlistof using Mcellof. p Mlistof R L match L with nil ñ rp nulls X :: L 1 ñ p Mcellof R X pmlistof Rq L 1 Focus on a field: p Mcellof R 1 V 1 R 2 V 2 Dv 1. p Mcellof Id v 1 R 2 V 2 v 1 R 1 V 1 Access to a focused field: tp Mcellof Id v 1 R 2 V 2 u pp.hdq tλx. rx v 1 s p Mcellof Id v 1 R 2 V 2 u tp Mcellof Id v 1 R 2 V 2 u pp.hd <- wq tλ. p Mcellof Id w R 2 V 2 u 35 / / 72
10 Binary tree: representation Chapter 22 Higher-order representation predicates for trees p Mtreeof R T match T with Leaf ñ rp nulls Node X T 1 T 2 ñ Dxp 1 p 2. p ÞÑ t item=x; left=p 1 ; right=p 2 u x R X p 1 Mtreeof R T 1 p 2 Mtreeof R T 2 37 / / 72 Binary tree: representation, revisited Trees with list of subtrees: implementation Representation predicate for tree cells: p Nodeof R 1 V 1 R 2 V 2 R 3 V 3 Dv 1 v 2 v 3. p ÞÑ t item=v 1 ; left=v 2 ; right=v 3 u v 1 R 1 V 1 v 2 R 2 V 2 v 3 R 3 V 3 p Mtreeof R T match T with Leaf ñ rp nulls Node X T 1 T 2 ñ p Nodeof R X pmtreeof Rq T 1 pmtreeof Rq T 2 type a node = { mutable item : a; mutable children : ( a node) cell } Inductive tree (A:Type) : Type := Leaf : tree A Node : A Ñ list (tree A) Ñ tree A. 39 / / 72
11 Trees with list of subtrees: specification Trees with list of subtrees: representation of nodes p Nodeof R 1 V 1 R 2 V 2 Dv 1 v 2. p ÞÑ t item=v 1 ; children=v 2 u v 1 R 1 V 1 v 2 R 2 V 2 p Narytreeof R T match T with Leaf ñ rp nulls Node X L ñ Dxc. p ÞÑ t item=x; children=c u x R X c Mlistof pnarytreeof Rq L p Narytreeof R T match T with Leaf ñ rp nulls Node X L ñ Dxc. p ÞÑ t item=x; children=c u x R X c Mlistof pnarytreeof Rq L 41 / / 72 Trees with list of subtrees, revisited Exercises Exercise: rewrite the specification of Narytreeof using Nodeof. p Narytreeof R T match T with Leaf ñ rp nulls Node X L ñ p Nodeof R X pmlistof pnarytreeof Rqq L Exam from 2015, Exercise 2: Bootstrapped chunked bags. Available from the webpage of the course. 43 / / 72
12 Iteration on lists Chapter 23 Iteration with higher-order representation predicates ti ku pf xq tλ. I pk&xqu ñ ti nilu piter f lq tλ. I pli. `@xk. ti ku pf xq tλ. I pk&xqu ñ tp Mlist l I nilu pmiter f pq tλ. p Mlist l I 1. `@xkk 1. tj 1 k k 1 u pf xq tλx 1. J pk&xq pk 1 &x 1 qu ñ tp Mlist l J 1 nil nilu pmmap f lq tλl 1. p Mlist l J 1 l l 1 u Challenge: ñ `@x... t...u pf xq tλ....u tp Mlistof R L...u pmiter f pq tλ. p......u 45 / / 72 Iterating over a mutable list of mutable items Exercise: specify the function miter, using an invariant of the form J K K 1, describing the state before and the state after the prlj. `@xxkk 1. tx R X J K K 1 u pf xq tλ. DX 1. x R X 1 J pk&xq pk 1 &X 1 qu ñ tp Mlistof R L J nil nilu pmiter f pq tλ. DL 1. p Mlistof R L 1 J L L 1 u Incrementing a mutable list of distinct references (1/2) let incr_all p = miter (fun x -> incr x) p let example_p = { hd = ref 5; tl = { hd = ref 3; tl = null } } x Ref X x ÞÑ X Exercise: using the representation predicates Ref and Mlistof, specify the function (fun x -> incr x) and incr_all. tx Ref Xu pincr xq tλ. x Ref px ` 1qu tp Mlistof Ref Lu pincr_all pq tλ. p Mlistof Ref pmap p`1q Lqu 47 / / 72
13 Incrementing a mutable list of distinct references prlj. ñ `@xxkk 1. tx R X J K K 1 u pf xq tλ. DX 1. x R X 1 J pk&xq pk 1 &X 1 qu tp Mlistof R L J nil nilu pmiter f pq tλ. DL 1. p Mlistof R L 1 J L L 1 u Chapter 24 Resource analysis in Separation Logic Consider: J K K 1 rk 1 map p`1q Ks Derives: `@xx. tx Ref Xu pfun x -> incr xq tλ. x Ref px ` 1qu ñ tp Mlistof Ref Lu pincr_all pq tλ. p Mlistof Ref pmap p`1q Lqu 49 / / 72 Controlling deallocation File handle protocols (1) Remove the garbage collection rule: thu t tq GCu gc-post thu t tqu (2) Add a free function for explicit deallocation: tr ÞÑ vu pfree rq tλ. r su (3) Theorem: for a full program execution starting in the empty heap, all the data still allocated at the end is described in the post-condition. (4) Corollary: terminating on the empty heap ensures no memory leaks. Goal: ensure that if a file is open then it is eventually closed. f File L where pf : locq denotes the file handler, and pl : list charq denotes the remaining bytes to read. tr su pfopen sq tλf. DL. f File Lu tf File pc :: Lqu pfread fq tλx. rx cs f File Lu tf File Lu pfclose fq tλ. r su tr su t tλn. rp nsu 51 / / 72
14 Complexity analysis Time credits in pre-conditions Time credits: Properties: $ x : Hprop where x P R` $px ` yq $ x $ y and $ 0 r s Constant-time: tt Array M $ cu parray.length tq tλn. rn M s t Array Mu Linear-time: Principle: The execution of every instruction costs $1. Simplification: Entering the body of a function or a loop costs $1. t$pc 1 n ` c 2 qu parray.make n vq tλt. DL. t Array L r...su Superlinear-time: tt Array L $pc 1 L log L ` c 2 qu parray.sort tq tλt. DL 1. t Array L 1 r...su 53 / / 72 Amortized analysis Stack of unbounded size with amortized constant-time operations: t$ cu pstack.create()q tλ. s Stack nilu ts Stack L $ cu pstack.push s xq tλ. s Stack px :: Lqu ts Stack px :: Lq $ cu pstack.pop sq tλy. ry xs s Stack Lu Representation predicate with a potential function: Chapter 25 Read-only permissions s Stack L DntMk. s ÞÑ t size=n; data=t u t Array M rn L ď M 2 k s r@i P r0, nq. Mris Lriss $pc 1 abspn M {2qq 55 / / 72
15 Motivation for read-only permissions Fractional permissions What we currently need to write: ta 1 Array L 1 a 2 Array L 2 u pconcat a 1 a 2 q tλa 3. a 3 Array pl 1``L 2 q a 1 Array L 1 a 2 Array L 2 u What we wish to write: ro ro ta 1 Array L 1 a 2 Array L 2 u pconcat a 1 a 2 q tλa 3. a 3 Array pl 1``L 2 qu More than syntactic sugar: we wish ro to enforce no write operations, we wish to allow aliasing of read-only arguments. Splitting and merging: More generally: Operations: pr α ÞÑ vq with 0 ă α ď 1 pr ÞÑ vq pr 1 ÞÑ vq pr 1{2 ÞÑ vq pr 1{2 ÞÑ vq pr α`β ÞÑ vq pr α ÞÑ vq pr β ÞÑ vq with 0 ă α, β ď tr su pref vq tλr. r 1 ÞÑ vu tr 1 ÞÑ v 1 u pr := vq tλ. r 1 ÞÑ vu tr α ÞÑ vu p!rq tλx. rx vs pr α ÞÑ vqu 57 / / 72 Fractional permissions in practice Generic read-only modifier Extension of the logic with a modifier ROpHq that applies to any ta 1 α Array L1 a 2 β Array L2 u pconcat a 1 a 2 q tλa 3. a 1 α Array L1 a 2 β Array L2 a 3 1 Array pl1``l 2 qu Limitations: need to quantify fractions explicitly, need to syntactic sugar to avoid copy-pasting, need to re-establish post-conditions, a fraction 1 2H cannot be defined for arbitrary H. a ro Array L ROpa Array Lq ROpHq is duplicatable and never mentioned in post-conditions. ROpHq Ź ROpHq ROpHq dup-ro tropl ÞÑ vqu pget lq tλx. rx vsu get-ro 59 / / 72
16 Read-only frame rule Read-only sequencing rule ROpHq is introduced on frame: thu t 1 tq 1 u tq 1 pqu t 2 tqu thu pt 1 ; t 2 q tqu seq th ROpH 1 qu t tqu no-ro-in H 1 th H 1 u t tq H 1 u frame-ro th ROpH 1 qu t 1 tq 1 u tq 1 pq ROpH 1 qu t 2 tqu th ROpH 1 qu pt 1 ; t 2 q tqu seq-ro thu t 1 tq 1 u tq 1 pq H 1 u t 2 tqu th H 1 u pt 1 ; t 2 q tqu seq-frame 61 / / 72 RO in practice tropa 1 Array L 1 q ROpa 2 Array L 2 qu pconcat a 1 a 2 q tλa 3. a 3 Array pl 1``L 2 qu Chapter 26 Parallelism and Concurrency 63 / / 72
17 Parallel pairs Efficient use of parallel pairs with granularity control A parallel pair, written p t 1, t 2 q, for evaluating two subterms in parallel. Computing: aris ` ari ` 1s `... ` arj 1s. let rec sum a i j = if j - i = 1 then a.(i) else begin let m = (i+j) / 2 in let (s1,s2) = ( sum a i m, sum a m j ) in s1 + s2 end let rec sum a i j = if j - i < sequential_cutoff then begin let r = ref 0 in for k = i to j-1 do r :=!r + a.(k) done;!r end else begin let m = (i+j) / 2 in let (s1,s2) = ( sum a i m, sum a m j ) in s1 + s2 end Generalizable to map-reduce: fptr0sq fpar1sq... fparn 1sq. 65 / / 72 Reasoning rule for parallel pairs Parallel rule needs read-only permissions th 1 u t 1 tq 1 u th 2 u t 2 tq 2 u th 1 H 2 u p t 1, t 2 q tq 1 Q 2 u parallel th 1 u t 1 tq 1 u th 2 u t 2 tq 2 u th 1 H 2 u p t 1, t 2 q tq 1 Q 2 u parallel Compute: urar0ss ` urar1ss `... ` urarn 1ss. where Q 1 Q 2 λpx 1, x 2 q. Q 1 x 1 Q 2 x 2 This rule restricts parallel threads to act on disjoint parts of memory. map_reduce (fun x -> u.(x)) 0 (+) 0 n The ownership of the array u is needed in both branches. th 1 ROpH 3 qu t 1 tq 1 u th 2 ROpH 3 qu t 2 tq 2 u th 1 H 2 ROpH 3 qu p t 1, t 2 q tq 1 Q 2 u parallel-ro 67 / / 72
18 Concurrent locks: example Concurrent locks: specification of operations let r = ref 0 let s = ref n let p = create_lock() let concurrent_step () = let () = acquire_lock p in incr r; decr s; release_lock p Heap predicate p Lock H asserts that lock p protects an invariant H. Here: p Lock pdi. pr ÞÑ iq ps ÞÑ n iqq Duplicatable representation predicate: p ro Lock H thu pcreate_lock ()q tλp. p ro Lock tp ro Lock Hu pacquire_lock pq tλ. th p ro Lock Hu prelease_lock pq tλ. r su 69 / / 72 Concurrent locks: exercise Describe the state at the front of each lines (except 5 and 6). Explicit the instantiation of the existential in the invariant. 1 let r = ref 0 2 let s = ref n 3 let p = create_lock() 4 5 let concurrent_step () = 6 let () = acquire_lock p in 7 incr r; 8 decr s; 9 release_lock p 1: rs. 2: r ÞÑ 0. 3: r ÞÑ 0 s ÞÑ n. 4: p ro Lock pdi. pr ÞÑ iq ps ÞÑ n iqq. 7: pr ÞÑ iq ps ÞÑ n iq. 8: pr ÞÑ i ` 1q ps ÞÑ n iq. 9: pr ÞÑ i ` 1q ps ÞÑ n i 1q. Instantiate the invariant with i ` 1. Conclusion Program verification using Separation Logic gives you: Expressiveness: tree-shaped structures, and structures with sharing Expressiveness: effectful, first-class functions, with local state Modularity: most-general specifications Modularity: composable representation predicates Abstraction: existential quantification of intermediate pointers Abstraction: existential quantification of invariants Practice: formalization in Coq of all heap predicates Practice: characteristic formulae for reasoning rules 71 / / 72
Focus rules for segments. Focus and defocus rules for concatenation. Mlength with a while loop. Mlength with a while loop.
The function nth-cell Separation Logic Part 2 Returns the i-th cell of a list: Arthur Charguéraud February 2015 let rec nth_cell (i:int) (p: a cell) = if i = 0 then p else nth_cell (i-1) (p.tl) Why is
More informationSeparation Logic 2/4. Chapter 7. Preservation of independent state. The frame rule. The Frame Rule. Arthur Charguéraud.
Separation Logic 2/4 Arthur Charguéraud Chapter 7 The Frame Rule Febuary 8th, 2017 1 / 75 2 / 75 Preservation of independent state The frame rule We have: tr ÞÑ 2u pincr rq tλ. r ÞÑ 3u Principle: a triple
More informationExample of a for-loop. Separation Logic. The repeat construct. Reasoning rule for for-loops. Before the loop:
Example of a for-loop Separation Logic Part 3 Arthur Charguéraud February 2015 let facto n = let r = ref 1 in for i = 2 to n do let v =!r in r := v * i; done;!r Before the loop: r ãñ 1 At each iteration:
More informationSeparation Logic. Part 3. Arthur Charguéraud. February / 66
Separation Logic Part 3 Arthur Charguéraud February 2014 1 / 66 Content Reasoning about loops For loops While loops Repeat-loops Total correctness Frame in a while loop Higher-order iterators for pure
More informationA new, axiom-free implementation of CFML for the verification of imperative programs
A new, axiom-free implementation of CFML for the verification of imperative programs Arthur Charguéraud Inria 2017/10/13 1 / 31 CFML: program verification using characteristic formulae Old CFML: too large
More informationIris: Higher-Order Concurrent Separation Logic. Lecture 4: Basic Separation Logic: Proving Pointer Programs
1 Iris: Higher-Order Concurrent Separation Logic Lecture 4: Basic Separation Logic: Proving Pointer Programs Lars Birkedal Aarhus University, Denmark November 10, 2017 2 Overview Earlier: Operational Semantics
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 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 informationVerified Characteristic Formulae for CakeML. Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017
Verified Characteristic Formulae for CakeML Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017 CakeML Has: references, modules, datatypes, exceptions, a FFI,... Doesn t have:
More informationCSE613: Parallel Programming, Spring 2012 Date: May 11. Final Exam. ( 11:15 AM 1:45 PM : 150 Minutes )
CSE613: Parallel Programming, Spring 2012 Date: May 11 Final Exam ( 11:15 AM 1:45 PM : 150 Minutes ) This exam will account for either 10% or 20% of your overall grade depending on your relative performance
More informationNOTES WEEK 01 DAY 1 SCOT ADAMS
NOTES WEEK 01 DAY 1 SCOT ADAMS Question: What is Mathematics? Answer: The study of absolute truth. Question: Why is it so hard to teach and to learn? Answer: One must learn to play a variety of games called
More informationModular Termination Verification for Non-blocking Concurrency
Modular Termination Verification for Non-blocking Concurrency Pedro da Rocha Pinto 1, Thomas Dinsdale-Young 2, Philippa Gardner 1, and Julian Sutherland 1 1 Imperial College London pmd09,pg,jhs110@doc.ic.ac.uk
More informationNOTES WEEK 13 DAY 2 SCOT ADAMS
NOTES WEEK 13 DAY 2 SCOT ADAMS Recall: Let px, dq be a metric space. Then, for all S Ď X, we have p S is sequentially compact q ñ p S is closed and bounded q. DEFINITION 0.1. Let px, dq be a metric space.
More information6 Coalgebraic modalities via predicate liftings
6 Coalgebraic modalities via predicate liftings In this chapter we take an approach to coalgebraic modal logic where the modalities are in 1-1 correspondence with so-called predicate liftings for the functor
More informationExtensive Form Abstract Economies and Generalized Perfect Recall
Extensive Form Abstract Economies and Generalized Perfect Recall Nicholas Butler Princeton University July 30, 2015 Nicholas Butler (Princeton) EFAE and Generalized Perfect Recall July 30, 2015 1 / 1 Motivation
More informationDS-GA 1002: PREREQUISITES REVIEW SOLUTIONS VLADIMIR KOBZAR
DS-GA 2: PEEQUISIES EVIEW SOLUIONS VLADIMI KOBZA he following is a selection of questions (drawn from Mr. Bernstein s notes) for reviewing the prerequisites for DS-GA 2. Questions from Ch, 8, 9 and 2 of
More informationAccumulators. A Trivial Example in Oz. A Trivial Example in Prolog. MergeSort Example. Accumulators. Declarative Programming Techniques
Declarative Programming Techniques Accumulators, Difference Lists (VRH 3.4.3-3.4.4) Carlos Varela RPI Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL September 13, 2007 Accumulators Accumulator
More informationAmortized Complexity Verified
Amortized Complexity Verified Tobias Nipkow Technische Universität München Abstract A framework for the analysis of the amortized complexity of (functional) data structures is formalized in Isabelle/HOL
More informationComputability and Complexity Results for a Spatial Assertion Language for Data Structures
Computability and Complexity Results for a Spatial Assertion Language for Data Structures Cristiano Calcagno 12, Hongseok Yang 3, and Peter W. O Hearn 1 1 Queen Mary, University of London 2 DISI, University
More informationProgram Verification Using Separation Logic
Program Verification Using Separation Logic Cristiano Calcagno Adapted from material by Dino Distefano Lecture 1 Goal of the course Study Separation Logic having automatic verification in mind Learn how
More informationIntroduction to Theory of Computing
CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages
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 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 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 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 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 informationNOTES WEEK 15 DAY 1 SCOT ADAMS
NOTES WEEK 15 DAY 1 SCOT ADAMS We fix some notation for the entire class today: Let n P N, W : R n, : 2 P N pw q, W : LpW, W q, I : id W P W, z : 0 W 0 n. Note that W LpR n, R n q. Recall, for all T P
More informationFORMALIZING CONCURRENT STACKS WITH HELPING: A CASE STUDY IN IRIS
FORMALIZING CONCURRENT STACKS WITH HELPING: A CASE STUDY IN IRIS DANIEL GRATZER, MATHIAS HØIER, ALE S BIZJAK, AND LARS BIRKEDAL Abstract. Iris is an expressive higher-order separation logic designed for
More informationDeclarative Programming Techniques
Declarative Programming Techniques Accumulators and Difference Lists (CTM 3.4.3-3.4.4) Carlos Varela RPI Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL February 12, 2015 C. Varela; Adapted
More informationCS156: The Calculus of Computation
CS156: The Calculus of Computation Zohar Manna Winter 2010 It is reasonable to hope that the relationship between computation and mathematical logic will be as fruitful in the next century as that between
More information4 Quantifiers and Quantified Arguments 4.1 Quantifiers
4 Quantifiers and Quantified Arguments 4.1 Quantifiers Recall from Chapter 3 the definition of a predicate as an assertion containing one or more variables such that, if the variables are replaced by objects
More informationPlease give details of your answer. A direct answer without explanation is not counted.
Please give details of your answer. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed to
More informationRandom Variables. Andreas Klappenecker. Texas A&M University
Random Variables Andreas Klappenecker Texas A&M University 1 / 29 What is a Random Variable? Random variables are functions that associate a numerical value to each outcome of an experiment. For instance,
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 informationDeclarative Programming Techniques
Declarative Programming Techniques Accumulators (CTM 3.4.3) Difference Lists (CTM 3.4.4) Carlos Varela RPI Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL December 1, 2015 C. Varela; Adapted
More informationFlow Interfaces Compositional Abstractions of Concurrent Data Structures. Siddharth Krishna, Dennis Shasha, and Thomas Wies
Flow Interfaces Compositional Abstractions of Concurrent Data Structures Siddharth Krishna, Dennis Shasha, and Thomas Wies Background Verifying programs, separation logic, inductive predicates Slides courtesy
More informationPremaster Course Algorithms 1 Chapter 3: Elementary Data Structures
Premaster Course Algorithms 1 Chapter 3: Elementary Data Structures Christian Scheideler SS 2018 23.04.2018 Chapter 3 1 Overview Basic data structures Search structures (successor searching) Dictionaries
More informationCSC236H Lecture 2. Ilir Dema. September 19, 2018
CSC236H Lecture 2 Ilir Dema September 19, 2018 Simple Induction Useful to prove statements depending on natural numbers Define a predicate P(n) Prove the base case P(b) Prove that for all n b, P(n) P(n
More informationFlow Interfaces Compositional Abstractions of Concurrent Data Structures. Siddharth Krishna, Dennis Shasha, and Thomas Wies
Flow Interfaces Compositional Abstractions of Concurrent Data Structures Siddharth Krishna, Dennis Shasha, and Thomas Wies Background Verifying programs, separation logic, inductive predicates Verifying
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 informationCSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26. Homework #2. ( Due: Nov 8 )
CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26 Homework #2 ( Due: Nov 8 ) Task 1. [ 80 Points ] Average Case Analysis of Median-of-3 Quicksort Consider the median-of-3 quicksort algorithm
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 informationCS361 Homework #3 Solutions
CS6 Homework # Solutions. Suppose I have a hash table with 5 locations. I would like to know how many items I can store in it before it becomes fairly likely that I have a collision, i.e., that two items
More informationOutline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018
Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 3. Logarithmic Space Reinhard Pichler Institute of Logic and Computation DBAI Group TU Wien 3. Logarithmic Space 3.1 Computational
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 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 informationNOTES WEEK 10 DAY 2. Unassigned HW: Let V and W be finite dimensional vector spaces and let x P V. Show, for all f, g : V W, that
NOTES WEEK 10 DAY 2 SCOT ADAMS Unassigned HW: Let V and W be finite dimensional vector spaces and let x P V. Show, for all f, g : V W, that D x pf ` gq pd x fq ` pd x gq. Also, show, for all c P R, for
More information3. The Logic of Quantified Statements Summary. Aaron Tan August 2017
3. The Logic of Quantified Statements Summary Aaron Tan 28 31 August 2017 1 3. The Logic of Quantified Statements 3.1 Predicates and Quantified Statements I Predicate; domain; truth set Universal quantifier,
More informationIris: Higher-Order Concurrent Separation Logic. Lecture 6: Case Study: foldr
1 Iris: Higher-Order Concurrent Separation Logic Lecture 6: Case Study: foldr Lars Birkedal Aarhus University, Denmark November 10, 2017 2 Overview Earlier: Operational Semantics of λ ref,conc e, (h, e)
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 informationHarvard School of Engineering and Applied Sciences CS 152: Programming Languages
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 17 Tuesday, April 2, 2013 1 There is a strong connection between types in programming languages and propositions
More informationL11: Algebraic Path Problems with applications to Internet Routing Lecture 15. Path Weight with functions on arcs?
L11: Algebraic Path Problems with applications to Internet Routing Lecture 15 Timothy G. Griffin timothy.griffin@cl.cam.ac.uk Computer Laboratory University of Cambridge, UK Michaelmas Term, 2016 tgg22
More informationLogic and Modelling. Introduction to Predicate Logic. Jörg Endrullis. VU University Amsterdam
Logic and Modelling Introduction to Predicate Logic Jörg Endrullis VU University Amsterdam Predicate Logic In propositional logic there are: propositional variables p, q, r,... that can be T or F In predicate
More informationElement x is R-minimal in X if y X. R(y, x).
CMSC 22100/32100: Programming Languages Final Exam M. Blume December 11, 2008 1. (Well-founded sets and induction principles) (a) State the mathematical induction principle and justify it informally. 1
More informationVery quick introduction to the conformal group and cft
CHAPTER 1 Very quick introduction to the conformal group and cft The world of Conformal field theory is big and, like many theories in physics, it can be studied in many ways which may seem very confusing
More informationProgramming with Dependent Types in Coq
Programming with Dependent Types in Coq Matthieu Sozeau LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project PPS Seminar February 26th 2009 Paris, France Coq A higher-order, polymorphic logic:
More informationLecture Notes: Program Analysis Correctness
Lecture Notes: Program Analysis Correctness 15-819O: Program Analysis Jonathan Aldrich jonathan.aldrich@cs.cmu.edu Lecture 5 1 Termination As we think about the correctness of program analysis, let us
More informationFundamental Algorithms
Chapter 2: Sorting, Winter 2018/19 1 Fundamental Algorithms Chapter 2: Sorting Jan Křetínský Winter 2018/19 Chapter 2: Sorting, Winter 2018/19 2 Part I Simple Sorts Chapter 2: Sorting, Winter 2018/19 3
More informationFundamental Algorithms
Fundamental Algorithms Chapter 2: Sorting Harald Räcke Winter 2015/16 Chapter 2: Sorting, Winter 2015/16 1 Part I Simple Sorts Chapter 2: Sorting, Winter 2015/16 2 The Sorting Problem Definition Sorting
More informationTHE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering)
THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: One A4
More informationCS156: The Calculus of Computation Zohar Manna Autumn 2008
Page 3 of 52 Page 4 of 52 CS156: The Calculus of Computation Zohar Manna Autumn 2008 Lecturer: Zohar Manna (manna@cs.stanford.edu) Office Hours: MW 12:30-1:00 at Gates 481 TAs: Boyu Wang (wangboyu@stanford.edu)
More informationPrecise Program Analysis through (Linear) Algebra
Precise Program Analysis through (Linear) Algebra Markus Müller-Olm FernUniversität Hagen (on leave from Universität Dortmund) Joint work with Helmut Seidl (TU München) CP+CV 4, Barcelona, March 8, 4 Overview
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 informationAdapted with permission from: Seif Haridi KTH Peter Van Roy UCL. C. Varela; Adapted w. permission from S. Haridi and P. Van Roy 1
Higher-Order Programming: Iterative computation (CTM Section 3.2) Closures, procedural abstraction, genericity, instantiation, embedding (CTM Section 3.6.1) Carlos Varela RPI September 15, 2017 Adapted
More informationProblem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26
Binary Search Introduction Problem Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Strategy 1: Random Search Randomly select a page until the page containing
More informationCS156: The Calculus of Computation Zohar Manna Winter 2010
Page 3 of 35 Page 4 of 35 quantifiers CS156: The Calculus of Computation Zohar Manna Winter 2010 Chapter 2: First-Order Logic (FOL) existential quantifier x. F [x] there exists an x such that F [x] Note:
More informationWeek 5: Quicksort, Lower bound, Greedy
Week 5: Quicksort, Lower bound, Greedy Agenda: Quicksort: Average case Lower bound for sorting Greedy method 1 Week 5: Quicksort Recall Quicksort: The ideas: Pick one key Compare to others: partition into
More informationAmortized analysis. Amortized analysis
In amortized analysis the goal is to bound the worst case time of a sequence of operations on a data-structure. If n operations take T (n) time (worst case), the amortized cost of an operation is T (n)/n.
More informationRoy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK
Midlands Graduate School, University of Birmingham, April 2008 1 Operational Semantics Abstract Machines and Correctness Roy L. Crole University of Leicester, UK Midlands Graduate School, University of
More informationOctober 6, Equivalence of Pushdown Automata with Context-Free Gramm
Equivalence of Pushdown Automata with Context-Free Grammar October 6, 2013 Motivation Motivation CFG and PDA are equivalent in power: a CFG generates a context-free language and a PDA recognizes a context-free
More informationL11: Algebraic Path Problems with applications to Internet Routing Lectures 7 and 8
L: Algebraic Path Problems with applications to Internet Routing Lectures 7 and 8 Timothy G. Grifn timothy.grifn@cl.cam.ac.uk Computer Laboratory University of Cambridge, UK Michaelmas Term, 27 tgg22 (cl.cam.ac.uk)
More informationThe Locally Nameless Representation
Noname manuscript No. (will be inserted by the editor) The Locally Nameless Representation Arthur Charguéraud Received: date / Accepted: date Abstract This paper provides an introduction to the locally
More informationSoftware Engineering using Formal Methods
Software Engineering using Formal Methods First-Order Logic Wolfgang Ahrendt 26th September 2013 SEFM: First-Order Logic 130926 1 / 53 Install the KeY-Tool... KeY used in Friday s exercise Requires: Java
More informationModel Checking, Theorem Proving, and Abstract Interpretation: The Convergence of Formal Verification Technologies
Model Checking, Theorem Proving, and Abstract Interpretation: The Convergence of Formal Verification Technologies Tom Henzinger EPFL Three Verification Communities Model checking: -automatic, but inefficient
More informationMarkov Chains. Andreas Klappenecker by Andreas Klappenecker. All rights reserved. Texas A&M University
Markov Chains Andreas Klappenecker Texas A&M University 208 by Andreas Klappenecker. All rights reserved. / 58 Stochastic Processes A stochastic process X tx ptq: t P T u is a collection of random variables.
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 informationPropositions and Proofs
Propositions and Proofs Gert Smolka, Saarland University April 25, 2018 Proposition are logical statements whose truth or falsity can be established with proofs. Coq s type theory provides us with a language
More informationChapter 4. Declarative Interpretation
Chapter 4 1 Outline Algebras (which provide a semantics of terms) Interpretations (which provide a semantics of programs) Soundness of SLD-resolution Completeness of SLD-resolution Least Herbrand models
More informationNOTES WEEK 02 DAY 1. THEOREM 0.3. Let A, B and C be sets. Then
NOTES WEEK 02 DAY 1 SCOT ADAMS LEMMA 0.1. @propositions P, Q, R, rp or pq&rqs rp p or Qq&pP or Rqs. THEOREM 0.2. Let A and B be sets. Then (i) A X B B X A, and (ii) A Y B B Y A THEOREM 0.3. Let A, B and
More informationA Brief History of Shared memory C M U
A Brief History of Shared memory S t e p h e n B r o o k e s C M U 1 Outline Revisionist history Rational reconstruction of early models Evolution of recent models A unifying framework Fault-detecting
More informationAnalysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes.
Analysis of Algorithms Fibonacci Heaps Andres Mendez-Vazquez October 29, 2015 1 / 119 Outline 1 Introduction Basic Definitions Ordered Trees 2 Binomial Trees Example 3 Fibonacci Heap Operations Fibonacci
More informationCIS 500: Software Foundations
CIS 500: Software Foundations Midterm I October 3, 2017 Directions: This exam booklet contains both the standard and advanced track questions. Questions with no annotation are for both tracks. Other questions
More informationIntroduction to computability Tutorial 7
Introduction to computability Tutorial 7 Context free languages and Turing machines November 6 th 2014 Context-free languages 1. Show that the following languages are not context-free: a) L ta i b j a
More informationt t t ér t rs r t ét q s
rés té t rs té s é té r t q r r ss r t t t ér t rs r t ét q s s t t t r2 sé t Pr ss r rs té P r s 2 t Pr ss r rs té r t r r ss s Pr ss r rs té P r q r Pr ss r t r t r r t r r Prés t r2 r t 2s Pr ss r rs
More informationSalembier s Min-tree algorithm turned into breadth first search
Information Processing Letters 88 (2003) 225 229 www.elsevier.com/locate/ipl Salembier s Min-tree algorithm turned into breadth first search Wim H. Hesselink Department of Mathematics and Computing Science,
More informationL11: Algebraic Path Problems with applications to Internet Routing Lecture 9
L11: Algebraic Path Problems with applications to Internet Routing Lecture 9 Timothy G. Griffin timothy.griffin@cl.cam.ac.uk Computer Laboratory University of Cambridge, UK Michaelmas Term, 2017 tgg22
More informationFundamentals of Software Engineering
Fundamentals of Software Engineering First-Order Logic Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel, Reiner Hähnle (Chalmers
More informationAbstractions and Decision Procedures for Effective Software Model Checking
Abstractions and Decision Procedures for Effective Software Model Checking Prof. Natasha Sharygina The University of Lugano, Carnegie Mellon University Microsoft Summer School, Moscow, July 2011 Lecture
More informationReview. Propositions, propositional operators, truth tables. Logical Equivalences. Tautologies & contradictions
Review Propositions, propositional operators, truth tables Logical Equivalences. Tautologies & contradictions Some common logical equivalences Predicates & quantifiers Some logical equivalences involving
More informationNOTES ON SOME EXERCISES OF LECTURE 5, MODULE 2
NOTES ON SOME EXERCISES OF LECTURE 5, MODULE 2 MARCO VITTURI Contents 1. Solution to exercise 5-2 1 2. Solution to exercise 5-3 2 3. Solution to exercise 5-7 4 4. Solution to exercise 5-8 6 5. Solution
More informationCS Data Structures and Algorithm Analysis
CS 483 - Data Structures and Algorithm Analysis Lecture VII: Chapter 6, part 2 R. Paul Wiegand George Mason University, Department of Computer Science March 22, 2006 Outline 1 Balanced Trees 2 Heaps &
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 informationSolution suggestions for examination of Logic, Algorithms and Data Structures,
Department of VT12 Software Engineering and Managment DIT725 (TIG023) Göteborg University, Chalmers 24/5-12 Solution suggestions for examination of Logic, Algorithms and Data Structures, Date : April 26,
More information2.5.2 Basic CNF/DNF Transformation
2.5. NORMAL FORMS 39 On the other hand, checking the unsatisfiability of CNF formulas or the validity of DNF formulas is conp-complete. For any propositional formula φ there is an equivalent formula in
More informationList reversal: back into the frying pan
List reversal: back into the frying pan Richard Bornat March 20, 2006 Abstract More than thirty years ago Rod Burstall showed how to do a proof of a neat little program, shown in a modern notation in figure
More informationFirst-Order Logic. Resolution
First-Order Logic Resolution 1 Resolution for predicate logic Gilmore s algorithm is correct and complete, but useless in practice. We upgrade resolution to make it work for predicate logic. 2 Recall:
More informationPrinciples of Program Analysis: Control Flow Analysis
Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag
More informationCS60007 Algorithm Design and Analysis 2018 Assignment 1
CS60007 Algorithm Design and Analysis 2018 Assignment 1 Palash Dey and Swagato Sanyal Indian Institute of Technology, Kharagpur Please submit the solutions of the problems 6, 11, 12 and 13 (written in
More informationKnuth-Morris-Pratt Algorithm
Knuth-Morris-Pratt Algorithm Jayadev Misra June 5, 2017 The Knuth-Morris-Pratt string matching algorithm (KMP) locates all occurrences of a pattern string in a text string in linear time (in the combined
More informationCSC236 Week 3. Larry Zhang
CSC236 Week 3 Larry Zhang 1 Announcements Problem Set 1 due this Friday Make sure to read Submission Instructions on the course web page. Search for Teammates on Piazza Educational memes: http://www.cs.toronto.edu/~ylzhang/csc236/memes.html
More information