SlideShare a Scribd company logo
1 of 50
Download to read offline
Linearity in the non-deterministic
               call-by-value setting


     Alejandro Díaz-Caro                                Barbara Petit
LIPN, Université Paris 13, Sorbonne Paris Cité   Focus (INRIA) – Università di Bologna




                                        19th WoLLIC
                           Buenos Aires, September 3–6, 2012
Non-determinism (or parallelism)
        t + u: non-deterministic superposition between t and u
               (it may run t or u, non-deterministically)




             Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   1 / 20
Non-determinism (or parallelism)
        t + u: non-deterministic superposition between t and u
               (it may run t or u, non-deterministically)
                      (t + u)s may run ts or us.




             Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   1 / 20
Non-determinism (or parallelism)
        t + u: non-deterministic superposition between t and u
               (it may run t or u, non-deterministically)
                      (t + u)s may run ts or us.
                      Hence (t + u)s → ts + us




             Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   1 / 20
Non-determinism (or parallelism)
            t + u: non-deterministic superposition between t and u
                    (it may run t or u, non-deterministically)
                           (t + u)s may run ts or us.
                           Hence (t + u)s → ts + us
                  Sum of functions: (f + g)(x) = f(x) + g(x)
    (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek])




                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   1 / 20
Non-determinism (or parallelism)
            t + u: non-deterministic superposition between t and u
                    (it may run t or u, non-deterministically)
                           (t + u)s may run ts or us.
                           Hence (t + u)s → ts + us
                  Sum of functions: (f + g)(x) = f(x) + g(x)
    (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek])
                                               t(u + s)

             (λx.t)(u + s) → t[(u + s)/x]                                                (CBN)
             (λx.t)(u + s) → (λx.t)u + (λx.t)s                                           (CBV)

                   Generically in CBV t(u + s) → tu + ts




                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   1 / 20
Non-determinism (or parallelism)
            t + u: non-deterministic superposition between t and u
                    (it may run t or u, non-deterministically)
                           (t + u)s may run ts or us.
                           Hence (t + u)s → ts + us
                  Sum of functions: (f + g)(x) = f(x) + g(x)
    (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek])
                                               t(u + s)

             (λx.t)(u + s) → t[(u + s)/x]                                                (CBN)
             (λx.t)(u + s) → (λx.t)u + (λx.t)s                                           (CBV)

                  Generically in CBV t(u + s) → tu + ts
         In algebraic terms, functions are treated as linear in CBV:
                           f(x + y ) = f(x) + f(y )



                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   1 / 20
Non-determinism (or parallelism)
            t + u: non-deterministic superposition between t and u
                    (it may run t or u, non-deterministically)
                           (t + u)s may run ts or us.
                           Hence (t + u)s → ts + us
                  Sum of functions: (f + g)(x) = f(x) + g(x)
    (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek])
                                               t(u + s)

             (λx.t)(u + s) → t[(u + s)/x]                                                (CBN)
             (λx.t)(u + s) → (λx.t)u + (λx.t)s                                           (CBV)

                  Generically in CBV t(u + s) → tu + ts
         In algebraic terms, functions are treated as linear in CBV:
                           f(x + y ) = f(x) + f(y )

                  We want to understand this ‘linearity’

                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   1 / 20
Outline




     The untyped calculus



     The Additive type system capturing the CBV behaviour of +



     Logical interpretation: translation into System F with pairs




               Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   2 / 20
The untyped CBV non-deterministic λ-calculus

                              t, u, s ::= v | tu | t + u | 0
                                      v ::= x | λx.t
  Intuitions
  t + u = non-deterministic superposition between t and u
  0 = impossible computation




                Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   3 / 20
The untyped CBV non-deterministic λ-calculus

                              t, u, s ::= v | tu | t + u | 0
                                      v ::= x | λx.t
  Intuitions
  t + u = non-deterministic superposition between t and u
  0 = impossible computation

                Hence, t + 0 → t because 0 is impossible!




                Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   3 / 20
The untyped CBV non-deterministic λ-calculus

                              t, u, s ::= v | tu | t + u | 0
                                      v ::= x | λx.t
  Intuitions
  t + u = non-deterministic superposition between t and u
  0 = impossible computation

                Hence, t + 0 → t because 0 is impossible!
  Also     0t → 0      t0 → 0
  Because non of them reduces (0 not a value) and there is an impossible
  computation




                Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   3 / 20
The untyped CBV non-deterministic λ-calculus

                               t, u, s ::= v | tu | t + u | 0
                                       v ::= x | λx.t
  Intuitions
  t + u = non-deterministic superposition between t and u
  0 = impossible computation

                Hence, t + 0 → t because 0 is impossible!
  Also     0t → 0      t0 → 0
  Because non of them reduces (0 not a value) and there is an impossible
  computation

                               Running t or u non-deterministically, is the
  Finally t + u = u + t
                               same as running u or t non-deterministically
  Also t + (u + s) = (t + u) + s



                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   3 / 20
The untyped CBV non-deterministic λ-calculus

                                t, u, s ::= v | tu | t + u | 0
                                        v ::= x | λx.t

                                           βv -reduction
                                         (λx.t)v → t[v/x]


  Distributivity rules                                            Zero rules
          (t + u)s → ts + us                                                t+0→t
          t(u + s) → tu + ts                                                     0t → 0
                                                                                 t0 → 0

  with + associative and commutative

  Remark: in the algebraic case, 0 is the sum of zero terms


                  Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   3 / 20
The Additive type system
  Objective: capture as much as possible the behaviour of +




                Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   4 / 20
The Additive type system
  Objective: capture as much as possible the behaviour of +

   Γ       t:T   Γ     s:S
       Γ    t+s :T +S                            Γ     0:¯
                                                         0




                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting   4 / 20
The Additive type system
  Objective: capture as much as possible the behaviour of +

   Γ       t:T   Γ     s:S                                                       Γ       t:T                T ≡S
       Γ    t+s :T +S                            Γ     0:¯
                                                         0                                    Γ      t:S



  T +R ≡ R +T            ;          T +(R +S) ≡ (T +R)+S                                  ;           T +¯ ≡ T
                                                                                                         0




                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting    4 / 20
The Additive type system
  Objective: capture as much as possible the behaviour of +

   Γ       t:T   Γ     s:S                                                       Γ       t:T                T ≡S
       Γ    t+s :T +S                            Γ     0:¯
                                                         0                                    Γ      t:S



  T +R ≡ R +T            ;          T +(R +S) ≡ (T +R)+S                                  ;           T +¯ ≡ T
                                                                                                         0


  T → R: functions from T to R




                 Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting    4 / 20
The Additive type system
  Objective: capture as much as possible the behaviour of +

   Γ       t:T    Γ     s:S                                                       Γ       t:T                T ≡S
       Γ    t+s :T +S                             Γ     0:¯
                                                          0                                    Γ      t:S



  T +R ≡ R +T             ;          T +(R +S) ≡ (T +R)+S                                  ;           T +¯ ≡ T
                                                                                                          0


  T → R: functions from T to R
                      But (T + R) → S does not exists
  there is no function taking a non-deterministic superposition as argument
  Recall t(v1 + v2 ) → tv1 + tv2
  If v1 : T and v2 : R then t needs to be both T → S1 and R → S2



                  Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting    4 / 20
