review the iterative algorithm
question
-
- is the algorithm guaranteed to terminate or reach the fixed point, or does it always have a solution ?
-
- if so, is there only one solution or only one fixed point ? if more than one, is our solution the best one (most precise) ?
-
- When will the algorithm reach the fixed point, or when can we get the solution ?
We need some math - Lattice. But before introduce Lattice, we need learn some concept.
Partial Order
We define poset as a pair (P, ), where is a binary relation that defines a partial ordering over P, and has the following properties:
Example: Is (S, ) a poset where S is a set of integers and represents ? → Yes
partial means for a pair of set elements in P, they could be incomparable; in other words, not necessary that every pair of set elements must satisfy the ordering
Upper and Lower Bounds
Given a poset (P, ) and its subset S that , we say that is an upper bound of S, if . Similarly, is an lower bound of S, if .

We define the least upper bound (lub or join) of S, written , if for every upper bound of S, say u, . Similarly, we define the greatest lower bound (glb, or meet) of S, written , if for every lower bound of S, say l, .

Some properties:
- Not every poset has lub or glb
- But if a poset has lub or glb, it will be unique
Lattice
lattice 是数学理论用来证明 data-flow analysis 的正确性
Given a poset (P, ), , then (P, ) is called a lattice.
A poset is a lattice if every pair of its elements has a least upper bound and a greatest lower bound
Semilattice
Given a poset (P, ), ,
- if only , then (P, ) is called a join semilattice.
- if only , then (P, ) is called a meet semilattice.
Complete lattice
Given a lattice (P, ), for arbitrary subset S of P, if and exist, then (P, ) is called a complete lattice.
All subsets of a lattice have a least upper bound and a greatest lower bound.
Every complete lattice (P, ) has
- a greatest element called top and
- a least element called bottom
Every finite lattice (P is finite) is a complete lattice.
Product Lattice
Ok, now the math is enough
Data Flow Analysis Framework via Lattice
A data flow analysis framework (D, L, F) consists of:
- D: a direction of data flow: forwards or backwards
- L: a lattice including domain of values V and a meet or join operator
- F: a family of transfer functions from V to V

Data flow analysis can be seen as iteratively applying transfer functions and meet/join operations on the values of a lattice
Now we can review the question of begin, for answering the three question, we need some properties:
- monotonicity of lattice
- lattice has only one top
Monotonicity
A function f : L → L (L is a lattice) is monotomic if ,
Fixed-Point Theorem
Given a complete lattice (L, ), if
- f: L → L is monotonic and
- L is finite then the least fixed point of f can be found by iterating until a fixed point is reached
then the greatest fixed point of f can be found by iterating until a fixed point is reached
May and Must Analyses, A Lattice View
