the implicit complexity content of quasi interpretations
play

The implicit complexity content of Quasi-interpretations G. - PowerPoint PPT Presentation

The implicit complexity content of Quasi-interpretations G. Bonfante, J-Y Marion and J-Y Moyen Ecole des Mines - INPL - Loria Appsem 04/04 p.1/21 Motivations Control program resources: time, memory, stack size. Static analysis


  1. The implicit complexity content of Quasi-interpretations G. Bonfante, J-Y Marion and J-Y Moyen Ecole des Mines - INPL - Loria Appsem – 04/04 – p.1/21

  2. Motivations Control program resources: time, memory, stack size. Static analysis provides a “resource certificate” A resource certificate can be attached to a program (see PCC) A resource certificate can give hints to run a program satisfying some computational property. Resource controls at runtime slowdown a program and is problematic in case of attack Appsem – 04/04 – p.2/21

  3. Proof theoretical analysis of computation and complexity Specification Proof of termination Program synthetesis Appsem – 04/04 – p.3/21

  4. Proof theoretical analysis of computation and complexity Specification 1st order functional programs Proof of termination Program synthetesis Appsem – 04/04 – p.3/21

  5. Proof theoretical analysis of computation and complexity Specification 1st order functional programs Proof of termination Complexity analysis Program synthetesis Appsem – 04/04 – p.3/21

  6. Proof theoretical analysis of computation and complexity Specification 1st order functional programs Proof of termination Complexity analysis Program synthetesis with transformation and guaranted complexity Appsem – 04/04 – p.3/21

  7. ✔ ✟ ✑ ✔ ☎ ✏ ✏ ☎✏ ✄ ☞ ✌ ✡ ✠ ✠ ✔ ✝ ✆ ☛ ✑ ✔ ☎ ✘ ✘ ✘ ☎ ✍ ✄ ✙ ✆ ✡ ✠ ✠ ✗ ✝ ✖ ✓ ☎ ✏ ☞ � ✁ ✂ ✄ � ☎ ✁ ☎ ✂ ✟ ✠ ✠ ✡ ✏ ☛ ✌ ☞ ☎✏ ☎✏ ✏ ✏ ☎ ✄ ✄ ✆ 1st order fct prog Constructors : , functions : , variables : . ✆✞✝ ✟✎✍ ✟✒✑ ✟✎✍ ✟✒✑ (Terms) f (Patterns) ✔✕✍ (Rules) f Appsem – 04/04 – p.4/21

  8. ✆ ☎ ✠ ✠ ✗ ✝ ✖ ✆ ☛ ☞ ✑ ✂ ✔ ☎ ✏ ✏ ☎✏ � ✄ ✌ ✡ ✄ ✠ ✟ � ✙ ✆ � ☎ ✁ ✄ ☎ ✙ ✔ ✆ ✑ ✔ ☎ ✘ ✘ ✘ ☎ ✍ ✡ ✠ ✄ ☎ ✡ ✠ ✠ ✟ ✂ ✂ ☎ ✁ � ☞ ✄ ☎ � ✂ ✆ ✁ ✆ � ☛ ✌ ✔ ✄ ✝ ✓ ✆ ✙ ☎ ✏ ✏ ☎✏ ✄ ✄ ✁ ☞ ✆ ☎ ☎ ✏ ✏ ☎✏ ✄ ✄ 1st order fct prog Constructors : , functions : , variables : . ✆✞✝ ✟✎✍ ✟✒✑ ✟✎✍ ✟✒✑ (Terms) f (Patterns) ✔✕✍ (Rules) f Nil concat Cons Cons concat concat Appsem – 04/04 – p.4/21

  9. � Termination Termination orderings : Polynomial interpretation (Lankford) Multiset path ordering (MPO) (Dershowitz) Lexicographic path ordering (LPO) Appsem – 04/04 – p.5/21

  10. Appsem – 04/04 – p.6/21 ☛ ✖ ☛ ✟✠ ✝ ✆ ✓ ✟ ☎ ✏ ✕ ✟✠ ✁ ✟ ✍ ✌ � ✆ ✝ ☛ ☎ ✏ ✟ ✟ ☎✏ ✁ ✏ ☛ ✟✠ ✟ ✍ ✙ ✘ ✄ ☛ ☎ ✏ ☎✏ ✏ ✁ ☛ ✖ ✟✠ ✝ ✝ ✆ ✘ ☎ ✏ ☎✏ ✏ ☛ ✝ � ✁ ✍ ✌ ✏ ✡ ✆ ✏ ✎ ☛ ☎ ✏ ✏ ☎✏ ✁ ☎ ✡ ☎✏ ✏ ✆ ✟✠ ✟✠ ✡ ✓ ✟ ☎ ✏ ✕ ☛ � ☎ ✟ ✄ ✓ ☛ ✟✠ ✟ ✟✠ g f g MPO (1/2) ✄ ☞☛ ✑✒✝ ✆✔✝ ✆✞✝ ✆✔✝ ✆✞✝ ✟ ✗✄ ✄ ☞☛ . ✟ ☎✄ g ✆✞✝ is an ordering on ✟ ✂✁

  11. � ☎ ✁ ✡ ✡ ✞ ✂ ✟✠ ✎ ✏ ✄ ✝ ✘ ✟ ✓ ✑ ✟✠ ☎ ✞ ✓ ✟ ✕ ✠ ✡ ✄ ☎ ✝ ✖ ✟ ☎✏ ✏ ✏ ☎ ✟ ✄ ✘ ✆ ✝ ☛ ✟✠ � ✡ ✖ ☛ ✁ ☎✏ ✏ ✏ ☎ ✄ MPO (2/2) ✟ ✂✁ iff and there is a permutation s.t. s.t. ✆✔✝ ☛ ✝✆ ✟ ☛✡ ☛ ✝✆ Appsem – 04/04 – p.7/21

  12. ✄ ✟✠ ✂ ✂ ✂ ✎ ✏ ✡ ☎ ✙ ✟ ✓ � ✟ ✡ ✞ ✓ ✟ ✕ ✠ ✄ ☎ ☎ ✡ ✑ ✝ � ✁ ✞ ✝ ✖ � ☎✏ ✏ ✏ ☎ ✟ ✄ ✘ ✆ ✝ ✟✠ ✟✠ � ✡ ✖ ☛ ✁ ☎✏ ✏ ✏ ☎ ☛ ✄ ✘ ✟✠ MPO (2/2) ✟ ✂✁ iff and there is a permutation s.t. s.t. ✆✔✝ ☛ ✝✆ ✟ ☛✡ ☛ ✝✆ A program terminates by MPO if for each rule , we have . ✆✔✝ Appsem – 04/04 – p.7/21

  13. Extensional characterization of MPO A MPO function is a function computed by a program which terminates by MPO. The set of MPO functions is exactly the set of primitive recursive functions. (Cichon (90), Hofbauer (92)) Appsem – 04/04 – p.8/21

  14. ✆ ☛ � ✆ ✄ ☛ ☎ ☎ ✆ ☎ ☎ ✏ ☎ ✄ Intentionnality The “good” algorithms which computes in ✁✄✂ steps is not definable by primitive recursive schema (Colson (89)) . However, it terminates by MPO. Appsem – 04/04 – p.9/21

  15. ☎ ☛ � ✆ ✄ ☛ ☎ ☎ ✆ ☎ ✆ ✏ ☎ ✄ Intentionnality The “good” algorithms which computes in ✁✄✂ steps is not definable by primitive recursive schema (Colson (89)) . However, it terminates by MPO. On the other hand, quicksort does not terminate by MPO but the sort function is a PR function. The goal is to capture “good” programs within a resource bound. Appsem – 04/04 – p.9/21

  16. ✓ ✏ ✁ ✂ � ✄ ✁ ✂ ✙ ✂ ✆ ✂ ☎ ✟ ✆ ✄ ☎ ☎ ✄ ☎✏ ✏ ✄ ✏ ✏ ☎✏ ✄ ✁ ✟ ✂ ✄ ✏ ✁ ✂ ✡ ✄ ✆ ✄ ☎ ✏ ✏ ☎✏ ✂ ✁ ✂ ✄ ✄ ✁ ✂ ✄ ✄ ✂ ✄ ✂ ✁ � ✄ ✁ ✁ ✁ � ✌ ✄ ✁ ☎ ☎ ✄ ✄ ✁ ✂ ✂ ✓ ✡ ☎ ✆ ✄ ☎ ☎ ✏ ✏ ☎✏ ✁ ☎ Quasi-interpretations (Marion et Moyen, Bonfante, ) A quasi-interprétation of is a function satisfying: is bounded by a polynomial. ✆✞✝ for all . is increasing (not-strictly). ✟ ✂✁ ✟ ☎✄ ✟ ☎✄ Program with quasi-interpretation if for each rule , we have . Appsem – 04/04 – p.10/21

  17. ✁ � ✁ � ✁ � ✁ ✁ Characterization of P TIME The set of functions which are computed by a program 1. which terminates by MPO 2. which admits a quasi-interpretation is exactly the set P TIME of functions computable in polynomial time. (Marion et Moyen, ) I CAR system implements this resource analysis method. (Moyen, ) Appsem – 04/04 – p.11/21

  18. � ✁ � ✁ ✁ � ✁ � Characterization of P SPACE The set of functions which are computed by a program 1. which terminates by LPO 2. which admits a quasi-interpretation is exactly the set P SPACE of functions computable in polynomial space. (Bonfante, Marion et Moyen, ) A upper bound on memory can be produced from termina- tion proof (Amadio et al. ). Appsem – 04/04 – p.12/21

  19. Length of the longest common subsequence Appsem – 04/04 – p.13/21

  20. Length of the longest common subsequence A B B A B A Appsem – 04/04 – p.13/21

  21. Length of the longest common subsequence A B B A B A B A B A Appsem – 04/04 – p.13/21

  22. Length of the longest common subsequence A B B A B A B A B A Appsem – 04/04 – p.13/21

  23. Length of the longest common subsequence A B B A B A B A B A Appsem – 04/04 – p.13/21

  24. ✁ � ✁ ✆ ✂ ✁ � ✟ ✆ ✆ ✝ � � ✂ ✂ ✟ ✝ ☛ ✆ � ✆ � ✁ ✆ ✂ � � � ✆ ✆ ✆ ✟ ✂ ✆ ✁ � � ✂ ✆ � ☎ � ✆ ✝ ✞ ✟ � ☎ ✂ ✟ ✆ ✝ ✞ ✟ Length of the longest common subsequence A B B A B A B A B A lcs ✁✄✂ lcs i i ✆✡✠ lcs lcs i j j i lcs max lcs lcs Appsem – 04/04 – p.13/21

  25. � � ✂ ✟ ✆ ☛ ✟ � ✂ ✆ ✁ ✆ ✂ ✁ ✟ � ✆ ✆ ✝ � � � � ✁ ✂ ✂ � ✟ ✁ ✆ ✆ ✝ � ✆ ☎ ✆ ✝ ✞ ✄ � ☎ ✂ ✟ ✆ ✞ ✝ � � ✄ � ✁ ✆ ✂ � � ✟ ✆ ✆ ✆ Explicit vs Implicit lcs ✁✄✂ lcs i i ✆✡✠ lcs lcs i j j i lcs max lcs lcs Explicit complexity : runtime is Appsem – 04/04 – p.14/21

  26. � � ✂ ✟ ✆ ☛ ✟ � ✂ ✆ ✁ ✆ ✂ ✁ ✟ � ✆ ✆ ✝ � � � � ✁ ✂ ✂ � ✟ ✁ ✆ ✆ ✝ � ✆ ☎ ✆ ✝ ✞ ✄ � ☎ ✂ ✟ ✆ ✞ ✝ � � ✄ � ✁ ✆ ✂ � � ✟ ✆ ✆ ✆ Explicit vs Implicit lcs ✁✄✂ lcs i i ✆✡✠ lcs lcs i j j i lcs max lcs lcs Explicit complexity : runtime is Appsem – 04/04 – p.14/21

  27. � ✝ ☛ ✄ � � � ✁ ✆ ✂ ✄ � ✟ ✆ ✆ ✆ ✟ � ✆ � ✁ ✂ ✟ � ✟ ✆ ✆ ✂ ✂ � ✆ ✆ ✂ ✁ ✞ � ✁ ☎ ✆ ✝ ✞ � � ☎ ✂ ✟ ✆ ✝ � ✁ � ✡ � ✁ ✆ ✂ ✄ � ✟ ✆ ✆ ✝ ✂ � � Explicit vs Implicit lcs ✁✄✂ lcs i i ✆✡✠ lcs lcs i j j i lcs max lcs lcs Explicit complexity : runtime is lcs terminates by MPO and admits a QI : . lcs Implicit complexity is polynomial. Appsem – 04/04 – p.14/21

  28. Memoisation Appsem – 04/04 – p.15/21

  29. � ✁✂ ✄ ☎ ✞ ✞ ✟ Memoisation ☎✝✆ Appsem – 04/04 – p.15/21

  30. ☎ ✄ ✄ ✁✂ � ✟ ✞ ✞ � ✁✂ ✞ � ✟ ✞ ✞ ✟ ✄ ✂ ✁ ☎ Memoisation ☎✝✆ ☎✝✆ ☎✝✆ Appsem – 04/04 – p.15/21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend