SlideShare a Scribd company logo
1 of 101
Download to read offline
A System F accounting for scalars
            arXiv:0903.3741          



 Pablo Arrighi and Alejandro Díaz-Caro


             Université de Grenoble

     Laboratoire d'Informatique de Grenoble




    November 19th, 2009. PPS (Paris)
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                    Conclusions and future work




Global context

                                                                                                                    1
                     Oddity of Quantum theory                    =⇒          Quantum Logic?                             (developed
                     ad hoc             before quantum computing, no clear relation with
                     quantum programs).




            Birkho, G. and J. von Neumann, The logic of quantum mechanics,
                1


         Annals of Mathematics 37 (1936), pp. 823843.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                             2/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                    Conclusions and future work




Global context

                                                                                                                    1
                     Oddity of Quantum theory                    =⇒          Quantum Logic?                             (developed
                     ad hoc             before quantum computing, no clear relation with
                     quantum programs).

                     Models of Linear Logics                 =⇒       Quantum Theory? (Coherent
                     spaces, Micromechanics loses duplicability.)




            Birkho, G. and J. von Neumann, The logic of quantum mechanics,
                1


         Annals of Mathematics 37 (1936), pp. 823843.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                             2/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                    Conclusions and future work




Global context

                                                                                                                    1
                     Oddity of Quantum theory                    =⇒          Quantum Logic?                             (developed
                     ad hoc             before quantum computing, no clear relation with
                     quantum programs).

                     Models of Linear Logics                 =⇒       Quantum Theory? (Coherent
                     spaces, Micromechanics loses duplicability.)

                     Curry-Howard : (programs,types)=⇒(proofs,logics).
                     Quantum Computation : (quantum programs, quantum
                     types).
                     CH+QC : (quantum th. proofs, quantum th. logics)?
                     Quantum logics : isolating the reasoning behind quantum
                     algorithms?




            Birkho, G. and J. von Neumann, The logic of quantum mechanics,
                1


         Annals of Mathematics 37 (1936), pp. 823843.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                             2/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                    Conclusions and future work




Global context

                                                                                                                    1
                     Oddity of Quantum theory                    =⇒          Quantum Logic?                             (developed
                     ad hoc             before quantum computing, no clear relation with
                     quantum programs).

                     Models of Linear Logics                 =⇒       Quantum Theory? (Coherent
                     spaces, Micromechanics loses duplicability.)

                     Curry-Howard : (programs,types)=⇒(proofs,logics).
                     Quantum Computation : (quantum programs, quantum
                     types).
                     CH+QC : (quantum th. proofs, quantum th. logics)?
                     Quantum logics : isolating the reasoning behind quantum
                     algorithms?


                                                  What are quantum types?
            Birkho, G. and J. von Neumann, The logic of quantum mechanics,
                1


         Annals of Mathematics 37 (1936), pp. 823843.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                             2/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Quantum theory




                     States are (normalized) vectors                        v.
                     Vector space of o.n.b.               (bi ).     Then          v=               i αi bi .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         3/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Quantum theory




                     States are (normalized) vectors                        v.
                     Vector space of o.n.b.               (bi ).     Then          v=               i αi bi .
                     Evolutions are (unitary) linear operators U .
                     v = U v.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         3/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Quantum theory




                     States are (normalized) vectors                        v.
                     Vector space of o.n.b.               (bi ).     Then          v=               i αi bi .
                     Evolutions are (unitary) linear operators U .
                     v = U v.
                     Systems are put next to one another with                                          ⊗.
                     Bilinear just like application :
                     u + v ⊗ w = u ⊗ w + v ⊗ w,
                     u ⊗ v + w = u ⊗ v + u ⊗ w, . . .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         3/31
Motivation               Linear-Algebraic    λ-Calculus      System F            The scalar type system                Conclusions and future work




Quantum theory




                     States are (normalized) vectors                           v.
                     Vector space of o.n.b.                   (bi ).    Then          v=               i αi bi .
                     Evolutions are (unitary) linear operators U .
                     v = U v.
                     Systems are put next to one another with                                             ⊗.
                     Bilinear just like application :
                     u + v ⊗ w = u ⊗ w + v ⊗ w,
                     u ⊗ v + w = u ⊗ v + u ⊗ w, . . .
                                                          No-cloning theorem!



Pablo Arrighi and Alejandro Díaz-Caro, LIG                        A System F accounting for scalars, arXiv:0903.3741                         3/31
Motivation               Linear-Algebraic    λ-Calculus        System F                  The scalar type system              Conclusions and future work




No-cloning theorem


         Statement:                     ∃U   /   ∀v   : U    v = v ⊗ v.
         Proof:
         Vector space of o.n.b.                           (bi ),   so   v=                 αi bi .       We can have
                                                                                     i
         U   bi = bi ⊗ bi                                                                                                (=copying, OK)
         But then

              U    v =               αi bi = αi U bi
                                     U
                                  i          i
                           =      αi bi ⊗ bi = αi αj bi ⊗ bj
                              i                 ij
                           = ( αi bi ) ⊗ ( αj bj )
                                i             j
                           = v⊗v                                                                       (=cloning, Not OK)




Pablo Arrighi and Alejandro Díaz-Caro, LIG                              A System F accounting for scalars, arXiv:0903.3741                         4/31
Motivation               Linear-Algebraic    λ-Calculus        System F                  The scalar type system              Conclusions and future work




No-cloning theorem


         Statement:                     ∃U   /   ∀v   : U    v = v ⊗ v.
         Proof:
         Vector space of o.n.b.                           (bi ),   so   v=                 αi bi .       We can have
                                                                                     i
         U   bi = bi ⊗ bi                                                                                                (=copying, OK)
         But then

              U    v =               αi bi = αi U bi
                                     U
                                  i          i
                           =      αi bi ⊗ bi = αi αj bi ⊗ bj
                              i                 ij
                           = ( αi bi ) ⊗ ( αj bj )
                                i             j
                           = v⊗v                                                                       (=cloning, Not OK)

                                                 Conicts with β -reduction?

Pablo Arrighi and Alejandro Díaz-Caro, LIG                              A System F accounting for scalars, arXiv:0903.3741                         4/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic                              λ-Calculus2
The language


    Higher-order computation
    t ::= x | λx .t | (t t)  |




             Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order,
                2


         encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
         (2008), pp. 1731.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         5/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic                              λ-Calculus2
The language


    Higher-order computation                                              Linear algebra
    t ::= x | λx .t | (t t)  |                                            t + t | α.t | 0




             Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order,
                2


         encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
         (2008), pp. 1731.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         5/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic                              λ-Calculus2
The language


    Higher-order computation                                              Linear algebra
    t ::= x | λx .t | (t t)  |                                            t + t | α.t | 0
               λx .t b → t[b/x ] (∗)
    (*)      b an abstraction or a
    variable.




             Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order,
                2


         encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
         (2008), pp. 1731.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         5/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic                              λ-Calculus2
The language


    Higher-order computation                                              Linear algebra
    t ::= x | λx .t | (t t)  |                                            t + t | α.t | 0
               λx .t b → t[b/x ] (∗)                                                  Elementary rules such as

    (*)      b an abstraction or a                                                    u + 0 → u and
                                                                                      α.(u + v) → α.u + α.v.
    variable.
                                                                                      Factorisation rules such as
    (**) u closed normal.                                                             α.u + β.u → (α + β).u.                        (**)
    (***) u and u + v closed normal.
                                                                                      Application rules such as
                                                                                      u (v + w) → (u v) + (u w).
                                                                                      (***)


             Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order,
                2


         encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
         (2008), pp. 1731.
Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         5/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Copying vs Cloning



         Untyped                λ-calculus        + linear algebra          ⇒       Cloning?




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         6/31
Motivation               Linear-Algebraic        λ-Calculus   System F                The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Copying vs Cloning



         Untyped                λ-calculus            + linear algebra              ⇒       Cloning?




                                             λx .(x ⊗ x )              αi bi →∗                      αi bi ⊗ bi
                                                               i                               i
                                             ↓
                                             (       αi bi ) ⊗ (         αi bi )
                                                 i                 i




Pablo Arrighi and Alejandro Díaz-Caro, LIG                             A System F accounting for scalars, arXiv:0903.3741                         6/31
Motivation               Linear-Algebraic        λ-Calculus    System F                The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Copying vs Cloning



         Untyped                λ-calculus            + linear algebra               ⇒       Cloning?




                                             λx .(x ⊗ x )               αi bi →∗                      αi bi ⊗ bi
                                                                i                               i
                                             ↓
                                             (        αi bi ) ⊗ (         αi bi )
                                                  i                 i
         No-cloning says bottom reduction forbidden. We must delay beta
         reduction till after linearity. So restrict beta reduction to                                                          base
         vectors → i.e.                          abstractions or variables.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                              A System F accounting for scalars, arXiv:0903.3741                         6/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Innities


         Untyped                λ-calculus        + linear algebra          ⇒∞




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         7/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Innities


         Untyped                λ-calculus         + linear algebra          ⇒∞

                                             Yb ≡ λx .(b + (x x )) λx .(b + (x x ))
                                                           Yb → b + Yb




Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         7/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Innities


         Untyped                λ-calculus         + linear algebra          ⇒∞

                                             Yb ≡ λx .(b + (x x )) λx .(b + (x x ))
                                                           Yb → b + Yb
         But whoever says innity says trouble says. . .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         7/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Innities


         Untyped                λ-calculus         + linear algebra          ⇒∞

                                             Yb ≡ λx .(b + (x x )) λx .(b + (x x ))
                                                           Yb → b + Yb
         But whoever says innity says trouble says. . . indenite forms.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         7/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Innities


         Untyped                λ-calculus          + linear algebra         ⇒∞

                                             Yb ≡ λx .(b + (x x )) λx .(b + (x x ))
                                                           Yb → b + Yb
         But whoever says innity says trouble says. . . indenite forms.




                                                Yb − Yb → b + Yb − Yb → b
                                                 ↓∗
                                                0



Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         7/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




Linear-Algebraic λ-Calculus
Why the restrictions : Innities


         Untyped                λ-calculus          + linear algebra         ⇒∞

                                             Yb ≡ λx .(b + (x x )) λx .(b + (x x ))
                                                           Yb → b + Yb
         But whoever says innity says trouble says. . . indenite forms.




                                                Yb − Yb → b + Yb − Yb → b
                                                 ↓∗
                                                0
         High school teacher says we must restrict factorization rules to
         nite vectors → i.e.                          closed-normal forms.


Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         7/31
Motivation               Linear-Algebraic     λ-Calculus       System F            The scalar type system                    Conclusions and future work




System F
Straightforward extension of System F (λ2la )




         System F rules plus simple rules to type algebraic terms


                                        ax0
                                                    Γ      u: A           Γ         v: A                                 Γ    t: A
                                                                                                +I                                     αI
                 Γ         0: A                            Γ      u + v: A                                         Γ         α.t : A




Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                             8/31
Motivation               Linear-Algebraic      λ-Calculus       System F            The scalar type system                    Conclusions and future work




System F
Straightforward extension of System F (λ2la )




         System F rules plus simple rules to type algebraic terms


                                        ax0
                                                     Γ      u: A           Γ         v: A                                 Γ    t: A
                                                                                                 +I                                     αI
                 Γ         0: A                             Γ      u + v: A                                         Γ         α.t : A

         Theorem (Strong normalization)
         Γ         t: T        ⇒t            is strongly normalising.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                             8/31
