Separation Logic 2/4. Chapter 7. Preservation of independent state. The frame rule. The Frame Rule. Arthur Charguéraud.

Size: px
Start display at page:

Download "Separation Logic 2/4. Chapter 7. Preservation of independent state. The frame rule. The Frame Rule. Arthur Charguéraud."

Transcription

1 Separation Logic 2/4 Arthur Charguéraud Chapter 7 The Frame Rule Febuary 8th, / 75 2 / 75 Preservation of independent state The frame rule We have: tr ÞÑ 2u pincr rq tλ. r ÞÑ 3u Principle: a triple remains valid when both the pre-condition and the post-condition are extended with a same heap predicate. We also have: tr ÞÑ 2 s ÞÑ 7u pincr rq tλ. r ÞÑ 3 s ÞÑ 7u More generally: tr ÞÑ 2 Hu pincr rq tλ. r ÞÑ 3 Hu General form: th 1 u t tλx. H 1 1u th 1 H 2 u t tλx. H 1 1 H 2 u 3 / 75 4 / 75

2 Frame rule and allocation Length of a mutable list, recursively We have: t r s u pref 3q tλr. pr ÞÑ 3qu By the frame rule, we have: ts ÞÑ 5u pref 3q tλr. pr ÞÑ 3q ps ÞÑ 5qu let rec mlength (p: a cell) = if p == null then 0 else let n = mlength p.tl in 1 + n Specification: This post-condition ensures r tp Mlist Lu pmlength pq tλn. rn length Ls p Mlist Lu The reference cell r is thus guaranteed to be distinct from any cell that might exist prior to the allocation of r. We prove this specification by induction on L. 5 / 75 6 / 75 Verification of mlength: nil case Verification of mlength: frame tp Mlist Lu pmlength pq tλn. rn length Ls p Mlist Lu Case p null. Goal is: tp Mlist Lu p0q tλn. rn length Ls p Mlist Lu Assume L x :: L 1. Exploit: p Mlist L pre-condition null Mlist L Ź rl nils null Mlist L p t hd=x; tl=p 1 u p 1 Mlist L 1 by unfolding and: 0 length nil p 1 Mlist L 1 p 1 Mlist L 1 rn 1 L 1 s frame begins by induction p t hd=x; tl=p 1 u p 1 Mlist L 1 rn 1 L 1 s frame ends p Mlist L rn 1 ` 1 x :: L 1 s by folding p Mlist L rn L s post-condition 7 / 75 8 / 75

3 Instantiation of the frame rule Verification of in-place increment Induction hypothesis: By the frame rule: tp 1 Mlist L 1 u pmlength p q tλn 1. rn length L 1 s p 1 Mlist L 1 u tp 1 Mlist L 1 p t hd=x; tl=p 1 u u pmlength p q tλn. rn length L 1 s p 1 Mlist L 1 p t hd=x; tl=p 1 u u let rec list_incr (p: a cell) = if p!= null then begin p.hd <- p.hd + 1; list_incr p.tl tp Mlist Lu plist incr pq tλ. p Mlist pmap p`1q Lqu Exercise: describe the frame process for in-place increment. 9 / / 75 Verification of in-place increment: frame process Specification of tree tp Mlist Lu plist incr pq tλ. p Mlist pmap p`1q Lqu Assume L x :: L 1. p Mlist L pre-condition p t hd=x; tl=p 1 u p 1 Mlist L 1 by unfolding p t hd=x ` 1; tl=p 1 u p 1 Mlist L 1 incrementing p 1 Mlist L 1 frame begins p 1 Mlist pmap p`1q L 1 q by induction p t hd=x ` 1; tl=p 1 u p 1 Mlist pmap p`1q L 1 q frame ends p Mlist ppx ` 1q :: pmap p`1q L 1 qq by folding p Mlist pmap p`1q Lq by rewriting post-condition 11 / 75 let rec copy (p:node) : node = if p == null then null else let p1 = copy p.left in let p2 = copy p.right in { item = p.item; left = p1 ; right = p2 } Exercise: specify the tree copy tp Mtree T u pcopy pq tλp 1. p Mtree T p 1 Mtree T u Exercise: describe the frame process for tree copy. 12 / 75

4 Verification of tree copy: frame process p Mtree T by pre-condition p ÞÑ t x; p 1 ; p 2 u p 1 Mtree T 1 p 2 Mtree T 2 by unfolding p 1 Mtree T 1 frame begins p 1 Mtree T 1 p 1 1 Mtree T 1 by induction p ÞÑ t x; p 1 ; p 2 u p 1 Mtree T 1 p 2 Mtree T 2 p 1 1 Mtree T 1 frame ends p 2 Mtree T 2 frame begins p 2 Mtree T 2 p 1 2 Mtree T 2 by induction p ÞÑ t x; p 1 ; p 2 u p 1 Mtree T 1 p 2 Mtree T 2 p 1 1 Mtree T 1 p 1 2 Mtree T 2 frame ends p ÞÑ t x; p 1 ; p 2 u p 1 Mtree T 1 p 2 Mtree T 2 p 1 ÞÑ t x; p 1 1 ; p1 2 u p1 1 Mtree T 1 p 1 2 Mtree T 2 by allocation p Mtree T p 1 Mtree T by folding Summary th 1 u t tλx. H 1 1u th 1 H 2 u t tλx. H 1 1 H 2 u frame In-place mutable list increment, when L x :: L 1. p Mlist L p t hd=x; tl=p 1 u p 1 Mlist L 1 by unfolding p t hd=x ` 1; tl=p 1 u p 1 Mlist L 1 p 1 Mlist L 1 p 1 Mlist pmap p`1q L 1 q p t hd=x ` 1; tl=p 1 u p 1 Mlist pmap p`1q L 1 q p Mlist ppx ` 1q :: pmap p`1q L 1 qq p Mlist pmap p`1q Lq incrementing frame begins by induction frame ends by folding by rewriting 13 / / 75 Small footprint access to records p t hd=v; tl=q u p.hd ÞÑ v p.tl ÞÑ q Chapter 8 Small footprint specifications Specification of a write on the head field: tp t hd=w; tl=q u u pp.hd <- vq tλ. p t hd=v; tl=q u u Same, but with a smaller footprint: or tp.hd ÞÑ wu pp.hd <- vq tλ. p.hd ÞÑ vu tp.hd ÞÑ u pp.hd <- vq tλ. p.hd ÞÑ vu From small to large footprint using frame: tp.hd ÞÑ w p.tl ÞÑ qu pp.hd <- vq tλ. p.hd ÞÑ v p.tl ÞÑ qu 15 / / 75

5 Representation predicate for arrays Representation predicate for C arrays: ç p Array L pris ÞÑ v v at index i in L where: pris ÞÑ v pp ` iq ÞÑ v Representation predicate for ML arrays: ç p Array L p.length ÞÑ L pris ÞÑ v v at index i in L where p.length ÞÑ n and pris ÞÑ v are abstract definitions for the user. Small footprint specifications of array operations i P dom L ñ tp Array Lu parray.get i pq tλx. rx Lriss p Array Lu tp Array Lu parray.set i p vq tλ. p Array plri : vsqu tp Array Lu parray.length pq tλn. rn L s p Array Lu Exercise: give small footprint specifications for array operations. How to derive the large footprint specifications from them? tpris ÞÑ vu parray.get i pq tλx. rx vs pris ÞÑ vu tpris ÞÑ u parray.set i pq tλ. pris ÞÑ vu tp.length ÞÑ nu parray.length pq tλx. rx ns p.length ÞÑ nu p Array L pris ÞÑ Lris p.length ÞÑ L Ç v at index j in L with j i prjs ÞÑ v 17 / / 75 Access to a memory cell Quicksort code In C, record and array accesses are treated uniformly: p.hd = v compiles to *(p+hd)=v p[i] = v compiles to *(p+i)=v Common small footprint specification for accessing a memory cell: tp ÞÑ u p*p = vq tλ. p ÞÑ vu tp ÞÑ vu p*pq tλx. rx vs p ÞÑ vu All other specifications for read and write operations are derivable. let rec qsort i j t = if j - i > 1 then begin let m = pivot i j t in qsort i (m-1) t; qsort (m+1) j t; end 19 / / 75

