Definitioncore
Maximal fixed-point solution
Also called MFP solution, maximum fixed point.
The greatest solution of the dataflow equations of a monotone framework, which iterative algorithms compute and which is below the MOP.
The maximal fixed-point (MFP) solution of a dataflow problem is the greatest solution of its dataflow equations. It is what iterative solvers such as the worklist dataflow algorithm compute: start every value at , the most optimistic fact, and lower values until the equations hold. In every monotone dataflow framework the MFP solution exists, is unique, is reached by iteration, and is below the ideal meet-over-all-paths solution, so it is safe. In a distributive dataflow framework it equals MOP. "Maximal" means greatest in the meet order used by Kildall, Kam and Ullman, and the dragon book. Turning the order upside down gives the convention of abstract interpretation and of Nielson, Nielson and Hankin, where the same solution is the least fixed point and the start value is .
Definition
The dataflow pages use the meet convention. is a meet semilattice: is idempotent, commutative and associative, and means , a partial order (reflexive, antisymmetric, transitive) in which is the greatest lower bound. is the identity of meet. The height is the largest number of strict steps in a chain , and it is finite. Lower facts are weaker, safer claims.
The equations as one function. Take a forward instance on a control flow graph with blocks , , edges, transfer functions that are monotone, and boundary value at the entry. An assignment gives each block a value , the fact at its start. Assignments are ordered block by block: if for all . Define
with the empty meet equal to . A solution of the dataflow equations is an with , a fixed point of . The facts at the ends of the blocks are then . A backward instance is the same on the reverse CFG, with after each ret block.
Definition. The maximal fixed-point solution is the greatest fixed point of : the solution with for every solution .
Facts about . is monotone, because each is monotone and the meet is monotone in each argument. The assignments form a semilattice of height , since a strict step lowers at least one of the entries, and each entry can fall at most times.
Existence, uniqueness and iteration. Let (every entry ) and . Then:
- The sequence goes down. . If , then by monotonicity.
- It stops. A strict step can happen at most times, so for some . Then is a fixed point.
- It is the greatest. Let be any assignment with , in particular any fixed point. Then , and if then . So .
So exists, it is unique (two greatest elements are equal by antisymmetry), and it is also the greatest with . This is the dual of Kleene's fixed-point theorem; with and finite height, and the assignments form complete lattices, and the Knaster-Tarski theorem gives the same greatest fixed point as the join of all with .
MFP is below MOP. For every block , .
Proof. Let be any assignment with . We show for every path from the entry to , by induction on the length of . If has length zero, is the entry, and . Otherwise is a path to some followed by the edge , and . Then
using the induction hypothesis and the monotonicity of . So is a lower bound of all , and hence below their meet . Take .
Soundness. If every is a safe description of its block, then every run that reaches follows a path , the fact describes its state there, and the lower facts and describe it too. The proof uses only monotonicity.
Precision, with an example. MFP merges facts at every join before it applies the next function, while MOP applies the functions along each path and merges only at the end. For a monotone , , so merging early can only lose. In constant propagation on the diamond where one branch sets and the other , followed by z = x + y, MFP says z is not a constant and MOP says . In a distributive framework with every block reachable, MFP = MOP (proved on the distributive dataflow framework page).
Cost. The plain iteration takes at most rounds, each with transfer functions and meets. The worklist dataflow algorithm recomputes only what can change: each entry falls at most times, so it uses at most transfer functions and meets. For rapid frameworks, round-robin iteration in reverse postorder needs only rounds, with the loop-connectedness depth (Kam-Ullman iteration bound).
Any fair order gives MFP. The result does not depend on the order in which blocks are updated. Any update applied to an gives a value , since . So every order stays above MFP, and an order that stops only when no update changes anything stops at a fixed point, which must then be MFP. This is why round-robin, worklist and other chaotic iteration orders of fixed-point iteration all agree.
Examples and non-examples
Live variables on the running example. For the loop of the running example of dataflow analysis, the MFP of live variable analysis has live at the start of entry and at the start of odd. Liveness is distributive and every block reaches the return, so this is also MOP.
Non-example: a fixed point that is not the greatest. Add w = 0 to entry in the running example, and let nothing read w. Putting w into the live sets of head, body, odd and next gives another solution of the equations: around the loop, each block passes w to the block before it, and no block in the loop writes w. The facts justify each other in a cycle. This solution has larger sets, so in the order of a may problem it is strictly below the MFP. Iteration from never adds w, because no read of w starts the chain. The MFP, the greatest fixed point, is the one without such self-supporting claims.
Non-example: the wrong start value in a must problem. For available expressions, starting the blocks other than the entry at () instead of also ends at a fixed point, but often a smaller one: an expression computed before a loop and not changed inside it is lost at the loop head, because the back edge brings . Only the start at gives the greatest fixed point.
Non-example: a framework that is not monotone. If a transfer function is not monotone, need not have a fixed point at all. With one item , union as the meet, and a block with a self-loop whose function is , the equation is , which no set satisfies.
Related definitions
- Meet-over-all-paths solution: the ideal answer, at least as precise as MFP.
- MOP-MFP coincidence theorem: MFP = MOP for distributive frameworks.
- Kleene fixed-point theorem and Knaster-Tarski theorem: fixed points of monotone functions by iteration and by lattice theory.
- Fixed-point iteration and worklist dataflow algorithm: ways to compute MFP.
- Abstract interpretation: the same idea with the order reversed (least fixed points from ) and with widening for lattices of infinite height.
References
- John B. Kam and Jeffrey D. Ullman, Monotone data flow analysis frameworks, Acta Informatica 7(3), 1977, 305-317, the whole paper (the maximal fixed point of a monotone framework, the proof that Kildall's algorithm computes it, and the proof that it is below the meet over all paths)
- Gary A. Kildall, A unified approach to global program optimization, Proceedings of the 1st ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 1973), 194-206, the whole paper (the iterative algorithm from the top element, and its result for distributive functions)
- Alfred V. Aho, Monica S. Lam, Ravi Sethi and Jeffrey D. Ullman, Compilers, Principles, Techniques, and Tools, second edition, Pearson Addison-Wesley, 2007, Section 9.3.3 (The Iterative Algorithm for General Frameworks) and Section 9.3.4 (Meaning of a Data-Flow Solution, the maximum fixedpoint and its relation to the meet-over-paths solution)
- Flemming Nielson, Hanne Riis Nielson and Chris Hankin, Principles of Program Analysis, Springer, 1999, Section 2.4 (Equation Solving, the worklist algorithm for the MFP solution and the comparison with the MOP solution), in the join convention where the same solution is the least one
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag F192NH Edit this page History Report an error Markdown