SlideShare a Scribd company logo
1 of 61
Download to read offline
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
Lambda calculus [Church’36]
Formal system to study the defini-
tion of function
               f (x)     ∼   tx
          x → f (x)      ∼   λx.tx
      (x → f (x))r       ∼   (λx.tx ) r
 (x → f (x))r = f (r )   ∼   (λx.tx ) r → tx [r /x]


        t, r ::= x | λx.t | (t) r
           (λx.t) r → t[r/x]




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

        t, r ::= x | λx.t | (t) r                                (λx.tx ) r : R
           (λx.t) r → t[r/x]




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

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

        t, r ::= x | λx.t | (t) r                                (λx.tx ) r : 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.x : Int → Int                             λx.tx : T → R           r:T
             λx.x : Bool → Bool                                  (λx.tx ) r : R
                    ...
                                                                T ⇒R         T
             λx.x : ∀X .X → X
                                                                       R


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

         t, r ::= x | λx.t | (t) r                                (λx.tx ) r : 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.tx : T → R           r:T
           λx Bool .x : Bool → Bool                               (λx.tx ) 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
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
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) (r1 + r2 ) → (t) r1 + (t) r2 ,
     (t1 + t2 ) r → (t1 ) r + (t2 ) r,
                   ...
   (oriented version of the axioms of
   vectorial spaces)[Arrighi,Dowek’07]
                                                                                         3 / 24
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,                   Vectorial space of values
           α.β.t → (α × β).t,                  B = {ti : ti var. or abs. }
   (t) (r1 + r2 ) → (t) r1 + (t) r2 ,
     (t1 + t2 ) r → (t1 ) r + (t2 ) r,         Set of values ::= Span(B)
                   ...
   (oriented version of the axioms of
   vectorial spaces)[Arrighi,Dowek’07]
                                                                                         3 / 24
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:
      α.t + β.t → (α + β).t,                  Vectorial space of values
           α.β.t → (α × β).t,                 B = {ti : ti var. or abs. }
   (t) (r1 + r2 ) → (t) r1 + (t) r2 ,
     (t1 + t2 ) r → (t1 ) r + (t2 ) r,        Set of values ::= Span(B)
                   ...
   (oriented version of the axioms of
   vectorial spaces)[Arrighi,Dowek’07]
                                                                                   3 / 24
Example of program
                  true = λx.λy .x
Two base vectors:
                  false = λx.λy .y




                                     4 / 24
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
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
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
Plan



                    System F


                y                 &
       Scalar                         Additive
        α.T                            T +R



                    $         y
                    Vectorial
                    α.T + β.R




                                                 5 / 24
Plan



                    System F


                y                 &
       Scalar                         Additive
        α.T                            T +R



                    $         y
                    Vectorial
                    α.T + β.R




                                                 5 / 24
The Scalar Type System
        A polymorphic type system tracking scalars:
         Γ t:T
         Γ   α.t : α.T

Γ       t : α.T   Γ   r : β.T
    Γ    t + r : (α + β).T




                                                      6 / 24
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
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
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
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
                            1
                     2.(λx. .x) y                                   1
    Example                 2                         y :C    2.(λx. .x) y : C
                      1                                             2
              ω(2.(λx. .x) y ) = 2
                      2
                                                                                 6 / 24
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
                            1
                     2.(λx. .x) y →∗ y                             1
    Example                 2                        y :C    2.(λx. .x) y : C
                      1                                            2
              ω(2.(λx. .x) y ) = 2   ω(y ) = 1
                      2
                                                                                6 / 24
The Scalar Type System
        A polymorphic type system tracking scalars:
         Γ t:T
                                  Subject reduction (type preservation)
       Γ α.t : α.T                Strong normalisation
                                    1. SN for a straightforward extension of
Γ     t : α.T   Γ   r : β.T            System F
                                    2. verify that both systems type the same
    Γ t + r : (α + β).T                terms
    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
                            1
                     2.(λx. .x) y →∗ y                             1
    Example                 2                        y :C    2.(λx. .x) y : C
                      1                                            2
              ω(2.(λx. .x) y ) = 2   ω(y ) = 1
                      2
                                                                                6 / 24
The Scalar Type System
        A polymorphic type system tracking scalars:
         Γ t:T
                                  Subject reduction (type preservation)
       Γ α.t : α.T                Strong normalisation
                                    1. SN for a straightforward extension of
Γ     t : α.T    Γ    r : β.T          System F
                                    2. verify that both systems type the same
    Γ t + r : (α + β).T                terms
    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
                            1
                     2.(λx. .x) y →∗ y                                    1
    Example                 2                               y :C    2.(λx. .x) y : C
                      1                                                   2
              ω(2.(λx. .x) y ) = 2   ω(y ) = 1
                      2
    Contribution: [Arrighi,Díaz-Caro’09]
                                                                                       6 / 24
Plan




                 System F


             y                &
       Scalar                Additive

                  &     x
                 Vectorial




                                        7 / 24
The Additive Type System
A polymorphic type system with sums (for the additive fragment of λlin )

 Γ       t:T   Γ   r:R             Sums ∼ Assoc., comm. pairs
     Γ    t+r:T +R                 distributive w.r.t. application




                                                                           8 / 24
The Additive Type System
A polymorphic type system with sums (for the additive fragment of λlin )

 Γ       t:T   Γ   r:R             Sums ∼ Assoc., comm. pairs
     Γ    t+r:T +R                 distributive w.r.t. application
Translation into System F with pairs




                                                                           8 / 24
The Additive Type System
A polymorphic type system with sums (for the additive fragment of λlin )

 Γ       t:T   Γ   r:R             Sums ∼ Assoc., comm. pairs
     Γ    t+r:T +R                 distributive w.r.t. application
Translation into System F with pairs
     Simplified version without AC of +              |T + R| = |T | × |R|




                                                                           8 / 24
The Additive Type System
A polymorphic type system with sums (for the additive fragment of λlin )

 Γ       t:T    Γ   r:R                Sums ∼ Assoc., comm. pairs
     Γ    t+r:T +R                     distributive w.r.t. application
Translation into System F with pairs
     Simplified version without AC of +                   |T + R| = |T | × |R|
     Distributivity in the translation (using the structure given by the type)




                                                                                 8 / 24
The Additive Type System
A polymorphic type system with sums (for the additive fragment of λlin )

 Γ       t:T    Γ   r:R                Sums ∼ Assoc., comm. pairs
     Γ    t+r:T +R                     distributive w.r.t. application
Translation into System F with pairs
     Simplified version without AC of +                   |T + R| = |T | × |R|
     Distributivity in the translation (using the structure given by the type)
     Equivalences given explicitly: T ≡ R implies |T | ⇔ |R|
               A×B ⇔B ×A             (A × B) × C ⇔ A × (B × C )




                                                                                 8 / 24
The Additive Type System
A polymorphic type system with sums (for the additive fragment of λlin )

 Γ         t:T     Γ   r:R               Sums ∼ Assoc., comm. pairs
       Γ    t+r:T +R                     distributive w.r.t. application