The Additive type system
  Objective: capture as much as possible the behaviour of +

   Γ       t:T    Γ     s:S                                                       Γ       t:T                T ≡S
       Γ    t+s :T +S                             Γ     0:¯
                                                          0                                    Γ      t:S



  T +R ≡ R +T             ;          T +(R +S) ≡ (T +R)+S                                  ;           T +¯ ≡ T
                                                                                                          0


  T → R: functions from T to R
                      But (T + R) → S does not exists
  there is no function taking a non-deterministic superposition as argument
  Recall t(v1 + v2 ) → tv1 + tv2
  If v1 : T and v2 : R then t needs to be both T → S1 and R → S2
             Polymorphism & unit types “U” (atomic types w.r.t. +)
                             Arrows: U → T
                  Alejandro Díaz-Caro & Barbara Petit   Linearity in the non-deterministic call-by-value setting    4 / 20
The Additive type system                                   (cont.)
Examples



                                           Concrete example

                  v1 : U1           ;         v2 : U2           ;           I : ∀X .X → X

            Hence        I (v1 + v2 ) → I v1 + I v2                      has type                 U1 + U2




                                        A more generic example

           v1 : U[W1 /X ]           ;         v2 : U[W2 /X ]                  ;          t : ∀X .U → T

    Hence       t(v1 + v2 ) → tv1 + tv2                     has type                T [W1 /X ] + T [W2 /X ]



                     Alejandro Díaz-Caro & Barbara Petit    Linearity in the non-deterministic call-by-value setting   5 / 20
The Additive type system                                   (cont.)
Examples



                                           Concrete example

                  v1 : U1           ;         v2 : U2           ;           I : ∀X .X → X

            Hence        I (v1 + v2 ) → I v1 + I v2                      has type                 U1 + U2




                                        A more generic example

           v1 : U[W1 /X ]           ;         v2 : U[W2 /X ]                  ;          t : ∀X .U → T

    Hence       t(v1 + v2 ) → tv1 + tv2                     has type                T [W1 /X ] + T [W2 /X ]



                     Alejandro Díaz-Caro & Barbara Petit    Linearity in the non-deterministic call-by-value setting   5 / 20
The Additive type system                                    (cont.)
Examples




                Γ   t : ∀X .U → T                 Γ        v1 + v2 : U[W1 /X ] + U[W2 /X ]
                             Γ     t(v1 + v2 ) : T [W1 /X ] + T [W2 /X ]




                                        A more generic example

           v1 : U[W1 /X ]           ;         v2 : U[W2 /X ]                    ;          t : ∀X .U → T

    Hence       t(v1 + v2 ) → tv1 + tv2                       has type                T [W1 /X ] + T [W2 /X ]



                     Alejandro Díaz-Caro & Barbara Petit      Linearity in the non-deterministic call-by-value setting   5 / 20
The Additive type system                                     (cont.)
Examples



                             t:U→T                       ;          u:V →R

                                        (t + u)v → tv + uv
             Hence U and V needs to “polymorph” to the type of v


       v : U[W1 /X ] = V [W2 /X ]                  t : ∀X .(U → T )                         u : ∀X .(V → R)

              Hence        tv + uv has type                       T [W1 /X ] + R[W2 /X ]




                   Alejandro Díaz-Caro & Barbara Petit        Linearity in the non-deterministic call-by-value setting   6 / 20
The Additive type system                                     (cont.)
Examples



                             t:U→T                       ;          u:V →R

                                        (t + u)v → tv + uv
             Hence U and V needs to “polymorph” to the type of v


       v : U[W1 /X ] = V [W2 /X ]                  t : ∀X .(U → T )                         u : ∀X .(V → R)

              Hence        tv + uv has type                       T [W1 /X ] + R[W2 /X ]




                   Alejandro Díaz-Caro & Barbara Petit        Linearity in the non-deterministic call-by-value setting   6 / 20
The Additive type system                                     (cont.)
Examples



                             t:U→T                       ;          u:V →R

                                        (t + u)v → tv + uv
             Hence U and V needs to “polymorph” to the type of v


       v : U[W1 /X ] = V [W2 /X ]                  t : ∀X .(U → T )                         u : ∀X .(V → R)

              Hence        tv + uv has type                       T [W1 /X ] + R[W2 /X ]



       Γ   t + u : ∀X .(U → T ) + ∀X .(V → R)                          Γ       v : U[W1 /X ] = V [W2 /X ]
                            Γ     (t + u)v : T [W1 /X ] + R[W2 /X ]




                   Alejandro Díaz-Caro & Barbara Petit        Linearity in the non-deterministic call-by-value setting   6 / 20
The Additive type system                                         (cont.)
Arrow elimination
                    Γ   t : ∀X .U → T                Γ         v1 + v2 : U[W1 /X ] + U[W2 /X ]
                                Γ      t(v1 + v2 ) : T [W1 /X ] + T [W2 /X ]

         Γ   t + u : ∀X .(U → T ) + ∀X .(V → R)                             Γ       v : U[W1 /X ] = V [W2 /X ]
                                  Γ     (t + u)v : T [W1 /X ] + R[W2 /X ]

     combined...
     Γ   t + u : ∀X .(U → T ) + ∀X .(U → R)                            Γ      v1 + v2 : U[W1 /X ] + U[W2 /X ]
             Γ   (t + u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ]




                         Alejandro Díaz-Caro & Barbara Petit       Linearity in the non-deterministic call-by-value setting   7 / 20
The Additive type system                                         (cont.)
Arrow elimination
                    Γ   t : ∀X .U → T                Γ         v1 + v2 : U[W1 /X ] + U[W2 /X ]
                                Γ          t(v1 + v2 ) : T [W1 /X ] + T [W2 /X ]

         Γ   t + u : ∀X .(U → T ) + ∀X .(V → R)                               Γ       v : U[W1 /X ] = V [W2 /X ]
                                   Γ        (t + u)v : T [W1 /X ] + R[W2 /X ]

     combined...
     Γ   t + u : ∀X .(U → T ) + ∀X .(U → R)                              Γ      v1 + v2 : U[W1 /X ] + U[W2 /X ]
             Γ   (t + u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ]

     generalising...
                                       n                                               m
                        Γ     t:            ∀X .(U → Ti )               Γ      u:           U[Wj /X ]
                                    i=1                                               j=1
                                                          n      m
                                             Γ   tu :                 Ti [Wj /X ]
                                                         i=1 j=1


                         Alejandro Díaz-Caro & Barbara Petit         Linearity in the non-deterministic call-by-value setting   7 / 20
The Additive type system                                           (cont.)
Examples


                          V1 = U[W1 /X ]                       ;          V2 = U[W2 /X ]

        Γ    λx.t + λy .u : ∀X .(U → T ) + ∀X .(U → R)                                      Γ       v1 + v2 : V1 + V2
    Γ       (λx.t + λy .u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ]


                          
     (λx.t)v1 + (λx.t)v2 + (λy .u)v1 + (λy .u)v2
        T [W1 /X ]   T [W2 /X ]        R[W1 /X ]              R[W2 /X ]




                        Alejandro Díaz-Caro  Barbara Petit         Linearity in the non-deterministic call-by-value setting   8 / 20