Motivation               Linear-Algebraic      λ-Calculus       System F            The scalar type system                    Conclusions and future work




System F
Straightforward extension of System F (λ2la )




         System F rules plus simple rules to type algebraic terms


                                        ax0
                                                     Γ      u: A           Γ         v: A                                 Γ    t: A
                                                                                                 +I                                     αI
                 Γ         0: A                             Γ      u + v: A                                         Γ         α.t : A

         Theorem (Strong normalization)
         Γ         t: T        ⇒t            is strongly normalising.


         Proof.              Sketch: We extend the notion of saturated sets.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                             8/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la

                     SN :        Set of strongly normalising terms




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         9/31
Motivation               Linear-Algebraic     λ-Calculus       System F             The scalar type system               Conclusions and future work




System F
Strong normalization of λ2la

                     SN :        Set of strongly normalising terms
                     A subset X               ∈ SN         is saturated if
                          1     ∀n ≥ 0, (((x t1 ) . . . ) tn ) ∈ X where ti ∈ SN ;
                                        →
                                        −                        →
                                                                 −
                          2     v[b/x ] t ∈ X ⇒ (λx v) b t ∈ X ;
                          3     t, u ∈ X ⇒ t + u ∈ X ;
                          4     ∀α, t ∈ X ⇒ α.t ∈ X ;
                          5     ∀i ∈ I , ((ui w1 ) . . . wn ) ∈ X ⇒                                      u   i    w1 . . . w ∈ X ;
                                                                                                                                n
                                                                                                i   ∈I

                          6     ∀i ∈ I , (u wi ) ∈ X ⇒ u                            w i      ∈ X;
                                                                           i   ∈I
                          7     α.((t1 t2 ) . . . tn ) ∈ X ⇔ ((t1 t2 ) . . . α.tk ) . . . tn ∈ X (1 ≤ k ≤ n);
                          8     0 ∈ X;
                                 →
                                 −                 →
                                                   −
                          9     ∀ t ∈ SN , (0 t ) ∈ X ;
                         10
                                   → ∈ SN , (t 0) → ∈ X .
                                   −
                                ∀t, u                    −u
                                       X     stable by construction and anti-reduction



Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         9/31
Motivation               Linear-Algebraic     λ-Calculus       System F             The scalar type system               Conclusions and future work




System F
Strong normalization of λ2la

                     SN :        Set of strongly normalising terms
                     A subset X               ∈ SN         is saturated if
                          1     ∀n ≥ 0, (((x t1 ) . . . ) tn ) ∈ X where ti ∈ SN ;
                                        →
                                        −                        →
                                                                 −
                          2     v[b/x ] t ∈ X ⇒ (λx v) b t ∈ X ;
                          3     t, u ∈ X ⇒ t + u ∈ X ;
                          4     ∀α, t ∈ X ⇒ α.t ∈ X ;
                          5     ∀i ∈ I , ((ui w1 ) . . . wn ) ∈ X ⇒                                      u   i    w1 . . . w ∈ X ;
                                                                                                                                n
                                                                                                i   ∈I

                          6     ∀i ∈ I , (u wi ) ∈ X ⇒ u                            w i      ∈ X;
                                                                           i   ∈I
                          7     α.((t1 t2 ) . . . tn ) ∈ X ⇔ ((t1 t2 ) . . . α.tk ) . . . tn ∈ X (1 ≤ k ≤ n);
                          8     0 ∈ X;
                                 →
                                 −                 →
                                                   −
                          9     ∀ t ∈ SN , (0 t ) ∈ X ;
                         10
                                   → ∈ SN , (t 0) → ∈ X .
                                   −
                                ∀t, u                    −u
                                       X     stable by construction and anti-reduction

                     SAT          is the set of all saturated sets
Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         9/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (II)




         Rening the sketch:

                     The idea is that types correspond to saturated sets.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         10/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (II)




         Rening the sketch:

                     The idea is that types correspond to saturated sets.

                     This correspondance is achived by a maping from types to
                     SAT .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         10/31
Motivation               Linear-Algebraic    λ-Calculus        System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (III)


         Lemma
              1      SN       ∈ SAT ,
              2      A B ,       ∈ SAT ⇒ A → B ∈ SAT ,
              3      For all collection A                 i   of members of SAT ,
                                                                                                                i Ai ∈ SAT ,




Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         11/31
Motivation               Linear-Algebraic    λ-Calculus        System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (III)


         Lemma
              1      SN       ∈ SAT ,
              2      A B ,       ∈ SAT ⇒ A → B ∈ SAT ,
              3      For all collection A                 i   of members of SAT ,
                                                                                                                i Ai ∈ SAT ,

         Denition (Mapping)
                     [[X ]]ξ = ξ(X )                      (where    ξ(·) : TVar → SAT )
                     [[A → B ]]ξ = [[A]]ξ → [[B ]]ξ
                     [[∀X .T ]]ξ =              Y ∈SAT [[T ]]ξ(X :=Y )




Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         11/31
Motivation               Linear-Algebraic    λ-Calculus        System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (III)


         Lemma
              1      SN       ∈ SAT ,
              2      A B ,       ∈ SAT ⇒ A → B ∈ SAT ,
              3      For all collection A                 i   of members of SAT ,
                                                                                                                i Ai ∈ SAT ,

         Denition (Mapping)
                     [[X ]]ξ = ξ(X )                      (where    ξ(·) : TVar → SAT )
                     [[A → B ]]ξ = [[A]]ξ → [[B ]]ξ
                     [[∀X .T ]]ξ =              Y ∈SAT [[T ]]ξ(X :=Y )

         Lemma
         Given a valuation                     ξ , [[T ]]ξ ∈ SAT

Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         11/31
Motivation               Linear-Algebraic     λ-Calculus      System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (IV)




         Denition ( )
         For       Γ = x1 : A1 , . . . , xn : An , Γ                 t: T        means that                    ∀ξ ,

                                             x1   ∈ [[A1 ]]ξ , . . . xn ∈ [[An ]]ξ ⇒ t ∈ [[T ]]ξ




Pablo Arrighi and Alejandro Díaz-Caro, LIG                         A System F accounting for scalars, arXiv:0903.3741                         12/31
Motivation               Linear-Algebraic     λ-Calculus      System F            The scalar type system                  Conclusions and future work




System F
Strong normalization of λ2la (IV)




         Denition ( )
         For       Γ = x1 : A1 , . . . , xn : An , Γ                 t: T        means that                    ∀ξ ,

                                             x1   ∈ [[A1 ]]ξ , . . . xn ∈ [[An ]]ξ ⇒ t ∈ [[T ]]ξ

         Rening the sketch: Prove that                               Γ         t: T ⇒ Γ t: T
         We prove this by induction on the derivation of                                                      Γ         t: T   (In fact
         the denition of                           is slightly dierent to strengthen the induction
         hypothesis)




Pablo Arrighi and Alejandro Díaz-Caro, LIG                         A System F accounting for scalars, arXiv:0903.3741                           12/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (V)




         Then, the proof of the strong normalisation theorem is:

         Let       Γ         t: T




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         13/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (V)




         Then, the proof of the strong normalisation theorem is:

         Let Γ t: T
         ⇒ Γ t: T




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         13/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (V)




         Then, the proof of the strong normalisation theorem is:

         Let Γ  t: T
         ⇒ Γ t: T
         ⇒ If ∀(xi : Ai ) ∈ Γ, xi ∈ [[Ai ]]ξ                   then        t ∈ [[T ]]ξ




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         13/31
Motivation               Linear-Algebraic    λ-Calculus       System F              The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (V)




         Then, the proof of the strong normalisation theorem is:

         Let Γ  t: T
         ⇒ Γ t: T
         ⇒ If ∀(xi : Ai ) ∈ Γ, xi ∈ [[Ai ]]ξ                         then        t ∈ [[T ]]ξ
         Note that

                     x i ∈ [[Ai ]]ξ          because      [[Ai ]]ξ   is saturated,




Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                         13/31
Motivation               Linear-Algebraic    λ-Calculus       System F              The scalar type system                Conclusions and future work




System F
Strong normalization of λ2la (V)




         Then, the proof of the strong normalisation theorem is:

         Let Γ  t: T
         ⇒ Γ t: T
         ⇒ If ∀(xi : Ai ) ∈ Γ, xi ∈ [[Ai ]]ξ                         then        t ∈ [[T ]]ξ
         Note that

                     x i ∈ [[Ai ]]ξ          because      [[Ai ]]ξ   is saturated,

                     then        t is strong normalising because [[T ]]ξ ⊆ SN




Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                         13/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Linear-Algebraic λ-Calculus with λ2la



    Higher-order computation                                              Linear algebra
    t ::= x | λx .t | (t t)  |                                            t + t | α.t | 0
               λx .t b → t[b/x ] (∗)                                                  Elementary rules such as

    (*)      b an abstraction or a variable.                                          u + 0 → u and
                                                                                      α.(u + v) → α.u + α.v.
                                                                                      Factorisation rules such as
                                                                                      α.u + β.u → (α + β).u.
                                                                                      Application rules such as
                                                                                      u (v + w) → (u v) + (u w).




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         14/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Linear-Algebraic λ-Calculus with λ2la



    Higher-order computation                                              Linear algebra
    t ::= x | λx .t | (t t)  |                                            t + t | α.t | 0
               λx .t b → t[b/x ] (∗)                                                  Elementary rules such as

    (*)      b an abstraction or a variable.                                          u + 0 → u and
                                                                                      α.(u + v) → α.u + α.v.
    Every typable term is strong
    normalizing                                                                       Factorisation rules such as
                                                                                      α.u + β.u → (α + β).u.
                                                                                      Application rules such as
                                                                                      u (v + w) → (u v) + (u w).




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         14/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Linear-Algebraic λ-Calculus with λ2la



    Higher-order computation                                              Linear algebra
    t ::= x | λx .t | (t t)  |                                            t + t | α.t | 0
               λx .t b → t[b/x ] (∗)                                                  Elementary rules such as

    (*)      b an abstraction or a variable.                                          u + 0 → u and
                                                                                      α.(u + v) → α.u + α.v.
    Every typable term is strong
    normalizing                                                                       Factorisation rules such as

    Hence            Yb is no typable!                                                α.u + β.u → (α + β).u.
                                                                                      Application rules such as
                                                                                      u (v + w) → (u v) + (u w).




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         14/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




System F
Linear-Algebraic λ-Calculus with λ2la



    Higher-order computation                                              Linear algebra
    t ::= x | λx .t | (t t)  |                                            t + t | α.t | 0
               λx .t b → t[b/x ] (∗)                                                  Elementary rules such as

    (*)      b an abstraction or a variable.                                          u + 0 → u and
                                                                                      α.(u + v) → α.u + α.v.
    Every typable term is strong
    normalizing                                                                       Factorisation rules such as

    Hence  Yb is no typable!                                                          α.u + β.u → (α + β).u.
    t − t → 0 always, so it is not                                                    Application rules such as
    necesary to reduce t rst. we can                                                 u (v + w) → (u v) + (u w).
    remove the closed-normal
    restrictions!




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         14/31
Motivation               Linear-Algebraic      λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Grammar




         Types grammar:


                                                      T = U | ∀X .T | α.T | 0,

                                                       U = X | U → T | ∀X .U
         where           α∈S                 and   (S, +, ×)   is a conmutative ring.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                       A System F accounting for scalars, arXiv:0903.3741                         15/31
