introduction
play

Introduction ICC : Implicit Computational Complexity The problem: - PowerPoint PPT Presentation

A Complete Polynomial -Calculus joint work with Simona Ronchi Della Rocca Erika De Benedetti Universit` a degli Studi di Torino ICTCS (Varese), 20 September 2012 A Complete Polynomial -Calculus Erika De Benedetti (UNITO) ICTCS (Varese),


  1. A Complete Polynomial λ -Calculus joint work with Simona Ronchi Della Rocca Erika De Benedetti Universit` a degli Studi di Torino ICTCS (Varese), 20 September 2012 A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 1 / 24

  2. Introduction ICC : Implicit Computational Complexity The problem: the design of programming languages with bounded computational complexity, in particular PTIME . The line: a ML-like approach λ -calculus as paradigmatic programming language. types as semantic properties of terms. Type assignment for λ -calculus such that: types guarantee the correctness of terms, in particular their complexity bound. A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 2 / 24

  3. Our ancestors Two similar proposals, based on Light Logics (derived from the Linear Logic of Girard) where the cut-elimination procedure is bounded in time by the size of the proof, exploiting the isomorphism: FORMULAE as TYPES DLAL (Baillot, Terui): Types are formulae of LAL (Light Affine Logic) (Girard, Asperti, Roversi) STA (Gaboardi, RDR): Types are formulae of SOFT (Soft Linear Logic) (Lafont) Both: are sound and complete w.r.t. FPTIME i.e.: all and only polynomial functions can be coded by typed terms (using a standard uniform coding) give type to a proper subset of strongly normalizing terms. A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 3 / 24

  4. A system with stratification types: ISTA We explore a different (non logical) approach, where types are stratified , so equivalent to intersection types with idempotence and commutativity, but without associativity. Our system ISTA is: sound and complete w.r.t. FPTIME sound and complete w.r.t. strong normalization A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 4 / 24

  5. Definitions The set of types of ISTA is defined by the following syntax: A :: = a | σ → A | ∀ a . A (linear types) σ :: = A | { σ 1 , ..., σ n } n > 0 (stratified types) where { σ 1 , ..., σ n } is treated as a set { j A } j stands for { ... { A } ... } ���� ���� j j brackets { } are not associative σ = { A 1 , ..., A n } ¯ ISTA proves judgments of the shape π : Γ ⊢ M : σ A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 5 / 24

  6. Typing rules for ISTA x : A ⊢ x : A ( Ax ) Γ ⊢ M : σ x � dom ( Γ ) Γ , x : σ ⊢ M : B ( w ) Γ ⊢ λ x . M : σ → B ( → I ) Γ , x : A ⊢ M : σ Γ 1 ⊢ M : σ → A Γ 2 ⊢ N : σ Γ 1 # Γ 2 ( → E ) Γ 1 , Γ 2 ⊢ MN : A Γ ⊢ M : A a � FTV ( Γ ) Γ ⊢ M : ∀ a . B ( ∀ I ) Γ ⊢ M : B [ A / a ] ( ∀ E ) Γ ⊢ M : ∀ a . A Γ i ⊢ M : σ i 1 ≤ i ≤ n Γ , x 1 : A , ..., x n : A ⊢ M : τ i = 1 { Γ i } ⊢ M : { σ 1 , ..., σ n } ( st ) Γ , x : { A } ⊢ M [ x / x 1 , ..., x / x n ] : τ ( m l ) � n Γ , x 1 : σ 1 , ..., x n : σ n ⊢ M : τ σ i not linear ( m s ) Γ , x : { σ 1 , ..., σ n } ⊢ M [ x / x 1 , ..., x / x n ] : τ A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 6 / 24

  7. Normalization bound The depth of a derivation π , denoted by d ( π ) , is the maximum nesting of applications of rule ( st ) Normalization bound ∗ nf ( M ) in m steps, then m ≤ | M | d ( π ) + 1 , where | M | is the size of M and d ( π ) π : Γ ⊢ M : σ , and M −→ β is the depth of the derivation π . Note that A typable term has infinite types, so infinite derivations. Every derivation gives a bound of its normalization time A typable term has a minimal derivation. So the minimal bound depends only on the term itself. A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 7 / 24

  8. Strong normalization ISTA is sound and complete w.r.t. strong normalization: if a term is typable in ISTA then it is strongly normalizing (soundness) Proof. Termination of reduction does not depend on the strategy all strongly normalizing terms can be typed in ISTA (completeness) Proof. Following the guidelines of Neergaard 1 : Longest reduction strategy 1 Subject expansion under perpetual strategy 2 Completeness follows as a corollary 3 1 Neergaard 2005 A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 8 / 24

  9. Typability w.r.t. System F With respect to system F : More terms can be typed: e.g. ⊢ ( λ xy . y ( x I )( x K )) ∆ : (( A → A ) → B → C ) → C I = λ x . x , K = λ xy . x , ∆ = λ x . xx More types can be assigned: e.g. ⊢ λ x . xx : ∀ � a . {{ σ } , { σ → B }} → B , � a ⊆ FV ( σ ) ∪ FV ( B ) Stratification does not limit the number of terms that can be typed, but is necessary in order to limit the complexity. A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 9 / 24

  10. Soft Type Assignment system ( STA ) To prove soundness and completeness w.r.t FPTIME , we use the corresponding property of STA 2 . We use the same technique of Bucciarelli and Piperno, when proving that adding intersection to simple types does not increase the definability of functions. The set of types of STA is a proper subset of the SOFT formulae and is defined by the following syntax: U :: = a | µ → U | ∀ a . U (linear types) µ :: = U | ! µ (modal types) restrictions with respect to SOFT : modalities are not allowed neither on the r.h.s. of an arrow nor under the universal quantifier. 2 Gaboardi-Ronchi 2007 A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 10 / 24

  11. Reminder: STA Θ ⊢ STA M : µ x � dom Θ x : U ⊢ STA x : U ( Ax ) ( w ) Θ , x : U ⊢ STA M : µ Θ , x : µ ⊢ STA M : U Θ ⊢ STA M : µ → U Ξ ⊢ STA N : µ Θ # Ξ Θ ⊢ STA λ x . M : µ → U ( → I ) ( → E ) Θ , Ξ ⊢ STA MN : U Θ ⊢ STA M : ∀ a . B Θ ⊢ STA M : U a � FV ( Θ ) ( ∀ I ) Θ ⊢ STA M : B [ U / a ] ( ∀ E ) Θ ⊢ STA M : ∀ a . U Θ , x 1 : µ, . . . , x n : µ ⊢ STA M : ν Θ ⊢ M : µ Θ , x :! µ ⊢ STA M [ x / x 1 , ..., x n ] : ν ( m ) ! Θ ⊢ STA M :! µ ( sp ) A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 11 / 24

  12. Representation of numerals We represent numerals in Church style, so m is represented by m = λ xy . x ( x ... ( x y ) ... )) � �� �� �� � m In STA , m can be typed either uniformely by N = ∀ a . !( a → a ) → a → a , or by N n = ∀ a . ! n ( a → a ) → a → a , for all n ≥ 1 In ISTA , m can be typed either uniformely by NI = ∀ a . { a → a } → a → a , or by NI n = ∀ a . { n a → a } n → a → a , for all n ≥ 1 Both in ISTA and in STA derivations for numerals have depth 0. A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 12 / 24

  13. Representation of functions in STA Let φ : N p −→ N be a function of arity p . M represents φ in STA iff 1 M n 1 ... n p = φ ( n 1 , ..., n p ) there are integers i 1 , ..., i p such that x 1 :! i 1 N j 1 , ..., x p :! i p N j p ⊢ STA Mx 1 ... x p : N j , for some 2 j h , j , 1 ≤ h ≤ p FPTIME characterization All and only the polynomial functions can be coded in STA . A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 13 / 24

  14. Representation of functions in STA Example: succ: N i → N i + 1 add : N i → N j → N max ( i , j ) + 1 mult : N i → ! i N j → N i + j for all i , j ≥ 1 So they cannot be iterated, but only composed in order to obtain polynomials. A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 14 / 24

  15. Representation of functions in ISTA Let φ : N p −→ N be a function of arity p . M represents φ in ISTA iff 1 M n 1 ... n p = φ ( n 1 , ..., n p ) 2 x 1 : σ 1 , ..., x p : σ p ⊢ Mx 1 ... x p : NI j , and for all i ∈ { 1 , ..., p } , either σ i = NI k or σ i = { NI i 1 , ... NI i m } ¯ for some k , i h , j , 1 ≤ h ≤ p , m > 0 A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 15 / 24

  16. FPTIME completeness Translation ( . ) ◦ from T S to T is defined as follows: ( a ) ◦ = a ; ( µ → U ) ◦ = ( µ ) ◦ → ( U ) ◦ ; (! µ ) ◦ = { ( µ ) ◦ } Translation extended to derivations: ( π : Θ ⊢ STA M : µ ) ◦ = ( π ) ◦ : ( Θ ) ◦ ⊢ M : ( µ ) ◦ such that: the subject is preserved the depth is preserved FPTIME completeness In ISTA all the polynomial functions are definable. A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 16 / 24

  17. From ISTA to STA ( . ) ∗ is a translation from ISTA -derivations to STA -derivations such that: ( π : Γ ⊢ M : A ) ∗ = ( π ) ∗ : Θ ⊢ STA ⌈ M ⌉ : ( A ) ∗ such that ( A ) ∗ is a linear type; ⌈ M ⌉ is a partial linearization of M . the depth is preserved A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 17 / 24

  18. From ISTA to STA (2) Example 1 Let M = λ x . xx : π : ⊢ M : {{ b → a } , { b }} → a ( π ) ∗ ⊢ STA λ x 1 .λ x 2 . x 1 x 2 :!!( b → a ) → !! b → a Example 2 Let N = λ x .λ y . yxx : π : ⊢ N : { a } → ( a → a → a ) → a ( π ) ∗ : ⊢ STA N :! a → ( a → a → a ) → a A Complete Polynomial λ -Calculus Erika De Benedetti (UNITO) ICTCS (Varese), 20 September 2012 18 / 24

Recommend


More recommend