Lattice
Definition: A set together with a partial ordering is called a partially ordered set or poset for short
Definition: Given a poset and its subset that , we say that
- is an upper bound of S, if
- is a lower bound of S, if
- least upper bound (lub or join) of , written , if for every upper bound of , say ,
- greatest lower bound (glb or meet) of , written , if for every lower bound of , say ,
Usaually, if contains only two elements and (), then
- can be written as (the join of and )
- can be written as (the meet of and )
Note that not every poset has lub or glb, but if a poset has lub or glb, it will be unique
Proof. assume and are both glbs of poset
Lattice
Definition: Given a poset, , if and exist, then its called a lattice
- In other words, a poset is called lattice if every pair of its elements has a least upper bound and a greatest lower bound
Definition: All subsets of a lattice have a least upper bound and a greatest lower bound
- the lub is called top
- the glb is called bottom
Definition: The height of a lattice h is the length of the longest path from Top to Bottom in the lattice
Definition: lattice 是分配的(distributive),当且仅当:
Definition: If only exists, then it's called a join semilattice
Definition: If only exists, then it's called a meet semilattice
Definition: Given a lattice, for arbitrary subset , if and exist, then it's called a complete lattice
- e.g., is not a complete lattice where is a set of integers and represents
- the subset represents all even numbers has no least upper bound.
Theorem: Every finite lattice is a complete lattice. Proof. TODO
Definition: Given lattices , if has least upper bound and greatest lower bound, then we can have a Product Lattice defined by
Lemma: If all latices are complete lattices, then the product lattice is a complete lattice
Fixed-Point Theorem
A function is monotone when
- e.g., a constant function
- e.g., functions and are monotone in both arguments.
, we want to prove
- by definition of , ,
- by transitivity of ,
thus is an upper bound for and also for , then we have
Definition: In a lattice with finite height, every monotone function has a unique least fixed-point.
The least fixed point of can be found by iterating until a fixed point is reached.
We have an increasing chain:
Since is assumed to have finite height, we must for some have that .
We define and since , we know that is a fixed-point.
Assume now that is another fixed-point. Since it follows that , since is monotone and by induction we get that . Hence, is the least fixed-point. By anti-symmetry, it is also unique.
Similarly, the greatest fixed point of can be found by iterating until a fixed point is reached.
Closure Properties
Definition: If are lattices with finite height, then so is the product:
where is defined pointwise. Note that and can be computed pointwise.
height
Definition: If are lattices with finite height, then so is the sum:
where iff and
Data Flow Analysis 可被看作沿某方向(正向分析或逆向分析),不停的应用 直到达到某不动点