Motivation               Linear-Algebraic    λ-Calculus          System F               The scalar type system                  Conclusions and future work




The scalar type system
Type inference rules



                                                                                          ax U [ ]
                                                              Γ, x : U         x   :U

             Γ         u: U → T                           Γ      v: U                                   Γ, x : U              t: T
                                                                               →E                                                     → I [U ]
                            Γ        (u v) : T                                                      Γ         λx t : U → T

                 Γ        u : ∀X .T                                            Γ         u: T
                                             ∀E [X := U ]                                                ∀I [X ] with           X    ∈ FV (Γ)
                                                                                                                                     /
              Γ        u : T [U /X ]                                       Γ        u : ∀X .T




Pablo Arrighi and Alejandro Díaz-Caro, LIG                               A System F accounting for scalars, arXiv:0903.3741                           16/31
Motivation               Linear-Algebraic    λ-Calculus          System F               The scalar type system                    Conclusions and future work




The scalar type system
Type inference rules



                                                                                          ax U [ ]
                                                              Γ, x : U         x   :U

             Γ         u: U → T                           Γ      v: U                                   Γ, x : U               t: T
                                                                               →E                                                       → I [U ]
                            Γ        (u v) : T                                                      Γ         λx t : U → T

                 Γ        u : ∀X .T                                            Γ         u: T
                                             ∀E [X := U ]                                                ∀I [X ] with             X   ∈ FV (Γ)
                                                                                                                                      /
              Γ        u : T [U /X ]                                       Γ        u : ∀X .T

                                             Γ       u: T            Γ          v: T                                   Γ        u: T
                                   ax0                                                           +I                                       αI
              Γ        0: T                      Γ     u + v: T                                                   Γ           α.u : T



Pablo Arrighi and Alejandro Díaz-Caro, LIG                               A System F accounting for scalars, arXiv:0903.3741                             16/31
Motivation               Linear-Algebraic     λ-Calculus          System F               The scalar type system                    Conclusions and future work




The scalar type system
Type inference rules



                                                                                           ax U [ ]
                                                               Γ, x : U         x   :U

             Γ         u : α.(U → T )                      Γ      v : β.U                                Γ, x : U               t: T
                                                                                →E                                                       → I [U ]
                            Γ        (u v) : (α × β).T                                               Γ         λx t : U → T

                 Γ        u : ∀X .T                                             Γ         u: T
                                              ∀E [X := U ]                                                ∀I [X ] with             X    ∈ FV (Γ)
                                                                                                                                        /
              Γ        u : T [U /X ]                                        Γ        u : ∀X .T

                                              Γ       u : α.T         Γ          v : β.T                                Γ        u: T
                                   ax                                                            +I
                                        0                                                                                                  sI   [α]
               Γ         0: 0                     Γ     u + v : (α + β).T                                          Γ           α.u : α.T

         Where U                 ∈U          and types in contexts are are in                                    U.

Pablo Arrighi and Alejandro Díaz-Caro, LIG                                A System F accounting for scalars, arXiv:0903.3741                             17/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Strong normalisation


                     (·)     : map that take types and remove all the scalars on it.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         18/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Strong normalisation


                     (·)     : map that take types and remove all the scalars on it.
                     Example:                (U → α.X ) = U → X




Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         18/31
Motivation               Linear-Algebraic     λ-Calculus        System F            The scalar type system                Conclusions and future work




The scalar type system
Strong normalisation


                     (·)     : map that take types and remove all the scalars on it.
                     Example:                (U → α.X ) = U → X
                     We also dene 0                       =T    for some T without scalars.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                         18/31
Motivation               Linear-Algebraic     λ-Calculus        System F            The scalar type system                Conclusions and future work




The scalar type system
Strong normalisation


                     (·)     : map that take types and remove all the scalars on it.
                     Example:                (U → α.X ) = U → X
                     We also dene 0                       =T    for some T without scalars.


         Lemma (Correspondence with λ2la )
         Γ         t: T        ⇒Γ             λ2la t : T    .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                         18/31
Motivation               Linear-Algebraic      λ-Calculus        System F            The scalar type system                Conclusions and future work




The scalar type system
Strong normalisation


                     (·)     : map that take types and remove all the scalars on it.
                     Example:                 (U → α.X ) = U → X
                     We also dene 0                        =T    for some T without scalars.


         Lemma (Correspondence with λ2la )
         Γ         t: T        ⇒Γ              λ2la t : T    .



         Theorem (Strong normalisation)
         Γ         t: T        ⇒t            is strongly normalising.


         Proof.              By previous lemma                    Γ      λ2la      t: T         , then          t is strong
         normalising.


Pablo Arrighi and Alejandro Díaz-Caro, LIG                            A System F accounting for scalars, arXiv:0903.3741                         18/31
Motivation               Linear-Algebraic    λ-Calculus        System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction




         Theorem (Subject Reduction)
         Let t         →∗        t . Then        Γ        t   :T ⇒ Γ           t    :T




Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         19/31
Motivation               Linear-Algebraic    λ-Calculus        System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction




         Theorem (Subject Reduction)
         Let t         →∗        t . Then        Γ        t   :T ⇒ Γ           t    :T
         Proof.              (sketch)

                     We proof rule by rule that if                         t→t               using that rule and
                     Γ         t : T , then Γ t : T .
                     In general, the method is to take the term                                               t, decompose it
                     into its small parts and recompose to                                       t.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         19/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (I)


         To show a rule as example, we need some auxiliary lemmas and
         denitions:




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         20/31
Motivation               Linear-Algebraic     λ-Calculus        System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (I)


         To show a rule as example, we need some auxiliary lemmas and
         denitions:
         Order:

                     Write A                 B   if either
                                B     ≡ ∀X .A or
                                A     ≡ ∀X .C and          B   ≡ C [U /X ] for some                     U     ∈ U.
                     ≥     is the reexive and transitive closure of                                          .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                         20/31
Motivation                Linear-Algebraic    λ-Calculus        System F            The scalar type system                    Conclusions and future work




The scalar type system
Subject reduction proof: example (I)


         To show a rule as example, we need some auxiliary lemmas and
         denitions:
         Order:

                     Write A                 B    if either
                                B     ≡ ∀X .A or
                                A     ≡ ∀X .C and          B   ≡ C [U /X ] for some                     U     ∈ U.
                     ≥     is the reexive and transitive closure of                                          .
         Instuition of this denition:
         Types in the numerator of


                      Γ         t: A                                                                        Γ             t : ∀X .C
                                              ∀I   with    X   ∈ FV (Γ)
                                                               /                          or                                           ∀E
                 Γ         t : ∀X .A                                                                     Γ          t : C [U /X ]
         are greater than the types in the denominator.


Pablo Arrighi and Alejandro Díaz-Caro, LIG                           A System F accounting for scalars, arXiv:0903.3741                             20/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (II)

         Some lemmas needed:




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         21/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (II)

         Some lemmas needed:
              1      A    ≥B           and   Γ     t: A ⇒ Γ t: B




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         21/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (II)

         Some lemmas needed:
              1      A ≥ B and Γ t : A ⇒ Γ                         t: B
              2      A ≥ B ⇒ αA ≥ αB




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         21/31
Motivation               Linear-Algebraic    λ-Calculus    System F            The scalar type system                   Conclusions and future work




The scalar type system
Subject reduction proof: example (II)

         Some lemmas needed:
              1      A ≥ B and Γ t : A ⇒ Γ                          t: B
              2      A ≥ B ⇒ αA ≥ αB

              3      Generation lemma (app): Let                          Γ         (u v) : γ.T ,                    then


                                                           Γ u : β.U → T
                                                          

                                                            Γ v : α.U
                                                          
                                                          
                                                           T ≥ T
                                                          
                                                            γ =α×β
                                                          




Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                            21/31
Motivation               Linear-Algebraic    λ-Calculus    System F            The scalar type system                   Conclusions and future work




The scalar type system
Subject reduction proof: example (II)

         Some lemmas needed:
              1      A ≥ B and Γ t : A ⇒ Γ                          t: B
              2      A ≥ B ⇒ αA ≥ αB

              3      Generation lemma (app): Let                          Γ         (u v) : γ.T ,                    then


                                                           Γ u : β.U → T
                                                          

                                                            Γ v : α.U
                                                          
                                                          
                                                           T ≥ T
                                                          
                                                            γ =α×β
                                                          


              4      Generation lemma (sum): Let                 Γ u + v : γ.T ,                                     then


                                                             Γ u : α.T
                                                            

                                                              Γ v : β.T
                                                              γ =α+β
                                                            

Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                            21/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (III)




         Example: Rule                       ( u + v) w → ( u w ) + ( v w ) .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         22/31
Motivation               Linear-Algebraic     λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (III)




         Example: Rule                       ( u + v) w → ( u w ) + ( v w ) .
                     Let       Γ         (u + v) w : T .




Pablo Arrighi and Alejandro Díaz-Caro, LIG                      A System F accounting for scalars, arXiv:0903.3741                         22/31
Motivation               Linear-Algebraic     λ-Calculus       System F            The scalar type system                Conclusions and future work




The scalar type system
Subject reduction proof: example (III)




         Example: Rule                       ( u + v) w → ( u w ) + ( v w ) .
                     Let       Γ         (u + v) w : T .
                     Using the previous lemmas we can prove that


                                                               u : (δ × β).U → T
                                                  
                                                   Γ
                                                    Γ          v : ((1 − δ) × β).U → T
                                                    Γ          w : α.U
                                                  

                     where           α × β = 1,            T   ≥T     and        δ   is some scalar.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         22/31
Motivation               Linear-Algebraic        λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Subject reduction proof: example (IV)



         Then
                                     Γ       u : (δ × β).U → T                         Γ         w : α.U
                                                                                                                        →E
                                             Γ      (u w) : (δ × β × α).T ≥ δ.T




Pablo Arrighi and Alejandro Díaz-Caro, LIG                         A System F accounting for scalars, arXiv:0903.3741                          23/31
Motivation               Linear-Algebraic        λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Subject reduction proof: example (IV)



         Then
                                     Γ       u : (δ × β).U → T                         Γ         w : α.U
                                                                                                                        →E
                                             Γ      (u w) : (δ × β × α).T ≥ δ.T
         Also,


                           Γ         v : ((1 − δ) × β).(U → T )                                  Γ         w : α.U
                                                                                                                         →E
                             Γ         (v w) : ((1 − δ) × β × α).T ≥ (1 − δ).T




Pablo Arrighi and Alejandro Díaz-Caro, LIG                         A System F accounting for scalars, arXiv:0903.3741                          23/31
Motivation               Linear-Algebraic        λ-Calculus   System F            The scalar type system                  Conclusions and future work