The Additive type system                                           (cont.)
Examples


                           V1 = U[W1 /X ]                      ;          V2 = U[W2 /X ]

        Γ    λx.t + λy .u : ∀X .(U → T ) + ∀X .(U → R)                                      Γ       v1 + v2 : V1 + V2
    Γ       (λx.t + λy .u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ]


                          
     (λx.t)v1 + (λx.t)v2 + (λy .u)v1 + (λy .u)v2
        T [W1 /X ]   T [W2 /X ]        R[W1 /X ]              R[W2 /X ]




    Simpler example
                       Γ      λx.x : ∀X .X → X                           Γ       v1 + v2 : U + V
                           Γ (λx.x)(v1 + v2 ) : U + V
    without simultaneous arrow/forall elimination it is not possible to type it!
                        Alejandro Díaz-Caro  Barbara Petit         Linearity in the non-deterministic call-by-value setting   8 / 20
The Additive type system                                                     (cont.)
Summarising



                       T , R, S := U | T + R | ¯
                                               0                                                       general types
                      U, V , W := X | U → T | ∀X .U                                                    unit types
    T +¯ ≡ T
       0                        ;          T +R ≡ R +T                                ;            T +(R +S) ≡ (T +R)+S

                                               ax                                         Γ        t:T            Γ       u:R
                                                                            ax¯
                                                                              0                                                 +I
                     Γ, x : U       x :U                     Γ    0:¯
                                                                    0                          Γ    t+u:T +R
                      n                                               m
        Γ       t:         ∀X .(U → Ti )                 Γ       u:         U[Wj /X ]
                     i=1                                              j=1                                        Γ, x : U     t:T
                                                                                              →E                                         →I
                                           n        m
                                                                                                             Γ        λx.t : U → T
                            Γ       tu :                Ti [Wj /X ]
                                           i=1 j=1
            Γ    t : ∀X .U                      Γ       t:U            X ∈ FV (Γ)
                                                                         /                               Γ        t:T           T ≡R
                                    ∀E                                                        ∀I                                             ≡
         Γ      t : U[V /X ]                                 Γ    t : ∀X .U                                           Γ   t:R

    • Strong normalisation
    • Subject reduction

                                Alejandro Díaz-Caro  Barbara Petit               Linearity in the non-deterministic call-by-value setting       9 / 20
Outline



     The untyped calculus



     The Additive type system capturing the CBV behaviour of +



     Logical interpretation: translation into System F with pairs




               Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   10 / 20
System F with pairs


             t, u ::= x | λx.t | tu |               | t, u | π1 (t) | π2 (t)
            A, B ::= X | A ⇒ B | ∀X .A | 1 | A × B



     (λx.t)u → t[u/x]                      π1 ( t1 , t2 ) → t1                 π2 ( t1 , t2 ) → t2




                   Additive                    System F with pairs
                      X                                   X
                   U→T                              |U| ⇒ |T |
                    ∀X .U                             ∀X .|U|
                      ¯
                      0                                   1
                    T +S                             |T | × |S|

              Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   11 / 20
Sums as Pairs
                  +, ¯
                     0                                                 ×, 1


           T +S ≡ S +T                                   A×B = B ×A
     T + (S + R) ≡ (T + S) + R                     A × (B × C ) = (A × B) × C
           T +¯ ≡ T
               0                                         A×1 = A




             Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   12 / 20
Sums as Pairs
                     +, ¯
                        0                                                 ×, 1


             T +S ≡ S +T                                    A×B = B ×A
       T + (S + R) ≡ (T + S) + R                      A × (B × C ) = (A × B) × C
             T +¯ ≡ T
                 0                                          A×1 = A
                         T , R, S ::= U | T + R | ¯ 0
                        U, V , W ::= X | U → T | ∀X .U
                       Type      Binary tree (leaf: U or ¯
                                                         0)


  Example:
  T = (U1 + U2 ) + ¯
                   0                                                                   ¯
                                                                                       0
  T [r → ¯ lr → U2 , ll → U1 ]
         0,
                                                         U1                 U2

                           We keep structured sum types

                Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   12 / 20
Structured Arrow-elimination
          n                                      m
Γ   t:         ∀X .(U → Ti )          Γ   u:           U[Wj /X ]
         i=1                                    j=1
                           n   m
                Γ   tu :             Ti [Wj /X ]
                           i=1 j=1
                                                   Γ    t : T [ → ∀X .(U → T )]                    Γ      u : T [ → U[W /X ]]
                                                                     Γ    tu : T ◦ T [             → T [W /X ]]

                                                                                   tu:
     t:                                        u:




                                                U[W1 /X ]        U[W2 /X ]
         ∀X .U→T1           ∀X .U→T2

                                                                                     T1 [W1 /X ]   T1 [W2 /X ] T2 [W1 /X ]      T2 [W2 /X ]




                               Alejandro Díaz-Caro  Barbara Petit       Linearity in the non-deterministic call-by-value setting             13 / 20
Structured Arrow-elimination
An example


 t = (t1 + t2 ) + 0                       tu →∗ t1 u1 + (u2 + u3 ) +
                                                t2 u1 + (u2 + u3 ) + 0
                                             →∗ t1 u1 + (t1 u2 + t1 u3 )+
                                                t2 u1 + (t2 u2 + t2 u3 ) + 0
                           ¯
                           0

    U → T1 U → T2
                                                                                                       ¯
                                                                                                       0
 u = u1 + (u2 + u3 )



      U                                                       T1                      T2


             U         U                                           T1 T1                  T2 T2


                      Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   14 / 20
Equivalence in System F

  What about associativity, commutativity and neutral element
  in system F with pairs?

  Lemma
                        T ≡T                  implies                |T | ↔ |T |



  Where A ↔ B means

                 F   εA,B : A ⇒ B                  and                   F   εB,A : B ⇒ A

  for some terms εA,B , εB,A s.t.

               εA,B ◦ εB,A ≈ idA                       and           εB,A ◦ εA,B ≈ idB



                 Alejandro Díaz-Caro  Barbara Petit         Linearity in the non-deterministic call-by-value setting   15 / 20
Translation of terms
What happens with the distributivity?




                                    t+u                              [t], [u]

           (t1 + t2 )(u1 + u2 ) →∗                      but       t1 , t2 r1 , r2
            t1 u1 + t1 u2 + t2 u1 + t2 u2                           t1 r1 , t1 r2 , t2 r1 , t2 r2
                         No distributivity in System F with pairs




                      Alejandro Díaz-Caro  Barbara Petit     Linearity in the non-deterministic call-by-value setting   16 / 20
Translation of terms
What happens with the distributivity?




                                    t+u                              [t], [u]

           (t1 + t2 )(u1 + u2 ) →∗                      but       t1 , t2 r1 , r2
            t1 u1 + t1 u2 + t2 u1 + t2 u2                           t1 r1 , t1 r2 , t2 r1 , t2 r2
                         No distributivity in System F with pairs

     Main ideas:
          The sum is distributed during the translation of application
              [tr] = [t1 ][u1 ], [t1 ][u2 ] , [t2 ][u1 ], [t2 ][u2 ]
                                                               if t = t1 + t2 and u = u1 + u2




                      Alejandro Díaz-Caro  Barbara Petit     Linearity in the non-deterministic call-by-value setting   16 / 20
