{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture-4 Program Analysis (continued)

# lecture-4 Program Analysis (continued) - 1 From last...

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

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 From last lecture • We want to find a fixed point of F, that is to say a map m such that m = F(m) • Define & , which is & lifted to be a map: & = λ e. & • Compute F( & ), then F(F( & )), then F(F(F( & ))), ... until the result doesn’t change anymore From last lecture • If F is monotonic and height of lattice is finite: iterative algorithm terminates • If F is monotonic, the fixed point we find is the least fixed point. What about if we start at top? • What if we start with ¡ : F( ¡ ), F(F( ¡ )), F(F(F( ¡ ))) • We get the greatest fixed point • Why do we prefer the least fixed point? – More precise Graphically x y 10 10 Graphically x y 10 10 Graphically x y 10 10 2 Graphically, another way Another example: constant prop • Set D = x := N in out F x := n (in) = x := y op z in out F x := y op z (in) = Another example: constant prop • Set D = 2 { x & N | x ¡ Vars ¢ N ¡ Z } x := N in out F x := n (in) = in – { x & * } £ { x & N } x := y op z in out F x := y op z (in) = in – { x & * } £ { x & N | ( y & N 1 ) ¡ in ¢ ( z & N 2 ) ¡ in ¢ N = N 1 op N 2 } Another example: constant prop *x := y in out F *x := y (in) = x := *y in out F x := *y (in) = Another example: constant prop *x := y in out F *x := y (in) = in – { z & * | z ¡ may-point(x) } £ { z & N | z ¡ must-point-to(x) ¢ y & N ¡ in } £ { z & N | (y & N) ¡ in ¢ (z & N) ¡ in } x := *y in out F x := *y (in) = in – { x & * } £ { x & N | ¤ z ¡ may-point-to(x) . (z & N) ¡ in } Another example: constant prop x := f(...) in out F x := f(...) (in) = *x := *y + *z in out F *x := *y + *z (in) = 3 Another example: constant prop x := f(...) in out F x := f(...) (in) = & *x := *y + *z in out F *x := *y + *z (in) = F a := *y;b := *z;c := a + b; *x := c (in) Another example: constant prop...
View Full Document

{[ snackBarMessage ]}

### Page1 / 8

lecture-4 Program Analysis (continued) - 1 From last...

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

View Full Document
Ask a homework question - tutors are online