{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

slides4

# slides4 - Principles of Program Analysis Abstract...

This preview shows pages 1–11. Sign up to view the full content.

Principles of Program Analysis: Abstract Interpretation Transparencies based on Chapter 4 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis . Springer Verlag 2005. c Flemming Nielson & Hanne Riis Nielson & Chris Hankin. PPA Chapter 4 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A Mundane Approach to Semantic Correctness Semantics: p v 1 v 2 where v 1 , v 2 V . Note: might be deterministic. Program analysis: p l 1 l 2 where l 1 , l 2 L . Note: should be deterministic: f p ( l 1 ) = l 2 . What is the relationship between the semantics and the analysis? Restrict attention to analyses where properties directly describe sets of values i.e. “first-order‘” analyses (rather than “second-order” analyses ). PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 2
Example: Data Flow Analysis Structural Operational Semantics: Values: V = State Transitions: S σ 1 σ 2 iff S , σ 1 * σ 2 Constant Propagation Analysis: Properties: L = State CP = ( Var Z ) Transitions: S σ 1 σ 2 iff σ 1 = ι σ 2 = { CP ( ) | final ( S ) } (CP , CP ) | = CP = ( S ) PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Example: Control Flow Analysis Structural Operational Semantics: Values: V = Val Transitions: e v 1 v 2 iff [ ] ( e v 1 1 ) 2 * v 2 2 Pure 0-CFA Analysis: Properties: L = Env × Val Transitions: e ( ρ 1 , v 1 ) ( ρ 2 , v 2 ) iff C ( 1 ) = v 1 C ( 2 ) = v 2 ρ 1 = ρ 2 = ρ ( C , ρ ) | = ( e c 1 ) 2 for some place holder constant c PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 4
Correctness Relations R : V × L → { true , false } Idea: v R l means that the value v is described by the property l . Correctness criterion: R is preserved under computation: p v 1 v 2 . . . . . . R R . . . . . . p l 1 l 2 logical relation: ( p · · ) ( R →→ R ) ( p · · ) PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Admissible Correctness Relations v R l 1 l 1 l 2 v R l 2 ( l L L : v R l ) v R ( L ) ( { l | v R l } is a Moore family) Two consequences: v R v R l 1 v R l 2 v R ( l 1 l 2 ) Assumption: ( L, ) is a complete lattice. PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 6
Example: Data Flow Analysis Correctness relation R CP : State × State CP → { true , false } is defined by σ R CP σ iff x FV ( S ) : ( σ ( x ) = σ ( x ) = σ ( x )) PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 7

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Example: Control Flow Analysis Correctness relation R CFA : Val × ( Env × Val ) → { true , false } is defined by v R CFA ( ρ , v ) iff v V ( ρ , v ) where V is given by: v V ( ρ , v ) iff true if v = c t v ∧ ∀ x dom ( ρ ) : ρ ( x ) V ( ρ , ρ ( x )) if v = close t in ρ PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 8
Representation Functions β : V L Idea: β maps a value to the best property describing it. Correctness criterion: p v 1 v 2 p l 1 l 2 β β PPA Section 4.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 9

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Equivalence of Correctness Criteria Given a representation function β we define a correctness relation R β by v R β l iff β ( v ) l Given a correctness relation R we define a representation function β R by β R ( v ) = { l | v R l } Lemma: (i) Given β : V L , then the relation R β : V × L
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 99

slides4 - Principles of Program Analysis Abstract...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online