Translation of terms
What happens with the distributivity?




                                    t+u                              [t], [u]

           (t1 + t2 )(u1 + u2 ) →∗                      but       t1 , t2 r1 , r2
            t1 u1 + t1 u2 + t2 u1 + t2 u2                           t1 r1 , t1 r2 , t2 r1 , t2 r2
                         No distributivity in System F with pairs

     Main ideas:
          The sum is distributed during the translation of application
              [tr] = [t1 ][u1 ], [t1 ][u2 ] , [t2 ][u1 ], [t2 ][u2 ]
                                                               if t = t1 + t2 and u = u1 + u2
          The “sum structure” of a term is known thanks to its type
          Γ t : (T1 + T2 ) + T3           t ∼ (t1 + t2 ) + t3
                                                                                          with Γ          ti : Ti



                      Alejandro Díaz-Caro  Barbara Petit     Linearity in the non-deterministic call-by-value setting   16 / 20
Translation of terms


              Γ         t:T                         |Γ|        F    [t]D : |T |

         Γ, x : T x : T                                               [x]D = x
             Γ 0:¯0                                                   [0]D =




            Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   17 / 20
Translation of terms


              Γ         t:T                         |Γ|        F    [t]D : |T |

         Γ, x : T x : T                                               [x]D = x
             Γ 0:¯0                                                   [0]D =
        Γ t:T T ≡T
                                                            [t]D = ε|T |,|T | [t]D
             Γ t:T




            Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   17 / 20
Translation of terms


                   Γ         t:T                         |Γ|        F    [t]D : |T |

         Γ, x : T x : T                                                    [x]D = x
             Γ 0:¯0                                                        [0]D =
        Γ t:T T ≡T
                                                                 [t]D = ε|T |,|T | [t]D
             Γ t:T
        Γ       t:T Γ u:S
                                                              [t+r]D = [t]D1 , [u]D2
            Γ    t+u:T +S
          Γ, x : U t : T
                                                                  [λx.t]D = λx.[t]D
         Γ λx.t : U → T




                 Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   17 / 20
Translation of terms


                     Γ         t:T                         |Γ|        F    [t]D : |T |

            Γ, x : T x : T                                                   [x]D = x
                Γ 0:¯0                                                       [0]D =
           Γ t:T T ≡T
                                                                   [t]D = ε|T |,|T | [t]D
                Γ t:T
          Γ       t:T Γ u:S
                                                                [t+r]D = [t]D1 , [u]D2
              Γ    t+u:T +S
               Γ, x : U t : T
                                             [λx.t]D = λx.[t]D
              Γ λx.t : U → T
   Γ   t : T [ →∀X .(U→T )] Γ u : T [ →U[W /X ]]
             Γ tu : T ◦ T [ →T [W /X ]]
                                      [tu]D = T ◦ T [ →π ([t]D1 )π                                              ([u]D2 )]




                   Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting           17 / 20
Translation of terms
An example



        Γ    t : (U → T1 ) + (U → T2 )                     + (U → T3 )                       Γ       u:U +U

                 Γ      tu : (T1 + T1 ) + (T2 + T2 ) + (T3 + T3 )

                                                                           t1 =π11 ([t]);t2 =π12 ([t]);t3 =π2 ([t]);
                                                                                             r1 =π1 ([u]);r2 =π2 ([u]);

    tu :                                              [tu]D =



                      T3          T3
     T1 T1T2 T2                                                                                t3 r1           t3 r2

                                                       t1 r1 t1 r2              t2 r1 t2 r2

                     Alejandro Díaz-Caro  Barbara Petit    Linearity in the non-deterministic call-by-value setting      18 / 20
Correctness


  Theorem (Correctness w.r.t. typing)
  Γ     t:T        implies               |Γ|       F   [t]D : |T |


  We provide a partial inverse translation (| · |) and prove

  Theorem (Inverse translation)
  Γ     t:T        =           (||Γ||)         F   (|[t]D |) : (||T ||)



  Theorem (Reduction preservation)
  Γ     t : T and t → t                implies              [t]D →+ [t ]D                      for some D
                                                                                     (except for t + 0 → t)



                 Alejandro Díaz-Caro  Barbara Petit      Linearity in the non-deterministic call-by-value setting   19 / 20
Summarising and concluding

     + “like linear functions”:              f(x + y ) = f(x) + f(y )
     Additive type system tight to the behaviour of +
     Typed system translate to System F with pairs




                Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   20 / 20
Summarising and concluding

     + “like linear functions”:              f(x + y ) = f(x) + f(y )
     Additive type system tight to the behaviour of +
     Typed system translate to System F with pairs

    System F with pairs correspond to the non-linear fragment of
                               IMELL




                Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   20 / 20
Summarising and concluding

       + “like linear functions”:              f(x + y ) = f(x) + f(y )
       Additive type system tight to the behaviour of +
       Typed system translate to System F with pairs

     System F with pairs correspond to the non-linear fragment of
                                IMELL

   Linear Logic                                         CBV nd/alg
   Force unique use of the argument                     Ban sum terms substitutions
   e.g.                                                 e.g.

           f(x) = x 2 no linear                                  f(x + y ) → f(x) + f(y )
           f(x) = x + 1 linear


   In the CBV non-deterministic setting (or algebraic) it is enough to treat
   functions as linear, even if they are not. (In LL all functions are linear).

                  Alejandro Díaz-Caro  Barbara Petit   Linearity in the non-deterministic call-by-value setting   20 / 20

More Related Content

What's hot

Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides)Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides)Matthew Leingang
 
Cue april 24, 2010
Cue april 24, 2010Cue april 24, 2010
Cue april 24, 2010guest3a010d
 
Transfers Principles Revisited with Choquet’s Lemma on Successive Differences
Transfers Principles Revisited with Choquet’s Lemma on Successive DifferencesTransfers Principles Revisited with Choquet’s Lemma on Successive Differences
Transfers Principles Revisited with Choquet’s Lemma on Successive DifferencesMarc Dubois
 
Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)
Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)
Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)Matthew Leingang
 
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)MarcelloSantosChaves
 
Lesson 14: Exponential Functions
Lesson 14: Exponential FunctionsLesson 14: Exponential Functions
Lesson 14: Exponential FunctionsMatthew Leingang
 
Slides used during my thesis defense "Du typage vectoriel"
Slides used during my thesis defense "Du typage vectoriel"Slides used during my thesis defense "Du typage vectoriel"
Slides used during my thesis defense "Du typage vectoriel"Alejandro Díaz-Caro
 
International conference "QP 34 -- Quantum Probability and Related Topics"
International conference "QP 34 -- Quantum Probability and Related Topics"International conference "QP 34 -- Quantum Probability and Related Topics"
International conference "QP 34 -- Quantum Probability and Related Topics"Medhi Corneille Famibelle*
 

What's hot (10)

Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides)Lesson 8: Basic Differentiation Rules (Section 21 slides)
Lesson 8: Basic Differentiation Rules (Section 21 slides)
 
Cue april 24, 2010
Cue april 24, 2010Cue april 24, 2010
Cue april 24, 2010
 
Transfers Principles Revisited with Choquet’s Lemma on Successive Differences
Transfers Principles Revisited with Choquet’s Lemma on Successive DifferencesTransfers Principles Revisited with Choquet’s Lemma on Successive Differences
Transfers Principles Revisited with Choquet’s Lemma on Successive Differences
 
Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)
Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)
Lesson 17: Indeterminate forms and l'Hôpital's Rule (slides)
 
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)
 