Translation into System F with pairs
       Simplified version without AC of +                    |T + R| = |T | × |R|
       Distributivity in the translation (using the structure given by the type)
       Equivalences given explicitly: T ≡ R implies |T | ⇔ |R|
                  A×B ⇔B ×A            (A × B) × C ⇔ A × (B × C )

Theorem
If Γ       t : T and exists T ≡ T then |Γ|    F   [t]D : |T |

Also we set up an inverse translation showing that it is non-trivial




                                                                                   8 / 24
The Additive Type System
A polymorphic type system with sums (for the additive fragment of λlin )

 Γ         t:T     Γ   r:R               Sums ∼ Assoc., comm. pairs
       Γ    t+r:T +R                     distributive w.r.t. application
Translation into System F with pairs
       Simplified version without AC of +                    |T + R| = |T | × |R|
       Distributivity in the translation (using the structure given by the type)
       Equivalences given explicitly: T ≡ R implies |T | ⇔ |R|
                  A×B ⇔B ×A            (A × B) × C ⇔ A × (B × C )

Theorem
If Γ       t : T and exists T ≡ T then |Γ|    F   [t]D : |T |

Also we set up an inverse translation showing that it is non-trivial
Subject reduction
Strong normalisation (using the one from System Fp )
Contribution: [Díaz-Caro,Petit’10]

                                                                                   8 / 24
Plan




                 System F


             y                &
       Scalar                Additive   / System Fp


                  %     x
                 Vectorial




                                                      9 / 24
Plan




                 System F


             y                &
       Scalar                Additive   / System Fp
                                O

                  %     x       
                 Vectorial     λCA




                                                      9 / 24
The Complete Additive System (λCA )
Extending sums to the whole calculus (with positive reals scalars)
    Γ t:T                                   More general than Additive
Γ    α.t : α .T = T + · · · + T
                                            Less complex than Vectorial
                        α
                                            “Amounts” approximated




                                                                          10 / 24
The Complete Additive System (λCA )
Extending sums to the whole calculus (with positive reals scalars)
    Γ t:T                                   More general than Additive
Γ    α.t : α .T = T + · · · + T
                                            Less complex than Vectorial
                        α
                                            “Amounts” approximated

                  If t : T , then (0.9).t + (1.1).t : T
                 (0.9).t + (1.1).t → 2.t and   2.t : 2.T




                                                                          10 / 24
The Complete Additive System (λCA )
Extending sums to the whole calculus (with positive reals scalars)
    Γ t:T                                   More general than Additive
Γ    α.t : α .T = T + · · · + T
                                            Less complex than Vectorial
                        α
                                            “Amounts” approximated

                  If t : T , then (0.9).t + (1.1).t : T
                 (0.9).t + (1.1).t → 2.t and   2.t : 2.T

Weak subject reduction: t → r, Γ    t:T ⇒Γ       r : R with T    R




                                                                          10 / 24
The Complete Additive System (λCA )
Extending sums to the whole calculus (with positive reals scalars)
    Γ t:T                                          More general than Additive
Γ    α.t : α .T = T + · · · + T
                                                   Less complex than Vectorial
                           α
                                                   “Amounts” approximated

                  If t : T , then (0.9).t + (1.1).t : T
                 (0.9).t + (1.1).t → 2.t and   2.t : 2.T

Weak subject reduction: t → r, Γ t : T ⇒ Γ               r : R with T   R
Abstract interpretation (theorem)

                                                 [·]
                      λCA
                                  τ   / λadd            / Fp

                       ↓                    ↓a               ↓F
                                     ( )             ( ) 
                      λCA             / λadd            / Fp
                                  τ              [·]




                                                                                 10 / 24
The Complete Additive System (λCA )
Extending sums to the whole calculus (with positive reals scalars)
    Γ t:T                                          More general than Additive
Γ    α.t : α .T = T + · · · + T
                                                   Less complex than Vectorial
                            α
                                                   “Amounts” approximated

                   If t : T , then (0.9).t + (1.1).t : T
                  (0.9).t + (1.1).t → 2.t and   2.t : 2.T

Weak subject reduction: t → r, Γ t : T ⇒ Γ               r : R with T   R
Abstract interpretation (theorem)

                                                 [·]
                        λCA
                                  τ   / λadd            / Fp

                        ↓                   ↓a               ↓F
                                     ( )             ( ) 
                        λCA           / λadd            / Fp
                                  τ              [·]


Strong normalisation (using Additive)
Contribution: [Buiras,Díaz-Caro,Jaskelioff’11]
                                                                                 10 / 24
Plan




                 System F


             y                
       Scalar                Additive   / System Fp
                                O

                  %     x       
                 Vectorial     λCA




                                                      11 / 24
The Vectorial system

Types:
                    T , R, S := U | T + R | α.T
                   U, V , W := X | U → T | ∀X .U
                       (U, V , W reflect the basis terms)

Equivalences:

                               1.T    ≡ T
                           α.(β.T ) ≡ (α × β).T
                        α.T + α.R     ≡ α.(T + R)
                       α.T + β.T      ≡ (α + β).T
                            T +R      ≡ R +T
                   T + (R + S) ≡ (T + R) + S

                  (reflect the vectorial spaces axioms)



                                                           12 / 24
Typing rules
                                                     Γ     t:T                               Γ      t:T
                                         ax                                0I                                   sI
           Γ, x : U           x :U                   Γ    0 : 0.T                     Γ          α.t : α.T
                 n                                                         m
                                                                                                  ∀Vj , ∃Wj /
       Γ   t:           αi .∀X .(U → Ti )                 Γ       r:            βj .Vj            U[Wj /X ] = Vj
                i=1                                                    j=1
                                                                                                                     →E
                                                 n   m
                             Γ        (t) r :             αi × βj .Ti [Wj /X ]
                                                i=1 j=1

                    Γ, x : U           t:T                    Γ        t:T                Γ        r:R
                                                →I                                                         +I
                Γ       λx.t : U → T                              Γ         t+r:T +R

                         n                                                               n
           Γ    t:            αi .Ui       X ∈ FV (Γ)
                                             /                          Γ        t:              αi .∀X .Ui
                        i=1                                                           i=1
                                                           ∀I                                                   ∀E
                                  n                                                   n
                    Γ    t:            αi .∀X .Ui                      Γ        t:           αi .Ui [V /X ]
                                 i=1                                                 i=1




                                                                                                                          13 / 24
Typing rules
                                                     Γ     t:T                               Γ      t:T
                                         ax                                0I                                   sI
           Γ, x : U           x :U                   Γ    0 : 0.T                     Γ          α.t : α.T
                 n                                                         m
                                                                                                  ∀Vj , ∃Wj /
       Γ   t:           αi .∀X .(U → Ti )                 Γ       r:            βj .Vj            U[Wj /X ] = Vj
                i=1                                                    j=1
                                                                                                                     →E
                                                 n   m
                             Γ        (t) r :             αi × βj .Ti [Wj /X ]
                                                i=1 j=1

                    Γ, x : U           t:T                    Γ        t:T                Γ        r:R
                                                →I                                                         +I
                Γ       λx.t : U → T                              Γ         t+r:T +R

                         n                                                               n
           Γ    t:            αi .Ui       X ∈ FV (Γ)
                                             /                          Γ        t:              αi .∀X .Ui
                        i=1                                                           i=1
                                                           ∀I                                                   ∀E
                                  n                                                   n
                    Γ    t:            αi .∀X .Ui                      Γ        t:           αi .Ui [V /X ]
                                 i=1                                                 i=1

