Program Analysis. Lecture 5. Rayna Dimitrova WS 2016/2017
|
|
- Berniece Heath
- 5 years ago
- Views:
Transcription
1 Program Analysis Lecture 5 Rayna Dimitrova WS 2016/2017
2 2/21 Recap: Constant propagation analysis Goal: For each program point, determine whether a variale has a constant value whenever an execution reaches the respective lock. Applications: Useful for the constant folding optimization: a use of the variale can e replaced y the respective constant. Classification: This is a forward must analysis.
3 3/21 Recap : Constant propagation analysis (lattice) (D, ) := ((Vars (Z {?})) { }, ) Vars is the set of variales appearing in the program an element d (Vars (Z {?})) is a function d : Vars (Z {?}) such that for a variale v Vars d(v) Z indicates that the value of v is the constant d(v) d(v) =? indicates that the variale v is non-constant the least element indicates that no information is availale the partial ordering is defined y d for all d D, d1 d 2 if and only if for every v Vars we have that either d 1 (v), d 2 (v) Z and d 1 (v) = d 2 (v), or it holds that d 2 (v) =?
4 3/21 Recap : Constant propagation analysis (lattice) (D, ) := ((Vars (Z {?})) { }, ) Then, the inary join operation is such that d = d = d, for all d D for all d 1, d 2 D \ { } and every v Vars, { d 1 (v) if d 1 (v) = d 2 (v), (d 1 d 2 )(v) =? otherwise It is easy to check that (D, ) is a complete lattice.
5 4/21 Recap: Constant propagation analysis (transfer functions) To define the transfer functions, we first define astract evaluation of arithmetic expressions, which is a function eval that maps each arithmetic expression a and d D \ { } to an element of Z {?}. if a is a variale v, then eval(a, d) := d(v) if a is a constant k, then eval(a, d) := k if a = a 1 a 2, then eval(a, d) :=?, if eval(a1, d) =? or eval(a 2, d) =?, eval(a, d) :=?, if eval(a1, d) eval(a 2, d) is undefined, eval(a, d) := eval(a1, d) eval(a 2, d), otherwise For d (Vars (Z {?})), x, v Vars, and n Z {?}, define the function d[x n] : Vars (Z {?}), such that { n if v = x, d[x n](v) = d(v) otherwise.
6 4/21 Recap: Constant propagation analysis (transfer functions) for [x := a] let f (d) := for [read(x)] let f (d) := { if d =, d[x eval(a, d)] otherwise { if d =, d[x?] otherwise for [print(a)], for [skip], and for condition [e] let f (d) = d for all d D
7 5/21 Recap: Constant propagation analysis (example) [z > 0] 1 initial f ( ) = for {1,..., 7} [x := 2] 2 [x := 3] 4 [y := 3] 3 [y := 2] 5 [z := x + y] 6 For d D \ { } we have f 1 (d) = d f 2 (d) = d[x 2] f 3 (d) = d[y 3] f 4 (d) = d[x 3] f 5 (d) = d[y 2] f 6 (d) = d[z eval(x, d) + eval(y, d)] f 7 (d) = d [skip] 7
8 5/21 Recap: Constant propagation analysis (example) (n 1, n 2, n 3 ) denotes the function d(x) = n 1, d(y) = n 2, d(z) = n 3 least fixpoint X 1 = (?,?,?) X 2 = f 1 (X 1 ) X 3 = f 2 (X 2 ) X 4 = f 1 (X 1 ) X 5 = f 4 (X 4 ) X 6 = f 3 (X 3 ) f 5 (X 5 ) X 7 = f 6 (X 6 ) ((?,?,?), (?,?,?), (2,?,?), (?,?,?), (3,?,?), (?,?,?), (?,?,?)) From this solution we cannot infer the information that at the eginning of lock 7 the value of z is 5 regardless of the execution path.
9 6/21 Example: precision of the least fixpoint solution [z > 0] 1 [x := 2] 2 [x := 3] 4 [y := 3] 3 [y := 2] 5 [z := x + y] 6 f 6 (d) = d[z eval(x, d) + eval(y, d) For the least fixpoint we compute f 6 ((2, 3,?) (3, 2,?)) = f 6 ((?,?,?)) = (?,?,?) On the other hand f 6 ((2, 3,?)) f 6 ((3, 2,?)) = (2, 3, 5) (3, 2, 5) = (?,?, 5) [skip] 7
10 7/21 Join Over all Paths (JOP) solution Let S = (G = (B, E, F ), (D, ), i, {f } B ) e a dataflow system. A different solution method, called Join Over all Paths (JOP) propagates analysis information along paths in the program. Analysis information for lock : join over all execution paths leading to, most precise information for (reference solution) Remark : In the literature often you see Meet Over all Paths (MOP).
11 8/21 Join Over all Paths (JOP) solution Let S = (G = (B, E, F ), (D, ), i, {f } B ) e a dataflow system. A path to the entry of a lock from the initial lock is a list of locks traversed from the initial lock to (excluding ). Paths() = {[ 1,..., n 1 ] n 1, 1 is initial, n =, i < n : i+1 succ( i )} We say that a path [ 1,..., n 1 ] has length n 1. Remark: For ackward analysis we can consider paths to the exit of lock that follow reverse edges starting from the final node. Paths() = {[ 1,..., n 1 ] n 1, 1 is final, n =, i < n : i+1 pred( i )}
12 8/21 Join Over all Paths (JOP) solution Let S = (G = (B, E, F ), (D, ), i, {f } B ) e a dataflow system. With a path π = [ 1,..., k ] we associate the transfer function f π = f k f k 1... f 1 id. Thus, for the empty path ε, the transfer function f ε = id is identity. The JOP solution for B (up to ut not including ) is defined as X JOP := {f π (i) π Paths()}. The JOP solution of S is JOP(S) := (X JOP 1,..., X JOP B ).
13 9/21 JOP solution: example [z > 0] 1 [x := 2] 2 [x := 3] 4 [y := 3] 3 [y := 2] 5 [z := x + y] 6 [skip] 7 For lock 7 we have Paths(7) = {[1, 2, 3, 6], [1, 4, 5, 6]}. f [1,2,3,6] ((?,?,?)) = f 6 (f 3 (f 2 (f 1 (id((?,?,?)))))) = f 6 (f 3 (f 2 (f 1 ((?,?,?))))) = f 6 (f 3 (f 2 ((?,?,?)))) = f 6 (f 3 ((2,?,?))) = f 6 ((2, 3,?)) = (2, 3, 5) Similarly we compute f [1,4,5,6] ((?,?,?)) = (3, 2, 5)
14 9/21 JOP solution: example [z > 0] 1 [x := 2] 2 [x := 3] 4 [y := 3] 3 [y := 2] 5 [z := x + y] 6 For lock 7 we have Paths(7) = {[1, 2, 3, 6], [1, 4, 5, 6]}. X7 JOP = f [1,2,3,6] ((?,?,?)) f [1,4,5,6] ((?,?,?)) = (2, 3, 5) (3, 2, 5) = (?,?, 5) Recall that X LFP 7 = (?,?,?). Thus, X JOP 7 X LFP 7. [skip] 7 Note: In general, the set of paths in a program is infinite.
15 10/21 Least fixpoint as an approximation of JOP Let S = (G = (B, E, F ), (D, ), i, {f } B ) e a dataflow system. Let lfp(s) = (X LFP 1,..., X LFP B ) e the least fixpoint solution of S. Then, lfp(s) is a sound approximation of JOP(S). Theorem For every dataflow system S = (G = (B, E, F ), (D, ), i, {f } B ) (1) it holds for all B that X JOP X LFP. (2) if all functions f for B are distriutive (that is, for all d 1, d 2 D, f (d 1 ) f (d 2 ) = f (d 1 d 2 )), then for all B it holds that X JOP = X LFP, i.e., oth solutions coincide.
16 11/21 Proof of (1) By definition we have X JOP = {f π (i) π Paths()}. Let us define X JOP,n := {f π (i) π Paths(), π n}, for the paths of length less than or equal to n for n N. Then X JOP X JOP X LFP = {X JOP,n n N}, and so, we can show y proving that for all n N, X JOP,n We show y induction on n that for all n N, for all B it holds that X JOP,n X LFP. For n = 0 there are two possile cases 1) There is no path of length 0 in Paths(). Then X JOP,0 = = X LFP. 2) There exists a path of length 0 in Paths(). Then is an extremal node, and thus, X LFP We have X JOP,0 = i. = f ε (i) = id(i) = i. Thus, X JOP,0 X LFP. = X LFP.
17 11/21 Proof of (1) continued Induction hypothesis: for some n and all B, X JOP,n If is an extremal node, the only path is the empty path. Now, suppose that is not extremal. Then, X LFP. X LFP = {f p (Xp LFP ) p pred()} (X LFP is a solution) {f p (Xp JOP,n ) p pred()} (IH, f p monotonic) = {f p ( {f π (i) π Paths(p), π n}) p pred()} (definition of Xp JOP,n ) { {f p (f π (i)) π Paths(p), π n} p pred()} (f p is monotonic and thus, f p (d 1 ) f p (d 2 ) f p (d 1 d 2 )) = {f p (f π (i)) π Paths(p), π n, p pred()} = {f π (i)) π Paths(), π n + 1} = X JOP,n+1 (π = π p is path of length n + 1 to ; f π = f p f π ) (definition of Xp JOP,n+1 )
18 12/21 Distriutive frameworks A dataflow system S = (G = (B, E, F ), (D, ), i, {f } B ) in which all f are distriutive are called a distriutive framework. The Reaching Definitions, Availale Expressions, Live Variales, and Very Busy Expressions analyses are all distriutive frameworks. For them, the least fixpoint computation delivers the JOP solution. Constant Propagation is not a distriutive framework.
19 13/21 JOP for Constant propagation Theorem The prolem of computing the JOP solution for the Constant Propagation analysis is undecidale. Proof reduction from modified Post Correspondence Prolem
20 14/21 Modified Post Correspondence Prolem Let Γ e a finite alphaet with at least 2 symols. given lists of finite words u 1,..., u n Γ + and v 1,..., v n Γ + determine whether there exists a sequence of indices i 1,..., i m {1,..., n} such that m 1, i 1 = 1, and u i1 u i2... u im = v i1 v i2... v im Example Γ = {a, } u 1 = a, u 2 = a, u 3 = a u 1 =, u 2 = aa, u 3 = aa 1,2,1,3 is a solution: aaaa = aaaa
21 14/21 Modified Post Correspondence Prolem Let Γ e a finite alphaet with at least 2 symols. given lists of finite words u 1,..., u n Γ + and v 1,..., v n Γ + determine whether there exists a sequence of indices i 1,..., i m {1,..., n} such that m 1, i 1 = 1, and u i1 u i2... u im = v i1 v i2... v im Remark: Fixing i 1 = 1 does not affect undecidaility. The (modified) Post Correspondence Prolem is undecidale.
22 15/21 Proof of the Theorem Theorem The prolem of computing the JOP solution for the Constant Propagation analysis is undecidale. Proof Let Γ = {1,..., 9} and for u Γ +, let u e the length of u when interpreted as a string in Γ +, u e the value of u when interpreted as a natural numer, Given lists of finite words u 1,..., u n Γ + and v 1,..., v n Γ + we construct a program for which computing the JOP solution for Constant Propagation allows us to determine if the modified Post correspondence prolem has a solution for this lists of words.
23 15/21 Proof of the Theorem (cont.) x := u 1 ; y := v 1 ; while [...] do { if [...] then { x := x 10 u1 + u 1 ; y := y 10 v1 + v 1 } else if [...] then { x := x 10 u2 + u 2 ; y := y 10 v2 + v 2 }... else if [...] then { x := x 10 un + u n ; y := y 10 vn + v n } } [z := sign((x y) (x y))] l 1 ; [skip] l ; We assume that our programming language contains arithmetic expressions a a2 1, for a 1, a 2 arithmetic expressions the function sign, where 1 if z < 0 sign(z) = 0 if z = 0 1 if z > 0 Note: We omit the conditions of while and if statements, as they are ignored y Constant Propagation.
24 15/21 Proof of the Theorem (cont.) The set Paths(l) consists of execution paths corresponding to all possile pairs of words x Γ + and y Γ + of the form x = u i1 u i2... u im and y = v i1 v i2... v im for sequences i 1,..., i m of indices where i 1 = 1 and m 1. For each such path if x = y then z is set to 0 in lock l 1, if x y then z is set to 1 in lock l 1. Hence, the modified Post correspondence prolem has no solution if and only if z is set to 1 on all execution paths reaching lock l. If Xl JOP = d is the JOP solution for program location l, then d(z) = 1 if and only if the modified Post correspondence prolem has no solution for the lists of words u 1,..., u n and v 1,..., v n.
25 15/21 Proof of the Theorem (cont.) Thus, if there exists an algorithm for computing the JOP solution for Constant Propagation, then we can construct an algorithm for solving the modified Post correspondence prolem. This implies that the prolem of computing the JOP solution for Constant Propagation is undecidale, since the modified Post correspondence prolem is undecidale.
26 16/21 Conditional ranches So far: values of conditions have een ignored y the analysis Essentially, we have een treating if and while statements as nondeterministic choice etween the two ranches. Solution: introduce transfer functions for ranches Possile approaches: 1. attach conditions as edge laels in the CFG advantage: no language modification required disadvantage: requires modification to the analysis framework 2. encode conditions as assert statements advantage: no modification of the analysis framework disadvantage: requires extension of the programming language
27 17/21 Taking into account conditional ranches approach 1: [w = 0] 1 w = 0 (w = 0) [z := 0] 2 [z := 1] 3 [skip] 4 approach 2: if [w = 0] 1 { [assert(w = 0)] 2 ; [z := 0] 3 ; } else { } [assert( (w = 0))] 4 ; [z := 1] 5 ; [skip] 6
28 18/21 While programs with assertions arithmetic expressions, which denote integer values a ::= k x a 1 + a 2 a 1 a 2 a 1 a 2 a 1 /a 2 k is an integer constant, x is a variale Boolean expressions ::= a 1 = a 2 a 1 < a true programs c ::= [skip] l [x := a] l [read(x)] l [print(a)] l c 1 ; c 2 if [] l then {c 1 } else {c 2 } while [] l do {c} [assert()] l x is a variale, a is arithmetic expression, is a Boolean expression
29 19/21 Assert statements assert() aorts the execution if is false, and has no effect otherwise. We will only insert it where it is guaranteed to hold. The definition of transfer functions for assert locks depends on the analysis prolem. Often, insight into the analysis prolem is required to define non-trivial and sound constraints for assert. Idea: use assertions as filters that only let valid information pass
30 Remark For simplicity, the definition of eval(a 1 = a 2 ) assumes that the value of oth expressions a 1 and a 2 is defined (this holds for expressions that do not contain division). To handle operations with undefined value (e.g., division y zero) the range of eval should e extended with the value?, and the value? should e taken into consideration in the transfer function for assert. 20/21 Constant propagation analysis with assertions extend the evaluation function eval to oolean expressions: maps a oolean expression and d D \ { } to an element of B if is true, then eval(, d) := true, if is a 1 = a 2, then eval(, d) := true, if eval(a 1, d) = eval(a 2, d), and eval(, d) := false, otherwise if is, then eval(, d) := true, if eval(, d) = false, and eval(, d) := false, otherwise if is 1 2, then eval(, d) := true, if eval( 1, d) = eval( 2, d) = true, and eval(, d) := false, otherwise
31 20/21 Constant propagation analysis with assertions for [assert()] l we define the transfer function f l : D D f l (d) = f l (d) = if d = if ( d α(d) : eval(, d ) = true) f l (d)(v) = n if ( d α(d) : eval(, d ) = true d (v) = n) f l (d)(v) =? otherwise where α(d) is the set of functions from Vars to Z such that d α(d) if and only if for all x Vars it holds that { d {n} if d(x) = n Z (x) Z if d(x) =?
32 21/21 Example: Constant propagation analysis with assertions [x := 0] 1 [x 0] 2 [assert(x 0)] 3 [assert(x < 0)] 4 [y := 0] 5 [y := 1] 6 [skip] 7 (d x, d y ): represents function d with d(x) = d x and d(y) = d y consider d = (0,?) α(d) = {(0, m) m Z} d α(d) if and only if for all v {x, y} it holds that { d {n} if d(v) = n Z (v) Z if d(v) =?
33 21/21 Example: Constant propagation analysis with assertions [x := 0] 1 [x 0] 2 [assert(x 0)] 3 [assert(x < 0)] 4 [y := 0] 5 [y := 1] 6 [skip] 7 (d x, d y ): represents function d with d(x) = d x and d(y) = d y consider d = (0,?) α(d) = {(0, m) m Z} d α(d) : eval(x 0, d ) = true d α(d) : eval(x < 0, d ) = false f 3 (d)(x) = 0, f 3 (d)(y) =? f 4 (d) = f 5 (f 3 (d)) = f 5 ((0,?)) = (0, 0) f 6 (f 4 (d)) = f 6 ( ) =
Static Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-18/spa/ Recap: Interprocedural Dataflow Analysis Outline of
More informationData Flow Analysis. Lecture 6 ECS 240. ECS 240 Data Flow Analysis 1
Data Flow Analysis Lecture 6 ECS 240 ECS 240 Data Flow Analysis 1 The Plan Introduce a few example analyses Generalize to see the underlying theory Discuss some more advanced issues ECS 240 Data Flow Analysis
More informationCMSC 631 Program Analysis and Understanding Fall Abstract Interpretation
Program Analysis and Understanding Fall 2017 Abstract Interpretation Based on lectures by David Schmidt, Alex Aiken, Tom Ball, and Cousot & Cousot What is an Abstraction? A property from some domain Blue
More informationSUFFIX TREE. SYNONYMS Compact suffix trie
SUFFIX TREE Maxime Crochemore King s College London and Université Paris-Est, http://www.dcs.kcl.ac.uk/staff/mac/ Thierry Lecroq Université de Rouen, http://monge.univ-mlv.fr/~lecroq SYNONYMS Compact suffix
More informationStatic Program Analysis
Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem
More informationCS 4120 Lecture 3 Automating lexical analysis 29 August 2011 Lecturer: Andrew Myers. 1 DFAs
CS 42 Lecture 3 Automating lexical analysis 29 August 2 Lecturer: Andrew Myers A lexer generator converts a lexical specification consisting of a list of regular expressions and corresponding actions into
More informationCMSC 631 Program Analysis and Understanding. Spring Data Flow Analysis
CMSC 631 Program Analysis and Understanding Spring 2013 Data Flow Analysis Data Flow Analysis A framework for proving facts about programs Reasons about lots of little facts Little or no interaction between
More informationAbstract Interpretation II
Abstract Interpretation II Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 11 13 May 2016 Course 11 Abstract Interpretation II Antoine
More informationMATH 225: Foundations of Higher Matheamatics. Dr. Morton. 3.4: Proof by Cases
MATH 225: Foundations of Higher Matheamatics Dr. Morton 3.4: Proof y Cases Chapter 3 handout page 12 prolem 21: Prove that for all real values of y, the following inequality holds: 7 2y + 2 2y 5 7. You
More informationStatic Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1617/spa/ Software Architektur Praxis-Workshop Bringen Sie Informatik
More informationFinite Automata and Regular Languages (part II)
Finite Automata and Regular Languages (part II) Prof. Dan A. Simovici UMB 1 / 25 Outline 1 Nondeterministic Automata 2 / 25 Definition A nondeterministic finite automaton (ndfa) is a quintuple M = (A,
More informationSemantics and Verification of Software
Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ss-15/sv-sw/ The Denotational Approach Denotational
More informationWe define a dataflow framework. A dataflow framework consists of:
So far been talking about various dataflow problems (e.g. reaching definitions, live variable analysis) in very informal terms. Now we will discuss a more fundamental approach to handle many of the dataflow
More informationCSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.
CSE 311: Foundations of Computing I Autumn 014 Practice Final: Section X YY ZZ Name: UW ID: Instructions: Closed book, closed notes, no cell phones, no calculators. You have 110 minutes to complete the
More informationInterprocedural Analysis: Sharir-Pnueli s Call-strings Approach
Interprocedural Analysis: Sharir-Pnueli s Call-strings Approach Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 04 September 2013 Outline 1 Motivation
More informationDataflow Analysis. Chapter 9, Section 9.2, 9.3, 9.4
Dataflow Analysis Chapter 9, Section 9.2, 9.3, 9.4 2 Dataflow Analysis Dataflow analysis is a sub area of static program analysis Used in the compiler back end for optimizations of three address code and
More informationStatic Program Analysis using Abstract Interpretation
Static Program Analysis using Abstract Interpretation Introduction Static Program Analysis Static program analysis consists of automatically discovering properties of a program that hold for all possible
More informationCS 420, Spring 2018 Homework 4 Solutions. 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0};
CS 420, Spring 2018 Homework 4 Solutions 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0}; Solution: Given p 1, choose s = 0 2p 10 p. Then, s is in the
More informationStatic Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1617/spa/ Software Architektur Praxis-Workshop Bringen Sie Informatik
More informationWhat is SSA? each assignment to a variable is given a unique name all of the uses reached by that assignment are renamed
Another Form of Data-Flow Analysis Propagation of values for a variable reference, where is the value produced? for a variable definition, where is the value consumed? Possible answers reaching definitions,
More informationAutomata, Logic and Games: Theory and Application
Automata, Logic and Games: Theory and Application 2 Parity Games, Tree Automata, and S2S Luke Ong University of Oxford TACL Summer School University of Salerno, 14-19 June 2015 Luke Ong S2S 14-19 June
More informationHoare Logic and Model Checking
Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the
More informationLecture Notes: Axiomatic Semantics and Hoare-style Verification
Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has
More informationCVO103: Programming Languages. Lecture 2 Inductive Definitions (2)
CVO103: Programming Languages Lecture 2 Inductive Definitions (2) Hakjoo Oh 2018 Spring Hakjoo Oh CVO103 2018 Spring, Lecture 2 March 13, 2018 1 / 20 Contents More examples of inductive definitions natural
More informationCausal Dataflow Analysis for Concurrent Programs
Causal Dataflow Analysis for Concurrent Programs Azadeh Farzan P. Madhusudan Department of Computer Science, University of Illinois at Urbana-Champaign. {afarzan,madhu}@cs.uiuc.edu Abstract. We define
More informationFormal Methods in Software Engineering
Formal Methods in Software Engineering An Introduction to Model-Based Analyis and Testing Vesal Vojdani Department of Computer Science University of Tartu Fall 2014 Vesal Vojdani (University of Tartu)
More informationModel Checking & Program Analysis
Model Checking & Program Analysis Markus Müller-Olm Dortmund University Overview Introduction Model Checking Flow Analysis Some Links between MC and FA Conclusion Apology for not giving proper credit to
More informationThe WHILE Hierarchy of Program Schemes is Infinite
The WHILE Hierarchy of Program Schemes is Infinite Can Adam Alayrak and Thomas Noll RWTH Aachen Ahornstr. 55, 52056 Aachen, Germany alayrak@informatik.rwth-aachen.de and noll@informatik.rwth-aachen.de
More informationCS422 - Programming Language Design
1 CS422 - Programming Language Design Denotational Semantics Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 Denotational semantics, also known as fix-point semantics,
More informationLanguages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet:
Languages 1 Languages A language is a set of strings String: A sequence of letters Examples: cat, dog, house, Defined over an alphaet: a,, c,, z 2 Alphaets and Strings We will use small alphaets: Strings
More informationAxiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE
Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE 6341 1 Outline Introduction What are axiomatic semantics? First-order logic & assertions about states Results (triples)
More informationDataflow Analysis. A sample program int fib10(void) { int n = 10; int older = 0; int old = 1; Simple Constant Propagation
-74 Lecture 2 Dataflow Analysis Basic Blocks Related Optimizations SSA Copyright Seth Copen Goldstein 200-8 Dataflow Analysis Last time we looked at code transformations Constant propagation Copy propagation
More informationScalar Optimisation Part 2
Scalar Optimisation Part 2 Michael O Boyle January 2014 1 Course Structure L1 Introduction and Recap 4-5 lectures on classical optimisation 2 lectures on scalar optimisation Last lecture on redundant expressions
More informationAxiomatic Semantics. Lecture 9 CS 565 2/12/08
Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics
More informationBuilding a befer mousetrap. Transi-on Graphs. L = { abba } Building a befer mousetrap. L = { abba } L = { abba } 2/16/15
Building a efer mousetrap Let s uild an FA that only accepts the string aa from Σ = { a } Models of Computa-on Lecture #5 (a?er quiz) Chapter 6 Building a efer mousetrap Let s uild an FA that only accepts
More informationSpace-aware data flow analysis
Space-aware data flow analysis C. Bernardeschi, G. Lettieri, L. Martini, P. Masci Dip. di Ingegneria dell Informazione, Università di Pisa, Via Diotisalvi 2, 56126 Pisa, Italy {cinzia,g.lettieri,luca.martini,paolo.masci}@iet.unipi.it
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP Recap: Logic, Sets, Relations, Functions
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017 Formal proofs; Simple/strong induction; Mutual induction; Inductively defined sets; Recursively defined functions. Lecture 3 Ana Bove
More informationStatic Program Analysis
Static Program Analysis Lecture 16: Abstract Interpretation VI (Counterexample-Guided Abstraction Refinement) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de
More informationAutomata 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 informationDistributed Timed Automata with Independently Evolving Clocks
Distriuted Timed Automata with Independently Evolving Clocks S. Akshay,3, Benedikt Bollig, Paul Gastin, Madhavan Mukund 2, and K. Narayan Kumar 2 LSV, ENS Cachan, CNRS, France {akshay,ollig,gastin}@lsv.ens-cachan.fr
More informationROUNDOFF ERRORS; BACKWARD STABILITY
SECTION.5 ROUNDOFF ERRORS; BACKWARD STABILITY ROUNDOFF ERROR -- error due to the finite representation (usually in floatingpoint form) of real (and complex) numers in digital computers. FLOATING-POINT
More informationDataflow Analysis - 2. Monotone Dataflow Frameworks
Dataflow Analysis - 2 Monotone dataflow frameworks Definition Convergence Safety Relation of MOP to MFP Constant propagation Categorization of dataflow problems DataflowAnalysis 2, Sp06 BGRyder 1 Monotone
More information1Number ONLINE PAGE PROOFS. systems: real and complex. 1.1 Kick off with CAS
1Numer systems: real and complex 1.1 Kick off with CAS 1. Review of set notation 1.3 Properties of surds 1. The set of complex numers 1.5 Multiplication and division of complex numers 1.6 Representing
More informationSample Solutions from the Student Solution Manual
1 Sample Solutions from the Student Solution Manual 1213 If all the entries are, then the matrix is certainly not invertile; if you multiply the matrix y anything, you get the matrix, not the identity
More informationProgramming Languages and Types
Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Where we re going Type Systems... Type systems are one of the most fascinating and powerful aspects of programming
More informationDenotational Semantics
5 Denotational Semantics In the operational approach, we were interested in how a program is executed. This is contrary to the denotational approach, where we are merely interested in the effect of executing
More informationPredicate Logic. x. x + 0 = x. Predicate logic over integer expressions: a language of logical assertions, for example. Why discuss predicate logic?
Predicate Logic Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic? It is an example of a simple language It has simple denotational
More informationOptimal Routing in Chord
Optimal Routing in Chord Prasanna Ganesan Gurmeet Singh Manku Astract We propose optimal routing algorithms for Chord [1], a popular topology for routing in peer-to-peer networks. Chord is an undirected
More informationΠ( ) Π( ) Π( ) A ε. b b. (d) (c) (a) (b)
Top-Down Parsing of Conjunctive Languages Alexander Okhotin (okhotin@aha.ru) Faculty of Computational Mathematics and Cyernetics, Moscow State University Astract. This paper generalizes the notion of a
More informationAxiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements
Axiomatic Semantics: Verification Conditions Meeting 12, CSCI 5535, Spring 2009 Announcements Homework 4 is due tonight Wed forum: papers on automated testing using symbolic execution 2 Questions? Review
More informationConfusion of Memory. Lawrence S. Moss. Department of Mathematics Indiana University Bloomington, IN USA February 14, 2008
Confusion of Memory Lawrence S. Moss Department of Mathematics Indiana University Bloomington, IN 47405 USA February 14, 2008 Abstract It is a truism that for a machine to have a useful access to memory
More informationReasoning About Imperative Programs. COS 441 Slides 10b
Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program
More informationIntroduction to Kleene Algebras
Introduction to Kleene Algebras Riccardo Pucella Basic Notions Seminar December 1, 2005 Introduction to Kleene Algebras p.1 Idempotent Semirings An idempotent semiring is a structure S = (S, +,, 1, 0)
More informationLecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009
CS 373: Theory of Computation Sariel Har-Peled and Madhusudan Parthasarathy Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009 This lecture covers Rice s theorem, as well as
More informationHoare Logic (I): Axiomatic Semantics and Program Correctness
Hoare Logic (I): Axiomatic Semantics and Program Correctness (Based on [Apt and Olderog 1991; Gries 1981; Hoare 1969; Kleymann 1999; Sethi 199]) Yih-Kuen Tsay Dept. of Information Management National Taiwan
More informationCSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal
CSE 311 Lecture 28: Undecidability of the Halting Problem Emina Torlak and Kevin Zatloukal 1 Topics Final exam Logistics, format, and topics. Countability and uncomputability A quick recap of Lecture 27.
More informationCSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.
Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify
More informationProf. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan
Language Processing Systems Prof. Mohamed Hamada Software Engineering La. The University of izu Japan Syntax nalysis (Parsing) 1. Uses Regular Expressions to define tokens 2. Uses Finite utomata to recognize
More informationMIT Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology
MIT 6.035 Foundations of Dataflow Analysis Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Dataflow Analysis Compile-Time Reasoning About Run-Time Values of Variables
More informationSection 2.1: Reduce Rational Expressions
CHAPTER Section.: Reduce Rational Expressions Section.: Reduce Rational Expressions Ojective: Reduce rational expressions y dividing out common factors. A rational expression is a quotient of polynomials.
More informationThe Mean Version One way to write the One True Regression Line is: Equation 1 - The One True Line
Chapter 27: Inferences for Regression And so, there is one more thing which might vary one more thing aout which we might want to make some inference: the slope of the least squares regression line. The
More informationM = (Q,Σ,δ,q 0,F) Σ is the alphabet over which the transitions are defined.
LECTURE 23 10.1 Formal Definition of a DFA Definition 10.1 A Deterministic Finite Automaton (DFA) M, is a five-tuple: where M = (Q,Σ,δ, 0,F) Q is a finite set of states. It is important that the set of
More informationLecture 21: Algebraic Computation Models
princeton university cos 522: computational complexity Lecture 21: Algebraic Computation Models Lecturer: Sanjeev Arora Scribe:Loukas Georgiadis We think of numerical algorithms root-finding, gaussian
More informationPredicate Logic - Undecidability
CS402, Spring 2016 Undecidable Problems Does the following program halts? (1) N : n, total, x, y, z (2) n GetUserInput() (3) total 3 (4) while true (5) for x 1 to total 2 (6) for y 1 to total x 1 (7) z
More informationCS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)
CS5371 Theory of Computation Lecture 14: Computability V (Prove by Reduction) Objectives This lecture shows more undecidable languages Our proof is not based on diagonalization Instead, we reduce the problem
More informationReversal of regular languages and state complexity
Reversal of regular languages and state complexity Juraj Šeej Institute of Computer Science, Faculty of Science, P. J. Šafárik University Jesenná 5, 04001 Košice, Slovakia juraj.seej@gmail.com Astract.
More informationChapter 3. Regular grammars
Chapter 3 Regular grammars 59 3.1 Introduction Other view of the concept of language: not the formalization of the notion of effective procedure, but set of words satisfying a given set of rules Origin
More informationCSC D70: Compiler Optimization Dataflow-2 and Loops
CSC D70: Compiler Optimization Dataflow-2 and Loops Prof. Gennady Pekhimenko University of Toronto Winter 2018 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip Gibbons
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 informationSOME GENERAL RESULTS AND OPEN QUESTIONS ON PALINTIPLE NUMBERS
#A42 INTEGERS 14 (2014) SOME GENERAL RESULTS AND OPEN QUESTIONS ON PALINTIPLE NUMBERS Benjamin V. Holt Department of Mathematics, Humoldt State University, Arcata, California vh6@humoldt.edu Received:
More informationSolving Systems of Linear Equations Symbolically
" Solving Systems of Linear Equations Symolically Every day of the year, thousands of airline flights crisscross the United States to connect large and small cities. Each flight follows a plan filed with
More informationFlow grammars a flow analysis methodology
Flow grammars a flow analysis methodology James S. Uhl and R. Nigel Horspool Dept. of Computer Science, University of Victoria P.O. Box 3055, Victoria, BC, Canada V8W 3P6 E-mail: juhl@csr.uvic.ca, nigelh@csr.uvic.ca
More informationSeptember 14. Fall Software Foundations CIS 500
CIS 500 Software Foundations Fall 2005 September 14 CIS 500, September 14 1 Announcements I will be away September 19-October 5. I will be reachable by email. Fastest response cis500@cis.upenn.edu No office
More informationDataflow Analysis. Dragon book, Chapter 9, Section 9.2, 9.3, 9.4
Dataflow Analysis Dragon book, Chapter 9, Section 9.2, 9.3, 9.4 2 Dataflow Analysis Dataflow analysis is a sub-area of static program analysis Used in the compiler back end for optimizations of three-address
More informationReading: Chapter 9.3. Carnegie Mellon
I II Lecture 3 Foundation of Data Flow Analysis Semi-lattice (set of values, meet operator) Transfer functions III Correctness, precision and convergence IV Meaning of Data Flow Solution Reading: Chapter
More informationThe complexity of unary tiling recognizable picture languages: nondeterministic and unambiguous cases
Fundamenta Informaticae X (2) 1 20 1 IOS Press The complexity of unary tiling recognizale picture languages: nondeterministic and unamiguous cases Alerto Bertoni Massimiliano Goldwurm Violetta Lonati Dipartimento
More informationDepartment of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)
Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Problem 1: Specify two different predicates P (x) and
More informationFunction Secret Sharing: Improvements and Extensions
Function Secret Sharing: Improvements and Extensions Elette Boyle Niv Giloa Yuval Ishai July 24, 2018 Astract Function Secret Sharing (FSS), introduced y Boyle et al. (Eurocrypt 2015), provides a way for
More information0.1 Random useful facts. 0.2 Language Definition
0.1 Random useful facts Lemma double neg : P : Prop, {P} + { P} P P. Lemma leq dec : n m, {n m} + {n > m}. Lemma lt dec : n m, {n < m} + {n m}. 0.2 Language Definition Definition var := nat. Definition
More informationTuring Machines Part II
Turing Machines Part II Hello Hello Condensed Slide Slide Readers! Readers! This This lecture lecture is is almost almost entirely entirely animations that that show show how how each each Turing Turing
More informationBASIC CONCEPTS OF ABSTRACT INTERPRETATION
BASIC CONCEPTS OF ABSTRACT INTERPRETATION Patrick Cousot École Normale Supérieure 45 rue d Ulm 75230 Paris cedex 05, France Patrick.Cousot@ens.fr Radhia Cousot CNRS & École Polytechnique 91128 Palaiseau
More informationDFA of non-distributive properties
DFA of non-distributive properties The general pattern of Dataflow Analysis GA (p)= i if p E { GA (q) q F } otherwise GA (p)= f p ( GA (p) ) where : E is the set of initial/final points of the control-flow
More informationData flow analysis. DataFlow analysis
Data flow analysis DataFlow analysis compile time reasoning about the runtime flow of values in the program represent facts about runtime behavior represent effect of executing each basic block propagate
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 informationCS154 Final Examination
CS154 Final Examination June 7, 2010, 7-10PM Directions: CS154 students: answer all 13 questions on this paper. Those taking CS154N should answer only questions 8-13. The total number of points on this
More information19 Tree Construction using Singular Value Decomposition
19 Tree Construction using Singular Value Decomposition Nicholas Eriksson We present a new, statistically consistent algorithm for phylogenetic tree construction that uses the algeraic theory of statistical
More informationCSE20: Discrete Mathematics
Spring 2018 Summary Today: Induction, Program Correctness Reading: Chap. 5 Division Theorem Theorem: For every integer a and positive integer d 1, there exist integers q, r such that a = qd + r and 0 r
More informationCS 151 Complexity Theory Spring Solution Set 5
CS 151 Complexity Theory Spring 2017 Solution Set 5 Posted: May 17 Chris Umans 1. We are given a Boolean circuit C on n variables x 1, x 2,..., x n with m, and gates. Our 3-CNF formula will have m auxiliary
More informationPredicate logic. Predicates and Boolean Expressions. V =100 I expresses a relationship between quantities identified
Predicate logic (Reading Gossett Section 2.6) Predicates and Boolean Expressions Recall that a statement or proposition is an assertion thatmaybelabelledtrueorfalse And that statements may depend on one
More information6.8 The Post Correspondence Problem
6.8. THE POST CORRESPONDENCE PROBLEM 423 6.8 The Post Correspondence Problem The Post correspondence problem (due to Emil Post) is another undecidable problem that turns out to be a very helpful tool for
More informationA short proof that O 2 is an MCFL
A short proof that O 2 is an MCFL Mark-Jan Nederhof School of Computer Science University of St Andrews, UK Astract We present a new proof that O 2 is a multiple context-free language. It contrasts with
More informationSemantics and Verification of Software
Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ws-1718/sv-sw/ Recap: The Denotational Approach Semantics
More informationLuis Manuel Santana Gallego 100 Investigation and simulation of the clock skew in modern integrated circuits. Clock Skew Model
Luis Manuel Santana Gallego 100 Appendix 3 Clock Skew Model Xiaohong Jiang and Susumu Horiguchi [JIA-01] 1. Introduction The evolution of VLSI chips toward larger die sizes and faster clock speeds makes
More informationPrecise Interprocedural Analysis using Random Interpretation
Precise Interprocedural Analysis using Random Interpretation Sumit Gulwani gulwani@cs.berkeley.edu George C. Necula necula@cs.berkeley.edu Department of Electrical Engineering and Computer Science University
More informationDiscrete Math in Computer Science Solutions to Practice Problems for Midterm 2
Discrete Math in Computer Science Solutions to Practice Problems for Midterm 2 CS 30, Fall 2018 by Professor Prasad Jayanti Problems 1. Let g(0) = 2, g(1) = 1, and g(n) = 2g(n 1) + g(n 2) whenever n 2.
More informationMonotone Hamiltonian paths in the Boolean lattice of subsets
Monotone Hamiltonian paths in the Boolean lattice of subsets Csaba Biró and David Howard December 10, 2007 Abstract Consider the lattice whose elements are the subsets of the set of positive integers not
More informationRegular Languages. Problem Characterize those Languages recognized by Finite Automata.
Regular Expressions Regular Languages Fundamental Question -- Cardinality Alphabet = Σ is finite Strings = Σ is countable Languages = P(Σ ) is uncountable # Finite Automata is countable -- Q Σ +1 transition
More informationMonotone Data Flow Analysis Framework
Monotone Data Flow Analysis Framework Definition. A relation R on a set S is (a) reflexive iff ( x S)[xRx], (b) antisymmetric iff [xry yrx x=y] (c) transitive iff ( x,y,z S) [xry yrz xrz] Definition. A
More informationComputability Theory. CS215, Lecture 6,
Computability Theory CS215, Lecture 6, 2000 1 The Birth of Turing Machines At the end of the 19th century, Gottlob Frege conjectured that mathematics could be built from fundamental logic In 1900 David
More informationDecision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012
Decision Problems with TM s Look at following sets: Lecture 31: Halting Problem CSCI 81 Spring, 2012 Kim Bruce A TM = { M,w M is a TM and w L(M)} H TM = { M,w M is a TM which halts on input w} TOTAL TM
More information