higher order interpretations for higher order complexity
play

Higher-order Interpretations for Higher-order Complexity Emmanuel - PowerPoint PPT Presentation

Higher-order Interpretations for Higher-order Complexity Emmanuel Hainry & Romain Pchoux LPAR, 11 may 2017 CNRS, INRIA, Universit de Lorraine & LORIA, Nancy, France 1 Introduction First-order computability and complexity


  1. Higher-order Interpretations for Higher-order Complexity Emmanuel Hainry & Romain Péchoux LPAR, 11 may 2017 CNRS, INRIA, Université de Lorraine & LORIA, Nancy, France 1

  2. Introduction

  3. First-order computability and complexity • Computability is well understood: • Definitions, hierarchies (Turing degree) • Church-Turing’s thesis • Computational Complexity is well understood: • Definitions, classes • Various characterizations: • machine based characterizations • machine independent characterizations → Implicit Computational Complexity 2

  4. Higher-order computability and complexity • Computability is (well) understood: • Order 2 = computations over reals. • No Church-Turing’s thesis! • General Purpose Analog Computer by Shannon, • Blum-Shub-Smale model, • Computable Analysis (CA) by Weihrauch, • Oracle TM, ... 3

  5. Higher-order computability and complexity • Computability is (well) understood: • Order 2 = computations over reals. • No Church-Turing’s thesis! • General Purpose Analog Computer by Shannon, • Blum-Shub-Smale model, • Computable Analysis (CA) by Weihrauch, • Oracle TM, ... • Complexity is not well understood. • Polytime complexity on OTM = Basic Feasible Functions (BFF) by Constable, Melhorn • Polytime complexity in CA = P ( R ) by Ko • No homogeneous theory for higher-order: P ( R ) � = BFF 3

  6. Objectives of this talk: • not developping a new complexity theory for higher-order, • adapting first-order tools for program complexity analysis, • validating the theory by capturing existing higher-order complexity classes 4

  7. Objectives of this talk: • not developping a new complexity theory for higher-order, • adapting first-order tools for program complexity analysis, • validating the theory by capturing existing higher-order complexity classes Framework: • tool = (polynomial) interpretations • target = BFF i , the Basic Feasible Functionals at any order. 4

  8. First-order interpretations

  9. First-order interpretations of TRS • Defined in the 70s for showing TRS termination : • ∀ b of arity n , � b � : N n → ↑ N • ∀ l → r ∈ R , � l � > � r � additive: for any constructor symbol c , � c � ( X ) = X + k , ∈ N . Let PI add be the set of functions computed by TRS admitting an additive polynomial interpretation. Theorem (Bonfante et al.) PI add ≡ FPTIME 5

  10. First-order interpretations of TRS Example double ( ǫ ) → ǫ double ( s ( x )) → s ( s ( double ( x )) 6

  11. First-order interpretations of TRS Example double ( ǫ ) → ǫ double ( s ( x )) → s ( s ( double ( x )) � ǫ � = 0 , � s � ( X ) = X + 1 , � double � ( X ) = 3 X + 1 6

  12. First-order interpretations of TRS Example double ( ǫ ) → ǫ double ( s ( x )) → s ( s ( double ( x )) � ǫ � = 0 , � s � ( X ) = X + 1 , � double � ( X ) = 3 X + 1 � double ǫ � = 1 > 0 = � ǫ � � double s ( x ) � = 3 X + 4 > 3 X + 3 = � s ( s ( double ( x )) � 6

  13. First-order interpretations of TRS Example double ( ǫ ) → ǫ double ( s ( x )) → s ( s ( double ( x )) � ǫ � = 0 , � s � ( X ) = X + 1 , � double � ( X ) = 3 X + 1 � double ǫ � = 1 > 0 = � ǫ � � double s ( x ) � = 3 X + 4 > 3 X + 3 = � s ( s ( double ( x )) � Additivity ⇒ [ [ double ] ] : x �→ 2 x ∈ FPTIME 6

  14. Higher-order interpretations of TRS: State of the art • Termination: • Van De Pol (1993) adapted interpretations for showing termination of higher-order TRS. 7

  15. Higher-order interpretations of TRS: State of the art • Termination: • Van De Pol (1993) adapted interpretations for showing termination of higher-order TRS. • Complexity: • Férée et al. (2010) adapted interpretations to first-order stream programs for characterizing BFF (BFF 2 ) and P ( R ). 7

  16. Higher-order interpretations of TRS: State of the art • Termination: • Van De Pol (1993) adapted interpretations for showing termination of higher-order TRS. • Complexity: • Férée et al. (2010) adapted interpretations to first-order stream programs for characterizing BFF (BFF 2 ) and P ( R ). • Baillot & Dal Lago (2016) adapted interpretations to higher-order Simply Typed TRS for characterizing FPtime. → a first step towards a better expressivity 7

  17. Higher-order language

  18. Higher Order Programming Language Definition (Functional Language) M := x | c | op | M 1 M 2 | λ x . M | case M of c 1 → M 1 | c 2 → M 2 | ... | c n → M n | letRec f = M + Inductive Typing 8

  19. Example Example letRec map = λ g. λ x.case x of c y z → c (g y) (map g z) | nil → nil List ( α ) ::= nil | c α List ( α ) map: ( A → B ) → List ( A ) → List ( B ) 9

  20. Semantics Four kinds of reductions: • β reduction: λ x . M N − → β M { N / x } • case reduction: case c j N j of c 1 → M 1 | ... | c n → M n − → case M j N j • letRec reduction: letRec f = M − → letRec M { letRec f = M / f } • Operator reduction (total functions over terms): op M → op [ [ op ] ]( M ) +Left-most outermost reduction strategy 10

  21. Higher-order interpretations

  22. Interpretations of types Definition • � b � = ¯ N = N ∪ {⊤} • � T → T ′ � = � T � → ↑ � T ′ � Definition • f : A → ↑ B a monotonic function from A to B . • x < ¯ N y iff x < y or y = ⊤ • f < A → ↑ B g iff ∀ x ∈ A , f ( x ) < B g ( x ) Example (map: ( A → B ) → List ( A ) → List ( B ) ) N → ↑ ¯ N ) → ↑ ¯ N → ↑ ¯ � map � is in (¯ N . 11

  23. Lattices ⊥ ¯ N = 0 ⊤ ¯ N = ⊤ ⊥ � T → T ′ � = Λ X � T � . ⊥ � T ′ � ⊤ � T → T ′ � = Λ X � T � . ⊤ � T ′ � ⊔ � T → T ′ � ( F , G ) = Λ X � T � . ⊔ � T ′ � ( F ( X ) , G ( X )) ⊓ � T → T ′ � ( F , G ) = Λ X � T � . ⊓ � T ′ � ( F ( X ) , G ( X )) Lemma For any type T, ( � T � , ≤ , ⊔ , ⊓ , ⊤ , ⊥ ) is a complete lattice. 12

  24. Interpretations of terms n ⊕ ¯ N = Λ X . ( n + X ) n ⊕ � T → T ′ � : Λ F . Λ X . ( n ⊕ � T ′ � F ( X )) Definition (Interpretations) � x � = X 1 ⊕ (Λ X 1 . . . . . Λ X n . � n � c � = i =1 X i ) � M N � = � M �� N � 13

  25. Interpretations of terms n ⊕ ¯ N = Λ X . ( n + X ) n ⊕ � T → T ′ � : Λ F . Λ X . ( n ⊕ � T ′ � F ( X )) Definition (Interpretations) � x � = X 1 ⊕ (Λ X 1 . . . . . Λ X n . � n � c � = i =1 X i ) � M N � = � M �� N � � λ x . M � = 1 ⊕ (Λ � x � . � M � ) 13

  26. Interpretations of terms n ⊕ ¯ N = Λ X . ( n + X ) n ⊕ � T → T ′ � : Λ F . Λ X . ( n ⊕ � T ′ � F ( X )) Definition (Interpretations) � x � = X 1 ⊕ (Λ X 1 . . . . . Λ X n . � n � c � = i =1 X i ) � M N � = � M �� N � � λ x . M � = 1 ⊕ (Λ � x � . � M � ) � case M of . . . c i → M i . . . � = 1 ⊕ ⊔ i { � M i � R i | � c i � R i ≤ � M � } 13

  27. Interpretations of terms n ⊕ ¯ N = Λ X . ( n + X ) n ⊕ � T → T ′ � : Λ F . Λ X . ( n ⊕ � T ′ � F ( X )) Definition (Interpretations) � x � = X 1 ⊕ (Λ X 1 . . . . . Λ X n . � n � c � = i =1 X i ) � M N � = � M �� N � � λ x . M � = 1 ⊕ (Λ � x � . � M � ) � case M of . . . c i → M i . . . � = 1 ⊕ ⊔ i { � M i � R i | � c i � R i ≤ � M � } � letRec f = M � = ⊓{ F | F ≥ 1 ⊕ (Λ � f � . � M ) � F } 13

  28. Interpretations of terms n ⊕ ¯ N = Λ X . ( n + X ) n ⊕ � T → T ′ � : Λ F . Λ X . ( n ⊕ � T ′ � F ( X )) Definition (Interpretations) � x � = X 1 ⊕ (Λ X 1 . . . . . Λ X n . � n � c � = i =1 X i ) � M N � = � M �� N � � λ x . M � = 1 ⊕ (Λ � x � . � M � ) � case M of . . . c i → M i . . . � = 1 ⊕ ⊔ i { � M i � R i | � c i � R i ≤ � M � } � letRec f = M � = ⊓{ F | F ≥ 1 ⊕ (Λ � f � . � M ) � F } � op M � ≥ �� op � ( M ) � 13

  29. Properties of interpretations Theorem Any term M has an interpretation. Knaster-Tarski: lfp (Λ X . 1 ⊕ ((Λ � f � . � M � ) X )) Lemma If M − → N, then � M � ≥ � N � . If M − → α N, α � = op, then � M � > � N � . Lemma If M :: B and � M � � = ⊤ then M terminates in time O( � M � ). 14

  30. Example of Interpretation � letRec map = λ g .λ x . case x of c y z → c ( g y ) ( map g z ) | nil → nil � = . . . . . . = . . . = ⊓{ F | F ≥ 5 ⊕ (Λ G . Λ X . ⊔ { (( G Y ) ⊕ ( F G Z )) | X ≥ 1 ⊕ Y ⊕ Z }} with 1 (letRec), 2 (Lambda), 1 (Case), 2 (Cons c ), 2 (Cons nil ) 15

  31. Relaxing interpretations � letRec map = λ g .λ x . case x of c y z → c ( g y ) ( map g z ) � = ⊓{ F | F ≥ 5 ⊕ (Λ G . Λ X . ⊔ { (( G Y ) ⊕ ( F G Z )) | X ≥ 1 ⊕ Y ⊕ Z }} 16

  32. Relaxing interpretations � letRec map = λ g .λ x . case x of c y z → c ( g y ) ( map g z ) � = ⊓{ F | F ≥ 5 ⊕ (Λ G . Λ X . ⊔ { (( G Y ) ⊕ ( F G Z )) | X ≥ 1 ⊕ Y ⊕ Z }} ≤ ⊓{ F | F ≥ 5 ⊕ (Λ G . Λ X . (( G ( X − 1)) ⊕ ( F G ( X − 1)))) } (constraint upper bound) 16

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