Strong normalisation: Reducibility candidates
Main difficulty: show that {ti }i SN ⇒ i ti SN (algebraic measure)

                                                                                                                          13 / 24
Typing rules
                                                     Γ     t:T                               Γ      t:T
                                         ax                                0I                                   sI
           Γ, x : U           x :U                   Γ    0 : 0.T                     Γ          α.t : α.T
                 n                                                         m
                                                                                                  ∀Vj , ∃Wj /
       Γ   t:           αi .∀X .(U → Ti )                 Γ       r:            βj .Vj            U[Wj /X ] = Vj
                i=1                                                    j=1
                                                                                                                     →E
                                                 n   m
                             Γ        (t) r :             αi × βj .Ti [Wj /X ]
                                                i=1 j=1

                    Γ, x : U           t:T                    Γ        t:T                Γ        r:R
                                                →I                                                         +I
                Γ       λx.t : U → T                              Γ         t+r:T +R

                         n                                                               n
           Γ    t:            αi .Ui       X ∈ FV (Γ)
                                             /                          Γ        t:              αi .∀X .Ui
                        i=1                                                           i=1
                                                           ∀I                                                   ∀E
                                  n                                                   n
                    Γ    t:            αi .∀X .Ui                      Γ        t:           αi .Ui [V /X ]
                                 i=1                                                 i=1

Strong normalisation: Reducibility candidates
Main difficulty: show that {ti }i SN ⇒ i ti SN (algebraic measure)
Subject reduction a challenge
                                                                                                                          13 / 24
The case of the factorisation rule
System F à la Curry: a term can have different, unrelated types


                        Γ t:T        Γ t:T
                       ==========
                        ==========
                       Γ α.t + β.t : α.T + β.T
However, α.t + β.t → (α + β).t... one of the two types must be chosen!
In general α.T + β.T = (α + β).T = (α + β).T
(and since we are working in System F, there is no principal types neither)




                                                                              14 / 24
Several possible solutions:

Remove factorisation rule (Done. SR and SN both work)
    + in scalars not used anymore. Scalars ⇒ Monoid
    It works!... but it is no so expressive (“vectorial” structure lost)




                                                                           15 / 24
Several possible solutions:

Remove factorisation rule (Done. SR and SN both work)
     + in scalars not used anymore. Scalars ⇒ Monoid
     It works!... but it is no so expressive (“vectorial” structure lost)

                           Γ   t:T        Γ   t:T
Add the typing rule
                      Γ (α + β).t : α.T + β.T
     As soon as we add this one, we have to add many others
     Too complex and inelegant (subject reduction by axiom)




                                                                            15 / 24
Several possible solutions:

Remove factorisation rule (Done. SR and SN both work)
     + in scalars not used anymore. Scalars ⇒ Monoid
     It works!... but it is no so expressive (“vectorial” structure lost)

                           Γ   t:T        Γ    t:T
Add the typing rule
                      Γ (α + β).t : α.T + β.T
     As soon as we add this one, we have to add many others
     Too complex and inelegant (subject reduction by axiom)

Weak subject reduction
    If Γ t : T and t →R r, then
          if R is not the factorisation rule: Γ r : T
          if R is the factorisation rule: ∃S   T /Γ r:S
     where (α + β).T      α.T + β.T if ∃t / Γ        t : T and Γ   t:T
Contribution: [Arrighi,Díaz-Caro,Valiron’11]




                                                                            15 / 24
Several possible solutions:

Remove factorisation rule (Done. SR and SN both work)
     + in scalars not used anymore. Scalars ⇒ Monoid
     It works!... but it is no so expressive (“vectorial” structure lost)

                           Γ   t:T        Γ    t:T
Add the typing rule
                      Γ (α + β).t : α.T + β.T
     As soon as we add this one, we have to add many others
     Too complex and inelegant (subject reduction by axiom)

Weak subject reduction
    If Γ t : T and t →R r, then
          if R is not the factorisation rule: Γ r : T
          if R is the factorisation rule: ∃S   T /Γ r:S
     where (α + β).T      α.T + β.T if ∃t / Γ        t : T and Γ   t:T
Contribution: [Arrighi,Díaz-Caro,Valiron’11]

Church style
    Seems to be the natural solution: the type is part of the term, if the
    types are different, the terms are different (no factorisation rule)

                                                                             15 / 24
Plan



                 System F


             y                
       Scalar                Additive   / System Fp
                                O

                  %     x       
                 Vectorial     λCA


                     
                  Lineal




                                                      16 / 24
The system Lineal

Types:
                 T , R, S := U | T + R | α.T
                U, V , W := X | U → T | ∀X .U | U@(         i   Vi )
                      (U, V , W reflect the basis terms)

Equivalences:

                               1.T   ≡ T
                          α.(β.T ) ≡ (α × β).T
                       α.T + α.R     ≡ α.(T + R)
                       α.T + β.T     ≡ (α + β).T
                            T +R     ≡ R +T
                     T + (R + S) ≡ (T + R) + S
                       (∀X .U)@V     ≡ U[V /X ]

                     (reflect the vectorial spaces axioms)


                                                                       17 / 24
Typing rules
                                                          Γ        t:T                              Γ      t:T
                                             ax                                 0I                                    sI
                       Γ, x : U       x :U               Γ     0 : 0.T                        Γ         α.t : α.T
             n                                         m+δ                               m
                                                                                                              ∀Vj , ∃j1 , . . . , jk /
Γ   t:            αi .( ∀X k .(U → Ti ))@                     Wj   k       Γ        r:         βj .Vj         U [Wj /X ]       = Vj
                                                                                                                            k
            i=1                                         j=1                              j=1
                                                                                                                                          →E
                                                   n     m
                                  Γ    (t) r :                αi × βj .Ti [Wj /X ] k
                                                  i=1 j=1

                            Γ, x : U     t:T                           Γ        t:T                 Γ       r:R
                                                         →I                                                          +I
                        Γ   λx : U.t : U → T                                Γ        t+r:T +R

                   n                                                                           n
    Γ       t:          αi .Ui     X ∈ FV (Γ)
                                     /                                          Γ        t:             αi .∀X .Ui
                  i=1                                                                         i=1
                                                   ∀I                                                                                    @I
                             n                                             m                  n                            m
        Γ        ΛX .t :          αi .∀X .Ui              Γ        t@(           Vj ) :             αi .(∀X .Ui )@(              Vj )
                            i=1                                            j=1                i=1                          j=1

