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 DICE-FOPARA, 22-23 april 2017 CNRS, INRIA, Universit de Lorraine & LORIA, Nancy, France 1 Introduction First-order computability and


  1. Higher-order Interpretations for Higher-order Complexity Emmanuel Hainry & Romain Péchoux DICE-FOPARA, 22-23 april 2017 CNRS, INRIA, Université de Lorraine & LORIA, Nancy, France 1

  2. Introduction

  3. First-order computability and complexity • First-order computability is well understood: • Agreed upon definitions • Hierarchies layering the Turing degree of problems • Church-Turing’s thesis • First-order computational Complexity is well understood: • Agreed upon definitions • Classes and hierarchies layering the difficulty of problems • Various characterizations: • machine based characterizations • machine independent characterizations → Implicit Computational Complexity 2

  4. Higher-order computability and complexity • Higher-order 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 • Higher-order 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, • ... • Higher-order 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 � • Quasi-interpretation (QI) for complexity analysis: • ∀ b of arity n , � b � : N n → ր N • ∀ l → r ∈ R , � l � ≥ � r � Theorem (Bonfante et al. 2011) Let QI poly add be the set of functions computed by TRS admitting an additive and polynomial QI. • QI poly add ∩ RPO ≡ FSPACE add ∩ RPO prod ≡ FPTIME • QI poly 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 0 � = 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 0 � = 1 > 0 = � ǫ � � double s ( x ) � = 3 X + 4 > 3 X + 3 = � s ( s ( double ( x )) � Termination by RPO prod ⇒ [ [ 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(A) :: = nil | c A List(A) 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 p jN 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): opM → 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 strictly monotonic function from A to B : ∀ x , y ∈ A , x < A y = ⇒ f ( x ) < B f ( y ) . • 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 )) → monotonic function over a complete lattice 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 ) � 15

  31. Example of Interpretation � letRec map = λ g .λ x . case x of c y z → c ( g y ) ( map g z ) � = ⊓ { F | F ≥ 1 ⊕ (Λ � f � . � λ g .λ x . case x of c y z → c ( g y ) ( f g z ) � ) F } ( letRec ) 15

Recommend


More recommend