static2 - Lattice Theory Control Flow Graphs Dataflow...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lattice Theory Lattice Theory Control Flow Graphs Control Flow Graphs Dataflow Analysis Dataflow Analysis Static Analysis 2009 Static Analysis 2009 Michael I. Schwartzbach Computer Science, University of Aarhus
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 2 Static Analysis Partial Orders Partial Orders ± A partial order is a structure L = (S, ) ± S is a set ± is a binary relation that satisfies: • reflexivity: x S: x x • transitivity: x,y,z S: x y y z x z • anti-symmetry: x,y S: x y y x x = y
Background image of page 2
3 3 Static Analysis Upper and Lower Bounds Upper and Lower Bounds ± Let X S be a subset ± We say that y S is an upper bound (X y) when: x X: x y ± We say that y S is a lower bound (y X) when: x X: y x ± A least upper bound X is defined by: X X ∧∀ y S: X y X y ± A greatest lower bound X is defined by: X X y S: y X y X
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 4 Static Analysis Lattices Lattices ± A lattice is a partial order where: X and X exist for all X S ± A lattice must have: • a unique largest element, = S • a unique smallest element, = S ± If S is a finite set, then it is a lattice iff: and exist • x y and y x exist for all x,y S
Background image of page 4
5 5 Static Analysis These Partial Orders Are Lattices These Partial Orders Are Lattices
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 6 Static Analysis These Partial Orders Are Not Lattices These Partial Orders Are Not Lattices
Background image of page 6
7 7 Static Analysis The Subset Lattice The Subset Lattice ± Every finite set A defines a lattice (2 A , ), where: •= A •x y = x y y = x y {0,1,2,3} {0,1,2} {0,1,3} {0,2,3} {1,2,3} {0,1} {0,2} {0,3} {1,2} {1,3} {2,3} {0} {1} {2} {3} {}
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 8 Static Analysis Lattice Height Lattice Height ± The height of a lattice is the length of the longest path from to ± The lattice (2 A , ) has height |A| {0,1,2,3} {0,1,2} {0,1,3} {0,2,3} {1,2,3} {0,1} {0,2} {0,3} {1,2} {1,3} {2,3} {0} {1} {2} {3} {}
Background image of page 8
9 9 Static Analysis Monotone and Increasing Functions Monotone and Increasing Functions ± A function f: L L is monotone when: x,y S: x y f(x) f(y) ± Monotone functions are closed under composition ± As functions, and are both monotone ± A function is increasing when: x S: x f(x) ± Monotone is different from increasing • e.g. all constant functions are monotone
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 10 Static Analysis The Fixed The Fixed - - Point Theorem Point Theorem ± In a lattice with finite height, every monotone function f has a unique least fixed-point: fix (f) = f i ( ) such that f( fix (f)) = fix (f) i 0
Background image of page 10
11 11 Static Analysis Proof of Existence Proof of Existence ± Clearly, f( ) ± Since f is monotone, we also have f( ) f 2 ( ) ± By induction, f i ( ) f i+1 ( ) ± This means that: f( ) f 2 ( ) ... f i ( ) . .. is an increasing chain ± L has finite height, so for some k : f k ( ) = f k +1 ( ) ± But then fix (f) = f k ( )
Background image of page 11

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

View Full DocumentRight Arrow Icon
12 12 Static Analysis Proof of Unique Least Proof of Unique Least ± Assume that x is another fixed-point: x = f( x ) ± Clearly, x ± By induction, f i ( ) f i ( x ) = x ± In particular, fix (f) = f k ( ) x ± Uniqueness then follows from anti-symmetry
Background image of page 12
13 13 Static Analysis Computing Fixed Computing Fixed - - Points Points ± The time complexity of fix (f) depends on: • the height of the lattice • the cost of computing f • the cost of testing equality x = ; do { t = x; x = f(x); } while (x t);
Background image of page 13

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

View Full DocumentRight Arrow Icon
14 14
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 66

static2 - Lattice Theory Control Flow Graphs Dataflow...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online