du typage vectoriel
play

Du typage vectoriel Alejandro Daz-Caro CAPP Team Adviser: - PowerPoint PPT Presentation

Soutenance de thse Du typage vectoriel Alejandro Daz-Caro CAPP Team Adviser: Co-adviser: Pablo Arrighi Frdric Prost 23 09 2011 Lambda calculus [Church36] Formal system to study the defini- tion of function f ( x ) t x


  1. Soutenance de thèse Du typage vectoriel Alejandro Díaz-Caro CAPP Team Adviser: Co-adviser: Pablo Arrighi Frédéric Prost 23 – 09 – 2011

  2. Lambda calculus [Church’36] Formal system to study the defini- tion of function f ( x ) ∼ t x x �→ f ( x ) ∼ λ x . t x ( x �→ f ( x )) r ∼ ( λ x . t x ) r ( x �→ f ( x )) r = f ( r ) ∼ ( λ x . t x ) r → t x [ r / x ] t , r ::= x | λ x . t | ( t ) r ( λ x . t ) r → t [ r / x ] 2 / 24

  3. Type system [Church’40] Lambda calculus [Church’36] “a tractable syntactic framework Formal system to study the defini- for classifying phrases according to tion of function the kinds of values they compute” f ( x ) ∼ t x – [Pierce’02] x �→ f ( x ) ∼ λ x . t x ( x �→ f ( x )) r ∼ ( λ x . t x ) r ( x �→ f ( x )) r = f ( r ) ∼ ( λ x . t x ) r → t x [ r / x ] λ x . t x : T → R r : T ( λ x . t x ) r : R t , r ::= x | λ x . t | ( t ) r ( λ x . t ) r → t [ r / x ] 2 / 24

  4. Type system [Church’40] Lambda calculus [Church’36] “a tractable syntactic framework Formal system to study the defini- for classifying phrases according to tion of function the kinds of values they compute” f ( x ) ∼ t x – [Pierce’02] x �→ f ( x ) ∼ λ x . t x ( x �→ f ( x )) r ∼ ( λ x . t x ) r ( x �→ f ( x )) r = f ( r ) ∼ ( λ x . t x ) r → t x [ r / x ] λ x . t x : T → R r : T ( λ x . t x ) r : R t , r ::= x | λ x . t | ( t ) r ( λ x . t ) r → t [ r / x ] System F [Girard’71] TS with a universal quantification over types λ x . x : Int → Int λ x . x : Bool → Bool . . . λ x . x : ∀ X . X → X � 2 / 24

  5. Type system [Church’40] Lambda calculus [Church’36] “a tractable syntactic framework Formal system to study the defini- for classifying phrases according to tion of function the kinds of values they compute” f ( x ) ∼ t x – [Pierce’02] x �→ f ( x ) ∼ λ x . t x ( x �→ f ( x )) r ∼ ( λ x . t x ) r ( x �→ f ( x )) r = f ( r ) ∼ ( λ x . t x ) r → t x [ r / x ] λ x . t x : T → R r : T ( λ x . t x ) r : R t , r ::= x | λ x . t | ( t ) r ( λ x . t ) r → t [ r / x ] System F [Girard’71] Curry-Howard correspondence TS with a universal quantification Correspondence between type sys- over types tems and logic λ x . t x : T → R r : T λ x . x : Int → Int λ x . x : Bool → Bool ( λ x . t x ) r : R . . . � T ⇒ R T λ x . x : ∀ X . X → X � R 2 / 24

  6. Type system [Church’40] Lambda calculus [Church’36] “a tractable syntactic framework Formal system to study the defini- for classifying phrases according to tion of function the kinds of values they compute” f ( x ) ∼ t x – [Pierce’02] x �→ f ( x ) ∼ λ x . t x ( x �→ f ( x )) r ∼ ( λ x . t x ) r ( x �→ f ( x )) r = f ( r ) ∼ ( λ x . t x ) r → t x [ r / x ] λ x . t x : T → R r : T ( λ x . t x ) r : R t , r ::= x | λ x . t | ( t ) r ( λ x . t ) r → t [ r / x ] System F [Girard’71] Curry-Howard correspondence TS with a universal quantification Correspondence between type sys- over types tems and logic λ x Int . x : Int → Int λ x . t x : T → R r : T λ x Bool . x : Bool → Bool ( λ x . t x ) r : R . . . � T ⇒ R T Λ X .λ x X . x : ∀ X . X → X � R Church vs. Curry style whether the types are part of the terms or not 2 / 24

  7. To capture probabilistic/quantum/quantitative constructions: algebraic extensions t , r ::= x | λ x . t | ( t ) r | t + r | α. t | 0 α ∈ ( S , + , × ) , a ring. Two origins: ◮ Differential λ -calculus [Ehrhard’03] : linearity à la Linear Logic Removing the differential operator : Algebraic λ -calculus ( λ alg ) [Vaux’09] ◮ Quantum computing: superposition of programs Linearity as in algebra : Linear-algebraic λ -calculus ( λ lin ) [Arrighi,Dowek’08] 3 / 24

  8. To capture probabilistic/quantum/quantitative constructions: algebraic extensions t , r ::= x | λ x . t | ( t ) r | t + r | α. t | 0 α ∈ ( S , + , × ) , a ring. Two origins: ◮ Differential λ -calculus [Ehrhard’03] : linearity à la Linear Logic Removing the differential operator : Algebraic λ -calculus ( λ alg ) [Vaux’09] ◮ Quantum computing: superposition of programs Linearity as in algebra : Linear-algebraic λ -calculus ( λ lin ) [Arrighi,Dowek’08] Beta reduction: ( λ x . t ) r → t [ r / x ] “Algebraic” reductions: α. t + β. t → ( α + β ) . t , α.β. t → ( α × β ) . t , ( t ) ( r 1 + r 2 ) → ( t ) r 1 + ( t ) r 2 , ( t 1 + t 2 ) r → ( t 1 ) r + ( t 2 ) r , . . . (oriented version of the axioms of vectorial spaces) [Arrighi,Dowek’07] 3 / 24

  9. To capture probabilistic/quantum/quantitative constructions: algebraic extensions t , r ::= x | λ x . t | ( t ) r | t + r | α. t | 0 α ∈ ( S , + , × ) , a ring. Two origins: ◮ Differential λ -calculus [Ehrhard’03] : linearity à la Linear Logic Removing the differential operator : Algebraic λ -calculus ( λ alg ) [Vaux’09] ◮ Quantum computing: superposition of programs Linearity as in algebra : Linear-algebraic λ -calculus ( λ lin ) [Arrighi,Dowek’08] Beta reduction: ( λ x . t ) r → t [ r / x ] “Algebraic” reductions: Vectorial space of values α. t + β. t → ( α + β ) . t , α.β. t → ( α × β ) . t , B = { t i : t i var. or abs. } ( t ) ( r 1 + r 2 ) → ( t ) r 1 + ( t ) r 2 , Set of values ::= Span ( B ) ( t 1 + t 2 ) r → ( t 1 ) r + ( t 2 ) r , . . . (oriented version of the axioms of vectorial spaces) [Arrighi,Dowek’07] 3 / 24

  10. To capture probabilistic/quantum/quantitative constructions: algebraic extensions t , r ::= x | λ x . t | ( t ) r | t + r | α. t | 0 α ∈ ( S , + , × ) , a ring. λ alg λ lin Origin Linear Logic Quantum computing Evaluation strategy Call-by-name Call-by-base Algebraic part Equalities Rewrite system Contribution: CPS simulation [Díaz-Caro,Perdrix,Tasson,Valiron’10] Beta reduction: ( λ x . t ) r → t [ r / x ] “Algebraic” reductions: Vectorial space of values α. t + β. t → ( α + β ) . t , α.β. t → ( α × β ) . t , B = { t i : t i var. or abs. } ( t ) ( r 1 + r 2 ) → ( t ) r 1 + ( t ) r 2 , Set of values ::= Span ( B ) ( t 1 + t 2 ) r → ( t 1 ) r + ( t 2 ) r , . . . (oriented version of the axioms of vectorial spaces) [Arrighi,Dowek’07] 3 / 24

  11. Example of program true = λ x .λ y . x Two base vectors: false = λ x .λ y . y 4 / 24

  12. Example of program true = λ x .λ y . x Two base vectors: false = λ x .λ y . y ( U ) true = a . true + b . false Linear map U s.t. ( U ) false = c . true + d . false 4 / 24

  13. Example of program true = λ x .λ y . x Two base vectors: false = λ x .λ y . y ( U ) true = a . true + b . false Linear map U s.t. ( U ) false = c . true + d . false U := λ x . { (( x ) [ a . true + b . false ]) [ c . true + d . false ] } 4 / 24

  14. Example of program true = λ x .λ y . x Two base vectors: false = λ x .λ y . y ( U ) true = a . true + b . false Linear map U s.t. ( U ) false = c . true + d . false U := λ x . { (( x ) [ a . true + b . false ]) [ c . true + d . false ] } Aim: To provide a type system capturing the “vectorial” structure of terms . . . to check for properties of probabilistic processes . . . to check for properties of quantum processes . . . or whatever application needing the structure of the vector in normal form . . . understand what it means “linear combination of types” . . . a Curry-Howard approach to defining Fuzzy/Quantum/Probabilistic logics from Fuzzy/Quantum/Probabilistic programming languages. 4 / 24

  15. � � � � Plan System F Scalar Additive α. T T + R Vectorial α. T + β. R 5 / 24

  16. � � � � Plan System F Scalar Additive α. T T + R Vectorial α. T + β. R 5 / 24

  17. The Scalar Type System A polymorphic type system tracking scalars : Γ ⊢ t : T Γ ⊢ α. t : α. T Γ ⊢ t : α. T Γ ⊢ r : β. T Γ ⊢ t + r : ( α + β ) . T 6 / 24

  18. The Scalar Type System A polymorphic type system tracking scalars : Γ ⊢ t : T Γ ⊢ α. t : α. T Γ ⊢ t : α. T Γ ⊢ r : β. T Γ ⊢ t + r : ( α + β ) . T Gives the “amount” of terms → Barycentric restrictions ( � α i = 1) 6 / 24

  19. The Scalar Type System A polymorphic type system tracking scalars : Γ ⊢ t : T Γ ⊢ α. t : α. T Γ ⊢ t : α. T Γ ⊢ r : β. T Γ ⊢ t + r : ( α + β ) . T Gives the “amount” of terms → Barycentric restrictions ( � α i = 1) Definition (Weight function (to check barycentricity) ) ω ( 0 ) = 0 ω ( b ) = 1 ω ( α. t ) = α × ω ( t ) ω (( t ) r ) = ω ( t ) × ω ( r ) ω ( t + r ) = ω ( t ) + ω ( r ) 6 / 24

  20. The Scalar Type System A polymorphic type system tracking scalars : Γ ⊢ t : T Γ ⊢ α. t : α. T Γ ⊢ t : α. T Γ ⊢ r : β. T Γ ⊢ t + r : ( α + β ) . T Gives the “amount” of terms → Barycentric restrictions ( � α i = 1) Definition (Weight function (to check barycentricity) ) ω ( 0 ) = 0 ω ( b ) = 1 ω ( α. t ) = α × ω ( t ) ω (( t ) r ) = ω ( t ) × ω ( r ) ω ( t + r ) = ω ( t ) + ω ( r ) Theorem If Γ C ⊢ t : C then ω ( t ↓ ) = 1 6 / 24

Recommend


More recommend