Subject reduction
Strong normalisation (using Vectorial)

                                                                                                                                               18 / 24
Most important properties of Lineal




Theorem
If Γ   t:       i   αi .Ui    then t →∗         i   αi .bi   where Γ   bi : Ui

                                  (where Ui is not a type abstraction or application)




Theorem
If t ↓=     i   αi .bi       then Γ   t:    i   αi .Ui + 0.T , where Γ           bi : Ui




                                                                                           19 / 24
Confluence as a side effect




                            20 / 24
Confluence
In the original untyped setting: “confluence by restrictions”:

                   Yb = (λx.(b + (x)x)) λx.(b + (x)x)


                   Yb → b + Yb → b + b + Yb → . . .




                                                                21 / 24
Confluence
In the original untyped setting: “confluence by restrictions”:

                   Yb = (λx.(b + (x)x)) λx.(b + (x)x)


                   Yb → b + Yb → b + b + Yb → . . .


Yb + (−1).Yb −→ (1 − 1).Yb −→∗ 0
       ↓
b + Yb + (−1).Yb
       ↓∗
       b




                                                                21 / 24
Confluence
In the original untyped setting: “confluence by restrictions”:

                   Yb = (λx.(b + (x)x)) λx.(b + (x)x)


                   Yb → b + Yb → b + b + Yb → . . .


Yb + (−1).Yb −→ (1 − 1).Yb −→∗ 0
       ↓                        Solution in the untyped setting:
b + Yb + (−1).Yb                   α.t + β.t → (α + β).t
       ↓∗                          only if t is closed-normal
       b




                                                                   21 / 24
Confluence
In the original untyped setting: “confluence by restrictions”:

                   Yb = (λx.(b + (x)x)) λx.(b + (x)x)


                   Yb → b + Yb → b + b + Yb → . . .


Yb + (−1).Yb −→ (1 − 1).Yb −→∗ 0
       ↓                        Solution in the untyped setting:
b + Yb + (−1).Yb                   α.t + β.t → (α + β).t
       ↓∗                          only if t is closed-normal
       b

    In the typed setting: Strong normalisation solves the problem



                                                                    21 / 24
Theorem (Confluence)
∀t / Γ   t:T     ∗
                        t            ∗
                                        
               r1                            r2
                    ∗       ~        ∗
                        s

Proof.
1) local confluence:                               t
                                                         
                                r1                            r2
                                     ∗                ~   ∗
                                                  s
    Algebraic fragment: Coq proof                              [Valiron’10]

    Beta-reduction: Straightforward extension
    Commutation: Induction

2) Local confluence + Strong normalisation ⇒ Confluence


                                                                              22 / 24
Contributions
                                                                           s
                  System F                                          λalg       3 λlin


      y                                    
Scalar                                    Additive             / System Fp
                                             O

                   %     x                    
                  Vectorial                  λCA
                                           Relation between λlin and λalg
                                          SN and SR for the five systems
                    Lineal
                                           Sums as pairs
                                           Types ↔ vectorial structure of terms
                                           Extra: No cloning theorem

Papers
Díaz-Caro,Perdrix,Tasson,Valiron HOR’10 (journal version in preparation)
Arrighi,Díaz-Caro QPL’09 (journal version submitted)
Díaz-Caro,Petit (in preparation)
Buiras,Díaz-Caro,Jaskelioff LSFA’11
Arrighi,Díaz-Caro,Valiron DCM’11 (journal version in preparation)

                                                                                        23 / 24
Future work



    Invariability of models of λalg through the CPS simulation

    Differential λ-calculus ↔ Linear-algebraic λ-calculus

    Algebraic Linearity ↔ Linear logic resources

    Quantum language (orthogonality issues)

    Relations with Probabilistic/Quantum/Fuzzy Logics




                                                                 24 / 24

More Related Content

What's hot

Algorithm chapter 7
Algorithm chapter 7Algorithm chapter 7
Algorithm chapter 7chidabdu
 
R short-refcard
R short-refcardR short-refcard
R short-refcardconline
 
lecture 10
lecture 10lecture 10
lecture 10sajinsc
 
Scala. Introduction to FP. Monads
Scala. Introduction to FP. MonadsScala. Introduction to FP. Monads
Scala. Introduction to FP. MonadsKirill Kozlov
 
Themes and motifs in music and mathematics (uh oct 2010)
Themes and motifs in music and mathematics (uh oct 2010)Themes and motifs in music and mathematics (uh oct 2010)
Themes and motifs in music and mathematics (uh oct 2010)Brendan Larvor
 
Monad presentation scala as a category
Monad presentation   scala as a categoryMonad presentation   scala as a category
Monad presentation scala as a categorysamthemonad
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In ScalaSkills Matter
 
Advanced matlab codigos matematicos
Advanced matlab codigos matematicosAdvanced matlab codigos matematicos
Advanced matlab codigos matematicosKmilo Bolaños
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Mattersromanandreg
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Bryan O'Sullivan
 
Modeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQL
Modeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQLModeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQL
Modeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQLKostis Kyzirakos
 
Locality-sensitive hashing for search in metric space
Locality-sensitive hashing for search in metric space Locality-sensitive hashing for search in metric space
Locality-sensitive hashing for search in metric space Eliezer Silva
 

What's hot (18)

Algorithm chapter 7
Algorithm chapter 7Algorithm chapter 7
Algorithm chapter 7
 
Lambda calculus
Lambda calculusLambda calculus
Lambda calculus
 
03.01 hash tables
03.01 hash tables03.01 hash tables
03.01 hash tables
 
Lambda Calculus
Lambda CalculusLambda Calculus
Lambda Calculus
 
R short-refcard
R short-refcardR short-refcard
R short-refcard
 
lecture 10
lecture 10lecture 10
lecture 10
 
Scala. Introduction to FP. Monads
Scala. Introduction to FP. MonadsScala. Introduction to FP. Monads
Scala. Introduction to FP. Monads
 
Themes and motifs in music and mathematics (uh oct 2010)
Themes and motifs in music and mathematics (uh oct 2010)Themes and motifs in music and mathematics (uh oct 2010)
Themes and motifs in music and mathematics (uh oct 2010)
 
Monad presentation scala as a category
Monad presentation   scala as a categoryMonad presentation   scala as a category
Monad presentation scala as a category
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In Scala
 
Advanced matlab codigos matematicos
Advanced matlab codigos matematicosAdvanced matlab codigos matematicos
Advanced matlab codigos matematicos
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Matters
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4
 
Zippers
ZippersZippers
Zippers
 
Modeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQL
Modeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQLModeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQL
Modeling and Querying Metadata in the Semantic Sensor Web: stRDF and stSPARQL
 
Locality-sensitive hashing for search in metric space
Locality-sensitive hashing for search in metric space Locality-sensitive hashing for search in metric space
Locality-sensitive hashing for search in metric space
 
Lec4
Lec4Lec4
Lec4
 

Viewers also liked

