linear two sorted arithmetic
play

Linear two-sorted arithmetic Helmut Schwichtenberg Mathematisches - PowerPoint PPT Presentation

Linear two-sorted higher type terms Linear two-sorted arithmetic Linear two-sorted arithmetic Helmut Schwichtenberg Mathematisches Institut, LMU, M unchen Kyoto University, Japan, 8. May 2009 Helmut Schwichtenberg Linear two-sorted


  1. Linear two-sorted higher type terms Linear two-sorted arithmetic Linear two-sorted arithmetic Helmut Schwichtenberg Mathematisches Institut, LMU, M¨ unchen Kyoto University, Japan, 8. May 2009 Helmut Schwichtenberg Linear two-sorted arithmetic

  2. Linear two-sorted higher type terms Linear two-sorted arithmetic Feasible computation with higher types odel’s T (1958) “¨ G¨ Uber eine bisher noch nicht ben¨ utzte Erweiterung des finiten Standpunkts”: finitely typed λ -terms with structural recursion. LT (;) (Bellantoni, Niggl, S. 2000, 2002): restriction such that the definable functions are exactly the polynomial time computable ones. Here: Heyting Arithmetic = LA (;) G¨ odel’s T LT (;) Helmut Schwichtenberg Linear two-sorted arithmetic

  3. Linear two-sorted higher type terms Linear two-sorted arithmetic Related work ◮ Hofmann (1998): similar results with a very different proof technique. Ramification concepts have been considered earlier e.g. by Simmons (1988), Bellantoni & Cook (1992), Leivant & Marion (1998, 2001), and Pfenning (2001). ◮ The “tiered” typed λ -calculi of Leivant & Marion (1993) depend heavily on different representations of data (as words and as Church-like abstraction terms), which is not necessary in the LT (;)-approach. ◮ Algebraic context semantics (Dal Lago 2006). ◮ Arai & Moser (2005), Beckmann & Weiermann (1996): Analysis (importance) of reduction strategies for R . ◮ Baillot & Terui (2004): DLAL. Similar results; they notice that one can drop ! and have ֒ → and → instead. Helmut Schwichtenberg Linear two-sorted arithmetic

  4. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Extending “Bellantoni/Cook” to higher types ◮ input → σ ) ( ρ ֒ n , ¯ x , ¯ y , . . . (BC: normal) Recurse on. Use many times ◮ output ( ρ → σ ) (BC: safe) a , p , x , y , . . . Cannot recurse on. Base type: use many times. Higher type: use at most once. Helmut Schwichtenberg Linear two-sorted arithmetic

  5. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Typing of recursion ◮ Recursion with value type τ has type R τ N : N ֒ → τ → ( N → τ → τ ) ֒ → τ with τ safe . ◮ A type is safe if it does not contain the input arrow ֒ → . Helmut Schwichtenberg Linear two-sorted arithmetic

  6. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Terms ◮ built from (typed) input/output variables and constants by introduction and elimination for ֒ → and → : x ρ | x ρ | C ρ ¯ (constant) | → σ | ( r ρ֒ → σ s ρ ) σ ( λ ¯ x ρ r σ ) ρ֒ ( s input term: FV ( s ) input) | ( λ x ρ r σ ) ρ → σ | ( r ρ → σ s ρ ) σ (higher type output vars in r , s distinct) , ◮ The restriction on output variables in r ρ → σ s ensures that every higher type output variable can occur at most once. ◮ A function f is definable in LT (;) if there is a closed term t f : N ։ . . . N ։ N ( ։ ∈ { ֒ → , →} ) denoting this function. Helmut Schwichtenberg Linear two-sorted arithmetic

  7. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Numerals Let W := L ( B ), and S 0 := λ v (ff :: v W ) , S 1 := λ v (tt :: v W ) . 1 := nil B , Particular lists are S i 1 ( . . . ( S i n 1 ) . . . ), called binary numerals (or words), denoted by v , w . . . . Helmut Schwichtenberg Linear two-sorted arithmetic

  8. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Polynomials ◮ ⊕ : W ֒ → W → W concatenates | | v | | bits onto w : 1 ⊕ w = S 0 w , ( S i v ) ⊕ w = S 0 ( v ⊕ w ) . The representing term is vS 0 λ , , p , w ( S 0 ( p W → W w )) w . v ⊕ w := R W → W ¯ ¯ ◮ ⊙ : W ֒ → W ֒ → W has output length | | v | | · | | w | | : v ⊙ 1 = v , v ⊙ ( S i w ) = v ⊕ ( v ⊙ w ) . The representing term is ¯ v ⊙ ¯ w := R W ¯ w ¯ v λ , , p (¯ v ⊕ p ) . Helmut Schwichtenberg Linear two-sorted arithmetic

  9. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time A non-example: exponentiation ◮ Notice that ⊕ : W ֒ → W → W , and the value type for the recursion was W → W , which is safe. ◮ If we try to go on and define exponentiation from multiplication just as ⊙ was defined from ⊕ , we find that we cannot go ahead, because of the different typing ⊙ : W ֒ → W ֒ → W . Helmut Schwichtenberg Linear two-sorted arithmetic

  10. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Two recursions Consider D ( 1 ) := S 0 ( 1 ) , E ( 1 ) := 1 , D ( S i ( w )) := S 0 ( S 0 ( D ( w ))) , E ( S i ( w )) := D ( E ( w )) . The corresponding terms are D := λ ¯ w ( R W ¯ w ( S 0 1 ) λ , , p ( S 0 ( S 0 p ))) , E := λ ¯ w ( R W ¯ w 1 λ , , p ( Dp )) . Here D is legal, but E is not: the application Dp is not allowed. Helmut Schwichtenberg Linear two-sorted arithmetic

  11. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Recursion with parameter substitution Consider E ( 1 , v ) := S 0 ( v ) , E ( 1 ) := S 0 , or E ( S i ( w ) , v ) := E ( w , E ( w , v )) , E ( S i ( w )) := E ( w ) ◦ E ( w ) . The corresponding term wS 0 λ , , p , v ( p W → W ( pv ))) λ ¯ w ( R W → W ¯ does not satisfy the linearity condition: the higher type variable p occurs twice, and the typing of R requires p to be an output variable. Helmut Schwichtenberg Linear two-sorted arithmetic

  12. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Higher argument types ◮ Consider iteration I ( n , f ) = f n : I (0 , f , w ) := w , I (0 , f ) := id , or I ( n + 1 , f , w ) := I ( n , f , f ( w )) , I ( n + 1 , f ) := I ( n , f ) ◦ f . It is definable by a term with f a parameter of type W → W : I f := λ n ( R W → W n ( λ w w ) λ , p , w ( p W → W ( fw ))) . ◮ f must be an input variable, because the step argument of a recursion is by definition an input argument. Thus λ f I f may only be applied to input terms of type W → W . ◮ We cannot define the exponential function by λ n ( R W → W nS λ , p ( I p 2)) . The step type requires p to be an output variable, but I p is only correctly formed if p is an input variable. Helmut Schwichtenberg Linear two-sorted arithmetic

  13. Higher type input and output variables Linear two-sorted higher type terms Examples Linear two-sorted arithmetic Polynomial time Normalization Let t be a closed LT (;)-term of type W ։ . . . W ։ W ( ։ ∈ { ֒ → , →} ). Then t denotes a polytime function. ◮ Let � z be new variables. Compute the normal form of t � z (needs constant time w.r.t. � n ). ◮ nf ( t � z ) is “simple” (i.e., no free or bound higher type input variables). ◮ Reduce to an R -free simple term rf ( nf ( t � z ); � z ; � n ) in time P t ( | | � n | | ), w.r.t. to a dag model of computation. ◮ Since the running time bounds the size of the produced term, | | rf ( nf ( t � z ); � z ; � n ) | | ≤ P t ( | | � n | | ). ◮ By Sharing Normalization one computes | ) 2 ). nf ( t � n ) = nf ( rf ( nf ( t � z ); � z ; � n )) in time O ( P t ( | | � n | Helmut Schwichtenberg Linear two-sorted arithmetic

  14. Motivation Linear two-sorted higher type terms Proof terms Linear two-sorted arithmetic Example: Insertion sort Linear two-sorted arithmetic LA (;) Using the Curry-Howard correspondence, we transfer the term system LT (;) to a logical system LA (;) of arithmetic, with ◮ two arrow types, ρ ֒ → σ (input) and ρ → σ (output), ◮ two sorts of variables, input ones ¯ x and output ones x , and ◮ two implications, A ֒ → B (input) and A → B (output). Restrictions: ◮ Proofs of the premise of A ֒ → B are only allowed to use input assumptions or input variables. ◮ Proofs of the premise of A → B can only have at most one use of the hypothesis, in case its type is not a base type. Helmut Schwichtenberg Linear two-sorted arithmetic

  15. Motivation Linear two-sorted higher type terms Proof terms Linear two-sorted arithmetic Example: Insertion sort Double use of assumptions ◮ Consider E ( 1 , y ) := S 0 ( y ) , E ( 1 ) := S 0 , or E ( S i ( x ) , y ) := E ( x , E ( x , y )) , E ( S i ( x )) := E ( x ) ◦ E ( x ) . Then E ( x ) = S (2 | | x | |− 1 ) , i.e., E grows exponentially. 0 ◮ Corresponding existence proof. Show by induction on x |− 1 + | | = 2 | | x | ∀ x , y ∃ v ( | | v | | y | | ) . ◮ Double use of the (“functional”) induction hypothesis is responsible for exponential growth. The linearity restriction on output implications will exclude such proofs. Helmut Schwichtenberg Linear two-sorted arithmetic

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