The scalar type system
Subject reduction proof: example (IV)



         Then
                                     Γ       u : (δ × β).U → T                         Γ         w : α.U
                                                                                                                        →E
                                             Γ        (u w) : (δ × β × α).T ≥ δ.T
         Also,


                           Γ         v : ((1 − δ) × β).(U → T )                                  Γ         w : α.U
                                                                                                                         →E
                             Γ         (v w) : ((1 − δ) × β × α).T ≥ (1 − δ).T

         So
                            Γ         (u w) : δ.T             Γ     (v w) : (1 − δ).T
                                                                                                               +I       and   ≡
                                                  Γ     (u w) + (v w) : T



Pablo Arrighi and Alejandro Díaz-Caro, LIG                         A System F accounting for scalars, arXiv:0903.3741                           23/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Intuition




                     Conditional              functions   →   same type on each branch.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         24/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Intuition




                     Conditional              functions   →   same type on each branch.

                     By restricting the scalars to positive reals                                     →       probabilistic type
                     system.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         24/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Intuition




                     Conditional              functions   →   same type on each branch.

                     By restricting the scalars to positive reals                                     →       probabilistic type
                     system.

                     For example, one can type functions such as

                                  λx {x [ 1 .(true + false)] [ 4 .true + 3 .false]} : B → B
                                          2
                                                               1
                                                                         4

                     with the type system serving as a guarantee that the function
                     conserves probabilities summing to one.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         24/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Formalisation



         We dene the probabilistic type system to be the scalar type
         system with the following restrictions:




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         25/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Formalisation



         We dene the probabilistic type system to be the scalar type
         system with the following restrictions:

                     S = R+ ,




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         25/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Formalisation



         We dene the probabilistic type system to be the scalar type
         system with the following restrictions:

                     S = R+ ,
                     Contexts: Types in contexts are classic types (C ), i.e. types in
                     U     exempt of any scalar,




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         25/31
Motivation               Linear-Algebraic    λ-Calculus      System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Formalisation



         We dene the probabilistic type system to be the scalar type
         system with the following restrictions:

                     S = R+ ,
                     Contexts: Types in contexts are classic types (C ), i.e. types in
                     U     exempt of any scalar,

                     We change the rule                   ∀E   to

                                                     Γ     t : ∀X .T
                                                                              ∀E        with         C     ∈C
                                                   Γ      t : T [C /X ]




Pablo Arrighi and Alejandro Díaz-Caro, LIG                        A System F accounting for scalars, arXiv:0903.3741                         25/31
Motivation               Linear-Algebraic    λ-Calculus      System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Formalisation



         We dene the probabilistic type system to be the scalar type
         system with the following restrictions:

                     S = R+ ,
                     Contexts: Types in contexts are classic types (C ), i.e. types in
                     U     exempt of any scalar,

                     We change the rule                   ∀E   to

                                                     Γ     t : ∀X .T
                                                                              ∀E        with         C     ∈C
                                                   Γ      t : T [C /X ]

                     The nal conclusion must be classic.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                        A System F accounting for scalars, arXiv:0903.3741                         25/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Proof

         Denition (Weight function                           to check probability distributions)
         Let       ω : Λ → R+                be a function dened inductively by:

                   ω(0) = 0                                               ω(t1 + t2 ) = ω(t1 ) + ω(t2 )
                   ω(b) = 1                                                       ω(α.t) = α × ω(t)
                   ω(t1 t2 ) = ω(t1 ) × ω(t2 )




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         26/31
Motivation               Linear-Algebraic     λ-Calculus       System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Proof

         Denition (Weight function                                to check probability distributions)
         Let       ω : Λ → R+                  be a function dened inductively by:

                   ω(0) = 0                                                    ω(t1 + t2 ) = ω(t1 ) + ω(t2 )
                   ω(b) = 1                                                            ω(α.t) = α × ω(t)
                   ω(t1 t2 ) = ω(t1 ) × ω(t2 )

         Theorem (Normal terms in probabilistic have weight 1)
         ΓC           t: C        ⇒ ω(t ↓) = 1.
         Proof.              We prove that                 Γ   t : α.C ⇒ ω(t ↓) = α by structural
         induction over                      t ↓.



Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                         26/31
Motivation               Linear-Algebraic     λ-Calculus          System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Proof

         Denition (Weight function                                   to check probability distributions)
         Let       ω : Λ → R+                  be a function dened inductively by:

                   ω(0) = 0                                                       ω(t1 + t2 ) = ω(t1 ) + ω(t2 )
                   ω(b) = 1                                                               ω(α.t) = α × ω(t)
                   ω(t1 t2 ) = ω(t1 ) × ω(t2 )

         Theorem (Normal terms in probabilistic have weight 1)
         ΓC           t: C        ⇒ ω(t ↓) = 1.
         Proof.              We prove that                    Γ   t : α.C ⇒ ω(t ↓) = α by structural
         induction over                      t ↓.
                                               1
         Example: 2.(λx                            .x )   y
                                               2




Pablo Arrighi and Alejandro Díaz-Caro, LIG                             A System F accounting for scalars, arXiv:0903.3741                         26/31
Motivation               Linear-Algebraic     λ-Calculus              System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Proof

         Denition (Weight function                                       to check probability distributions)
         Let       ω : Λ → R+                  be a function dened inductively by:

                   ω(0) = 0                                                           ω(t1 + t2 ) = ω(t1 ) + ω(t2 )
                   ω(b) = 1                                                                   ω(α.t) = α × ω(t)
                   ω(t1 t2 ) = ω(t1 ) × ω(t2 )

         Theorem (Normal terms in probabilistic have weight 1)
         ΓC           t: C        ⇒ ω(t ↓) = 1.
         Proof.              We prove that                    Γ        t : α.C ⇒ ω(t ↓) = α by structural
         induction over                      t ↓.
                                               1
         Example: 2.(λx                            .x )   y
                                               2

                                                                  1
                                              ω(2.(λx             2
                                                                      .x ) y ) = 2
Pablo Arrighi and Alejandro Díaz-Caro, LIG                                 A System F accounting for scalars, arXiv:0903.3741                         26/31
Motivation               Linear-Algebraic     λ-Calculus              System F            The scalar type system                Conclusions and future work




The scalar type system
Probabilistic type system: Proof

         Denition (Weight function                                       to check probability distributions)
         Let       ω : Λ → R+                  be a function dened inductively by:

                   ω(0) = 0                                                           ω(t1 + t2 ) = ω(t1 ) + ω(t2 )
                   ω(b) = 1                                                                   ω(α.t) = α × ω(t)
                   ω(t1 t2 ) = ω(t1 ) × ω(t2 )

         Theorem (Normal terms in probabilistic have weight 1)
         ΓC           t: C        ⇒ ω(t ↓) = 1.
         Proof.              We prove that                    Γ        t : α.C ⇒ ω(t ↓) = α by structural
         induction over                      t ↓.
                                               1
         Example: 2.(λx
                                               2
                                                   .x )   y   →y
                                                                  1
                                              ω(2.(λx             2
                                                                      .x ) y ) = 2                    ω(y ) = 1
Pablo Arrighi and Alejandro Díaz-Caro, LIG                                 A System F accounting for scalars, arXiv:0903.3741                         26/31
Motivation               Linear-Algebraic    λ-Calculus        System F            The scalar type system                    Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (I)


         Denition (Proof method of depth n)
         Π0 (S ) = S
                   Πn−1 (S )                                   Πk (S ) πh                                     πk         Πh ( S )
         Πn (S ) =           R                            or                            R          or                               R
                     PS                                              P    S                                              S
                                                                                                                         P
         where

                     S    is a sequent,

                     πn      is a constant derivation tree of size n,

                     max{k , h}              = n − 1,
                     R     is a typing rule, and

                     P   S    is a sequent such that the resulting derivation tree is
                     well-formed.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                             27/31
Motivation               Linear-Algebraic    λ-Calculus        System F            The scalar type system                      Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (I)


         Denition (Proof method of depth n)
         Π0 (S ) = S
                   Πn−1 (S )                                   Πk (S ) πh                                     πk          Πh ( S )
         Πn (S ) =           R                            or                            R          or                                 R
                     PS                                              P    S                                              P S
         where

                     S    is a sequent,

                     πn      is a constant derivation tree of size n,

                     max{k , h}              = n − 1,
                     R     is a typing rule, and

                     P   S    is a sequent such that the resulting derivation tree is
                     well-formed.


         C   (Πn (S ))             denote the conclusion (root) of the tree                                              Πn (S ).
Pablo Arrighi and Alejandro Díaz-Caro, LIG                          A System F accounting for scalars, arXiv:0903.3741                               27/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (II)



         Examples:

                                               S
                            Π1 ( S ) =              ∀I
                                              P S




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         28/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (II)



         Examples:

                                               S                                                    Γ         t: T
                            Π1 ( S ) =              ∀I     Π1 (Γ          t: T) =                                       ∀I
                                              P S                                              Γ         t : ∀X .T




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                          28/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (II)



         Examples:

                                               S                                                    Γ         t: T
                            Π1 ( S ) =              ∀I     Π1 (Γ          t: T) =                                       ∀I
                                              P S                                              Γ         t : ∀X .T
                                                                                                      π n −2
                                Πn (Γ         u : α.A) = Γ u : α.A      Γ v : 2.A
                                                                                  +I
                                                           Γ u + v : (2 + α).A
         (Partial function or pattern matching)




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                          28/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (II)



         Examples:

                                               S                                                    Γ         t: T
                            Π1 ( S ) =              ∀I     Π1 (Γ          t: T) =                                       ∀I
                                              P S                                              Γ         t : ∀X .T
                                                                                                      π n −2
                                Πn (Γ         u : α.A) = Γ u : α.A      Γ v : 2.A
                                                                                  +I
                                                           Γ u + v : (2 + α).A
         (Partial function or pattern matching) Basically C (Πn (S ))                                                      = PS
         means that PS can be derived from S by using S once, with the
         xed proof method                          Π.


Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                          28/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (III)


         Theorem (No-cloning of scalars)
          Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with
         δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U .
         Proof.              Induction over n.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         29/31
Motivation               Linear-Algebraic      λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (III)


         Theorem (No-cloning of scalars)
          Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with
         δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U .
         Proof.              Induction over n.

         Corollary (No-cloning Theorem)
            Πn       such that                ∀T , C (Πn (Γ     T   )) = ∆                  T     ⊗ T.
         where A              ⊗B             is the classical encoding for the type of tuples.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                       A System F accounting for scalars, arXiv:0903.3741                         29/31
Motivation               Linear-Algebraic      λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (III)


         Theorem (No-cloning of scalars)
          Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with
         δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U .
         Proof.              Induction over n.

         Corollary (No-cloning Theorem)
            Πn       such that                ∀T , C (Πn (Γ     T   )) = ∆                  T     ⊗ T.
         where A              ⊗B             is the classical encoding for the type of tuples.
         Proof.

                     It is easy to show that                  ∀T , T ≡ α.U                   with U             ∈U




Pablo Arrighi and Alejandro Díaz-Caro, LIG                       A System F accounting for scalars, arXiv:0903.3741                         29/31
Motivation               Linear-Algebraic      λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (III)


         Theorem (No-cloning of scalars)
          Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with
         δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U .
         Proof.              Induction over n.

         Corollary (No-cloning Theorem)
            Πn       such that                ∀T , C (Πn (Γ     T    )) = ∆                 T     ⊗ T.
         where A              ⊗B             is the classical encoding for the type of tuples.
         Proof.

                     It is easy to show that                  ∀T , T ≡ α.U                   with U             ∈U
                     T     ⊗ T ≡ α.U ⊗ α.U ≡ α .(U ⊗ U ) = (1 × α2 + 0).(U ⊗ U ).
                                                                 2