Lesson 14: Exponential Functions
Lesson 14: Exponential FunctionsLesson 14: Exponential Functions
Lesson 14: Exponential Functions
 
Lecture 02
Lecture 02Lecture 02
Lecture 02
 
Slides used during my thesis defense "Du typage vectoriel"
Slides used during my thesis defense "Du typage vectoriel"Slides used during my thesis defense "Du typage vectoriel"
Slides used during my thesis defense "Du typage vectoriel"
 
International conference "QP 34 -- Quantum Probability and Related Topics"
International conference "QP 34 -- Quantum Probability and Related Topics"International conference "QP 34 -- Quantum Probability and Related Topics"
International conference "QP 34 -- Quantum Probability and Related Topics"
 
Stochastic Assignment Help
Stochastic Assignment Help Stochastic Assignment Help
Stochastic Assignment Help
 

Similar to Linearity in the non-deterministic call-by-value setting

Parameterized curves in r^3
Parameterized curves in r^3Parameterized curves in r^3
Parameterized curves in r^3Tarun Gehlot
 
Linear Transformations, Matrix Algebra
Linear Transformations, Matrix AlgebraLinear Transformations, Matrix Algebra
Linear Transformations, Matrix AlgebraPrasanth George
 
Derivatives pricing
Derivatives pricingDerivatives pricing
Derivatives pricingIlya Gikhman
 
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
 
torsionbinormalnotes
torsionbinormalnotestorsionbinormalnotes
torsionbinormalnotesJeremy Lane
 
Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Sean Meyn
 
Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!A Jorge Garcia
 
Stochastic Control and Information Theoretic Dualities (Complete Version)
Stochastic Control and Information Theoretic Dualities (Complete Version)Stochastic Control and Information Theoretic Dualities (Complete Version)
Stochastic Control and Information Theoretic Dualities (Complete Version)Haruki Nishimura
 
linear transformation and rank nullity theorem
linear transformation and rank nullity theorem linear transformation and rank nullity theorem
linear transformation and rank nullity theorem Manthan Chavda
 
Mesh Processing Course : Active Contours
Mesh Processing Course : Active ContoursMesh Processing Course : Active Contours
Mesh Processing Course : Active ContoursGabriel Peyré
 
12.5. vector valued functions
12.5. vector valued functions12.5. vector valued functions
12.5. vector valued functionsmath267
 
conference_poster_5_UCSB
conference_poster_5_UCSBconference_poster_5_UCSB
conference_poster_5_UCSBXining Li
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Mel Anthony Pepito
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Matthew Leingang
 

Similar to Linearity in the non-deterministic call-by-value setting (20)

Parameterized curves in r^3
Parameterized curves in r^3Parameterized curves in r^3
Parameterized curves in r^3
 
Linear Transformations, Matrix Algebra
Linear Transformations, Matrix AlgebraLinear Transformations, Matrix Algebra
Linear Transformations, Matrix Algebra
 
Derivatives pricing
Derivatives pricingDerivatives pricing
Derivatives pricing
 
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
 
torsionbinormalnotes
torsionbinormalnotestorsionbinormalnotes
torsionbinormalnotes
 
Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009Markov Tutorial CDC Shanghai 2009
Markov Tutorial CDC Shanghai 2009
 
Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!Stuff You Must Know Cold for the AP Calculus BC Exam!
Stuff You Must Know Cold for the AP Calculus BC Exam!
 
Stochastic Control and Information Theoretic Dualities (Complete Version)
Stochastic Control and Information Theoretic Dualities (Complete Version)Stochastic Control and Information Theoretic Dualities (Complete Version)
Stochastic Control and Information Theoretic Dualities (Complete Version)
 
Test
TestTest
Test
 
linear transformation and rank nullity theorem
linear transformation and rank nullity theorem linear transformation and rank nullity theorem
linear transformation and rank nullity theorem
 
Mesh Processing Course : Active Contours
Mesh Processing Course : Active ContoursMesh Processing Course : Active Contours
Mesh Processing Course : Active Contours
 
12.5. vector valued functions
12.5. vector valued functions12.5. vector valued functions
12.5. vector valued functions
 
conference_poster_5_UCSB
conference_poster_5_UCSBconference_poster_5_UCSB
conference_poster_5_UCSB
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)
 
QMC: Operator Splitting Workshop, Thresholdings, Robustness, and Generalized ...
QMC: Operator Splitting Workshop, Thresholdings, Robustness, and Generalized ...QMC: Operator Splitting Workshop, Thresholdings, Robustness, and Generalized ...
QMC: Operator Splitting Workshop, Thresholdings, Robustness, and Generalized ...
 
Fourier series
Fourier seriesFourier series
Fourier series
 
Signal Processing Homework Help
Signal Processing Homework HelpSignal Processing Homework Help
Signal Processing Homework Help
 
smtlecture.5
smtlecture.5smtlecture.5
smtlecture.5
 

More from Alejandro Díaz-Caro

Typing quantum superpositions and measurement
Typing quantum superpositions and measurementTyping quantum superpositions and measurement
Typing quantum superpositions and measurementAlejandro Díaz-Caro
 
A lambda calculus for density matrices with classical and probabilistic controls
A lambda calculus for density matrices with classical and probabilistic controlsA lambda calculus for density matrices with classical and probabilistic controls
A lambda calculus for density matrices with classical and probabilistic controlsAlejandro 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
 
Affine computation and affine automaton
Affine computation and affine automatonAffine computation and affine automaton
Affine computation and affine automatonAlejandro 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
 
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
 
Vectorial types, non-determinism and probabilistic systems: Towards a computa...
Vectorial types, non-determinism and probabilistic systems: Towards a computa...Vectorial types, non-determinism and probabilistic systems: Towards a computa...
Vectorial types, non-determinism and probabilistic systems: Towards a computa...Alejandro 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
 
Non determinism through type isomophism
Non determinism through type isomophismNon determinism through type isomophism
Non determinism through type isomophismAlejandro 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
 
Equivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculiEquivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculiAlejandro Díaz-Caro
 

More from Alejandro Díaz-Caro (13)

Typing quantum superpositions and measurement
Typing quantum superpositions and measurementTyping quantum superpositions and measurement
Typing quantum superpositions and measurement
 
A lambda calculus for density matrices with classical and probabilistic controls
A lambda calculus for density matrices with classical and probabilistic controlsA lambda calculus for density matrices with classical and probabilistic controls
A lambda calculus for density matrices with classical and probabilistic controls
 
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
 
Affine computation and affine automaton
Affine computation and affine automatonAffine computation and affine automaton
Affine computation and affine automaton
 
Simply typed lambda-calculus modulo isomorphisms
Simply typed lambda-calculus modulo isomorphismsSimply typed lambda-calculus modulo isomorphisms
Simply typed lambda-calculus modulo isomorphisms
 
The probability of non-confluent systems
The probability of non-confluent systemsThe probability of non-confluent systems
The probability of non-confluent systems
 
Vectorial types, non-determinism and probabilistic systems: Towards a computa...
Vectorial types, non-determinism and probabilistic systems: Towards a computa...Vectorial types, non-determinism and probabilistic systems: Towards a computa...
Vectorial types, non-determinism and probabilistic systems: Towards a computa...
 
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...
 
Non determinism through type isomophism
Non determinism through type isomophismNon determinism through type isomophism
Non determinism through type isomophism
 
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
 
