solving fixed point equations on continuous semirings
play

Solving fixed-point equations on -continuous semirings Javier - PowerPoint PPT Presentation

Solving fixed-point equations on -continuous semirings Javier Esparza Technische Universit at M unchen Joint work with Stefan Kiefer and Michael Luttenberger From programs to flowgraphs proc X 2 proc X 3 proc X 1 c f a d X 2 X 2 X


  1. Solving fixed-point equations on ω -continuous semirings Javier Esparza Technische Universit¨ at M¨ unchen Joint work with Stefan Kiefer and Michael Luttenberger

  2. From programs to flowgraphs proc X 2 proc X 3 proc X 1 c f a d X 2 X 2 X 1 X 1 e g b X 1 X 3 X 3 X 2

  3. From flowgraphs to equations A syntactic transformation. = a · X 1 · X 2 + b X 1 X 2 = c · X 2 · X 3 + d · X 2 · X 1 + e = f · X 1 · X 3 + g X 3 But how should the equations be interpreted mathematically? − What kind of objects are a , . . . , g ? − What kind of operations are sum and product ? It depends. Different interpretations lead to different semantics

  4. From flowgraphs to equations A syntactic transformation. = a · X 1 · X 2 + b X 1 X 2 = c · X 2 · X 3 + d · X 2 · X 1 + e = f · X 1 · X 3 + g X 3 But how should the equations be interpreted mathematically? − What kind of objects are a , . . . , g ? − What kind of operations are sum and product ? It depends. Different interpretations lead to different semantics.

  5. Input/output relational semantics Interpret a , . . . , g as assignments or guards over a set of program variables V with set of valuations Val . R ( X i ) = ( v , v ′ ) ∈ Val × Val such that X i started at v , may terminate at v ′ .

  6. Language semantics Interpret the atomic actions as letters of an alphabet A . L ( X i ) = words w ∈ A ∗ such that X i can execute w and terminate.

  7. Language semantics Interpret the atomic actions as letters of an alphabet A . L ( X i ) = words w ∈ A ∗ such that X i can execute w and terminate. ( L ( X 1 ) , L ( X 2 ) , L ( X 3 ) ) is the least solution of the equations under the following interpretation: • Universe: 2 A ∗ (languages over A ). • a , . . . , g are the singleton languages { a } , . . . , { g } . • sum is union of languages, product is concatenation: L 1 · L 2 = { w 1 w 2 | w 1 ∈ L 1 ∧ w 2 ∈ l 2 }

  8. Probabilistic termination semantics Interpret a , . . . , g as probabilities. T ( X i ) = probability that X i terminates.

  9. Probabilistic termination semantics Interpret a , . . . , g as probabilities. T ( X i ) = probability that X i terminates. ( T ( X 1 ) , T ( X 2 ) , T ( X 3 ) ) is the least solution of the equations under the following interpretation: • Universe: R + • a , . . . , g are the probabilities of taking the transitions • sum and product are addition and multiplication of reals

  10. ω -continuous semirings Underlying mathematical structure: ω -continuous semirings Algebra ( C , + , · , 0 , 1) – ( C , + , 0) is a commutative monoid – · distributes over + – ( C , · , 1) is a monoid – 0 · a = a · 0 = 0 – a ⊑ a + b is a partial order – ⊑ -chains have limits System of (w.l.o.g. quadratic) equations X = f ( X ) where • X = ( X 1 , . . . , X n ) vector of variables, • f ( X ) = ( f 1 ( X ) , . . . , f n ( X )) vector of terms over C ∪ { X 1 , . . . , X n } . Notice: the f i are polynomials

  11. Kleenean program analysis Theorem [Kleene]: The least solution µ f is the supremum of { k i } i ≥ 0 , where = f (0) k 0 k i +1 = f ( k i ) Basic algorithm for computing µ f : compute k 0 , k 1 , k 2 , . . . until either k i = k i +1 or the approximation is considered adequate.

  12. Kleenean program analysis is slow Set interpretations: Kleene iteration never terminates if µ f is an infinite set. µ f = a ∗ b • X = a · X + b • Kleene approximants are finite sets: k i = ( ǫ + a + . . . + a i ) b Probabilistic interpretation: convergence can be very slow [EY STACS05]. • X = 1 2 X 2 + 1 µ f = 1 = 0 . 99999 . . . 2 • “Logarithmic convergence”: k iterations to get log k bits of accuracy. 1 k n ≤ 1 − k 2000 = 0 . 9990 n + 1

  13. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  14. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  15. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  16. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  17. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  18. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  19. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  20. Kleene Iteration for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  21. Newton’s Method for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  22. Newton’s Method for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  23. Newton’s Method for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  24. Newton’s Method for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  25. Newton’s Method for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  26. Newton’s Method for X = f ( X ) (univariate case) 1 . 2 1 µ f 0 . 8 f ( X ) 0 . 6 0 . 4 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 . 2

  27. Evaluation of Newton’s method Newton’s Method is usually very efficient • often exponential convergence . . . but not robust: • may not converge, converge only locally (in some neighborhood of the least fixed-point), or converge very slowly.

  28. A puzzling mismatch Program analysis: • General domain: arbitrary ω -continuous semirings • Kleene Iteration is robust and generally applicable • . . . but converges slowly. Numerical mathematics: • Particular domain: the real field • Newton’s Method converges fast • . . . but is not robust

  29. Our main result • Newton’s Method can be defined for arbitrary ω -continuous semirings, and becomes as robust as Kleene’s method.

  30. Mathematical formulation of Newton’s Method Let ν be some approximation of µ f . (We start with ν = f (0) .) • Compute the function T ν ( X ) describing the tangent to f ( X ) at ν • Solve X = T ν ( X ) (instead of X = f ( X ) ), and take the solution as the new approximation Elementary analysis: T ν ( X ) = Df ν ( X ) + f ( ν ) − ν where Df x 0 ( X ) is the differential of f at x 0 = 0 So: ν 0 = ν i + ∆ i where ∆ i solution of X = Df ν i ( X ) + f ( ν i ) − ν i ν i +1

  31. Generalizing Newton’s method X = Df ν ( X ) + f ( ν ) − ν Key point: generalize In an arbitrary ω -continuous semiring • neither the differential Df ν ( X ) , nor • the difference f ( ν ) − ν are defined.

  32. Differentials in semirings Standard solution: take the algebraic definition  0 if f ( X ) = c     if f ( X ) = X X       Dg ν ( X ) + Dh ν ( X ) if f ( X ) = g ( X ) + h ( X ) Df ν ( X ) = Dg ν ( X ) · h ( ν ) + g ( ν ) · Dh ν ( X ) if f ( X ) = g ( X ) · h ( X )      � � Df ν ( X ) if f ( X ) = f i ( X ) .      i ∈ I i ∈ I

  33. The difference f ( ν i ) − ν i Solution: Replace f ( ν i ) − ν i by any δ i such that f ( ν i ) = ν i + δ i ν i +1 = ν i + ∆ i where ∆ i solution of X = Df ν i ( X ) + δ i But does δ i always exist? Proposition: Yes. But ν i + i depends on your choice of δ i ! Theorem: No, it doesn’t. Can’t you give a closed form for ν i +1 ? Proposition: Yes. ∞ Df j Df ∗ � The least solution of X = Df ν i ( X ) + δ i is ν i ( δ i ):= ν i ( δ i ) j =0 and so: ν i +1 = ν i + Df ∗ ν i ( δ i )

  34. The difference f ( ν i ) − ν i Solution: Replace f ( ν i ) − ν i by any δ i such that f ( ν i ) = ν i + δ i ν i +1 = ν i + ∆ i where ∆ i solution of X = Df ν i ( X ) + δ i But does δ i always exist? Proposition: Yes. But ν i + i depends on your choice of δ i ! Theorem: No, it doesn’t. Can’t you give a closed form for ν i +1 ? Proposition: Yes. ∞ Df j Df ∗ � The least solution of X = Df ν i ( X ) + δ i is ν i ( δ i ):= ν i ( δ i ) j =0 and so: ν i +1 = ν i + Df ∗ ν i ( δ i )

  35. The difference f ( ν i ) − ν i Solution: Replace f ( ν i ) − ν i by any δ i such that f ( ν i ) = ν i + δ i ν i +1 = ν i + ∆ i where ∆ i solution of X = Df ν i ( X ) + δ i But does δ i always exist? Proposition: Yes. But ν i + i depends on your choice of δ i ! Theorem: No, it doesn’t. Can’t you give a closed form for ν i +1 ? Proposition: Yes. ∞ Df j Df ∗ � The least solution of X = Df ν i ( X ) + δ i is ν i ( δ i ):= ν i ( δ i ) j =0 and so: ν i +1 = ν i + Df ∗ ν i ( δ i )

Recommend


More recommend