Pablo Arrighi and Alejandro Díaz-Caro, LIG                       A System F accounting for scalars, arXiv:0903.3741                         29/31
Motivation               Linear-Algebraic      λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Logical content: No-cloning theorem (III)


         Theorem (No-cloning of scalars)
          Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with
         δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U .
         Proof.              Induction over n.

         Corollary (No-cloning Theorem)
            Πn       such that                ∀T , C (Πn (Γ     T    )) = ∆                 T     ⊗ T.
         where A              ⊗B             is the classical encoding for the type of tuples.
         Proof.

                     It is easy to show that                  ∀T , T ≡ α.U                   with U             ∈U
                     T     ⊗ T ≡ α.U ⊗ α.U ≡ α .(U ⊗ U ) = (1 × α2 + 0).(U ⊗ U ).
                                                                 2



                     By the previous theorem, the corollary holds.


Pablo Arrighi and Alejandro Díaz-Caro, LIG                       A System F accounting for scalars, arXiv:0903.3741                         29/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Summary of contributions




                     S.N. : Simplied the Linear-algebraic                                  λ-calculus              by lifting
                     most restrictions. S.R. OK.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                          30/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Summary of contributions




                     S.N. : Simplied the Linear-algebraic                                  λ-calculus              by lifting
                     most restrictions. S.R. OK.

                     Scalar          type system : types keep track of the `amount of a
                     type' by holding sum of amplitudes of terms of that types.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                          30/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                 Conclusions and future work




The scalar type system
Summary of contributions




                     S.N. : Simplied the Linear-algebraic                                  λ-calculus              by lifting
                     most restrictions. S.R. OK.

                     Scalar          type system : types keep track of the `amount of a
                     type' by holding sum of amplitudes of terms of that types.

                     =⇒         probabilistic type system, yielding a higher-order
                     probabilistic            λ-calculus.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                          30/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Polemics, future work




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         31/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Polemics, future work



                     Captured no-cloning theorem is a way that is faithful to
                     quantum theory and linear algebra, unlike LL:
                                For all     one can nd a copying proof method, but there is no
                                             A

                                proof method     for cloning all A.
                                Algebraic linearity is about taking α.U to something in
                                αγ + δ . . . not just for γ = 1 = δ + 1.




Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         31/31
Motivation               Linear-Algebraic    λ-Calculus   System F            The scalar type system                Conclusions and future work




The scalar type system
Polemics, future work



                     Captured no-cloning theorem is a way that is faithful to
                     quantum theory and linear algebra, unlike LL:
                                For all     one can nd a copying proof method, but there is no
                                             A

                                proof method     for cloning all A.
                                Algebraic linearity is about taking α.U to something in
                                αγ + δ . . . not just for γ = 1 = δ + 1.
                     C.-H.+Q.C.=(quantum th. proofs, quantum th. logics)?
                     Need a Vectorial type system:
                                Scalar type system → magnitude and signs for type vectors.
                                Future system → direction, (i.e. addition and orthogonality of
                                types). Then it would be possible to check norm on
                                amplitudes rather than probabilities.



Pablo Arrighi and Alejandro Díaz-Caro, LIG                     A System F accounting for scalars, arXiv:0903.3741                         31/31

More Related Content

What's hot

Monte Caro Simualtions, Sampling and Markov Chain Monte Carlo
Monte Caro Simualtions, Sampling and Markov Chain Monte CarloMonte Caro Simualtions, Sampling and Markov Chain Monte Carlo
Monte Caro Simualtions, Sampling and Markov Chain Monte CarloXin-She Yang
 
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...A new approach in specifying the inverse quadratic matrix in modulo-2 for con...
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...Anax Fotopoulos
 
Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...
Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...
Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...Hui Yang
 
Time series anomaly discovery with grammar-based compression
Time series anomaly discovery with grammar-based compressionTime series anomaly discovery with grammar-based compression
Time series anomaly discovery with grammar-based compressionPavel Senin
 
Wireless Localization: Positioning
Wireless Localization: PositioningWireless Localization: Positioning
Wireless Localization: PositioningStefano Severi
 
Cryptography Baby Step Giant Step
Cryptography Baby Step Giant StepCryptography Baby Step Giant Step
Cryptography Baby Step Giant StepSAUVIK BISWAS
 
Eigen valus n vectors
Eigen valus n vectors Eigen valus n vectors
Eigen valus n vectors vadher manish
 

What's hot (12)

Monte Caro Simualtions, Sampling and Markov Chain Monte Carlo
Monte Caro Simualtions, Sampling and Markov Chain Monte CarloMonte Caro Simualtions, Sampling and Markov Chain Monte Carlo
Monte Caro Simualtions, Sampling and Markov Chain Monte Carlo
 
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...A new approach in specifying the inverse quadratic matrix in modulo-2 for con...
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...
 
Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...
Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...
Mining Dynamic Recurrences in Nonlinear and Nonstationary Systems for Feature...
 
Time series anomaly discovery with grammar-based compression
Time series anomaly discovery with grammar-based compressionTime series anomaly discovery with grammar-based compression
Time series anomaly discovery with grammar-based compression
 
SASA 2016
SASA 2016SASA 2016
SASA 2016
 
Wireless Localization: Positioning
Wireless Localization: PositioningWireless Localization: Positioning
Wireless Localization: Positioning
 
Cryptography Baby Step Giant Step
Cryptography Baby Step Giant StepCryptography Baby Step Giant Step
Cryptography Baby Step Giant Step
 
Presentation
PresentationPresentation
Presentation
 
My Amatuer Slide Show
My Amatuer Slide ShowMy Amatuer Slide Show
My Amatuer Slide Show
 
Eigen valus n vectors
Eigen valus n vectors Eigen valus n vectors
Eigen valus n vectors
 
NTU_paper
NTU_paperNTU_paper
NTU_paper
 
algebraic-geometry
algebraic-geometryalgebraic-geometry
algebraic-geometry
 

Similar to A System F accounting for scalars

Fundamentals of quantum computing part i rev
Fundamentals of quantum computing   part i revFundamentals of quantum computing   part i rev
Fundamentals of quantum computing part i revPRADOSH K. ROY
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum ComputingGDSC PJATK
 
MMath Paper, Canlin Zhang
MMath Paper, Canlin ZhangMMath Paper, Canlin Zhang
MMath Paper, Canlin Zhangcanlin zhang
 
Parameter Estimation for Semiparametric Models with CMARS and Its Applications
Parameter Estimation for Semiparametric Models with CMARS and Its ApplicationsParameter Estimation for Semiparametric Models with CMARS and Its Applications
Parameter Estimation for Semiparametric Models with CMARS and Its ApplicationsSSA KPI
 
Do we need a logic of quantum computation?
Do we need a logic of quantum computation?Do we need a logic of quantum computation?
Do we need a logic of quantum computation?Matthew Leifer
 
Be2419772016
Be2419772016Be2419772016
Be2419772016IJMER
 
István Dienes Lecture For Unified Theories 2006
István Dienes Lecture For Unified Theories 2006István Dienes Lecture For Unified Theories 2006
István Dienes Lecture For Unified Theories 2006Istvan Dienes
 
Machine learning with quantum computers
Machine learning with quantum computersMachine learning with quantum computers
Machine learning with quantum computersSpeck&Tech
 
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
 
Going Without: a modality and its role
Going Without: a modality and its roleGoing Without: a modality and its role
Going Without: a modality and its roleValeria de Paiva
 
Harvard_University_-_Linear_Al
Harvard_University_-_Linear_AlHarvard_University_-_Linear_Al
Harvard_University_-_Linear_Alramiljayureta
 
Harvard_University_-_Linear_Al
Harvard_University_-_Linear_AlHarvard_University_-_Linear_Al
Harvard_University_-_Linear_AlRamil Jay Ureta
 
Quantum Algorithms and Lower Bounds in Continuous Time
Quantum Algorithms and Lower Bounds in Continuous TimeQuantum Algorithms and Lower Bounds in Continuous Time
Quantum Algorithms and Lower Bounds in Continuous TimeDavid Yonge-Mallo
 
Quantum algorithm for solving linear systems of equations
 Quantum algorithm for solving linear systems of equations Quantum algorithm for solving linear systems of equations
Quantum algorithm for solving linear systems of equationsXequeMateShannon
 

Similar to A System F accounting for scalars (20)

Fundamentals of quantum computing part i rev
Fundamentals of quantum computing   part i revFundamentals of quantum computing   part i rev
Fundamentals of quantum computing part i rev
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum Computing
 
MMath Paper, Canlin Zhang
MMath Paper, Canlin ZhangMMath Paper, Canlin Zhang
MMath Paper, Canlin Zhang
 
Thesis defence
Thesis defenceThesis defence
Thesis defence
 
Parameter Estimation for Semiparametric Models with CMARS and Its Applications
Parameter Estimation for Semiparametric Models with CMARS and Its ApplicationsParameter Estimation for Semiparametric Models with CMARS and Its Applications
Parameter Estimation for Semiparametric Models with CMARS and Its Applications
 
Chaos Analysis
Chaos AnalysisChaos Analysis
Chaos Analysis
 
Do we need a logic of quantum computation?
Do we need a logic of quantum computation?Do we need a logic of quantum computation?
Do we need a logic of quantum computation?
 
Be2419772016
Be2419772016Be2419772016
Be2419772016
 
István Dienes Lecture For Unified Theories 2006
István Dienes Lecture For Unified Theories 2006István Dienes Lecture For Unified Theories 2006
István Dienes Lecture For Unified Theories 2006
 
Machine learning with quantum computers
Machine learning with quantum computersMachine learning with quantum computers
Machine learning with quantum computers
 
Ieee lecture
Ieee lectureIeee lecture
Ieee lecture
 
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...
 
Thelearningpoint
ThelearningpointThelearningpoint
Thelearningpoint
 
Going Without: a modality and its role
Going Without: a modality and its roleGoing Without: a modality and its role
Going Without: a modality and its role
 
Harvard_University_-_Linear_Al
Harvard_University_-_Linear_AlHarvard_University_-_Linear_Al
Harvard_University_-_Linear_Al
 
Harvard_University_-_Linear_Al
Harvard_University_-_Linear_AlHarvard_University_-_Linear_Al
Harvard_University_-_Linear_Al
 
Linear algebra havard university
Linear algebra havard universityLinear algebra havard university
Linear algebra havard university
 
Quantum Algorithms and Lower Bounds in Continuous Time
Quantum Algorithms and Lower Bounds in Continuous TimeQuantum Algorithms and Lower Bounds in Continuous Time
Quantum Algorithms and Lower Bounds in Continuous Time
 
Qualifier
QualifierQualifier
Qualifier
 
Quantum algorithm for solving linear systems of equations
 Quantum algorithm for solving linear systems of equations Quantum algorithm for solving linear systems of equations
Quantum algorithm for solving linear systems of equations
 

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
 
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
 
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
 
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
 
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
 
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
 