Slides QuAND 2011
Slides QuAND 2011Slides QuAND 2011
Slides QuAND 2011
 
Equivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculiEquivalence of algebraic λ-calculi
Equivalence of algebraic λ-calculi
 
A System F accounting for scalars
A System F accounting for scalarsA System F accounting for scalars
A System F accounting for scalars
 

Recently uploaded

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

Linearity in the non-deterministic call-by-value setting

  • 1. Linearity in the non-deterministic call-by-value setting Alejandro Díaz-Caro Barbara Petit LIPN, Université Paris 13, Sorbonne Paris Cité Focus (INRIA) – Università di Bologna 19th WoLLIC Buenos Aires, September 3–6, 2012
  • 2. Non-determinism (or parallelism) t + u: non-deterministic superposition between t and u (it may run t or u, non-deterministically) Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 1 / 20
  • 3. Non-determinism (or parallelism) t + u: non-deterministic superposition between t and u (it may run t or u, non-deterministically) (t + u)s may run ts or us. Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 1 / 20
  • 4. Non-determinism (or parallelism) t + u: non-deterministic superposition between t and u (it may run t or u, non-deterministically) (t + u)s may run ts or us. Hence (t + u)s → ts + us Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 1 / 20
  • 5. Non-determinism (or parallelism) t + u: non-deterministic superposition between t and u (it may run t or u, non-deterministically) (t + u)s may run ts or us. Hence (t + u)s → ts + us Sum of functions: (f + g)(x) = f(x) + g(x) (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek]) Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 1 / 20
  • 6. Non-determinism (or parallelism) t + u: non-deterministic superposition between t and u (it may run t or u, non-deterministically) (t + u)s may run ts or us. Hence (t + u)s → ts + us Sum of functions: (f + g)(x) = f(x) + g(x) (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek]) t(u + s) (λx.t)(u + s) → t[(u + s)/x] (CBN) (λx.t)(u + s) → (λx.t)u + (λx.t)s (CBV) Generically in CBV t(u + s) → tu + ts Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 1 / 20
  • 7. Non-determinism (or parallelism) t + u: non-deterministic superposition between t and u (it may run t or u, non-deterministically) (t + u)s may run ts or us. Hence (t + u)s → ts + us Sum of functions: (f + g)(x) = f(x) + g(x) (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek]) t(u + s) (λx.t)(u + s) → t[(u + s)/x] (CBN) (λx.t)(u + s) → (λx.t)u + (λx.t)s (CBV) Generically in CBV t(u + s) → tu + ts In algebraic terms, functions are treated as linear in CBV: f(x + y ) = f(x) + f(y ) Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 1 / 20
  • 8. Non-determinism (or parallelism) t + u: non-deterministic superposition between t and u (it may run t or u, non-deterministically) (t + u)s may run ts or us. Hence (t + u)s → ts + us Sum of functions: (f + g)(x) = f(x) + g(x) (this is the interpretation of the algebraic calculi [Vaux, Arrighi-Dowek]) t(u + s) (λx.t)(u + s) → t[(u + s)/x] (CBN) (λx.t)(u + s) → (λx.t)u + (λx.t)s (CBV) Generically in CBV t(u + s) → tu + ts In algebraic terms, functions are treated as linear in CBV: f(x + y ) = f(x) + f(y ) We want to understand this ‘linearity’ Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 1 / 20
  • 9. Outline The untyped calculus The Additive type system capturing the CBV behaviour of + Logical interpretation: translation into System F with pairs Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 2 / 20
  • 10. The untyped CBV non-deterministic λ-calculus t, u, s ::= v | tu | t + u | 0 v ::= x | λx.t Intuitions t + u = non-deterministic superposition between t and u 0 = impossible computation Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 3 / 20
  • 11. The untyped CBV non-deterministic λ-calculus t, u, s ::= v | tu | t + u | 0 v ::= x | λx.t Intuitions t + u = non-deterministic superposition between t and u 0 = impossible computation Hence, t + 0 → t because 0 is impossible! Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 3 / 20
  • 12. The untyped CBV non-deterministic λ-calculus t, u, s ::= v | tu | t + u | 0 v ::= x | λx.t Intuitions t + u = non-deterministic superposition between t and u 0 = impossible computation Hence, t + 0 → t because 0 is impossible! Also 0t → 0 t0 → 0 Because non of them reduces (0 not a value) and there is an impossible computation Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 3 / 20
  • 13. The untyped CBV non-deterministic λ-calculus t, u, s ::= v | tu | t + u | 0 v ::= x | λx.t Intuitions t + u = non-deterministic superposition between t and u 0 = impossible computation Hence, t + 0 → t because 0 is impossible! Also 0t → 0 t0 → 0 Because non of them reduces (0 not a value) and there is an impossible computation Running t or u non-deterministically, is the Finally t + u = u + t same as running u or t non-deterministically Also t + (u + s) = (t + u) + s Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 3 / 20
  • 14. The untyped CBV non-deterministic λ-calculus t, u, s ::= v | tu | t + u | 0 v ::= x | λx.t βv -reduction (λx.t)v → t[v/x] Distributivity rules Zero rules (t + u)s → ts + us t+0→t t(u + s) → tu + ts 0t → 0 t0 → 0 with + associative and commutative Remark: in the algebraic case, 0 is the sum of zero terms Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 3 / 20
  • 15. The Additive type system Objective: capture as much as possible the behaviour of + Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 4 / 20
  • 16. The Additive type system Objective: capture as much as possible the behaviour of + Γ t:T Γ s:S Γ t+s :T +S Γ 0:¯ 0 Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 4 / 20
  • 17. The Additive type system Objective: capture as much as possible the behaviour of + Γ t:T Γ s:S Γ t:T T ≡S Γ t+s :T +S Γ 0:¯ 0 Γ t:S T +R ≡ R +T ; T +(R +S) ≡ (T +R)+S ; T +¯ ≡ T 0 Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 4 / 20
  • 18. The Additive type system Objective: capture as much as possible the behaviour of + Γ t:T Γ s:S Γ t:T T ≡S Γ t+s :T +S Γ 0:¯ 0 Γ t:S T +R ≡ R +T ; T +(R +S) ≡ (T +R)+S ; T +¯ ≡ T 0 T → R: functions from T to R Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 4 / 20
  • 19. The Additive type system Objective: capture as much as possible the behaviour of + Γ t:T Γ s:S Γ t:T T ≡S Γ t+s :T +S Γ 0:¯ 0 Γ t:S T +R ≡ R +T ; T +(R +S) ≡ (T +R)+S ; T +¯ ≡ T 0 T → R: functions from T to R But (T + R) → S does not exists there is no function taking a non-deterministic superposition as argument Recall t(v1 + v2 ) → tv1 + tv2 If v1 : T and v2 : R then t needs to be both T → S1 and R → S2 Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 4 / 20
  • 20. The Additive type system Objective: capture as much as possible the behaviour of + Γ t:T Γ s:S Γ t:T T ≡S Γ t+s :T +S Γ 0:¯ 0 Γ t:S T +R ≡ R +T ; T +(R +S) ≡ (T +R)+S ; T +¯ ≡ T 0 T → R: functions from T to R But (T + R) → S does not exists there is no function taking a non-deterministic superposition as argument Recall t(v1 + v2 ) → tv1 + tv2 If v1 : T and v2 : R then t needs to be both T → S1 and R → S2 Polymorphism & unit types “U” (atomic types w.r.t. +) Arrows: U → T Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 4 / 20
  • 21. The Additive type system (cont.) Examples Concrete example v1 : U1 ; v2 : U2 ; I : ∀X .X → X Hence I (v1 + v2 ) → I v1 + I v2 has type U1 + U2 A more generic example v1 : U[W1 /X ] ; v2 : U[W2 /X ] ; t : ∀X .U → T Hence t(v1 + v2 ) → tv1 + tv2 has type T [W1 /X ] + T [W2 /X ] Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 5 / 20
  • 22. The Additive type system (cont.) Examples Concrete example v1 : U1 ; v2 : U2 ; I : ∀X .X → X Hence I (v1 + v2 ) → I v1 + I v2 has type U1 + U2 A more generic example v1 : U[W1 /X ] ; v2 : U[W2 /X ] ; t : ∀X .U → T Hence t(v1 + v2 ) → tv1 + tv2 has type T [W1 /X ] + T [W2 /X ] Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 5 / 20
  • 23. The Additive type system (cont.) Examples Γ t : ∀X .U → T Γ v1 + v2 : U[W1 /X ] + U[W2 /X ] Γ t(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] A more generic example v1 : U[W1 /X ] ; v2 : U[W2 /X ] ; t : ∀X .U → T Hence t(v1 + v2 ) → tv1 + tv2 has type T [W1 /X ] + T [W2 /X ] Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 5 / 20
  • 24. The Additive type system (cont.) Examples t:U→T ; u:V →R (t + u)v → tv + uv Hence U and V needs to “polymorph” to the type of v v : U[W1 /X ] = V [W2 /X ] t : ∀X .(U → T ) u : ∀X .(V → R) Hence tv + uv has type T [W1 /X ] + R[W2 /X ] Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 6 / 20
  • 25. The Additive type system (cont.) Examples t:U→T ; u:V →R (t + u)v → tv + uv Hence U and V needs to “polymorph” to the type of v v : U[W1 /X ] = V [W2 /X ] t : ∀X .(U → T ) u : ∀X .(V → R) Hence tv + uv has type T [W1 /X ] + R[W2 /X ] Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 6 / 20
  • 26. The Additive type system (cont.) Examples t:U→T ; u:V →R (t + u)v → tv + uv Hence U and V needs to “polymorph” to the type of v v : U[W1 /X ] = V [W2 /X ] t : ∀X .(U → T ) u : ∀X .(V → R) Hence tv + uv has type T [W1 /X ] + R[W2 /X ] Γ t + u : ∀X .(U → T ) + ∀X .(V → R) Γ v : U[W1 /X ] = V [W2 /X ] Γ (t + u)v : T [W1 /X ] + R[W2 /X ] Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 6 / 20
  • 27. The Additive type system (cont.) Arrow elimination Γ t : ∀X .U → T Γ v1 + v2 : U[W1 /X ] + U[W2 /X ] Γ t(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] Γ t + u : ∀X .(U → T ) + ∀X .(V → R) Γ v : U[W1 /X ] = V [W2 /X ] Γ (t + u)v : T [W1 /X ] + R[W2 /X ] combined... Γ t + u : ∀X .(U → T ) + ∀X .(U → R) Γ v1 + v2 : U[W1 /X ] + U[W2 /X ] Γ (t + u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ] Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 7 / 20
  • 28. The Additive type system (cont.) Arrow elimination Γ t : ∀X .U → T Γ v1 + v2 : U[W1 /X ] + U[W2 /X ] Γ t(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] Γ t + u : ∀X .(U → T ) + ∀X .(V → R) Γ v : U[W1 /X ] = V [W2 /X ] Γ (t + u)v : T [W1 /X ] + R[W2 /X ] combined... Γ t + u : ∀X .(U → T ) + ∀X .(U → R) Γ v1 + v2 : U[W1 /X ] + U[W2 /X ] Γ (t + u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ] generalising... n m Γ t: ∀X .(U → Ti ) Γ u: U[Wj /X ] i=1 j=1 n m Γ tu : Ti [Wj /X ] i=1 j=1 Alejandro Díaz-Caro & Barbara Petit Linearity in the non-deterministic call-by-value setting 7 / 20
  • 29. The Additive type system (cont.) Examples V1 = U[W1 /X ] ; V2 = U[W2 /X ] Γ λx.t + λy .u : ∀X .(U → T ) + ∀X .(U → R) Γ v1 + v2 : V1 + V2 Γ (λx.t + λy .u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ] (λx.t)v1 + (λx.t)v2 + (λy .u)v1 + (λy .u)v2 T [W1 /X ] T [W2 /X ] R[W1 /X ] R[W2 /X ] Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 8 / 20
  • 30. The Additive type system (cont.) Examples V1 = U[W1 /X ] ; V2 = U[W2 /X ] Γ λx.t + λy .u : ∀X .(U → T ) + ∀X .(U → R) Γ v1 + v2 : V1 + V2 Γ (λx.t + λy .u)(v1 + v2 ) : T [W1 /X ] + T [W2 /X ] + R[W1 /X ] + R[W2 /X ] (λx.t)v1 + (λx.t)v2 + (λy .u)v1 + (λy .u)v2 T [W1 /X ] T [W2 /X ] R[W1 /X ] R[W2 /X ] Simpler example Γ λx.x : ∀X .X → X Γ v1 + v2 : U + V Γ (λx.x)(v1 + v2 ) : U + V without simultaneous arrow/forall elimination it is not possible to type it! Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 8 / 20
  • 31. The Additive type system (cont.) Summarising T , R, S := U | T + R | ¯ 0 general types U, V , W := X | U → T | ∀X .U unit types T +¯ ≡ T 0 ; T +R ≡ R +T ; T +(R +S) ≡ (T +R)+S ax Γ t:T Γ u:R ax¯ 0 +I Γ, x : U x :U Γ 0:¯ 0 Γ t+u:T +R n m Γ t: ∀X .(U → Ti ) Γ u: U[Wj /X ] i=1 j=1 Γ, x : U t:T →E →I n m Γ λx.t : U → T Γ tu : Ti [Wj /X ] i=1 j=1 Γ t : ∀X .U Γ t:U X ∈ FV (Γ) / Γ t:T T ≡R ∀E ∀I ≡ Γ t : U[V /X ] Γ t : ∀X .U Γ t:R • Strong normalisation • Subject reduction Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 9 / 20
  • 32. Outline The untyped calculus The Additive type system capturing the CBV behaviour of + Logical interpretation: translation into System F with pairs Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 10 / 20
  • 33. System F with pairs t, u ::= x | λx.t | tu | | t, u | π1 (t) | π2 (t) A, B ::= X | A ⇒ B | ∀X .A | 1 | A × B (λx.t)u → t[u/x] π1 ( t1 , t2 ) → t1 π2 ( t1 , t2 ) → t2 Additive System F with pairs X X U→T |U| ⇒ |T | ∀X .U ∀X .|U| ¯ 0 1 T +S |T | × |S| Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 11 / 20
  • 34. Sums as Pairs +, ¯ 0 ×, 1 T +S ≡ S +T A×B = B ×A T + (S + R) ≡ (T + S) + R A × (B × C ) = (A × B) × C T +¯ ≡ T 0 A×1 = A Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 12 / 20
  • 35. Sums as Pairs +, ¯ 0 ×, 1 T +S ≡ S +T A×B = B ×A T + (S + R) ≡ (T + S) + R A × (B × C ) = (A × B) × C T +¯ ≡ T 0 A×1 = A T , R, S ::= U | T + R | ¯ 0 U, V , W ::= X | U → T | ∀X .U Type Binary tree (leaf: U or ¯ 0) Example: T = (U1 + U2 ) + ¯ 0 ¯ 0 T [r → ¯ lr → U2 , ll → U1 ] 0, U1 U2 We keep structured sum types Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 12 / 20
  • 36. Structured Arrow-elimination n m Γ t: ∀X .(U → Ti ) Γ u: U[Wj /X ] i=1 j=1 n m Γ tu : Ti [Wj /X ] i=1 j=1 Γ t : T [ → ∀X .(U → T )] Γ u : T [ → U[W /X ]] Γ tu : T ◦ T [ → T [W /X ]] tu: t: u: U[W1 /X ] U[W2 /X ] ∀X .U→T1 ∀X .U→T2 T1 [W1 /X ] T1 [W2 /X ] T2 [W1 /X ] T2 [W2 /X ] Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 13 / 20
  • 37. Structured Arrow-elimination An example t = (t1 + t2 ) + 0 tu →∗ t1 u1 + (u2 + u3 ) + t2 u1 + (u2 + u3 ) + 0 →∗ t1 u1 + (t1 u2 + t1 u3 )+ t2 u1 + (t2 u2 + t2 u3 ) + 0 ¯ 0 U → T1 U → T2 ¯ 0 u = u1 + (u2 + u3 ) U T1 T2 U U T1 T1 T2 T2 Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 14 / 20
  • 38. Equivalence in System F What about associativity, commutativity and neutral element in system F with pairs? Lemma T ≡T implies |T | ↔ |T | Where A ↔ B means F εA,B : A ⇒ B and F εB,A : B ⇒ A for some terms εA,B , εB,A s.t. εA,B ◦ εB,A ≈ idA and εB,A ◦ εA,B ≈ idB Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 15 / 20
  • 39. Translation of terms What happens with the distributivity? t+u [t], [u] (t1 + t2 )(u1 + u2 ) →∗ but t1 , t2 r1 , r2 t1 u1 + t1 u2 + t2 u1 + t2 u2 t1 r1 , t1 r2 , t2 r1 , t2 r2 No distributivity in System F with pairs Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 16 / 20
  • 40. Translation of terms What happens with the distributivity? t+u [t], [u] (t1 + t2 )(u1 + u2 ) →∗ but t1 , t2 r1 , r2 t1 u1 + t1 u2 + t2 u1 + t2 u2 t1 r1 , t1 r2 , t2 r1 , t2 r2 No distributivity in System F with pairs Main ideas: The sum is distributed during the translation of application [tr] = [t1 ][u1 ], [t1 ][u2 ] , [t2 ][u1 ], [t2 ][u2 ] if t = t1 + t2 and u = u1 + u2 Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 16 / 20
  • 41. Translation of terms What happens with the distributivity? t+u [t], [u] (t1 + t2 )(u1 + u2 ) →∗ but t1 , t2 r1 , r2 t1 u1 + t1 u2 + t2 u1 + t2 u2 t1 r1 , t1 r2 , t2 r1 , t2 r2 No distributivity in System F with pairs Main ideas: The sum is distributed during the translation of application [tr] = [t1 ][u1 ], [t1 ][u2 ] , [t2 ][u1 ], [t2 ][u2 ] if t = t1 + t2 and u = u1 + u2 The “sum structure” of a term is known thanks to its type Γ t : (T1 + T2 ) + T3 t ∼ (t1 + t2 ) + t3 with Γ ti : Ti Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 16 / 20
  • 42. Translation of terms Γ t:T |Γ| F [t]D : |T | Γ, x : T x : T [x]D = x Γ 0:¯0 [0]D = Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 17 / 20
  • 43. Translation of terms Γ t:T |Γ| F [t]D : |T | Γ, x : T x : T [x]D = x Γ 0:¯0 [0]D = Γ t:T T ≡T [t]D = ε|T |,|T | [t]D Γ t:T Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 17 / 20
  • 44. Translation of terms Γ t:T |Γ| F [t]D : |T | Γ, x : T x : T [x]D = x Γ 0:¯0 [0]D = Γ t:T T ≡T [t]D = ε|T |,|T | [t]D Γ t:T Γ t:T Γ u:S [t+r]D = [t]D1 , [u]D2 Γ t+u:T +S Γ, x : U t : T [λx.t]D = λx.[t]D Γ λx.t : U → T Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 17 / 20
  • 45. Translation of terms Γ t:T |Γ| F [t]D : |T | Γ, x : T x : T [x]D = x Γ 0:¯0 [0]D = Γ t:T T ≡T [t]D = ε|T |,|T | [t]D Γ t:T Γ t:T Γ u:S [t+r]D = [t]D1 , [u]D2 Γ t+u:T +S Γ, x : U t : T [λx.t]D = λx.[t]D Γ λx.t : U → T Γ t : T [ →∀X .(U→T )] Γ u : T [ →U[W /X ]] Γ tu : T ◦ T [ →T [W /X ]] [tu]D = T ◦ T [ →π ([t]D1 )π ([u]D2 )] Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 17 / 20
  • 46. Translation of terms An example Γ t : (U → T1 ) + (U → T2 ) + (U → T3 ) Γ u:U +U Γ tu : (T1 + T1 ) + (T2 + T2 ) + (T3 + T3 ) t1 =π11 ([t]);t2 =π12 ([t]);t3 =π2 ([t]); r1 =π1 ([u]);r2 =π2 ([u]); tu : [tu]D = T3 T3 T1 T1T2 T2 t3 r1 t3 r2 t1 r1 t1 r2 t2 r1 t2 r2 Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 18 / 20
  • 47. Correctness Theorem (Correctness w.r.t. typing) Γ t:T implies |Γ| F [t]D : |T | We provide a partial inverse translation (| · |) and prove Theorem (Inverse translation) Γ t:T = (||Γ||) F (|[t]D |) : (||T ||) Theorem (Reduction preservation) Γ t : T and t → t implies [t]D →+ [t ]D for some D (except for t + 0 → t) Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 19 / 20
  • 48. Summarising and concluding + “like linear functions”: f(x + y ) = f(x) + f(y ) Additive type system tight to the behaviour of + Typed system translate to System F with pairs Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 20 / 20
  • 49. Summarising and concluding + “like linear functions”: f(x + y ) = f(x) + f(y ) Additive type system tight to the behaviour of + Typed system translate to System F with pairs System F with pairs correspond to the non-linear fragment of IMELL Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 20 / 20
  • 50. Summarising and concluding + “like linear functions”: f(x + y ) = f(x) + f(y ) Additive type system tight to the behaviour of + Typed system translate to System F with pairs System F with pairs correspond to the non-linear fragment of IMELL Linear Logic CBV nd/alg Force unique use of the argument Ban sum terms substitutions e.g. e.g. f(x) = x 2 no linear f(x + y ) → f(x) + f(y ) f(x) = x + 1 linear In the CBV non-deterministic setting (or algebraic) it is enough to treat functions as linear, even if they are not. (In LL all functions are linear). Alejandro Díaz-Caro Barbara Petit Linearity in the non-deterministic call-by-value setting 20 / 20