Linearity in the non-deterministic call-by-value setting
Linearity in the non-deterministic call-by-value settingLinearity in the non-deterministic call-by-value setting
Linearity in the non-deterministic call-by-value settingAlejandro Díaz-Caro
 
Call-by-value non-determinism in a linear logic type discipline
Call-by-value non-determinism in a linear logic type disciplineCall-by-value non-determinism in a linear logic type discipline
Call-by-value non-determinism in a linear logic type disciplineAlejandro Díaz-Caro
 
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
A type system for the vectorial aspects of the linear-algebraic lambda-calculusA type system for the vectorial aspects of the linear-algebraic lambda-calculus
A type system for the vectorial aspects of the linear-algebraic lambda-calculusAlejandro Díaz-Caro
 
Equivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculiEquivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculiAlejandro Díaz-Caro
 
The probability of non-confluent systems
The probability of non-confluent systemsThe probability of non-confluent systems
The probability of non-confluent systemsAlejandro Díaz-Caro
 
Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...Alejandro Díaz-Caro
 
Affine computation and affine automaton
Affine computation and affine automatonAffine computation and affine automaton
Affine computation and affine automatonAlejandro Díaz-Caro
 
Non determinism through type isomophism
Non determinism through type isomophismNon determinism through type isomophism
Non determinism through type isomophismAlejandro Díaz-Caro
 
Simply typed lambda-calculus modulo isomorphisms
Simply typed lambda-calculus modulo isomorphismsSimply typed lambda-calculus modulo isomorphisms
Simply typed lambda-calculus modulo isomorphismsAlejandro Díaz-Caro
 
Towards a quantum lambda-calculus with quantum control
Towards a quantum lambda-calculus with quantum controlTowards a quantum lambda-calculus with quantum control
Towards a quantum lambda-calculus with quantum controlAlejandro Díaz-Caro
 

Viewers also liked (12)

Linearity in the non-deterministic call-by-value setting
Linearity in the non-deterministic call-by-value settingLinearity in the non-deterministic call-by-value setting
Linearity in the non-deterministic call-by-value setting
 
Call-by-value non-determinism in a linear logic type discipline
Call-by-value non-determinism in a linear logic type disciplineCall-by-value non-determinism in a linear logic type discipline
Call-by-value non-determinism in a linear logic type discipline
 
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
A type system for the vectorial aspects of the linear-algebraic lambda-calculusA type system for the vectorial aspects of the linear-algebraic lambda-calculus
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
 
Equivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculiEquivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculi
 
The probability of non-confluent systems
The probability of non-confluent systemsThe probability of non-confluent systems
The probability of non-confluent systems
 
Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...Quantum computing, non-determinism, probabilistic systems... and the logic be...
Quantum computing, non-determinism, probabilistic systems... and the logic be...
 
Affine computation and affine automaton
Affine computation and affine automatonAffine computation and affine automaton
Affine computation and affine automaton
 
Non determinism through type isomophism
Non determinism through type isomophismNon determinism through type isomophism
Non determinism through type isomophism
 
Simply typed lambda-calculus modulo isomorphisms
Simply typed lambda-calculus modulo isomorphismsSimply typed lambda-calculus modulo isomorphisms
Simply typed lambda-calculus modulo isomorphisms
 
Towards a quantum lambda-calculus with quantum control
Towards a quantum lambda-calculus with quantum controlTowards a quantum lambda-calculus with quantum control
Towards a quantum lambda-calculus with quantum control
 
A System F accounting for scalars
A System F accounting for scalarsA System F accounting for scalars
A System F accounting for scalars
 
Slides QuAND 2011
Slides QuAND 2011Slides QuAND 2011
Slides QuAND 2011
 

Similar to Slides used during my thesis defense "Du typage vectoriel"

Some Thoughts on Sampling
Some Thoughts on SamplingSome Thoughts on Sampling
Some Thoughts on SamplingDon Sheehy
 
IR-ranking
IR-rankingIR-ranking
IR-rankingFELIX75
 
Vanilla rao blackwellisation
Vanilla rao blackwellisationVanilla rao blackwellisation
Vanilla rao blackwellisationDeb Roy
 
Seismic data processing lecture 3
Seismic data processing lecture 3Seismic data processing lecture 3
Seismic data processing lecture 3Amin khalil
 
Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...
Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...
Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...Satoshi Kura
 
Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014Nikita V. Artamonov
 
ENBIS 2018 presentation on Deep k-Means
ENBIS 2018 presentation on Deep k-MeansENBIS 2018 presentation on Deep k-Means
ENBIS 2018 presentation on Deep k-Meanstthonet
 
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...Marco Benini
 
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docxMATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docxandreecapon
 
R Programming Reference Card
R Programming Reference CardR Programming Reference Card
R Programming Reference CardMaurice Dawson
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in Rnaroranisha
 
Hybrid Atlas Models of Financial Equity Market
Hybrid Atlas Models of Financial Equity MarketHybrid Atlas Models of Financial Equity Market
Hybrid Atlas Models of Financial Equity Markettomoyukiichiba
 
Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Sean Meyn
 

Similar to Slides used during my thesis defense "Du typage vectoriel" (20)

Some Thoughts on Sampling
Some Thoughts on SamplingSome Thoughts on Sampling
Some Thoughts on Sampling
 
IR-ranking
IR-rankingIR-ranking
IR-ranking
 
Trondheim, LGM2012
Trondheim, LGM2012Trondheim, LGM2012
Trondheim, LGM2012
 
Vanilla rao blackwellisation
Vanilla rao blackwellisationVanilla rao blackwellisation
Vanilla rao blackwellisation
 
Seismic data processing lecture 3
Seismic data processing lecture 3Seismic data processing lecture 3
Seismic data processing lecture 3
 
Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...
Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...
Tail Probabilities for Randomized Program Runtimes via Martingales for Higher...
 
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014Levitan Centenary Conference Talk, June 27 2014
Levitan Centenary Conference Talk, June 27 2014
 
ENBIS 2018 presentation on Deep k-Means
ENBIS 2018 presentation on Deep k-MeansENBIS 2018 presentation on Deep k-Means
ENBIS 2018 presentation on Deep k-Means
 
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
 
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docxMATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
 
ma112011id535
ma112011id535ma112011id535
ma112011id535
 
R Programming Reference Card
R Programming Reference CardR Programming Reference Card
R Programming Reference Card
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in R
 
Rdnd2008
Rdnd2008Rdnd2008
Rdnd2008
 
Adc
AdcAdc
Adc
 
Hybrid Atlas Models of Financial Equity Market
Hybrid Atlas Models of Financial Equity MarketHybrid Atlas Models of Financial Equity Market
Hybrid Atlas Models of Financial Equity Market
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009
 