More from Alejandro Díaz-Caro (12)

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
 
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
 
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 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"
 
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
 
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
 
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

  • 1. A System F accounting for scalars arXiv:0903.3741 Pablo Arrighi and Alejandro Díaz-Caro Université de Grenoble Laboratoire d'Informatique de Grenoble November 19th, 2009. PPS (Paris)
  • 2. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Global context 1 Oddity of Quantum theory =⇒ Quantum Logic? (developed ad hoc before quantum computing, no clear relation with quantum programs). Birkho, G. and J. von Neumann, The logic of quantum mechanics, 1 Annals of Mathematics 37 (1936), pp. 823843. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 2/31
  • 3. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Global context 1 Oddity of Quantum theory =⇒ Quantum Logic? (developed ad hoc before quantum computing, no clear relation with quantum programs). Models of Linear Logics =⇒ Quantum Theory? (Coherent spaces, Micromechanics loses duplicability.) Birkho, G. and J. von Neumann, The logic of quantum mechanics, 1 Annals of Mathematics 37 (1936), pp. 823843. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 2/31
  • 4. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Global context 1 Oddity of Quantum theory =⇒ Quantum Logic? (developed ad hoc before quantum computing, no clear relation with quantum programs). Models of Linear Logics =⇒ Quantum Theory? (Coherent spaces, Micromechanics loses duplicability.) Curry-Howard : (programs,types)=⇒(proofs,logics). Quantum Computation : (quantum programs, quantum types). CH+QC : (quantum th. proofs, quantum th. logics)? Quantum logics : isolating the reasoning behind quantum algorithms? Birkho, G. and J. von Neumann, The logic of quantum mechanics, 1 Annals of Mathematics 37 (1936), pp. 823843. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 2/31
  • 5. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Global context 1 Oddity of Quantum theory =⇒ Quantum Logic? (developed ad hoc before quantum computing, no clear relation with quantum programs). Models of Linear Logics =⇒ Quantum Theory? (Coherent spaces, Micromechanics loses duplicability.) Curry-Howard : (programs,types)=⇒(proofs,logics). Quantum Computation : (quantum programs, quantum types). CH+QC : (quantum th. proofs, quantum th. logics)? Quantum logics : isolating the reasoning behind quantum algorithms? What are quantum types? Birkho, G. and J. von Neumann, The logic of quantum mechanics, 1 Annals of Mathematics 37 (1936), pp. 823843. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 2/31
  • 6. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Quantum theory States are (normalized) vectors v. Vector space of o.n.b. (bi ). Then v= i αi bi . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 3/31
  • 7. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Quantum theory States are (normalized) vectors v. Vector space of o.n.b. (bi ). Then v= i αi bi . Evolutions are (unitary) linear operators U . v = U v. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 3/31
  • 8. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Quantum theory States are (normalized) vectors v. Vector space of o.n.b. (bi ). Then v= i αi bi . Evolutions are (unitary) linear operators U . v = U v. Systems are put next to one another with ⊗. Bilinear just like application : u + v ⊗ w = u ⊗ w + v ⊗ w, u ⊗ v + w = u ⊗ v + u ⊗ w, . . . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 3/31
  • 9. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Quantum theory States are (normalized) vectors v. Vector space of o.n.b. (bi ). Then v= i αi bi . Evolutions are (unitary) linear operators U . v = U v. Systems are put next to one another with ⊗. Bilinear just like application : u + v ⊗ w = u ⊗ w + v ⊗ w, u ⊗ v + w = u ⊗ v + u ⊗ w, . . . No-cloning theorem! Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 3/31
  • 10. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work No-cloning theorem Statement: ∃U / ∀v : U v = v ⊗ v. Proof: Vector space of o.n.b. (bi ), so v= αi bi . We can have i U bi = bi ⊗ bi (=copying, OK) But then U v = αi bi = αi U bi U i i = αi bi ⊗ bi = αi αj bi ⊗ bj i ij = ( αi bi ) ⊗ ( αj bj ) i j = v⊗v (=cloning, Not OK) Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 4/31
  • 11. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work No-cloning theorem Statement: ∃U / ∀v : U v = v ⊗ v. Proof: Vector space of o.n.b. (bi ), so v= αi bi . We can have i U bi = bi ⊗ bi (=copying, OK) But then U v = αi bi = αi U bi U i i = αi bi ⊗ bi = αi αj bi ⊗ bj i ij = ( αi bi ) ⊗ ( αj bj ) i j = v⊗v (=cloning, Not OK) Conicts with β -reduction? Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 4/31
  • 12. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus2 The language Higher-order computation t ::= x | λx .t | (t t) | Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order, 2 encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117 (2008), pp. 1731. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 5/31
  • 13. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus2 The language Higher-order computation Linear algebra t ::= x | λx .t | (t t) | t + t | α.t | 0 Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order, 2 encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117 (2008), pp. 1731. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 5/31
  • 14. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus2 The language Higher-order computation Linear algebra t ::= x | λx .t | (t t) | t + t | α.t | 0 λx .t b → t[b/x ] (∗) (*) b an abstraction or a variable. Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order, 2 encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117 (2008), pp. 1731. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 5/31
  • 15. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus2 The language Higher-order computation Linear algebra t ::= x | λx .t | (t t) | t + t | α.t | 0 λx .t b → t[b/x ] (∗) Elementary rules such as (*) b an abstraction or a u + 0 → u and α.(u + v) → α.u + α.v. variable. Factorisation rules such as (**) u closed normal. α.u + β.u → (α + β).u. (**) (***) u and u + v closed normal. Application rules such as u (v + w) → (u v) + (u w). (***) Arrighi, P. and G. Dowek. Linear-algebraic λ-calculus: higher-order, 2 encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117 (2008), pp. 1731. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 5/31
  • 16. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Copying vs Cloning Untyped λ-calculus + linear algebra ⇒ Cloning? Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 6/31
  • 17. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Copying vs Cloning Untyped λ-calculus + linear algebra ⇒ Cloning? λx .(x ⊗ x ) αi bi →∗ αi bi ⊗ bi i i ↓ ( αi bi ) ⊗ ( αi bi ) i i Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 6/31
  • 18. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Copying vs Cloning Untyped λ-calculus + linear algebra ⇒ Cloning? λx .(x ⊗ x ) αi bi →∗ αi bi ⊗ bi i i ↓ ( αi bi ) ⊗ ( αi bi ) i i No-cloning says bottom reduction forbidden. We must delay beta reduction till after linearity. So restrict beta reduction to base vectors → i.e. abstractions or variables. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 6/31
  • 19. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Innities Untyped λ-calculus + linear algebra ⇒∞ Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 7/31
  • 20. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Innities Untyped λ-calculus + linear algebra ⇒∞ Yb ≡ λx .(b + (x x )) λx .(b + (x x )) Yb → b + Yb Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 7/31
  • 21. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Innities Untyped λ-calculus + linear algebra ⇒∞ Yb ≡ λx .(b + (x x )) λx .(b + (x x )) Yb → b + Yb But whoever says innity says trouble says. . . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 7/31
  • 22. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Innities Untyped λ-calculus + linear algebra ⇒∞ Yb ≡ λx .(b + (x x )) λx .(b + (x x )) Yb → b + Yb But whoever says innity says trouble says. . . indenite forms. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 7/31
  • 23. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Innities Untyped λ-calculus + linear algebra ⇒∞ Yb ≡ λx .(b + (x x )) λx .(b + (x x )) Yb → b + Yb But whoever says innity says trouble says. . . indenite forms. Yb − Yb → b + Yb − Yb → b ↓∗ 0 Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 7/31
  • 24. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work Linear-Algebraic λ-Calculus Why the restrictions : Innities Untyped λ-calculus + linear algebra ⇒∞ Yb ≡ λx .(b + (x x )) λx .(b + (x x )) Yb → b + Yb But whoever says innity says trouble says. . . indenite forms. Yb − Yb → b + Yb − Yb → b ↓∗ 0 High school teacher says we must restrict factorization rules to nite vectors → i.e. closed-normal forms. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 7/31
  • 25. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Straightforward extension of System F (λ2la ) System F rules plus simple rules to type algebraic terms ax0 Γ u: A Γ v: A Γ t: A +I αI Γ 0: A Γ u + v: A Γ α.t : A Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 8/31
  • 26. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Straightforward extension of System F (λ2la ) System F rules plus simple rules to type algebraic terms ax0 Γ u: A Γ v: A Γ t: A +I αI Γ 0: A Γ u + v: A Γ α.t : A Theorem (Strong normalization) Γ t: T ⇒t is strongly normalising. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 8/31
  • 27. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Straightforward extension of System F (λ2la ) System F rules plus simple rules to type algebraic terms ax0 Γ u: A Γ v: A Γ t: A +I αI Γ 0: A Γ u + v: A Γ α.t : A Theorem (Strong normalization) Γ t: T ⇒t is strongly normalising. Proof. Sketch: We extend the notion of saturated sets. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 8/31
  • 28. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la SN : Set of strongly normalising terms Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 9/31
  • 29. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la SN : Set of strongly normalising terms A subset X ∈ SN is saturated if 1 ∀n ≥ 0, (((x t1 ) . . . ) tn ) ∈ X where ti ∈ SN ; → − → − 2 v[b/x ] t ∈ X ⇒ (λx v) b t ∈ X ; 3 t, u ∈ X ⇒ t + u ∈ X ; 4 ∀α, t ∈ X ⇒ α.t ∈ X ; 5 ∀i ∈ I , ((ui w1 ) . . . wn ) ∈ X ⇒ u i w1 . . . w ∈ X ; n i ∈I 6 ∀i ∈ I , (u wi ) ∈ X ⇒ u w i ∈ X; i ∈I 7 α.((t1 t2 ) . . . tn ) ∈ X ⇔ ((t1 t2 ) . . . α.tk ) . . . tn ∈ X (1 ≤ k ≤ n); 8 0 ∈ X; → − → − 9 ∀ t ∈ SN , (0 t ) ∈ X ; 10 → ∈ SN , (t 0) → ∈ X . − ∀t, u −u X stable by construction and anti-reduction Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 9/31
  • 30. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la SN : Set of strongly normalising terms A subset X ∈ SN is saturated if 1 ∀n ≥ 0, (((x t1 ) . . . ) tn ) ∈ X where ti ∈ SN ; → − → − 2 v[b/x ] t ∈ X ⇒ (λx v) b t ∈ X ; 3 t, u ∈ X ⇒ t + u ∈ X ; 4 ∀α, t ∈ X ⇒ α.t ∈ X ; 5 ∀i ∈ I , ((ui w1 ) . . . wn ) ∈ X ⇒ u i w1 . . . w ∈ X ; n i ∈I 6 ∀i ∈ I , (u wi ) ∈ X ⇒ u w i ∈ X; i ∈I 7 α.((t1 t2 ) . . . tn ) ∈ X ⇔ ((t1 t2 ) . . . α.tk ) . . . tn ∈ X (1 ≤ k ≤ n); 8 0 ∈ X; → − → − 9 ∀ t ∈ SN , (0 t ) ∈ X ; 10 → ∈ SN , (t 0) → ∈ X . − ∀t, u −u X stable by construction and anti-reduction SAT is the set of all saturated sets Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 9/31
  • 31. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (II) Rening the sketch: The idea is that types correspond to saturated sets. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 10/31
  • 32. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (II) Rening the sketch: The idea is that types correspond to saturated sets. This correspondance is achived by a maping from types to SAT . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 10/31
  • 33. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (III) Lemma 1 SN ∈ SAT , 2 A B , ∈ SAT ⇒ A → B ∈ SAT , 3 For all collection A i of members of SAT , i Ai ∈ SAT , Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 11/31
  • 34. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (III) Lemma 1 SN ∈ SAT , 2 A B , ∈ SAT ⇒ A → B ∈ SAT , 3 For all collection A i of members of SAT , i Ai ∈ SAT , Denition (Mapping) [[X ]]ξ = ξ(X ) (where ξ(·) : TVar → SAT ) [[A → B ]]ξ = [[A]]ξ → [[B ]]ξ [[∀X .T ]]ξ = Y ∈SAT [[T ]]ξ(X :=Y ) Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 11/31
  • 35. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (III) Lemma 1 SN ∈ SAT , 2 A B , ∈ SAT ⇒ A → B ∈ SAT , 3 For all collection A i of members of SAT , i Ai ∈ SAT , Denition (Mapping) [[X ]]ξ = ξ(X ) (where ξ(·) : TVar → SAT ) [[A → B ]]ξ = [[A]]ξ → [[B ]]ξ [[∀X .T ]]ξ = Y ∈SAT [[T ]]ξ(X :=Y ) Lemma Given a valuation ξ , [[T ]]ξ ∈ SAT Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 11/31
  • 36. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (IV) Denition ( ) For Γ = x1 : A1 , . . . , xn : An , Γ t: T means that ∀ξ , x1 ∈ [[A1 ]]ξ , . . . xn ∈ [[An ]]ξ ⇒ t ∈ [[T ]]ξ Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 12/31
  • 37. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (IV) Denition ( ) For Γ = x1 : A1 , . . . , xn : An , Γ t: T means that ∀ξ , x1 ∈ [[A1 ]]ξ , . . . xn ∈ [[An ]]ξ ⇒ t ∈ [[T ]]ξ Rening the sketch: Prove that Γ t: T ⇒ Γ t: T We prove this by induction on the derivation of Γ t: T (In fact the denition of is slightly dierent to strengthen the induction hypothesis) Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 12/31
  • 38. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (V) Then, the proof of the strong normalisation theorem is: Let Γ t: T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 13/31
  • 39. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (V) Then, the proof of the strong normalisation theorem is: Let Γ t: T ⇒ Γ t: T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 13/31
  • 40. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (V) Then, the proof of the strong normalisation theorem is: Let Γ t: T ⇒ Γ t: T ⇒ If ∀(xi : Ai ) ∈ Γ, xi ∈ [[Ai ]]ξ then t ∈ [[T ]]ξ Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 13/31
  • 41. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (V) Then, the proof of the strong normalisation theorem is: Let Γ t: T ⇒ Γ t: T ⇒ If ∀(xi : Ai ) ∈ Γ, xi ∈ [[Ai ]]ξ then t ∈ [[T ]]ξ Note that x i ∈ [[Ai ]]ξ because [[Ai ]]ξ is saturated, Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 13/31
  • 42. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Strong normalization of λ2la (V) Then, the proof of the strong normalisation theorem is: Let Γ t: T ⇒ Γ t: T ⇒ If ∀(xi : Ai ) ∈ Γ, xi ∈ [[Ai ]]ξ then t ∈ [[T ]]ξ Note that x i ∈ [[Ai ]]ξ because [[Ai ]]ξ is saturated, then t is strong normalising because [[T ]]ξ ⊆ SN Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 13/31
  • 43. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Linear-Algebraic λ-Calculus with λ2la Higher-order computation Linear algebra t ::= x | λx .t | (t t) | t + t | α.t | 0 λx .t b → t[b/x ] (∗) Elementary rules such as (*) b an abstraction or a variable. u + 0 → u and α.(u + v) → α.u + α.v. Factorisation rules such as α.u + β.u → (α + β).u. Application rules such as u (v + w) → (u v) + (u w). Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 14/31
  • 44. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Linear-Algebraic λ-Calculus with λ2la Higher-order computation Linear algebra t ::= x | λx .t | (t t) | t + t | α.t | 0 λx .t b → t[b/x ] (∗) Elementary rules such as (*) b an abstraction or a variable. u + 0 → u and α.(u + v) → α.u + α.v. Every typable term is strong normalizing Factorisation rules such as α.u + β.u → (α + β).u. Application rules such as u (v + w) → (u v) + (u w). Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 14/31
  • 45. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Linear-Algebraic λ-Calculus with λ2la Higher-order computation Linear algebra t ::= x | λx .t | (t t) | t + t | α.t | 0 λx .t b → t[b/x ] (∗) Elementary rules such as (*) b an abstraction or a variable. u + 0 → u and α.(u + v) → α.u + α.v. Every typable term is strong normalizing Factorisation rules such as Hence Yb is no typable! α.u + β.u → (α + β).u. Application rules such as u (v + w) → (u v) + (u w). Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 14/31
  • 46. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work System F Linear-Algebraic λ-Calculus with λ2la Higher-order computation Linear algebra t ::= x | λx .t | (t t) | t + t | α.t | 0 λx .t b → t[b/x ] (∗) Elementary rules such as (*) b an abstraction or a variable. u + 0 → u and α.(u + v) → α.u + α.v. Every typable term is strong normalizing Factorisation rules such as Hence Yb is no typable! α.u + β.u → (α + β).u. t − t → 0 always, so it is not Application rules such as necesary to reduce t rst. we can u (v + w) → (u v) + (u w). remove the closed-normal restrictions! Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 14/31
  • 47. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Grammar Types grammar: T = U | ∀X .T | α.T | 0, U = X | U → T | ∀X .U where α∈S and (S, +, ×) is a conmutative ring. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 15/31
  • 48. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Type inference rules ax U [ ] Γ, x : U x :U Γ u: U → T Γ v: U Γ, x : U t: T →E → I [U ] Γ (u v) : T Γ λx t : U → T Γ u : ∀X .T Γ u: T ∀E [X := U ] ∀I [X ] with X ∈ FV (Γ) / Γ u : T [U /X ] Γ u : ∀X .T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 16/31
  • 49. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Type inference rules ax U [ ] Γ, x : U x :U Γ u: U → T Γ v: U Γ, x : U t: T →E → I [U ] Γ (u v) : T Γ λx t : U → T Γ u : ∀X .T Γ u: T ∀E [X := U ] ∀I [X ] with X ∈ FV (Γ) / Γ u : T [U /X ] Γ u : ∀X .T Γ u: T Γ v: T Γ u: T ax0 +I αI Γ 0: T Γ u + v: T Γ α.u : T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 16/31
  • 50. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Type inference rules ax U [ ] Γ, x : U x :U Γ u : α.(U → T ) Γ v : β.U Γ, x : U t: T →E → I [U ] Γ (u v) : (α × β).T Γ λx t : U → T Γ u : ∀X .T Γ u: T ∀E [X := U ] ∀I [X ] with X ∈ FV (Γ) / Γ u : T [U /X ] Γ u : ∀X .T Γ u : α.T Γ v : β.T Γ u: T ax +I 0 sI [α] Γ 0: 0 Γ u + v : (α + β).T Γ α.u : α.T Where U ∈U and types in contexts are are in U. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 17/31
  • 51. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Strong normalisation (·) : map that take types and remove all the scalars on it. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 18/31
  • 52. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Strong normalisation (·) : map that take types and remove all the scalars on it. Example: (U → α.X ) = U → X Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 18/31
  • 53. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Strong normalisation (·) : map that take types and remove all the scalars on it. Example: (U → α.X ) = U → X We also dene 0 =T for some T without scalars. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 18/31
  • 54. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Strong normalisation (·) : map that take types and remove all the scalars on it. Example: (U → α.X ) = U → X We also dene 0 =T for some T without scalars. Lemma (Correspondence with λ2la ) Γ t: T ⇒Γ λ2la t : T . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 18/31
  • 55. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Strong normalisation (·) : map that take types and remove all the scalars on it. Example: (U → α.X ) = U → X We also dene 0 =T for some T without scalars. Lemma (Correspondence with λ2la ) Γ t: T ⇒Γ λ2la t : T . Theorem (Strong normalisation) Γ t: T ⇒t is strongly normalising. Proof. By previous lemma Γ λ2la t: T , then t is strong normalising. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 18/31
  • 56. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction Theorem (Subject Reduction) Let t →∗ t . Then Γ t :T ⇒ Γ t :T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 19/31
  • 57. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction Theorem (Subject Reduction) Let t →∗ t . Then Γ t :T ⇒ Γ t :T Proof. (sketch) We proof rule by rule that if t→t using that rule and Γ t : T , then Γ t : T . In general, the method is to take the term t, decompose it into its small parts and recompose to t. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 19/31
  • 58. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (I) To show a rule as example, we need some auxiliary lemmas and denitions: Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 20/31
  • 59. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (I) To show a rule as example, we need some auxiliary lemmas and denitions: Order: Write A B if either B ≡ ∀X .A or A ≡ ∀X .C and B ≡ C [U /X ] for some U ∈ U. ≥ is the reexive and transitive closure of . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 20/31
  • 60. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (I) To show a rule as example, we need some auxiliary lemmas and denitions: Order: Write A B if either B ≡ ∀X .A or A ≡ ∀X .C and B ≡ C [U /X ] for some U ∈ U. ≥ is the reexive and transitive closure of . Instuition of this denition: Types in the numerator of Γ t: A Γ t : ∀X .C ∀I with X ∈ FV (Γ) / or ∀E Γ t : ∀X .A Γ t : C [U /X ] are greater than the types in the denominator. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 20/31
  • 61. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (II) Some lemmas needed: Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 21/31
  • 62. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (II) Some lemmas needed: 1 A ≥B and Γ t: A ⇒ Γ t: B Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 21/31
  • 63. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (II) Some lemmas needed: 1 A ≥ B and Γ t : A ⇒ Γ t: B 2 A ≥ B ⇒ αA ≥ αB Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 21/31
  • 64. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (II) Some lemmas needed: 1 A ≥ B and Γ t : A ⇒ Γ t: B 2 A ≥ B ⇒ αA ≥ αB 3 Generation lemma (app): Let Γ (u v) : γ.T , then  Γ u : β.U → T  Γ v : α.U    T ≥ T  γ =α×β  Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 21/31
  • 65. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (II) Some lemmas needed: 1 A ≥ B and Γ t : A ⇒ Γ t: B 2 A ≥ B ⇒ αA ≥ αB 3 Generation lemma (app): Let Γ (u v) : γ.T , then  Γ u : β.U → T  Γ v : α.U    T ≥ T  γ =α×β  4 Generation lemma (sum): Let Γ u + v : γ.T , then  Γ u : α.T  Γ v : β.T γ =α+β  Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 21/31
  • 66. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (III) Example: Rule ( u + v) w → ( u w ) + ( v w ) . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 22/31
  • 67. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (III) Example: Rule ( u + v) w → ( u w ) + ( v w ) . Let Γ (u + v) w : T . Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 22/31
  • 68. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (III) Example: Rule ( u + v) w → ( u w ) + ( v w ) . Let Γ (u + v) w : T . Using the previous lemmas we can prove that u : (δ × β).U → T   Γ Γ v : ((1 − δ) × β).U → T Γ w : α.U  where α × β = 1, T ≥T and δ is some scalar. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 22/31
  • 69. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (IV) Then Γ u : (δ × β).U → T Γ w : α.U →E Γ (u w) : (δ × β × α).T ≥ δ.T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 23/31
  • 70. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (IV) Then Γ u : (δ × β).U → T Γ w : α.U →E Γ (u w) : (δ × β × α).T ≥ δ.T Also, Γ v : ((1 − δ) × β).(U → T ) Γ w : α.U →E Γ (v w) : ((1 − δ) × β × α).T ≥ (1 − δ).T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 23/31
  • 71. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Subject reduction proof: example (IV) Then Γ u : (δ × β).U → T Γ w : α.U →E Γ (u w) : (δ × β × α).T ≥ δ.T Also, Γ v : ((1 − δ) × β).(U → T ) Γ w : α.U →E Γ (v w) : ((1 − δ) × β × α).T ≥ (1 − δ).T So Γ (u w) : δ.T Γ (v w) : (1 − δ).T +I and ≡ Γ (u w) + (v w) : T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 23/31
  • 72. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Intuition Conditional functions → same type on each branch. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 24/31
  • 73. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Intuition Conditional functions → same type on each branch. By restricting the scalars to positive reals → probabilistic type system. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 24/31
  • 74. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Intuition Conditional functions → same type on each branch. By restricting the scalars to positive reals → probabilistic type system. For example, one can type functions such as λx {x [ 1 .(true + false)] [ 4 .true + 3 .false]} : B → B 2 1 4 with the type system serving as a guarantee that the function conserves probabilities summing to one. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 24/31
  • 75. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Formalisation We dene the probabilistic type system to be the scalar type system with the following restrictions: Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 25/31
  • 76. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Formalisation We dene the probabilistic type system to be the scalar type system with the following restrictions: S = R+ , Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 25/31
  • 77. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Formalisation We dene the probabilistic type system to be the scalar type system with the following restrictions: S = R+ , Contexts: Types in contexts are classic types (C ), i.e. types in U exempt of any scalar, Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 25/31
  • 78. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Formalisation We dene the probabilistic type system to be the scalar type system with the following restrictions: S = R+ , Contexts: Types in contexts are classic types (C ), i.e. types in U exempt of any scalar, We change the rule ∀E to Γ t : ∀X .T ∀E with C ∈C Γ t : T [C /X ] Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 25/31
  • 79. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Formalisation We dene the probabilistic type system to be the scalar type system with the following restrictions: S = R+ , Contexts: Types in contexts are classic types (C ), i.e. types in U exempt of any scalar, We change the rule ∀E to Γ t : ∀X .T ∀E with C ∈C Γ t : T [C /X ] The nal conclusion must be classic. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 25/31
  • 80. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Proof Denition (Weight function to check probability distributions) Let ω : Λ → R+ be a function dened inductively by: ω(0) = 0 ω(t1 + t2 ) = ω(t1 ) + ω(t2 ) ω(b) = 1 ω(α.t) = α × ω(t) ω(t1 t2 ) = ω(t1 ) × ω(t2 ) Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 26/31
  • 81. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Proof Denition (Weight function to check probability distributions) Let ω : Λ → R+ be a function dened inductively by: ω(0) = 0 ω(t1 + t2 ) = ω(t1 ) + ω(t2 ) ω(b) = 1 ω(α.t) = α × ω(t) ω(t1 t2 ) = ω(t1 ) × ω(t2 ) Theorem (Normal terms in probabilistic have weight 1) ΓC t: C ⇒ ω(t ↓) = 1. Proof. We prove that Γ t : α.C ⇒ ω(t ↓) = α by structural induction over t ↓. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 26/31
  • 82. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Proof Denition (Weight function to check probability distributions) Let ω : Λ → R+ be a function dened inductively by: ω(0) = 0 ω(t1 + t2 ) = ω(t1 ) + ω(t2 ) ω(b) = 1 ω(α.t) = α × ω(t) ω(t1 t2 ) = ω(t1 ) × ω(t2 ) Theorem (Normal terms in probabilistic have weight 1) ΓC t: C ⇒ ω(t ↓) = 1. Proof. We prove that Γ t : α.C ⇒ ω(t ↓) = α by structural induction over t ↓. 1 Example: 2.(λx .x ) y 2 Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 26/31
  • 83. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Proof Denition (Weight function to check probability distributions) Let ω : Λ → R+ be a function dened inductively by: ω(0) = 0 ω(t1 + t2 ) = ω(t1 ) + ω(t2 ) ω(b) = 1 ω(α.t) = α × ω(t) ω(t1 t2 ) = ω(t1 ) × ω(t2 ) Theorem (Normal terms in probabilistic have weight 1) ΓC t: C ⇒ ω(t ↓) = 1. Proof. We prove that Γ t : α.C ⇒ ω(t ↓) = α by structural induction over t ↓. 1 Example: 2.(λx .x ) y 2 1 ω(2.(λx 2 .x ) y ) = 2 Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 26/31
  • 84. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Probabilistic type system: Proof Denition (Weight function to check probability distributions) Let ω : Λ → R+ be a function dened inductively by: ω(0) = 0 ω(t1 + t2 ) = ω(t1 ) + ω(t2 ) ω(b) = 1 ω(α.t) = α × ω(t) ω(t1 t2 ) = ω(t1 ) × ω(t2 ) Theorem (Normal terms in probabilistic have weight 1) ΓC t: C ⇒ ω(t ↓) = 1. Proof. We prove that Γ t : α.C ⇒ ω(t ↓) = α by structural induction over t ↓. 1 Example: 2.(λx 2 .x ) y →y 1 ω(2.(λx 2 .x ) y ) = 2 ω(y ) = 1 Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 26/31
  • 85. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (I) Denition (Proof method of depth n) Π0 (S ) = S Πn−1 (S ) Πk (S ) πh πk Πh ( S ) Πn (S ) = R or R or R PS P S S P where S is a sequent, πn is a constant derivation tree of size n, max{k , h} = n − 1, R is a typing rule, and P S is a sequent such that the resulting derivation tree is well-formed. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 27/31
  • 86. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (I) Denition (Proof method of depth n) Π0 (S ) = S Πn−1 (S ) Πk (S ) πh πk Πh ( S ) Πn (S ) = R or R or R PS P S P S where S is a sequent, πn is a constant derivation tree of size n, max{k , h} = n − 1, R is a typing rule, and P S is a sequent such that the resulting derivation tree is well-formed. C (Πn (S )) denote the conclusion (root) of the tree Πn (S ). Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 27/31
  • 87. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (II) Examples: S Π1 ( S ) = ∀I P S Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 28/31
  • 88. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (II) Examples: S Γ t: T Π1 ( S ) = ∀I Π1 (Γ t: T) = ∀I P S Γ t : ∀X .T Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 28/31
  • 89. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (II) Examples: S Γ t: T Π1 ( S ) = ∀I Π1 (Γ t: T) = ∀I P S Γ t : ∀X .T π n −2 Πn (Γ u : α.A) = Γ u : α.A Γ v : 2.A +I Γ u + v : (2 + α).A (Partial function or pattern matching) Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 28/31
  • 90. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (II) Examples: S Γ t: T Π1 ( S ) = ∀I Π1 (Γ t: T) = ∀I P S Γ t : ∀X .T π n −2 Πn (Γ u : α.A) = Γ u : α.A Γ v : 2.A +I Γ u + v : (2 + α).A (Partial function or pattern matching) Basically C (Πn (S )) = PS means that PS can be derived from S by using S once, with the xed proof method Π. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 28/31
  • 91. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (III) Theorem (No-cloning of scalars) Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U . Proof. Induction over n. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 29/31
  • 92. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (III) Theorem (No-cloning of scalars) Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U . Proof. Induction over n. Corollary (No-cloning Theorem) Πn such that ∀T , C (Πn (Γ T )) = ∆ T ⊗ T. where A ⊗B is the classical encoding for the type of tuples. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 29/31
  • 93. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (III) Theorem (No-cloning of scalars) Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U . Proof. Induction over n. Corollary (No-cloning Theorem) Πn such that ∀T , C (Πn (Γ T )) = ∆ T ⊗ T. where A ⊗B is the classical encoding for the type of tuples. Proof. It is easy to show that ∀T , T ≡ α.U with U ∈U Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 29/31
  • 94. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (III) Theorem (No-cloning of scalars) Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U . Proof. Induction over n. Corollary (No-cloning Theorem) Πn such that ∀T , C (Πn (Γ T )) = ∆ T ⊗ T. where A ⊗B is the classical encoding for the type of tuples. Proof. It is easy to show that ∀T , T ≡ α.U with U ∈U T ⊗ T ≡ α.U ⊗ α.U ≡ α .(U ⊗ U ) = (1 × α2 + 0).(U ⊗ U ). 2 Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 29/31
  • 95. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Logical content: No-cloning theorem (III) Theorem (No-cloning of scalars) Πn such that ∀α, C (Πn (Γ α.U )) = ∆ (δ × αs + γ).V with δ = 0 and γ constants in S , s ∈ N1 and U , V constants in U . Proof. Induction over n. Corollary (No-cloning Theorem) Πn such that ∀T , C (Πn (Γ T )) = ∆ T ⊗ T. where A ⊗B is the classical encoding for the type of tuples. Proof. It is easy to show that ∀T , T ≡ α.U with U ∈U T ⊗ T ≡ α.U ⊗ α.U ≡ α .(U ⊗ U ) = (1 × α2 + 0).(U ⊗ U ). 2 By the previous theorem, the corollary holds. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 29/31
  • 96. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Summary of contributions S.N. : Simplied the Linear-algebraic λ-calculus by lifting most restrictions. S.R. OK. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 30/31
  • 97. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Summary of contributions S.N. : Simplied the Linear-algebraic λ-calculus by lifting most restrictions. S.R. OK. Scalar type system : types keep track of the `amount of a type' by holding sum of amplitudes of terms of that types. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 30/31
  • 98. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Summary of contributions S.N. : Simplied the Linear-algebraic λ-calculus by lifting most restrictions. S.R. OK. Scalar type system : types keep track of the `amount of a type' by holding sum of amplitudes of terms of that types. =⇒ probabilistic type system, yielding a higher-order probabilistic λ-calculus. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 30/31
  • 99. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Polemics, future work Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 31/31
  • 100. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Polemics, future work Captured no-cloning theorem is a way that is faithful to quantum theory and linear algebra, unlike LL: For all one can nd a copying proof method, but there is no A proof method for cloning all A. Algebraic linearity is about taking α.U to something in αγ + δ . . . not just for γ = 1 = δ + 1. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 31/31
  • 101. Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work The scalar type system Polemics, future work Captured no-cloning theorem is a way that is faithful to quantum theory and linear algebra, unlike LL: For all one can nd a copying proof method, but there is no A proof method for cloning all A. Algebraic linearity is about taking α.U to something in αγ + δ . . . not just for γ = 1 = δ + 1. C.-H.+Q.C.=(quantum th. proofs, quantum th. logics)? Need a Vectorial type system: Scalar type system → magnitude and signs for type vectors. Future system → direction, (i.e. addition and orthogonality of types). Then it would be possible to check norm on amplitudes rather than probabilities. Pablo Arrighi and Alejandro Díaz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 31/31