6 Large-footprint specification of where: sortedseg i j L 1 0 ď i ď j ă L ñ tp Array Lu pqsort i j pq tλ. DL 1. pp Array L 1 q rsortedseg i j L 1 s rpermut L L 1 s r@a P [0, iq Y pj, L q. L 1 ras b P [i, j]. a ď b ñ L 1 ras ď L 1 rbs. u Group of array cells Definition æ p Cells M pris ÞÑ v pi,vqpm where M has type map int A, for some A. Conversions: p Array L p.length ÞÑ L p Cells pmapoflist Lq p Cells H r s p Cells tpi, vqu pris ÞÑ v p Cells pm 1 Z M 2 q p Cells M 1 p Cells M 2 pwhen M 1 KM 2 q where: mapoflist L tpi, vq v at index i in Lu. 21 / / 75 Small-footprint specification of quicksort Segment splitting in Quicksort Exercise: give a small-footprint specification for quicksort. use p Cells M with some constraints to describe a segment, use sortedseg i j M to assert that a segment is sorted, use permut M M 1 to assert that values in a segment are dom M [i, j] ñ tp Cells Mu pqsort i j pq tλ. DM 1. p Cells M 1 rsortedseg i j M 1 s rpermut M M 1 s u Assume dom M [i, j] with j i ą 1. Then: p Cells M p Cells pm [i,m 1] q p Cells pm [m,m] q p Cells pm [m`1,j] q Note that: p Cells pm [m,m] q prms ÞÑ Mrms In recursive calls, we frame over the cells that are not involved. 23 / / 75

7 Operations on groups of cells Convenient specifications for operating directly on groups of cells: Summary Representation of a full array using a list: p Array L p.length ÞÑ L ç v at index i in L pris ÞÑ v i P dom M ñ tp Cells Mu parray.get i pq tλx. rx Mriss p Cells Mu tp Cells Mu parray.set i p vq tλ. p Cells pmri : vsqu Small footprint accesses: tpris ÞÑ u parray.get i pq tλ. pris ÞÑ vu tpris ÞÑ vu parray.set i p vq tλx. rx vs pris ÞÑ vu tp.length ÞÑ nu parray.length pq tλx. rx ns p.length ÞÑ nu Representation of a set of array cells using a finite map: æ p Cells M pris ÞÑ v pi,vqpm 25 / / 75 Definition of Hprop Chapter 9 Heap entailment Let: For example: Hprop Heap Ñ Prop r s : Hprop l ÞÑ v : Hprop H 1 H 2 : Hprop In particular: p q : Hprop Ñ Hprop Ñ Hprop 27 / / 75

8 The separation algebra Extensionality Associativity: ph 1 H 2 q H 3 H 1 ph 2 H 3 q Commutativity: H 1 H 2 H 2 H 1 Functional extensionality: Propositional extensionality: p@x. f x g xq ñ pf gq pif f,g:añbq Neutral element: H r s H pp ô Qq ñ pp Qq pif P,Q:Propq Predicate extensionality: Extrusion of existentials: pdx. H 1 q H 2 Dx. ph 1 H 2 q pif xrh 2 q p@x. P x ô Q xq ñ pp Qq pif P,Q:AÑPropq Extrusion of pure facts: prp s Hq m P ^ ph mq Heap predicate extensionality: p@m. H m ô H 1 mq ô ph H 1 q pif H,H 1 :Hpropq 29 / / 75 Heap entailment Heap entailment as a partial order Definition: H 1 Ź H H 1 m ñ H 2 m H 1 Ź H H 1 m ñ H 2 m For example: pr ÞÑ 6q Ź Dn. pr ÞÑ nq reven ns Thanks to pźq, we never need to manipulate heaps explicitly. The relation pźq defines a partial order on the type Hprop: reflexivity H Ź H transitivity H 1 Ź H 2 H 2 Ź H 3 H 1 Ź H 3 antisymmetry H 1 Ź H 2 H 2 Ź H 1 H 1 H 2 31 / / 75

9 Frame property for heap entailment Heap implications: true or false? For example, to prove: it suffices and prove: H 1 Ź H 1 1 H 1 H 2 Ź H 1 1 H 2 entail-frame pr ÞÑ 2q ps ÞÑ 3q Ź pr ÞÑ 2q pt ÞÑ nq ps ÞÑ 3q Ź pt ÞÑ nq. 1. pr ÞÑ 3q ps ÞÑ 4q Ź ps ÞÑ 4q pr ÞÑ 3q 2. pr ÞÑ 3q Ź ps ÞÑ 4q pr ÞÑ 3q 3. ps ÞÑ 4q pr ÞÑ 3q Ź pr ÞÑ 4q 4. ps ÞÑ 4q pr ÞÑ 3q Ź pr ÞÑ 3q 5. rfalses pr ÞÑ 3q Ź ps ÞÑ 4q pr ÞÑ 4q 6. pr ÞÑ 4q ps ÞÑ 3q Ź rfalses 7. pr ÞÑ 4q pr ÞÑ 3q Ź rfalses 8. pr ÞÑ 3q pr ÞÑ 3q Ź rfalses true false false false true false true true 33 / / 75 Instantiation of existentials and propositions pr ÞÑ 6q Ź pdn. pr ÞÑ nq reven nsq To prove the above, we exhibit an even number n for which r ÞÑ n. Rules: H 1 Ź prx Ñ vs H 2 q ph 1 Ź H 2 q P exists-r H 1 Ź pdx. H 2 q H 1 Ź ph 2 rp sq prop-r Example: pr ÞÑ 6q Ź pr ÞÑ 6q refl even 6 math prop-r pr ÞÑ 6q Ź pr ÞÑ 6q reven 6s pr ÞÑ 6q Ź rn Ñ 6s ppr ÞÑ nq reven nsq subst pr ÞÑ 6q Ź Dn. pr ÞÑ nq reven ns exists-r Extraction of existentials and propositions pdn. reven ns pr ÞÑ nqq Ź pdm. reven ms pr ÞÑ m ` 2qq To prove the above, we show that for any even number n, we have: pr ÞÑ nq Ź Dm. reven ms pr ÞÑ m ` 2q Reasoning ph 1 Ź H 2 q P ñ ph 1 Ź H 2 q exists-l prop-l pdx. H 1 q Ź H 2 prp s H 1 q Ź H 2 Same with explicit proof contexts: Γ, x : A $ H 1 Ź H 2 Γ $ pdpx : Aq. H 1 q Ź H 2 pxrh 2 q Γ, h : P $ H 1 Ź H 2 Γ $ prp s H 1 q Ź H 2 35 / / 75

10 Heap implications: true or false? Proving heap entailment relations 1. pr ÞÑ 3q Ź Dn. pr ÞÑ nq 2. Dn. pr ÞÑ nq Ź pr ÞÑ 3q 3. Dn. pr ÞÑ nq rn ą 0s Ź Dn. rn ą 1s pr ÞÑ pn 1qq 4. pr ÞÑ 3q ps ÞÑ 3q Ź Dn. pr ÞÑ nq ps ÞÑ nq 5. Dn. pr ÞÑ nq rn ą 0s rn ă 0s Ź pr ÞÑ nq pr ÞÑ nq true false true true true Systematic approach to dealing with heap entailment: 1. extract from left hand side, 2. instantiate in right hand side, 3. cancel equal predicates on both sides. Example: a : int, a ą 5 $ pr ÞÑ 3q ps ÞÑ aq Ź pr ÞÑ 3q ps ÞÑ aq a : int, a ą 5 $ pr ÞÑ 3q ps ÞÑ aq Ź pr ÞÑ 3q ps ÞÑ 3 ` pa 3qq a : int, a ą 5 $ pr ÞÑ 3q ps ÞÑ aq Ź Dm. pr ÞÑ 3q ps ÞÑ 3 ` mq a : int, a ą 5 $ pr ÞÑ 3q ps ÞÑ aq Ź Dnm. pr ÞÑ nq ps ÞÑ n ` mq H $ Da. ra ą 5s pr ÞÑ 3q ps ÞÑ aq Ź Dnm. pr ÞÑ nq ps ÞÑ n ` mq H $ pr ÞÑ 3q Da. ra ą 5s ps ÞÑ aq Ź Dnm. ps ÞÑ n ` mq pr ÞÑ nq 37 / / 75 Summary p q is associative, commutative, and has r s as neutral element. Existentials and pure facts may be extruded from stars. pźq is a partial order, satisfying the frame property. rfalses Ź H is always true. Chapter 10 Structural rules pr ÞÑ nq pr ÞÑ mq is equivalent to rfalses. Strategy: extract from the right, instantiate on the left, then cancel out. 39 / / 75

11 Frame rule Consequence rule th 1 u t tλx. H 1 1u th 1 H 2 u t tλx. H 1 1 H 2 u H Ź H 1 th 1 u t tq 1 u Q 1 Ź Q consequence Reformulation: th 1 u t tq 1 u th 1 H 2 u t tq 1 H 2 u frame with the overloading: Q 1 Ź pq 1 x Ź Q xq with the overloading: Q H λx. pq x Hq Note that H and H 1 must cover the same set of memory cells, that is, no garbage collection is allowed here. Similarly for Q and Q / / 75 Recall the need for garbage collection Garbage collection rule let myref x = let r = ref x in let s = ref r in r thu t tq GCu gc-post where: GC DH 1. H 1 From: To: tr su pmyref xq tλr. r ÞÑ x Ds. s ÞÑ ru tr su pmyref xq tλr. r ÞÑ xu Same as: thu t tλx. pq x DH 1. H 1 qu Can the following rule be used? thu t tq H 1 u gc-post Observe that H 1 may depend on the return value x: For pλr. r ÞÑ x Ds. s ÞÑ rq, we may instantiate H 1 as pds. s ÞÑ rq. 43 / / 75

12 Garbage collection in the pre-condition th GCu t tqu gc-pre th H 1 u t tqu gc-pre Exercise: show that gc-pre is derivable from gc-post and frame. Combined structural rule H Ź H 1 th 1 u t tq 1 u Q 1 Ź Q consequence thu t tq GCu gc-post th 1 u t tq 1 u th 1 H 2 u t tq 1 H 2 u frame Proof: thu t tq GCu gc-post th 1 u t tq 1 u th 1 H 2 u t tq 1 H 2 u frame th GCu t tq GCu frame gc-post th GCu t tqu H H 1 H 2 th 1 u t tq 1 u Q 1 H 2 Q frame H Ź H 1 H 2 th 1 u t tq 1 u Q 1 H 2 Ź Q GC combined 45 / / 75 Extraction of existentials and propositions Application: copying a tree with invariants tdn. pr ÞÑ nq reven nsu p!rq tλx....u To prove the above, we need to show that: even n ñ tr ÞÑ nu p!rq tdx. Hu t tqu exists P ñ trp s Hu t tqu prop Specification of copy for binary trees: tp Mtree T u pcopy pq tλp 1. p Mtree T p 1 Mtree T u Description of complete binary trees: p MtreeComplete T Dn. pp Mtree T q rdepth n T s Exercise: give a specification of copy in terms of MtreeComplete; which rules are used to derive this specification? tp MtreeComplete T u pcopy pq tλp 1. p MtreeComplete T p 1 MtreeComplete T u 47 / / 75

13 Proof of the derived specification (1) By unfolding of MtreeComplete: tdn. pp Mtree T q rdepth n T su pcopy pq tλp 1. Dn. pp Mtree T q rdepth n T s Dn. pp 1 Mtree T q rdepth n T s u (2) By the exists and prop depth n T ñ tp Mtree T u pcopy pq tλp 1. Dn. pp Mtree T q rdepth n T s Dn. pp 1 Mtree T q rdepth n T s u (3) By the consequence rule: p Mtree T p 1 Mtree T Ź Dn. pp Mtree T q rdepth n T s Dn. pp 1 Mtree T q rdepth n T s (4) Conclude using comm., assoc., extrusion, and exists-r and prop-r. 49 / 75 Summary Structural rules: H Ź H 1 H 2 th 1 u t tq 1 u Q 1 H 2 Ź Q GC tdx. Hu t tqu exists Other structural rules are derivable. P ñ trp s Hu t tqu prop 50 / 75 Reasoning rule for sequences Chapter 11 Reasoning rules for terms Example: tr ÞÑ nu pincr rq tλ. r ÞÑ n ` 1u tr ÞÑ n ` 1u p!rq tλx. rx n ` 1s r ÞÑ n ` 1u tr ÞÑ nu pincr r;!rq tλx. rx n ` 1s r ÞÑ n ` 1u Exercise: complete the rule for sequences. t...u t 1 t...u t...u t 2 t...u thu pt 1 ; t 2 q tqu 51 / / 75

14 Reasoning rule for sequences Reasoning rule for let-bindings Solution 1: thu t 1 tλ. H 1 u thu pt 1 ; t 2 q tqu th 1 u t 2 tqu Exercise: complete the reasoning rule for let-bindings. t...u t 1 `t...u t 2 t...u thu plet x t 1 in t 2 q tqu Solution 2: thu t 1 tq 1 u tq 1 pqu t 2 tqu thu pt 1 ; t 2 q tqu seq Solution: thu t 1 tq 1 tq 1 xu t 2 tqu thu plet x t 1 in t 2 q tqu let Remark: Q 1 λ. H 1 is equivalent to Q 1 pq H / / 75 Example of let-binding thu t 1 tq 1 tq 1 xu t 2 tqu thu plet x t 1 in t 2 q tqu Exercise: instantiate the rule for let-bindings on the following code. Solution: tr ÞÑ 3u plet a =!r in a+1q tqu H pr ÞÑ 3q Q λx. rx 4s pr ÞÑ 3q Q 1 λy. ry 3s pr ÞÑ 3q Reasoning rule for values Example: Rule: t r s u 3 tλx. rx 3su t r s u v tλx. rx vsu val Exercise: state a reasoning rule for values using a heap implication. Solution:... Ź... thu v tqu H Ź Q v thu v tqu val-frame 55 / / 75

15 Derivability of the val-frame rule Reasoning rule for conditionals Proof: H Ź Q v thu v tqu val-frame H Ź Q v hypothesis t r s u v tλx. rx vsu x v ñ ph Ź Q xq subst thu v tλx. rx vs Hu prx vs Hq Ź pq xq prop-l def of Ź pλx. rx vs Hq Ź Q conseq thu v tqu Rule: pv true ñ thu t 1 tquq pv false ñ thu t 2 tquq thu pif v then t 1 else t 2 q tqu Transformation to A-normal form: pif t 0 then t 1 else t 2 q plet v t 0 in pif v then t 1 else t 2 qq 57 / / 75 Reasoning rule for top-level functions Verification of a simple function Rule: v 1 λx. t thu prx Ñ v 2 s tq tqu thu pv 1 v 2 q tqu Transformation to A-normal form: pt 1 t 2 q plet f t 1 in let v t 2 in pf vqq Specification: let incr r = let a =!r in r := tr ÞÑ nu pincr rq tλ. r ÞÑ n ` 1u Verification: Fix r and n. We need to prove that the body satisfies the specification: tr ÞÑ nu plet a =!r in r := a+1q tλ. r ÞÑ n ` 1u We conclude using the let-binding rule: Q 1 λx. rx ns pr ÞÑ nq. 59 / / 75

16 Reasoning rule for top-level recursive functions Verification of a recursive function Rule: v 1 μf.λx.t thu prf Ñ v 1 s rx Ñ v 2 s tq tqu thu pv 1 v 2 q tqu Specification of recursive functions may be established by induction. let rec mlength (p: a cell) = if p == null then 0 else let p = p.tl in let n = mlength p in 1 + n tp Mlist Lu pmlength pq tλn. rn L s p Mlist Lu We prove this specification by induction on L. Consider p and L. Apply the if rule. 61 / / 75 Verification of mlength: nil case Case p null. Goal is: tp Mlist Lu p0q tλn. rn L s p Mlist Lu Replace p with null. Rewrite null Mlist L to rl nils in the pre and the post. By the prop rule: Replace L with nil. L nil ñ tr su p0q tλn. rn L s rl nilsu Apply the val-frame rule. tr su p0q tλn. rn nil s rnil nilsu r s Ź r0 0s rnil nils Verification of mlength: cons case (1/2) Case p null. Goal is: tp Mlist Lu plet p = p.tl in let n = mlength p in 1 + n q tλn. rn L s p Mlist Lu Unfold Mlist in pre and post, and decompose L as x :: L 1 : p 1 Mlist L 1 p t hd=x; tl=p 1 u Apply the let-binding rule, and the read axiom. Remains: tp 1 Mlist L 1 p t hd=x; tl=p 1 u u plet n = mlength p in 1 + n q tλn. rn L s p 1 Mlist L 1 p t hd=x; tl=p 1 u u Apply the frame rule to remove: p t hd=x; tl=p 1 u. Apply the let-binding rule with : Q λn 1. rn 1 L 1 s p 1 Mlist L / / 75

17 Verification of mlength: cons case (2/2) Reasoning rule for local functions There remains to prove the two premises of the let-rule. First branch, exploit the induction hypothesis: tp 1 Mlist L 1 u pmlength p q tλn 1. rn L 1 s p 1 Mlist L 1 u Second branch: tp 1 Mlist L 1 rn 1 L 1 su p1 + n q tλn. rn L s p 1 Mlist L 1 u Apply the prop rule and the val-frame rule. n 1 L 1 ñ p 1 Mlist L 1 Ź r1 ` n 1 L s p 1 Mlist L 1 Cancel equal parts, conclude using L x :: L 1 1 ` L 1 1 ` n 1. Rule p...q ñ thu t 2 tqu thu plet rec f x t 1 in t 2 q tqu Hypothesis about 1 Q 1. th 1 u t 1 tq 1 u ñ th 1 u pf xq tq 1 u `@xh 1 Q 1. th 1 u t 1 tq 1 u ñ th 1 u pf xq tq 1 u ñ thu t 2 tqu thu plet rec f x t 1 in t 2 q tqu 65 / / 75 Summary t r s u v tλx. rx vsu thu t 1 tq 1 tq 1 xu t 2 tqu thu plet x t 1 in t 2 q tqu Summary of Course 2 v true ñ thu t 1 tqu v false ñ thu t 2 tqu thu pif v then t 1 else t 2 q `@xh 1 Q 1. th 1 u t 1 tq 1 u ñ th 1 u pf xq tq 1 u ñ thu t 2 tqu thu plet rec f x t 1 in t 2 q tqu 67 / / 75

18 Summary of chapter 7 th 1 u t tλx. H 1 1u th 1 H 2 u t tλx. H 1 1 H 2 u frame In-place mutable list increment, when L x :: L 1. p Mlist L p t hd=x; tl=p 1 u p 1 Mlist L 1 by unfolding p t hd=x ` 1; tl=p 1 u p 1 Mlist L 1 p 1 Mlist L 1 p 1 Mlist pmap p`1q L 1 q p t hd=x ` 1; tl=p 1 u p 1 Mlist pmap p`1q L 1 q p Mlist ppx ` 1q :: pmap p`1q L 1 qq p Mlist pmap p`1q Lq incrementing frame begins by induction frame ends by folding by rewriting Summary of chapter 8 Small footprint specification for C-style memory accesses: tp ÞÑ wu p*p = vq tλ. p ÞÑ vu tp ÞÑ vu p*pq tλx. rx vs p ÞÑ vu Representation of a full array using a list: p Array L p.length ÞÑ L ç v at index i in L Representation of a set of array cells using a finite map: æ p Cells M pris ÞÑ v pi,vqpm pris ÞÑ v 69 / / 75 Summary of chapter 9 Summary of chapter 10 p q is associative, commutative, and has r s as neutral element. pźq is a partial order, regular w.r.t. p q. rfalses Ź H is always true. pr ÞÑ nq pr ÞÑ mq is equivalent to rfalses. Strategy: extract from the right, instantiate on the left, then cancel out. Structural rules: H Ź H 1 H 2 th 1 u t tq 1 u Q 1 H 2 Ź Q GC tdx. Hu t tqu exists Other structural rules are derivable. P ñ trp s Hu t tqu prop 71 / / 75

19 Summary of chapter 11 Exercises t r s u v tλx. rx vsu thu t 1 tq 1 tq 1 xu t 2 tqu thu plet x t 1 in t 2 q tqu v true ñ thu t 1 tqu v false ñ thu t 2 tqu thu pif v then t 1 else t 2 q tqu Exam from 2015, Exercise 2: Operations on binary search trees. Available from the webpage of the `@xh 1 Q 1. th 1 u t 1 tq 1 u ñ th 1 u pf xq tq 1 u ñ thu t 2 tqu thu plet rec f x t 1 in t 2 q tqu 73 / / 75 The end! 75 / 75

Focus rules for segments. Focus and defocus rules for concatenation. Mlength with a while loop. Mlength with a while loop.

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 information

Separation Logic. Part 3. Arthur Charguéraud. February / 66

Separation 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 information

Example of a for-loop. Separation Logic. The repeat construct. Reasoning rule for for-loops. Before the loop:

Example 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 information

Separation Logic 4/4. Chapter 18. Integration of structural rules. Definition of the local predicate (1/2)

Separation Logic 4/4. Chapter 18. Integration of structural rules. Definition of the local predicate (1/2) Separation Logic 4/4 Arthur Charguéraud Chapter 18 Characteristic Formulae with structural rules Febuary 22th, 2016 1 / 72 2 / 72 Integration of structural rules Definition of the local predicate (1/2)

More information

A 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 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 information

For example, p12q p2x 1 x 2 ` 5x 2 x 2 3 q 2x 2 x 1 ` 5x 1 x 2 3. (a) Let p 12x 5 1x 7 2x 4 18x 6 2x 3 ` 11x 1 x 2 x 3 x 4,

For example, p12q p2x 1 x 2 ` 5x 2 x 2 3 q 2x 2 x 1 ` 5x 1 x 2 3. (a) Let p 12x 5 1x 7 2x 4 18x 6 2x 3 ` 11x 1 x 2 x 3 x 4, SOLUTIONS Math A4900 Homework 5 10/4/2017 1. (DF 2.2.12(a)-(d)+) Symmetric polynomials. The group S n acts on the set tx 1, x 2,..., x n u by σ x i x σpiq. That action extends to a function S n ˆ A Ñ A,

More information

PRINCIPLES OF ANALYSIS - LECTURE NOTES

PRINCIPLES OF ANALYSIS - LECTURE NOTES PRINCIPLES OF ANALYSIS - LECTURE NOTES PETER A. PERRY 1. Constructions of Z, Q, R Beginning with the natural numbers N t1, 2, 3,...u we can use set theory to construct, successively, Z, Q, and R. We ll

More information

DS-GA 1002: PREREQUISITES REVIEW SOLUTIONS VLADIMIR KOBZAR

DS-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 information

Extensive Form Abstract Economies and Generalized Perfect Recall

Extensive 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 information

L11: Algebraic Path Problems with applications to Internet Routing Lecture 9

L11: 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 information

The Locally Nameless Representation

The 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 information

HOMEWORK 4 MATH B4900 DUE: 2/28/ Annihilators. Let R be a ring with 1, and let M be an R-module. The annihilator of M in R is

HOMEWORK 4 MATH B4900 DUE: 2/28/ Annihilators. Let R be a ring with 1, and let M be an R-module. The annihilator of M in R is HOMEWORK 4 MATH B4900 DUE: 2/28/2018 SOLUTIONS Math B4900 Homework 4 2/28/2018 1. Annihilators. Let R be a ring with 1, and let M be an R-module. The annihilator of M in R is (a) Show that AnnpMq is an

More information

4 Quantifiers and Quantified Arguments 4.1 Quantifiers

4 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 information

Logic 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 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 information

L11: 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. 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 information

NOTES WEEK 01 DAY 1 SCOT ADAMS

NOTES 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 information

REAL ANALYSIS II TAKE HOME EXAM. T. Tao s Lecture Notes Set 5

REAL ANALYSIS II TAKE HOME EXAM. T. Tao s Lecture Notes Set 5 REAL ANALYSIS II TAKE HOME EXAM CİHAN BAHRAN T. Tao s Lecture Notes Set 5 1. Suppose that te 1, e 2, e 3,... u is a countable orthonormal system in a complex Hilbert space H, and c 1, c 2,... is a sequence

More information

Homework for MATH 4604 (Advanced Calculus II) Spring 2017

Homework for MATH 4604 (Advanced Calculus II) Spring 2017 Homework for MATH 4604 (Advanced Calculus II) Spring 2017 Homework 14: Due on Tuesday 2 May 55. Let m, n P N, A P R mˆn and v P R n. Show: L A pvq 2 ď A 2 v 2. 56. Let n P N and let A P R nˆn. Let I n

More information

Iris: Higher-Order Concurrent Separation Logic. Lecture 4: Basic Separation Logic: Proving Pointer Programs

Iris: 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 information

NOTES WEEK 13 DAY 2 SCOT ADAMS

NOTES 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 information

Differential Geometry

Differential Geometry Differential Geometry Rob Arthan, Roger Jones Abstract The theory of real vector spaces, norms and derivatives of functions between normed vector spaces as required for formal modelling of some physical

More information

NOTES WEEK 15 DAY 1 SCOT ADAMS

NOTES 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 information

MTH 505: Number Theory Spring 2017

MTH 505: Number Theory Spring 2017 MTH 505: Number Theory Spring 2017 Homework 1 Drew Armstrong 1.1. From pn, σ, 0q to pn, `,, 0, 1q. Recall Peano s four axioms for the natural numbers: (P1) There exists a special element called 0 P N.

More information

Introduction to Permission-Based Program Logics Part II Concurrent Programs

Introduction 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 information

Dr. Marques Sophie Algebra 1 Spring Semester 2017 Problem Set 9

Dr. Marques Sophie Algebra 1 Spring Semester 2017 Problem Set 9 Dr. Marques Sophie Algebra Spring Semester 207 Office 59 marques@cims.nyu.edu Problem Set 9 Exercise 0 : Prove that every group of order G 28 must contain a normal subgroup of order 7. (Why should it contain

More information

APPROXIMATE HOMOMORPHISMS BETWEEN THE BOOLEAN CUBE AND GROUPS OF PRIME ORDER

APPROXIMATE HOMOMORPHISMS BETWEEN THE BOOLEAN CUBE AND GROUPS OF PRIME ORDER APPROXIMATE HOMOMORPHISMS BETWEEN THE BOOLEAN CUBE AND GROUPS OF PRIME ORDER TOM SANDERS The purpose of this note is to highlight a question raised by Shachar Lovett [Lov], and to offer some motivation

More information

Program Verification Using Separation Logic

Program 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 information

LECTURE 11: AXIOMATIC SET THEORY PART 3

LECTURE 11: AXIOMATIC SET THEORY PART 3 LECTURE 11: AXIOMATIC SET THEORY PART 3 1. Natural numbers and the ordinal ω Recall from last lecture that a set x is an ordinal just in case it is transitive and wellordered by P (membership). Note that

More information

( V ametavariable) P P true. even in E)

( V ametavariable) P P true. even in E) Propositional Calculus E Inference rules (3.1) Leibniz: (3.2) Transitivity: (3.3) Equanimity: P = Q E[V := P ]=E[V := Q] P = Q Q = R P = R P P Q Q ( V ametavariable) Derived inference rules (3.11) Redundant

More information

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Dynamic 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 information

Propositions and Proofs

Propositions 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 information

BOUNDS FOR HIGHER TOPOLOGICAL COMPLEXITY OF REAL PROJECTIVE SPACE IMPLIED BY BP

BOUNDS FOR HIGHER TOPOLOGICAL COMPLEXITY OF REAL PROJECTIVE SPACE IMPLIED BY BP BOUNDS FOR HIGHER TOPOLOGICAL COMPLEXITY OF REAL PROJECTIVE SPACE IMPLIED BY BP DONALD M. DAVIS Abstract. We use Brown-Peterson cohomology to obtain lower bounds for the higher topological complexity,

More information

Applied Logic for Computer Scientists. Answers to Some Exercises

Applied Logic for Computer Scientists. Answers to Some Exercises Applied Logic for Computer Scientists Computational Deduction and Formal Proofs Springer, 2017 doi: http://link.springer.com/book/10.1007%2f978-3-319-51653-0 Answers to Some Exercises Mauricio Ayala-Rincón

More information

m + q = p + n p + s = r + q m + q + p + s = p + n + r + q. (m + s) + (p + q) = (r + n) + (p + q) m + s = r + n.

m + q = p + n p + s = r + q m + q + p + s = p + n + r + q. (m + s) + (p + q) = (r + n) + (p + q) m + s = r + n. 9 The Basic idea 1 = { 0, 1, 1, 2, 2, 3,..., n, n + 1,...} 5 = { 0, 5, 1, 6, 2, 7,..., n, n + 5,...} Definition 9.1. Let be the binary relation on ω ω defined by m, n p, q iff m + q = p + n. Theorem 9.2.

More information

Existence and Consistency in Bounded Arithmetic

Existence and Consistency in Bounded Arithmetic Existence and Consistency in Bounded Arithmetic Yoriyuki Yamagata National Institute of Advanced Science and Technology (AIST) Kusatsu, August 30, 2011 Outline Self introduction Summary Theories of PV

More information

Very quick introduction to the conformal group and cft

Very 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 information

Flow 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 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 information

Structuring the verification of heap-manipulating programs

Structuring 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 information

Symmetries of Weight Enumerators

Symmetries of Weight Enumerators Martino Borello (Paris 8-LAGA) Trento, 16.11.2016 1 / 23 Symmetries of Weight Enumerators Martino Borello Université Paris 8 - LAGA Trento, 16.11.2016 Martino Borello (Paris 8-LAGA) Trento, 16.11.2016

More information

King s Research Portal

King s Research Portal King s Research Portal Document Version Version created as part of publication process; publisher's layout; not normally made publicly available Link to publication record in King's Research Portal Citation

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare 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 information

Random Variables. Andreas Klappenecker. Texas A&M University

Random 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 information

Existence of weak adiabatic limit in almost all models of perturbative QFT

Existence of weak adiabatic limit in almost all models of perturbative QFT Existence of weak adiabatic limit in almost all models of perturbative QFT Paweł Duch Jagiellonian University, Cracow, Poland LQP 40 Foundations and Constructive Aspects of Quantum Field Theory, 23.06.2017

More information

Verified 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 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 information

Computational Logic for Computer Science

Computational Logic for Computer Science Motivation: formalization - proofs & deduction Computational proofs - logic & deduction Formal proofs Pr Computational Logic for Computer Science Mauricio Ayala-Rinco n & Fla vio L.C. de Moura Grupo de

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

An Entailment Checker for Separation Logic with Inductive Definitions

An Entailment Checker for Separation Logic with Inductive Definitions An Entailment Checker for Separation Loic with Inductive Definitions Radu Iosif, Cristina Serban Université de Grenoble Alpes, CNRS, VERIMAG July 18, 2018 Cristina Serban (VERIMAG) An Entailment Checker

More information

Flow 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 Flow Interfaces Compositional Abstractions of Concurrent Data Structures Siddharth Krishna, Dennis Shasha, and Thomas Wies Background Verifying programs, separation logic, inductive predicates Verifying

More information

Views: Compositional Reasoning for Concurrent Programs

Views: 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 information

Lectures on Separation Logic. Lecture 2: Foundations

Lectures on Separation Logic. Lecture 2: Foundations Lectures on Separation Logic. Lecture 2: Foundations Peter O Hearn Queen Mary, University of London Marktoberdorf Summer School, 2011 Outline for this lecture Part I : Assertions and Their Semantics Part

More information

On Borel maps, calibrated σ-ideals and homogeneity

On Borel maps, calibrated σ-ideals and homogeneity On Borel maps, calibrated σ-ideals and homogeneity Institute of Mathematics University of Warsaw Ideals and exceptional sets in Polish spaces, Lausanne, 4-8 June 2018 The results come from a joint paper

More information

Flag Varieties. Matthew Goroff November 2, 2016

Flag Varieties. Matthew Goroff November 2, 2016 Flag Varieties Matthew Goroff November 2, 2016 1. Grassmannian Variety Definition 1.1: Let V be a k-vector space of dimension n. The Grassmannian Grpr, V q is the set of r-dimensional subspaces of V. It

More information

Induction and Recursion

Induction and Recursion Induction and Recursion Prof. Clarkson Fall 2016 Today s music: Dream within a Dream from the soundtrack to Inception by Hans Zimmer Review Previously in 3110: Behavioral equivalence Proofs of correctness

More information

Probability Generating Functions

Probability Generating Functions Probability Generating Functions Andreas Klappenecker Texas A&M University 2018 by Andreas Klappenecker. All rights reserved. 1 / 27 Probability Generating Functions Definition Let X be a discrete random

More information

CS 151. Red Black Trees & Structural Induction. Thursday, November 1, 12

CS 151. Red Black Trees & Structural Induction. Thursday, November 1, 12 CS 151 Red Black Trees & Structural Induction 1 Announcements Majors fair tonight 4:30-6:30pm in the Root Room in Carnegie. Come and find out about the CS major, or some other major. Winter Term in CS

More information

1. Examples. We did most of the following in class in passing. Now compile all that data.

1. Examples. We did most of the following in class in passing. Now compile all that data. SOLUTIONS Math A4900 Homework 12 11/22/2017 1. Examples. We did most of the following in class in passing. Now compile all that data. (a) Favorite examples: Let R tr, Z, Z{3Z, Z{6Z, M 2 prq, Rrxs, Zrxs,

More information

NOTES FOR BEILINSON-DRINFELD SEMINAR - EVEN SHORTER VERSION. Contents 1. Overview Steenrod s construction

NOTES FOR BEILINSON-DRINFELD SEMINAR - EVEN SHORTER VERSION. Contents 1. Overview Steenrod s construction NOTES FOR BEILINSON-DRINFELD SEMINAR - EVEN SHORTER VERSION GUS LONERGAN Abstract. We use Steenrod s construction to prove that the quantum Coulomb branch is a Frobenius-constant quantization. Contents

More information

A TASTE OF COMBINATORIAL REPRESENTATION THEORY. MATH B4900 5/02/2018

A TASTE OF COMBINATORIAL REPRESENTATION THEORY. MATH B4900 5/02/2018 A TASTE OF COMBINATORIAL REPRESENTATION THEORY. MATH B4900 5/02/2018 Young s Lattice is an infinite leveled labeled graph with vertices and edges as follows. Vertices: Label vertices in label vertices

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 101, Winter 2018 Design and Analysis of Algorithms Lecture 5: Divide and Conquer (Part 2) Class URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ A Lower Bound on Convex Hull Lecture 4 Task: sort the

More information

we can assume without loss of generality that x and y are of the form x pabcq and y pbcdq,

we can assume without loss of generality that x and y are of the form x pabcq and y pbcdq, 1. Symmetric and alternating groups. SOLUTIONS Math A4900 Homework 9 11/1/2017 (a) In class we showed that S n is generated by T tpi jq 1 ď i ă j ď nu, the set of transpositions in S n. Show by induction

More information

HOPF ALGEBRAS AND LIE ALGEBRAS UCHICAGO PRO-SEMINAR - JANUARY 9, 2014

HOPF ALGEBRAS AND LIE ALGEBRAS UCHICAGO PRO-SEMINAR - JANUARY 9, 2014 HOPF ALGEBRAS AND LIE ALGEBRAS UCHICAGO PRO-SEMINAR - JANUARY 9, 2014 Hopf Algebras Lie Algebras Restricted Lie Algebras Poincaré-Birkhoff-Witt Theorem Milnor-Moore Theorem Cohomology of Lie Algebras Remark

More information

q-de Rham cohomology via Λ-rings

q-de Rham cohomology via Λ-rings q-de Rham cohomology via Λ-rings J.P.Pridham arxiv:1608.07142 1 / 21 q-analogues (Gauss) rns q : qn 1 q 1 1 q... qn 1 rns q! : rns q... r2s q r1s q, ¹ n 1 i 0 n 1 ¹ i 0 p1 p1 n k q : rns q! rn ksq!rksq!

More information

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

Introduction to computability Tutorial 7

Introduction 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 information

NOTES WEEK 02 DAY 1. THEOREM 0.3. Let A, B and C be sets. Then

NOTES 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 information

Math 230 Final Exam, Spring 2009

Math 230 Final Exam, Spring 2009 IIT Dept. Applied Mathematics, May 13, 2009 1 PRINT Last name: Signature: First name: Student ID: Math 230 Final Exam, Spring 2009 Conditions. 2 hours. No book, notes, calculator, cell phones, etc. Part

More information

Computability and Complexity Results for a Spatial Assertion Language for Data Structures

Computability 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 information

Hoare Examples & Proof Theory. COS 441 Slides 11

Hoare 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 information

Iris: Higher-Order Concurrent Separation Logic. Lecture 9: Concurrency Intro and Invariants

Iris: 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 information

Review: Review: 'pgq imgp'q th P H h 'pgq for some g P Gu H; kerp'q tg P G 'pgq 1 H u G.

Review: Review: 'pgq imgp'q th P H h 'pgq for some g P Gu H; kerp'q tg P G 'pgq 1 H u G. Review: A homomorphism is a map ' : G Ñ H between groups satisfying 'pg 1 g 2 q 'pg 1 q'pg 2 q for all g 1,g 2 P G. Anisomorphism is homomorphism that is also a bijection. We showed that for any homomorphism

More information

Models of Computation,

Models of Computation, Models of Computation, 2010 1 Induction We use a lot of inductive techniques in this course, both to give definitions and to prove facts about our semantics So, it s worth taking a little while to set

More information

arxiv: v2 [math.ca] 13 May 2015

arxiv: v2 [math.ca] 13 May 2015 ON THE CLOSURE OF TRANSLATION-DILATION INVARIANT LINEAR SPACES OF POLYNOMIALS arxiv:1505.02370v2 [math.ca] 13 May 2015 J. M. ALMIRA AND L. SZÉKELYHIDI Abstract. Assume that a linear space of real polynomials

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical 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 information

Theorem The simple finite dimensional sl 2 modules Lpdq are indexed by

Theorem The simple finite dimensional sl 2 modules Lpdq are indexed by The Lie algebra sl 2 pcq has basis x, y, and h, with relations rh, xs 2x, rh, ys 2y, and rx, ys h. Theorem The simple finite dimensional sl 2 modules Lpdq are indexed by d P Z ě0 with basis tv`, yv`, y

More information

Proofs. Chapter 2 P P Q Q

Proofs. Chapter 2 P P Q Q Chapter Proofs In this chapter we develop three methods for proving a statement. To start let s suppose the statement is of the form P Q or if P, then Q. Direct: This method typically starts with P. Then,

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

arxiv: v1 [math.nt] 3 May 2017

arxiv: v1 [math.nt] 3 May 2017 arxiv:1705.01363v1 [math.nt] 3 May 2017 Expansions of arithmetic functions of several variables with respect to certain modified unitary Ramanujan sums László Tóth Department of Mathematics, University

More information

Semantic Groundedness I: Kripke and Yablo

Semantic Groundedness I: Kripke and Yablo Semantic Groundedness I: Kripke and Yablo Jönne Speck 21st April 2012 The full Tarski T-schema leads to paradox. It is consistent, if restricted to sentences without truth predicate but we want more. What

More information

Data selection. Lower complexity bound for sorting

Data selection. Lower complexity bound for sorting Data selection. Lower complexity bound for sorting Lecturer: Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 12 1 Data selection: Quickselect 2 Lower complexity bound for sorting 3 The

More information

CS156: The Calculus of Computation Zohar Manna Autumn 2008

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

More information

On Monoids over which All Strongly Flat Right S-Acts Are Regular

On Monoids over which All Strongly Flat Right S-Acts Are Regular Æ26 Æ4 ² Vol.26, No.4 2006µ11Â JOURNAL OF MATHEMATICAL RESEARCH AND EXPOSITION Nov., 2006 Article ID: 1000-341X(2006)04-0720-05 Document code: A On Monoids over which All Strongly Flat Right S-Acts Are

More information

Sobolev-Type Extremal Polynomials

Sobolev-Type Extremal Polynomials Soolev-Type Extremal Polyomials (case of the sigular measures) Ael Díaz-Gozález Joi with Héctor Pijeira-Carera ULL 2016 Soolev-Type Extremal Polyomials adiazgo@math.uc3m.es 1 / 18 Moic extremal polyomials

More information

Introduction to Randomized Algorithms: Quick Sort and Quick Selection

Introduction to Randomized Algorithms: Quick Sort and Quick Selection Chapter 14 Introduction to Randomized Algorithms: Quick Sort and Quick Selection CS 473: Fundamental Algorithms, Spring 2011 March 10, 2011 14.1 Introduction to Randomized Algorithms 14.2 Introduction

More information

Predicate Logic. Andreas Klappenecker

Predicate Logic. Andreas Klappenecker Predicate Logic Andreas Klappenecker Predicates A function P from a set D to the set Prop of propositions is called a predicate. The set D is called the domain of P. Example Let D=Z be the set of integers.

More information

NOTES WEEK 11 DAY 2 SCOT ADAMS

NOTES WEEK 11 DAY 2 SCOT ADAMS NOTES WEEK 11 DAY 2 SCOT ADAMS In Proposition 0.1 below, Bp0, δq is just the open interval p δ, δq and Bp0, x q is just the closed interval r x, x s. PROPOSITION 0.1. Let g : R R and let δ ą 0. Assume

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare 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 information

First-Order Predicate Logic. Basics

First-Order Predicate Logic. Basics First-Order Predicate Logic Basics 1 Syntax of predicate logic: terms A variable is a symbol of the form x i where i = 1, 2, 3.... A function symbol is of the form fi k where i = 1, 2, 3... und k = 0,

More information

Programming with Dependent Types in Coq

Programming 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 information

Mariusz Jurkiewicz, Bogdan Przeradzki EXISTENCE OF SOLUTIONS FOR HIGHER ORDER BVP WITH PARAMETERS VIA CRITICAL POINT THEORY

Mariusz Jurkiewicz, Bogdan Przeradzki EXISTENCE OF SOLUTIONS FOR HIGHER ORDER BVP WITH PARAMETERS VIA CRITICAL POINT THEORY DEMONSTRATIO MATHEMATICA Vol. XLVIII No 1 215 Mariusz Jurkiewicz, Bogdan Przeradzki EXISTENCE OF SOLUTIONS FOR HIGHER ORDER BVP WITH PARAMETERS VIA CRITICAL POINT THEORY Communicated by E. Zadrzyńska Abstract.

More information

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University COMP 182 Algorithmic Thinking Proofs Luay Nakhleh Computer Science Rice University 1 Reading Material Chapter 1, Section 3, 6, 7, 8 Propositional Equivalences The compound propositions p and q are called

More information

Symmetries of weight enumerators

Symmetries of weight enumerators Martino Borello (Paris 8-LAGA) Gaeta, 06.06.2017 0 / 13 Symmetries of weight enumerators Martino Borello Université Paris 8 - LAGA Fq13 Martino Borello (Paris 8-LAGA) Gaeta, 06.06.2017 1 / 13 Introduction

More information

A DG-based incompressible Navier-Stokes solver

A DG-based incompressible Navier-Stokes solver A DG-based incompressible Navier-Stokes solver Higer-order DG metods and finite element software for modern arcitectures - Bat 2016 Marian Piatkowski 1 Peter Bastian 1 1 Interdisciplinary Center for Scientific

More information

Learning Goals of CS245 Logic and Computation

Learning 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 information

Math 230 Final Exam, Spring 2008

Math 230 Final Exam, Spring 2008 c IIT Dept. Applied Mathematics, May 15, 2008 1 PRINT Last name: Signature: First name: Student ID: Math 230 Final Exam, Spring 2008 Conditions. 2 hours. No book, notes, calculator, cell phones, etc. Part

More information

The Approximation Theorem for the Λµ-Calculus

The Approximation Theorem for the Λµ-Calculus The Approximation Theorem for the Λµ-Calculus Ugo de Liguoro ICTCS 13 - September 2013, Palermo Parigot s λµ-calculus (1992) is an extension of the λ-calculus to compute with classical proofs However there

More information

Section 2.2 Set Operations. Propositional calculus and set theory are both instances of an algebraic system called a. Boolean Algebra.

Section 2.2 Set Operations. Propositional calculus and set theory are both instances of an algebraic system called a. Boolean Algebra. Section 2.2 Set Operations Propositional calculus and set theory are both instances of an algebraic system called a Boolean Algebra. The operators in set theory are defined in terms of the corresponding

More information

CS156: The Calculus of Computation

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

More information

Semilattice Modes II: the amalgamation property

Semilattice Modes II: the amalgamation property Semilattice Modes II: the amalgamation property Keith A. Kearnes Abstract Let V be a variety of semilattice modes with associated semiring R. We prove that if R is a bounded distributive lattice, then

More information

NOTES WEEK 04 DAY 1 SCOT ADAMS

NOTES WEEK 04 DAY 1 SCOT ADAMS NOTES WEEK 0 DAY 1 SCOT ADAMS DEFINITION 01 Let m, n P N, B P BpR m, R n q Let e 1,, e m be the standard basis of R m Let f 1,, f n be the standard basis of R n Then we define rbs P R nˆm by rbs ji Bpe

More information

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!!

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!! CSCE 222 Discrete Structures for Computing Review for Exam 1 Dr. Hyunyoung Lee 1 Topics Propositional Logic (Sections 1.1, 1.2 and 1.3) Predicate Logic (Sections 1.4 and 1.5) Rules of Inferences and Proofs

More information