Recently uploaded

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Slides used during my thesis defense "Du typage vectoriel"

  • 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) ∼ tx x → f (x) ∼ λx.tx (x → f (x))r ∼ (λx.tx ) r (x → f (x))r = f (r ) ∼ (λx.tx ) r → tx [r /x] t, r ::= x | λx.t | (t) r (λx.t) r → t[r/x] 2 / 24
  • 3. Lambda calculus [Church’36] Type system [Church’40] Formal system to study the defini- “a tractable syntactic framework tion of function for classifying phrases according to f (x) ∼ tx the kinds of values they compute” x → f (x) ∼ λx.tx –[Pierce’02] (x → f (x))r ∼ (λx.tx ) r (x → f (x))r = f (r ) ∼ (λx.tx ) r → tx [r /x] λx.tx : T → R r:T t, r ::= x | λx.t | (t) r (λx.tx ) r : R (λx.t) r → t[r/x] 2 / 24
  • 4. Lambda calculus [Church’36] Type system [Church’40] Formal system to study the defini- “a tractable syntactic framework tion of function for classifying phrases according to f (x) ∼ tx the kinds of values they compute” x → f (x) ∼ λx.tx –[Pierce’02] (x → f (x))r ∼ (λx.tx ) r (x → f (x))r = f (r ) ∼ (λx.tx ) r → tx [r /x] λx.tx : T → R r:T t, r ::= x | λx.t | (t) r (λx.tx ) r : 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. Lambda calculus [Church’36] Type system [Church’40] Formal system to study the defini- “a tractable syntactic framework tion of function for classifying phrases according to f (x) ∼ tx the kinds of values they compute” x → f (x) ∼ λx.tx –[Pierce’02] (x → f (x))r ∼ (λx.tx ) r (x → f (x))r = f (r ) ∼ (λx.tx ) r → tx [r /x] λx.tx : T → R r:T t, r ::= x | λx.t | (t) r (λx.tx ) r : 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.x : Int → Int λx.tx : T → R r:T λx.x : Bool → Bool (λx.tx ) r : R ... T ⇒R T λx.x : ∀X .X → X R 2 / 24
  • 6. Lambda calculus [Church’36] Type system [Church’40] Formal system to study the defini- “a tractable syntactic framework tion of function for classifying phrases according to f (x) ∼ tx the kinds of values they compute” x → f (x) ∼ λx.tx –[Pierce’02] (x → f (x))r ∼ (λx.tx ) r (x → f (x))r = f (r ) ∼ (λx.tx ) r → tx [r /x] λx.tx : T → R r:T t, r ::= x | λx.t | (t) r (λx.tx ) r : 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.tx : T → R r:T λx Bool .x : Bool → Bool (λx.tx ) 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) (r1 + r2 ) → (t) r1 + (t) r2 , (t1 + t2 ) r → (t1 ) r + (t2 ) 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: α.t + β.t → (α + β).t, Vectorial space of values α.β.t → (α × β).t, B = {ti : ti var. or abs. } (t) (r1 + r2 ) → (t) r1 + (t) r2 , (t1 + t2 ) r → (t1 ) r + (t2 ) r, Set of values ::= Span(B) ... (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: α.t + β.t → (α + β).t, Vectorial space of values α.β.t → (α × β).t, B = {ti : ti var. or abs. } (t) (r1 + r2 ) → (t) r1 + (t) r2 , (t1 + t2 ) r → (t1 ) r + (t2 ) r, Set of values ::= Span(B) ... (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 y & Scalar Additive α.T T +R $ y Vectorial α.T + β.R 5 / 24
  • 16. Plan System F y & Scalar Additive α.T T +R $ y 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
  • 21. 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 1 2.(λx. .x) y 1 Example 2 y :C 2.(λx. .x) y : C 1 2 ω(2.(λx. .x) y ) = 2 2 6 / 24
  • 22. 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 1 2.(λx. .x) y →∗ y 1 Example 2 y :C 2.(λx. .x) y : C 1 2 ω(2.(λx. .x) y ) = 2 ω(y ) = 1 2 6 / 24
  • 23. The Scalar Type System A polymorphic type system tracking scalars: Γ t:T Subject reduction (type preservation) Γ α.t : α.T Strong normalisation 1. SN for a straightforward extension of Γ t : α.T Γ r : β.T System F 2. verify that both systems type the same Γ t + r : (α + β).T terms 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 1 2.(λx. .x) y →∗ y 1 Example 2 y :C 2.(λx. .x) y : C 1 2 ω(2.(λx. .x) y ) = 2 ω(y ) = 1 2 6 / 24
  • 24. The Scalar Type System A polymorphic type system tracking scalars: Γ t:T Subject reduction (type preservation) Γ α.t : α.T Strong normalisation 1. SN for a straightforward extension of Γ t : α.T Γ r : β.T System F 2. verify that both systems type the same Γ t + r : (α + β).T terms 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 1 2.(λx. .x) y →∗ y 1 Example 2 y :C 2.(λx. .x) y : C 1 2 ω(2.(λx. .x) y ) = 2 ω(y ) = 1 2 Contribution: [Arrighi,Díaz-Caro’09] 6 / 24
  • 25. Plan System F y & Scalar Additive & x Vectorial 7 / 24
  • 26. The Additive Type System A polymorphic type system with sums (for the additive fragment of λlin ) Γ t:T Γ r:R Sums ∼ Assoc., comm. pairs Γ t+r:T +R distributive w.r.t. application 8 / 24
  • 27. The Additive Type System A polymorphic type system with sums (for the additive fragment of λlin ) Γ t:T Γ r:R Sums ∼ Assoc., comm. pairs Γ t+r:T +R distributive w.r.t. application Translation into System F with pairs 8 / 24
  • 28. The Additive Type System A polymorphic type system with sums (for the additive fragment of λlin ) Γ t:T Γ r:R Sums ∼ Assoc., comm. pairs Γ t+r:T +R distributive w.r.t. application Translation into System F with pairs Simplified version without AC of + |T + R| = |T | × |R| 8 / 24
  • 29. The Additive Type System A polymorphic type system with sums (for the additive fragment of λlin ) Γ t:T Γ r:R Sums ∼ Assoc., comm. pairs Γ t+r:T +R distributive w.r.t. application Translation into System F with pairs Simplified version without AC of + |T + R| = |T | × |R| Distributivity in the translation (using the structure given by the type) 8 / 24
  • 30. The Additive Type System A polymorphic type system with sums (for the additive fragment of λlin ) Γ t:T Γ r:R Sums ∼ Assoc., comm. pairs Γ t+r:T +R distributive w.r.t. application Translation into System F with pairs Simplified version without AC of + |T + R| = |T | × |R| Distributivity in the translation (using the structure given by the type) Equivalences given explicitly: T ≡ R implies |T | ⇔ |R| A×B ⇔B ×A (A × B) × C ⇔ A × (B × C ) 8 / 24
  • 31. The Additive Type System A polymorphic type system with sums (for the additive fragment of λlin ) Γ t:T Γ r:R Sums ∼ Assoc., comm. pairs Γ t+r:T +R distributive w.r.t. application Translation into System F with pairs Simplified version without AC of + |T + R| = |T | × |R| Distributivity in the translation (using the structure given by the type) Equivalences given explicitly: T ≡ R implies |T | ⇔ |R| A×B ⇔B ×A (A × B) × C ⇔ A × (B × C ) Theorem If Γ t : T and exists T ≡ T then |Γ| F [t]D : |T | Also we set up an inverse translation showing that it is non-trivial 8 / 24
  • 32. The Additive Type System A polymorphic type system with sums (for the additive fragment of λlin ) Γ t:T Γ r:R Sums ∼ Assoc., comm. pairs Γ t+r:T +R distributive w.r.t. application Translation into System F with pairs Simplified version without AC of + |T + R| = |T | × |R| Distributivity in the translation (using the structure given by the type) Equivalences given explicitly: T ≡ R implies |T | ⇔ |R| A×B ⇔B ×A (A × B) × C ⇔ A × (B × C ) Theorem If Γ t : T and exists T ≡ T then |Γ| F [t]D : |T | Also we set up an inverse translation showing that it is non-trivial Subject reduction Strong normalisation (using the one from System Fp ) Contribution: [Díaz-Caro,Petit’10] 8 / 24
  • 33. Plan System F y & Scalar Additive / System Fp % x Vectorial 9 / 24
  • 34. Plan System F y & Scalar Additive / System Fp O % x Vectorial λCA 9 / 24
  • 35. The Complete Additive System (λCA ) Extending sums to the whole calculus (with positive reals scalars) Γ t:T More general than Additive Γ α.t : α .T = T + · · · + T Less complex than Vectorial α “Amounts” approximated 10 / 24
  • 36. The Complete Additive System (λCA ) Extending sums to the whole calculus (with positive reals scalars) Γ t:T More general than Additive Γ α.t : α .T = T + · · · + T Less complex than Vectorial α “Amounts” approximated If t : T , then (0.9).t + (1.1).t : T (0.9).t + (1.1).t → 2.t and 2.t : 2.T 10 / 24
  • 37. The Complete Additive System (λCA ) Extending sums to the whole calculus (with positive reals scalars) Γ t:T More general than Additive Γ α.t : α .T = T + · · · + T Less complex than Vectorial α “Amounts” approximated If t : T , then (0.9).t + (1.1).t : T (0.9).t + (1.1).t → 2.t and 2.t : 2.T Weak subject reduction: t → r, Γ t:T ⇒Γ r : R with T R 10 / 24
  • 38. The Complete Additive System (λCA ) Extending sums to the whole calculus (with positive reals scalars) Γ t:T More general than Additive Γ α.t : α .T = T + · · · + T Less complex than Vectorial α “Amounts” approximated If t : T , then (0.9).t + (1.1).t : T (0.9).t + (1.1).t → 2.t and 2.t : 2.T Weak subject reduction: t → r, Γ t : T ⇒ Γ r : R with T R Abstract interpretation (theorem) [·] λCA τ / λadd / Fp ↓ ↓a ↓F ( ) ( ) λCA / λadd / Fp τ [·] 10 / 24
  • 39. The Complete Additive System (λCA ) Extending sums to the whole calculus (with positive reals scalars) Γ t:T More general than Additive Γ α.t : α .T = T + · · · + T Less complex than Vectorial α “Amounts” approximated If t : T , then (0.9).t + (1.1).t : T (0.9).t + (1.1).t → 2.t and 2.t : 2.T Weak subject reduction: t → r, Γ t : T ⇒ Γ r : R with T R Abstract interpretation (theorem) [·] λCA τ / λadd / Fp ↓ ↓a ↓F ( ) ( ) λCA / λadd / Fp τ [·] Strong normalisation (using Additive) Contribution: [Buiras,Díaz-Caro,Jaskelioff’11] 10 / 24
  • 40. Plan System F y Scalar Additive / System Fp O % x Vectorial λCA 11 / 24
  • 41. The Vectorial system Types: T , R, S := U | T + R | α.T U, V , W := X | U → T | ∀X .U (U, V , W reflect the basis terms) Equivalences: 1.T ≡ T α.(β.T ) ≡ (α × β).T α.T + α.R ≡ α.(T + R) α.T + β.T ≡ (α + β).T T +R ≡ R +T T + (R + S) ≡ (T + R) + S (reflect the vectorial spaces axioms) 12 / 24
  • 42. Typing rules Γ t:T Γ t:T ax 0I sI Γ, x : U x :U Γ 0 : 0.T Γ α.t : α.T n m ∀Vj , ∃Wj / Γ t: αi .∀X .(U → Ti ) Γ r: βj .Vj U[Wj /X ] = Vj i=1 j=1 →E n m Γ (t) r : αi × βj .Ti [Wj /X ] i=1 j=1 Γ, x : U t:T Γ t:T Γ r:R →I +I Γ λx.t : U → T Γ t+r:T +R n n Γ t: αi .Ui X ∈ FV (Γ) / Γ t: αi .∀X .Ui i=1 i=1 ∀I ∀E n n Γ t: αi .∀X .Ui Γ t: αi .Ui [V /X ] i=1 i=1 13 / 24
  • 43. Typing rules Γ t:T Γ t:T ax 0I sI Γ, x : U x :U Γ 0 : 0.T Γ α.t : α.T n m ∀Vj , ∃Wj / Γ t: αi .∀X .(U → Ti ) Γ r: βj .Vj U[Wj /X ] = Vj i=1 j=1 →E n m Γ (t) r : αi × βj .Ti [Wj /X ] i=1 j=1 Γ, x : U t:T Γ t:T Γ r:R →I +I Γ λx.t : U → T Γ t+r:T +R n n Γ t: αi .Ui X ∈ FV (Γ) / Γ t: αi .∀X .Ui i=1 i=1 ∀I ∀E n n Γ t: αi .∀X .Ui Γ t: αi .Ui [V /X ] i=1 i=1 Strong normalisation: Reducibility candidates Main difficulty: show that {ti }i SN ⇒ i ti SN (algebraic measure) 13 / 24
  • 44. Typing rules Γ t:T Γ t:T ax 0I sI Γ, x : U x :U Γ 0 : 0.T Γ α.t : α.T n m ∀Vj , ∃Wj / Γ t: αi .∀X .(U → Ti ) Γ r: βj .Vj U[Wj /X ] = Vj i=1 j=1 →E n m Γ (t) r : αi × βj .Ti [Wj /X ] i=1 j=1 Γ, x : U t:T Γ t:T Γ r:R →I +I Γ λx.t : U → T Γ t+r:T +R n n Γ t: αi .Ui X ∈ FV (Γ) / Γ t: αi .∀X .Ui i=1 i=1 ∀I ∀E n n Γ t: αi .∀X .Ui Γ t: αi .Ui [V /X ] i=1 i=1 Strong normalisation: Reducibility candidates Main difficulty: show that {ti }i SN ⇒ i ti SN (algebraic measure) Subject reduction a challenge 13 / 24
  • 45. The case of the factorisation rule System F à la Curry: a term can have different, unrelated types Γ t:T Γ t:T ========== ========== Γ α.t + β.t : α.T + β.T However, α.t + β.t → (α + β).t... one of the two types must be chosen! In general α.T + β.T = (α + β).T = (α + β).T (and since we are working in System F, there is no principal types neither) 14 / 24
  • 46. Several possible solutions: Remove factorisation rule (Done. SR and SN both work) + in scalars not used anymore. Scalars ⇒ Monoid It works!... but it is no so expressive (“vectorial” structure lost) 15 / 24
  • 47. Several possible solutions: Remove factorisation rule (Done. SR and SN both work) + in scalars not used anymore. Scalars ⇒ Monoid It works!... but it is no so expressive (“vectorial” structure lost) Γ t:T Γ t:T Add the typing rule Γ (α + β).t : α.T + β.T As soon as we add this one, we have to add many others Too complex and inelegant (subject reduction by axiom) 15 / 24
  • 48. Several possible solutions: Remove factorisation rule (Done. SR and SN both work) + in scalars not used anymore. Scalars ⇒ Monoid It works!... but it is no so expressive (“vectorial” structure lost) Γ t:T Γ t:T Add the typing rule Γ (α + β).t : α.T + β.T As soon as we add this one, we have to add many others Too complex and inelegant (subject reduction by axiom) Weak subject reduction If Γ t : T and t →R r, then if R is not the factorisation rule: Γ r : T if R is the factorisation rule: ∃S T /Γ r:S where (α + β).T α.T + β.T if ∃t / Γ t : T and Γ t:T Contribution: [Arrighi,Díaz-Caro,Valiron’11] 15 / 24
  • 49. Several possible solutions: Remove factorisation rule (Done. SR and SN both work) + in scalars not used anymore. Scalars ⇒ Monoid It works!... but it is no so expressive (“vectorial” structure lost) Γ t:T Γ t:T Add the typing rule Γ (α + β).t : α.T + β.T As soon as we add this one, we have to add many others Too complex and inelegant (subject reduction by axiom) Weak subject reduction If Γ t : T and t →R r, then if R is not the factorisation rule: Γ r : T if R is the factorisation rule: ∃S T /Γ r:S where (α + β).T α.T + β.T if ∃t / Γ t : T and Γ t:T Contribution: [Arrighi,Díaz-Caro,Valiron’11] Church style Seems to be the natural solution: the type is part of the term, if the types are different, the terms are different (no factorisation rule) 15 / 24
  • 50. Plan System F y Scalar Additive / System Fp O % x Vectorial λCA Lineal 16 / 24
  • 51. The system Lineal Types: T , R, S := U | T + R | α.T U, V , W := X | U → T | ∀X .U | U@( i Vi ) (U, V , W reflect the basis terms) Equivalences: 1.T ≡ T α.(β.T ) ≡ (α × β).T α.T + α.R ≡ α.(T + R) α.T + β.T ≡ (α + β).T T +R ≡ R +T T + (R + S) ≡ (T + R) + S (∀X .U)@V ≡ U[V /X ] (reflect the vectorial spaces axioms) 17 / 24
  • 52. Typing rules Γ t:T Γ t:T ax 0I sI Γ, x : U x :U Γ 0 : 0.T Γ α.t : α.T n m+δ m ∀Vj , ∃j1 , . . . , jk / Γ t: αi .( ∀X k .(U → Ti ))@ Wj k Γ r: βj .Vj U [Wj /X ] = Vj k i=1 j=1 j=1 →E n m Γ (t) r : αi × βj .Ti [Wj /X ] k i=1 j=1 Γ, x : U t:T Γ t:T Γ r:R →I +I Γ λx : U.t : U → T Γ t+r:T +R n n Γ t: αi .Ui X ∈ FV (Γ) / Γ t: αi .∀X .Ui i=1 i=1 ∀I @I n m n m Γ ΛX .t : αi .∀X .Ui Γ t@( Vj ) : αi .(∀X .Ui )@( Vj ) i=1 j=1 i=1 j=1 Subject reduction Strong normalisation (using Vectorial) 18 / 24
  • 53. Most important properties of Lineal Theorem If Γ t: i αi .Ui then t →∗ i αi .bi where Γ bi : Ui (where Ui is not a type abstraction or application) Theorem If t ↓= i αi .bi then Γ t: i αi .Ui + 0.T , where Γ bi : Ui 19 / 24
  • 54. Confluence as a side effect 20 / 24
  • 55. Confluence In the original untyped setting: “confluence by restrictions”: Yb = (λx.(b + (x)x)) λx.(b + (x)x) Yb → b + Yb → b + b + Yb → . . . 21 / 24
  • 56. Confluence In the original untyped setting: “confluence by restrictions”: Yb = (λx.(b + (x)x)) λx.(b + (x)x) Yb → b + Yb → b + b + Yb → . . . Yb + (−1).Yb −→ (1 − 1).Yb −→∗ 0 ↓ b + Yb + (−1).Yb ↓∗ b 21 / 24
  • 57. Confluence In the original untyped setting: “confluence by restrictions”: Yb = (λx.(b + (x)x)) λx.(b + (x)x) Yb → b + Yb → b + b + Yb → . . . Yb + (−1).Yb −→ (1 − 1).Yb −→∗ 0 ↓ Solution in the untyped setting: b + Yb + (−1).Yb α.t + β.t → (α + β).t ↓∗ only if t is closed-normal b 21 / 24
  • 58. Confluence In the original untyped setting: “confluence by restrictions”: Yb = (λx.(b + (x)x)) λx.(b + (x)x) Yb → b + Yb → b + b + Yb → . . . Yb + (−1).Yb −→ (1 − 1).Yb −→∗ 0 ↓ Solution in the untyped setting: b + Yb + (−1).Yb α.t + β.t → (α + β).t ↓∗ only if t is closed-normal b In the typed setting: Strong normalisation solves the problem 21 / 24
  • 59. Theorem (Confluence) ∀t / Γ t:T ∗ t ∗  r1 r2 ∗ ~ ∗ s Proof. 1) local confluence: t  r1 r2 ∗ ~ ∗ s Algebraic fragment: Coq proof [Valiron’10] Beta-reduction: Straightforward extension Commutation: Induction 2) Local confluence + Strong normalisation ⇒ Confluence 22 / 24
  • 60. Contributions s System F λalg 3 λlin y Scalar Additive / System Fp O % x Vectorial λCA Relation between λlin and λalg SN and SR for the five systems Lineal Sums as pairs Types ↔ vectorial structure of terms Extra: No cloning theorem Papers Díaz-Caro,Perdrix,Tasson,Valiron HOR’10 (journal version in preparation) Arrighi,Díaz-Caro QPL’09 (journal version submitted) Díaz-Caro,Petit (in preparation) Buiras,Díaz-Caro,Jaskelioff LSFA’11 Arrighi,Díaz-Caro,Valiron DCM’11 (journal version in preparation) 23 / 24
  • 61. Future work Invariability of models of λalg through the CPS simulation Differential λ-calculus ↔ Linear-algebraic λ-calculus Algebraic Linearity ↔ Linear logic resources Quantum language (orthogonality issues) Relations with Probabilistic/Quantum/Fuzzy Logics 24 / 24