
CMSC 631, Spring 2006
Homework 1
Due Thursday, February 9, in class
1. Let Sbe a finite set, and let Lbe the lattice of subsets of S, with order ⊆. Show that any function
f(x) constructed from union, intersection, and constant sets is monotonic. Here, I mean that f(x) = e
where ecan be specified by the grammar
e::= x|S0|e∪e|e∩e
where S0is any subset of S. Your proof should be by induction on the structure of e.
2. Suppose that we extend the grammar for efrom problem 1 to include the complement operator !e,
where !T=S−T. Is fstill guaranteed to be monotonic? If it is, justify your answer. If it’s not,
explain why a transfer function defined by Out(stmt) = Gen(stmt)∪(In(stmt)−K ill(stmt)), which
seems to include negation, is monotonic.
3. Let Abe a lattice, with order ≤. Define A→Ato be the set of all functions from Ato A, and define
f≤0gif f(x)≤g(x) for all x∈A.
•Show that A→Awith order ≤0is also a lattice. That is, show that for all f, g ∈A→A,ftg
and fugalways exist.
•Suppose lattice Ahas height hand that Ais finite with nelements. What is the height of the
lattice (A→A, ≤0)? (When counting height, count “edges” rather than “nodes,” e.g., if Awere
the lattice {a, b}with a < b, then its height would be 1.)
4. (ASU, exercise 10.35) In class we talked about how an analysis is conservative if it models the behavior
of the program in a way that is safe. As it turns out, “safe” is in the eye of the beholder.
When performing dataflow analysis to estimate the following properties, determine whether too-large
or too-small estimates are conservative. Explain your answer in terms of the intended use of the
information. (Hint: This is a bit of a trick question.)
(a) Available expressions
(b) Variables changed by a procedure
(c) Variables not changed by a procedure
(d) Copy statements reaching a given program point
1