SlideShare a Scribd company logo
Non determinism through type
                   isomophism


     Alejandro Díaz-Caro                                Gilles Dowek
LIPN, Université Paris 13, Sorbonne Paris Cité        INRIA – Paris–Rocquencourt




                                           7th LSFA
                        Rio de Janeiro, September 29–30, 2012
Motivation: Di Cosmo’s isomorphisms           [Di Cosmo’95]


  - A∧B ≡B ∧A
  - A ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C
  - A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C )
  - (A ∧ B) ⇒ C ≡ A ⇒ (B ⇒ C )
  - A ⇒ (B ⇒ C ) ≡ B ⇒ (A ⇒ C )
  - A∧T≡A
  - A⇒T≡T
  - T⇒A≡A
  - ∀X .∀Y .A ≡ ∀Y .∀X .A
  - ∀X .A ≡ ∀Y .A[Y = X ]
  - ∀X .(A ⇒ B) ≡ A ⇒ ∀X .B if X ∈ FV (A)
                                 /
  - ∀X .(A ∧ B) ≡ ∀X .A ∧ ∀X .B
  - ∀X .T ≡ T
  - ∀X .(A ∧ B) ≡ ∀X .∀Y .(A ∧ (B[Y = X ]))

                                                              2 / 10
Motivation: Di Cosmo’s isomorphisms                 [Di Cosmo’95]


  - A∧B ≡B ∧A
  - A ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C
  - A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C )
  - (A ∧ B) ⇒ C ≡ A ⇒ (B ⇒ C )
  - A ⇒ (B ⇒ C ) ≡ B ⇒ (A ⇒ C )
  - A∧T≡A
  - A⇒T≡T                                     We want a proof-system
  - T⇒A≡A                                     where isomorphic proposi-
  - ∀X .∀Y .A ≡ ∀Y .∀X .A                     tions have the same proofs
  - ∀X .A ≡ ∀Y .A[Y = X ]
  - ∀X .(A ⇒ B) ≡ A ⇒ ∀X .B if X ∈ FV (A)
                                 /
  - ∀X .(A ∧ B) ≡ ∀X .A ∧ ∀X .B
  - ∀X .T ≡ T
  - ∀X .(A ∧ B) ≡ ∀X .∀Y .(A ∧ (B[Y = X ]))

                                                                       2 / 10
Minimal second order propositional logic
                               Γ, x : A        t:B   Γ       t:A⇒B            Γ   s:A
  Γ, x : A   x :A          Γ      λx.t : A ⇒ B                   Γ   ts : B


                  Γ     t:A                              Γ    t : ∀X .A
                                  X ∈ FV (Γ)
                                    /
              Γ       t : ∀X .A                      Γ       t : A[B/X ]




                                                                                        3 / 10
Minimal second order propositional logic
                               Γ, x : A        t:B         Γ       t:A⇒B            Γ   s:A
  Γ, x : A   x :A          Γ      λx.t : A ⇒ B                         Γ   ts : B


                  Γ     t:A                                    Γ    t : ∀X .A
                                  X ∈ FV (Γ)
                                    /
              Γ       t : ∀X .A                              Γ     t : A[B/X ]

Adding conjunction
                                  Γ       t:A         Γ   r:B
                                      Γ        t, r   :A∧B




                                                                                              3 / 10
Minimal second order propositional logic
                                Γ, x : A        t:B         Γ       t:A⇒B            Γ   s:A
   Γ, x : A   x :A          Γ      λx.t : A ⇒ B                         Γ   ts : B


                   Γ     t:A                                    Γ    t : ∀X .A
                                   X ∈ FV (Γ)
                                     /
               Γ       t : ∀X .A                              Γ     t : A[B/X ]

Adding conjunction
                                   Γ       t:A         Γ   r:B
                                       Γ        t, r   :A∧B

  We want A ∧ B        = B ∧A
      A ∧ (B ∧ C )     = (A ∧ B) ∧ C
      so      t, r     = r, t
          t, r, s      = t, r , s



                                                                                               3 / 10
Minimal second order propositional logic
                                Γ, x : A        t:B         Γ       t:A⇒B            Γ   s:A
   Γ, x : A   x :A          Γ      λx.t : A ⇒ B                         Γ   ts : B


                   Γ     t:A                                    Γ    t : ∀X .A
                                   X ∈ FV (Γ)
                                     /
               Γ       t : ∀X .A                            Γ       t : A[B/X ]

Adding conjunction
                                   Γ       t:A        Γ   r:B
                                       Γ        t+r :A∧B

  We want A ∧ B        = B ∧A                    We write
      A ∧ (B ∧ C )     = (A ∧ B) ∧ C                                t+r=r+t
      so      t, r     = r, t                             t + (r + s) = (t + r) + s
          t, r, s      = t, r , s



                                                                                               3 / 10
Minimal second order propositional logic
                                Γ, x : A        t:B         Γ       t:A⇒B            Γ   s:A
   Γ, x : A   x :A          Γ      λx.t : A ⇒ B                         Γ   ts : B


                   Γ     t:A                                    Γ    t : ∀X .A
                                   X ∈ FV (Γ)
                                     /
               Γ       t : ∀X .A                            Γ       t : A[B/X ]

Adding conjunction
                                   Γ       t:A        Γ   r:B
                                       Γ        t+r :A∧B

  We want A ∧ B        = B ∧A                    We write
      A ∧ (B ∧ C )     = (A ∧ B) ∧ C                                t+r=r+t
      so      t, r     = r, t                             t + (r + s) = (t + r) + s
          t, r, s      = t, r , s

                                                                λx.(t + r) = λx.t + λx.r
   Also A ⇒ (B ∧ C ) = (A ⇒ B) ∧ (A ⇒ C ) induces
                                                                  (t + r)s = ts + rs
                                                                                               3 / 10
What about ∧-elimination?
  Γ   t+r:A∧B
  Γ   π1 (t + r) : A




                            4 / 10
What about ∧-elimination?
  Γ   t+r:A∧B                                          Γ   t+r:B ∧A
                           But A ∧ B = B ∧ A !!
  Γ   π1 (t + r) : A                                   Γ   π1 (t + r) : B

  Moreover
  t+r=r+t              so π1 (t + r) = π1 (r + t) !!




                                                                            4 / 10
What about ∧-elimination?
  Γ   t+r:A∧B                                          Γ   t+r:B ∧A
                           But A ∧ B = B ∧ A !!
  Γ   π1 (t + r) : A                                   Γ   π1 (t + r) : B

  Moreover
  t+r=r+t              so π1 (t + r) = π1 (r + t) !!

  Workaround: Church-style. Project w.r.t. a type

                        If Γ     t : A then πA (t + r) → t




                                                                            4 / 10
What about ∧-elimination?
  Γ   t+r:A∧B                                          Γ   t+r:B ∧A
                           But A ∧ B = B ∧ A !!
  Γ   π1 (t + r) : A                                   Γ   π1 (t + r) : B

  Moreover
  t+r=r+t              so π1 (t + r) = π1 (r + t) !!

  Workaround: Church-style. Project w.r.t. a type

                        If Γ     t : A then πA (t + r) → t

  This induces non-determinism
                           Γ   t:A               πA (t + r) → t
                   If                   then
                           Γ   r:A               πA (t + r) → r




                                                                            4 / 10
What about ∧-elimination?
  Γ   t+r:A∧B                                          Γ   t+r:B ∧A
                           But A ∧ B = B ∧ A !!
  Γ   π1 (t + r) : A                                   Γ   π1 (t + r) : B

  Moreover
  t+r=r+t              so π1 (t + r) = π1 (r + t) !!

  Workaround: Church-style. Project w.r.t. a type

                        If Γ     t : A then πA (t + r) → t

  This induces non-determinism
                           Γ   t:A               πA (t + r) → t
                   If                   then
                           Γ   r:A               πA (t + r) → r


                                        We are interested in the proof theory
                                        and both t and r are valid proofs of A

                                                                                 4 / 10
The calculus
Types
A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A
Equivalences
        A∧B     ≡   B ∧A
  (A ∧ B) ∧ C   ≡   A ∧ (B ∧ C )
 A ⇒ (B ∧ C )   ≡   (A ⇒ B) ∧ (A ⇒ C )




                                         5 / 10
The calculus
Types
A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A
Equivalences
        A∧B         ≡    B ∧A
  (A ∧ B) ∧ C       ≡    A ∧ (B ∧ C )
 A ⇒ (B ∧ C )       ≡    (A ⇒ B) ∧ (A ⇒ C )

Terms
 t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A}
             | t + r | πA (t)




                                                 5 / 10
The calculus
Types
A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A
Equivalences
        A∧B         ≡    B ∧A
  (A ∧ B) ∧ C       ≡    A ∧ (B ∧ C )
 A ⇒ (B ∧ C )       ≡    (A ⇒ B) ∧ (A ⇒ C )

Terms
 t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A}
             | t + r | πA (t)
Reduction rules
   (λx A .t)r → t[r/x]
 (ΛX .t){A} → t[A/X ]
  πA (t + r) → t (if Γ         t : A)




                                                 5 / 10
The calculus
Types
A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A
Equivalences
        A∧B          ≡      B ∧A
  (A ∧ B) ∧ C        ≡      A ∧ (B ∧ C )
 A ⇒ (B ∧ C )        ≡      (A ⇒ B) ∧ (A ⇒ C )

Terms
 t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A}
             | t + r | πA (t)
Reduction rules
     (λx A .t)r →   t[r/x]
 (ΛX .t){A} →       t[A/X ]
   πA (t + r) →     t (if Γ t : A)
         t+r        r+t
  (t + r) + s       t + (r + s)
      (t + r)s      ts + rs
 λx A .(t + r)      λx A .t + λx A .r
   πA⇒B (t)r        πB (tr)
                    (if Γ    t : A ⇒ (B ∧ C ))

                                                 5 / 10
The calculus
Types                                                                                        Γ, x : A        t:B
A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A                                  ax                                               ⇒I
                                                 Γ, x : A       x :A                                 A
                                                                                        Γ        λx .t : A ⇒ B
Equivalences
        A∧B          ≡      B ∧A                            Γ    t:A⇒B                       Γ       s:A
  (A ∧ B) ∧ C        ≡      A ∧ (B ∧ C )                                                                    ⇒E
                                                                        Γ         ts : B
 A ⇒ (B ∧ C )        ≡      (A ⇒ B) ∧ (A ⇒ C )
                                                 Γ       t:A    X ∈ FV (Γ)
                                                                  /                              Γ       t : ∀X .A
                                                                             ∀I                                         ∀E
Terms                                            Γ       ΛX .t : ∀X .A                   Γ       t{B} : A[B/X ]
 t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A}
             | t + r | πA (t)                    Γ       t:A Γ         r:B                           Γ     t:A∧B
Reduction rules                                                                   ∧I                                    ∧E
     (λx A .t)r →   t[r/x]                           Γ   t+r:A∧B                                     Γ     πA (t) : A
 (ΛX .t){A} →       t[A/X ]
                                                                   Γ     t:A A≡B
   πA (t + r) →     t (if Γ t : A)                                                                   ≡
         t+r        r+t                                                      Γ     t:B
  (t + r) + s       t + (r + s)
      (t + r)s      ts + rs                      Theorem (Subject reduction)
 λx A .(t + r)      λx A .t + λx A .r
   πA⇒B (t)r        πB (tr)                      If Γ       t : A and t → r then Γ                              r:A
                    (if Γ    t : A ⇒ (B ∧ C ))                                         with → := → or

                                                                                                                      5 / 10
Example (I)


              λx A∧B .x : (A ∧ B) ⇒ (A ∧ B)




                                              6 / 10
Example (I)


                     λx A∧B .x : (A ∧ B) ⇒ (A ∧ B)


     (A ∧ B) ⇒ (A ∧ B)     ≡      ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B)




                                                                  6 / 10
Example (I)


                     λx A∧B .x : (A ∧ B) ⇒ (A ∧ B)


     (A ∧ B) ⇒ (A ∧ B)     ≡      ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B)
  Hence
                  π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A




                                                                  6 / 10
Example (I)


                        λx A∧B .x : (A ∧ B) ⇒ (A ∧ B)


        (A ∧ B) ⇒ (A ∧ B)     ≡      ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B)
  Hence
                     π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A
  Let        r:A∧B




                                                                     6 / 10
Example (I)


                        λx A∧B .x : (A ∧ B) ⇒ (A ∧ B)


        (A ∧ B) ⇒ (A ∧ B)       ≡      ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B)
  Hence
                     π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A
  Let        r:A∧B

                            π(A∧B)⇒A (λx A∧B .x) r : A




                                                                       6 / 10
Example (I)


                        λx A∧B .x : (A ∧ B) ⇒ (A ∧ B)


        (A ∧ B) ⇒ (A ∧ B)       ≡      ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B)
  Hence
                     π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A
  Let        r:A∧B

                            π(A∧B)⇒A (λx A∧B .x) r : A



    π(A∧B)⇒A (λx A∧B .x)r              πA ((λx A∧B .x)r)   →    πA (r)




                                                                         6 / 10
Example (II)

               TF = λx B .λy B .(x + y )
               TF : B ⇒ B ⇒ (B ∧ B)




                                           7 / 10
Example (II)

                        TF = λx B .λy B .(x + y )
                        TF : B ⇒ B ⇒ (B ∧ B)


      B ⇒ B ⇒ (B ∧ B)       ≡       (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B)




                                                                7 / 10
Example (II)

                        TF = λx B .λy B .(x + y )
                        TF : B ⇒ B ⇒ (B ∧ B)


      B ⇒ B ⇒ (B ∧ B)       ≡       (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B)


                    πB⇒B⇒B (TF) : B ⇒ B ⇒ B




                                                                7 / 10
Example (II)

                          TF = λx B .λy B .(x + y )
                          TF : B ⇒ B ⇒ (B ∧ B)


        B ⇒ B ⇒ (B ∧ B)       ≡       (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B)


                         πB⇒B⇒B (TF) : B ⇒ B ⇒ B
  Let      t:B     and         f:B




                                                                  7 / 10
Example (II)

                           TF = λx B .λy B .(x + y )
                           TF : B ⇒ B ⇒ (B ∧ B)


        B ⇒ B ⇒ (B ∧ B)        ≡       (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B)


                          πB⇒B⇒B (TF) : B ⇒ B ⇒ B
  Let      t:B      and         f:B

         πB⇒B⇒B (TF) t f




                                                                   7 / 10
Example (II)

                           TF = λx B .λy B .(x + y )
                           TF : B ⇒ B ⇒ (B ∧ B)


        B ⇒ B ⇒ (B ∧ B)        ≡       (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B)


                          πB⇒B⇒B (TF) : B ⇒ B ⇒ B
  Let      t:B      and         f:B

         πB⇒B⇒B (TF) t f           πB⇒B ((TF)t) f




                                                                   7 / 10
Example (II)

                           TF = λx B .λy B .(x + y )
                           TF : B ⇒ B ⇒ (B ∧ B)


        B ⇒ B ⇒ (B ∧ B)        ≡       (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B)


                          πB⇒B⇒B (TF) : B ⇒ B ⇒ B
  Let      t:B      and         f:B

         πB⇒B⇒B (TF) t f           πB⇒B ((TF)t) f      πB ((TF)tf)




                                                                     7 / 10
Example (II)

                           TF = λx B .λy B .(x + y )
                           TF : B ⇒ B ⇒ (B ∧ B)


        B ⇒ B ⇒ (B ∧ B)        ≡       (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B)


                          πB⇒B⇒B (TF) : B ⇒ B ⇒ B
  Let      t:B      and         f:B

         πB⇒B⇒B (TF) t f           πB⇒B ((TF)t) f        πB ((TF)tf)


                                          7Õ      3t
                           → πB (t + f) % y
                                                    +f


                                                                       7 / 10
Confluence (some ideas)
  Of course, a non-deterministic calculus is not confluent!
  Counterexample            πA (x A + y A )
                        x                        &
                   xA                                yA
                            |                |
                                 '       w
                                     ?




                                                             8 / 10
Confluence (some ideas)
  Of course, a non-deterministic calculus is not confluent!
  Counterexample                         πA (x A + y A )
                               x                                       &
                        xA                                                 yA
                                         |                       |
                                                     '       w
                                                         ?
  However, we can prove it keeps some coherence

      Confluence of the deterministic fragment
      Confluence of the “term ensembles”

   e.g.                       t
                    z                        "
           {ri }i                                t
                        #            }
                            {ri }i                                   [Arrighi,Díaz-Caro,Gadella,Grattage’08]



                                                                                                               8 / 10
Conclusions (with some examples)
  Proof system
  Let t be a proof of A
  and r be a proof of B
  so t + r is a proof of both A ∧ B and B ∧ A
                      Non deterministic calculus
                       t = ΛX .λx X .λy X .x
                       t                                 ff = ΛX .λx X .λy X .y
                                     B = ∀X .X ⇒ X ⇒ X


                                              t + ff : B ∧ B
                                              πB (t + ff ) : B
                                                  t

                                          {                      #
                                      t                              ff

  So far:
  - Proof system where (three) isomorphic types get the same proofs
  - Non-deterministic calculus
                                                                                  9 / 10
Future directions (open problems)
          Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0   t and A ⇒ T ≡ T induces λx.0   0




                                                                    10 / 10
Future directions (open problems)
         Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0  t and A ⇒ T ≡ T induces λx.0   0
  But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong)




                                                                   10 / 10
Future directions (open problems)
          Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0  t and A ⇒ T ≡ T induces λx.0   0
  But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong)

                   A more interesting open question:
   Can we use this no determinism to define a probabilistic/quantum
                              language?




                                                                     10 / 10
Future directions (open problems)
          Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0  t and A ⇒ T ≡ T induces λx.0              0
  But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong)

                    A more interesting open question:
   Can we use this no determinism to define a probabilistic/quantum
                              language?

  Some clues:
      Similar to the linear-algebraic lambda-calculus   [Arrighi,Dowek]




                                                                              10 / 10
Future directions (open problems)
          Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0  t and A ⇒ T ≡ T induces λx.0              0
  But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong)

                    A more interesting open question:
   Can we use this no determinism to define a probabilistic/quantum
                              language?

  Some clues:
      Similar to the linear-algebraic lambda-calculus   [Arrighi,Dowek]
      We need call-by-value (no-cloning)




                                                                              10 / 10
Future directions (open problems)
          Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0  t and A ⇒ T ≡ T induces λx.0              0
  But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong)

                     A more interesting open question:
   Can we use this no determinism to define a probabilistic/quantum
                              language?

  Some clues:
      Similar to the linear-algebraic lambda-calculus   [Arrighi,Dowek]
      We need call-by-value (no-cloning)
          In call-by-value,
                                   t(r + s)   tr + ts




                                                                              10 / 10
Future directions (open problems)
          Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0  t and A ⇒ T ≡ T induces λx.0                0
  But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong)

                     A more interesting open question:
   Can we use this no determinism to define a probabilistic/quantum
                              language?

  Some clues:
      Similar to the linear-algebraic lambda-calculus     [Arrighi,Dowek]
      We need call-by-value (no-cloning)
          In call-by-value,
                                   t(r + s)     tr + ts

          But      (A ∧ B) ⇒ C      ≡         (A ⇒ C ) ∧ (B ⇒ C )


                                                                                10 / 10
Future directions (open problems)
          Can we continue adding Di Cosmo’s isomorphisms?

  e.g. A ∧ T ≡ A induces t + 0  t and A ⇒ T ≡ T induces λx.0                0
  But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong)

                     A more interesting open question:
   Can we use this no determinism to define a probabilistic/quantum
                              language?

  Some clues:
      Similar to the linear-algebraic lambda-calculus     [Arrighi,Dowek]
      We need call-by-value (no-cloning)
          In call-by-value,
                                   t(r + s)     tr + ts

          But      (A ∧ B) ⇒ C      ≡         (A ⇒ C ) ∧ (B ⇒ C )
       Workaround: Use polymorphism: ∀X .X ⇒ CX            [Arrighi,Díaz-Caro]

                                                                                 10 / 10

More Related Content

PDF
Discussion of Fearnhead and Prangle, RSS< Dec. 14, 2011
PDF
Galois: A Language for Proofs Using Galois Connections and Fork Algebras
PPTX
Calculus- Basics
PPT
Formulae
PDF
Math 189 Exam 1 Solutions
PDF
Effects of the Discussion Groups Sizes on the Dynamics of Public Opinion
PDF
AP Calculus Slides April 17, 2008
PDF
PAGOdA poster
Discussion of Fearnhead and Prangle, RSS< Dec. 14, 2011
Galois: A Language for Proofs Using Galois Connections and Fork Algebras
Calculus- Basics
Formulae
Math 189 Exam 1 Solutions
Effects of the Discussion Groups Sizes on the Dynamics of Public Opinion
AP Calculus Slides April 17, 2008
PAGOdA poster

What's hot (20)

PDF
Sop and pos
PPTX
Polynomial
PPT
Ai4 heuristic2
PPT
3.1 2
PDF
Study of VBF/VBS in the LHC at 13 TeV and available tools
PDF
Lesson 4: Lines and Planes (slides + notes)
PDF
Analytic construction of elliptic curves and rational points
PDF
A new practical algorithm for volume estimation using annealing of convex bodies
PPT
1 polar coordinates
PDF
Stinespring’s theorem for maps on hilbert c star modules
PDF
Summary of Integration Methods
PPT
Probability Arunesh Chand Mankotia 2005
PDF
Pc 4.5 notes_graphing
PPT
A26-8 analyze poly graphs
PDF
Linear logic (and Linear Lisp)
PDF
slides_thesis
PPT
ECCV2008: MAP Estimation Algorithms in Computer Vision - Part 1
KEY
Week 12 - Trigonometry
PDF
Towards a one shot entanglement theory
Sop and pos
Polynomial
Ai4 heuristic2
3.1 2
Study of VBF/VBS in the LHC at 13 TeV and available tools
Lesson 4: Lines and Planes (slides + notes)
Analytic construction of elliptic curves and rational points
A new practical algorithm for volume estimation using annealing of convex bodies
1 polar coordinates
Stinespring’s theorem for maps on hilbert c star modules
Summary of Integration Methods
Probability Arunesh Chand Mankotia 2005
Pc 4.5 notes_graphing
A26-8 analyze poly graphs
Linear logic (and Linear Lisp)
slides_thesis
ECCV2008: MAP Estimation Algorithms in Computer Vision - Part 1
Week 12 - Trigonometry
Towards a one shot entanglement theory
Ad

Similar to Non determinism through type isomophism (20)

PDF
Proving Decidability of Intuitionistic Propositional Calculus on Coq
PDF
透明な真理観を巡って
PDF
Lect1 No 873503264
PDF
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
PDF
Math63032modal
PDF
10 modtab
PDF
On the proof theory for Description Logics
PDF
Slides used during my thesis defense "Du typage vectoriel"
PDF
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
PDF
TaPL名古屋 Chap2
PPT
Simplifiaction of grammar
PDF
Bounded arithmetic in free logic
PDF
Discrete mathematic question answers
PDF
Bounded arithmetic in free logic
PDF
Theory of Relations (1)
PDF
Slides QuAND 2011
PDF
Adgrams: Categories and Linguistics
PDF
04 - Sets
PDF
rinko2011-agh
Proving Decidability of Intuitionistic Propositional Calculus on Coq
透明な真理観を巡って
Lect1 No 873503264
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
Math63032modal
10 modtab
On the proof theory for Description Logics
Slides used during my thesis defense "Du typage vectoriel"
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...
TaPL名古屋 Chap2
Simplifiaction of grammar
Bounded arithmetic in free logic
Discrete mathematic question answers
Bounded arithmetic in free logic
Theory of Relations (1)
Slides QuAND 2011
Adgrams: Categories and Linguistics
04 - Sets
rinko2011-agh
Ad

More from Alejandro Díaz-Caro (12)

PDF
Typing quantum superpositions and measurement
PDF
A lambda calculus for density matrices with classical and probabilistic controls
PDF
Towards a quantum lambda-calculus with quantum control
PDF
Affine computation and affine automaton
PDF
Simply typed lambda-calculus modulo isomorphisms
PDF
The probability of non-confluent systems
PDF
Vectorial types, non-determinism and probabilistic systems: Towards a computa...
PDF
Quantum computing, non-determinism, probabilistic systems... and the logic be...
PDF
Call-by-value non-determinism in a linear logic type discipline
PDF
Linearity in the non-deterministic call-by-value setting
PDF
Equivalence of algebraic λ-calculi
PDF
A System F accounting for scalars
Typing quantum superpositions and measurement
A lambda calculus for density matrices with classical and probabilistic controls
Towards a quantum lambda-calculus with quantum control
Affine computation and affine automaton
Simply typed lambda-calculus modulo isomorphisms
The probability of non-confluent systems
Vectorial types, non-determinism and probabilistic systems: Towards a computa...
Quantum computing, non-determinism, probabilistic systems... and the logic be...
Call-by-value non-determinism in a linear logic type discipline
Linearity in the non-deterministic call-by-value setting
Equivalence of algebraic λ-calculi
A System F accounting for scalars

Non determinism through type isomophism

  • 1. Non determinism through type isomophism Alejandro Díaz-Caro Gilles Dowek LIPN, Université Paris 13, Sorbonne Paris Cité INRIA – Paris–Rocquencourt 7th LSFA Rio de Janeiro, September 29–30, 2012
  • 2. Motivation: Di Cosmo’s isomorphisms [Di Cosmo’95] - A∧B ≡B ∧A - A ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C - A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C ) - (A ∧ B) ⇒ C ≡ A ⇒ (B ⇒ C ) - A ⇒ (B ⇒ C ) ≡ B ⇒ (A ⇒ C ) - A∧T≡A - A⇒T≡T - T⇒A≡A - ∀X .∀Y .A ≡ ∀Y .∀X .A - ∀X .A ≡ ∀Y .A[Y = X ] - ∀X .(A ⇒ B) ≡ A ⇒ ∀X .B if X ∈ FV (A) / - ∀X .(A ∧ B) ≡ ∀X .A ∧ ∀X .B - ∀X .T ≡ T - ∀X .(A ∧ B) ≡ ∀X .∀Y .(A ∧ (B[Y = X ])) 2 / 10
  • 3. Motivation: Di Cosmo’s isomorphisms [Di Cosmo’95] - A∧B ≡B ∧A - A ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C - A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C ) - (A ∧ B) ⇒ C ≡ A ⇒ (B ⇒ C ) - A ⇒ (B ⇒ C ) ≡ B ⇒ (A ⇒ C ) - A∧T≡A - A⇒T≡T We want a proof-system - T⇒A≡A where isomorphic proposi- - ∀X .∀Y .A ≡ ∀Y .∀X .A tions have the same proofs - ∀X .A ≡ ∀Y .A[Y = X ] - ∀X .(A ⇒ B) ≡ A ⇒ ∀X .B if X ∈ FV (A) / - ∀X .(A ∧ B) ≡ ∀X .A ∧ ∀X .B - ∀X .T ≡ T - ∀X .(A ∧ B) ≡ ∀X .∀Y .(A ∧ (B[Y = X ])) 2 / 10
  • 4. Minimal second order propositional logic Γ, x : A t:B Γ t:A⇒B Γ s:A Γ, x : A x :A Γ λx.t : A ⇒ B Γ ts : B Γ t:A Γ t : ∀X .A X ∈ FV (Γ) / Γ t : ∀X .A Γ t : A[B/X ] 3 / 10
  • 5. Minimal second order propositional logic Γ, x : A t:B Γ t:A⇒B Γ s:A Γ, x : A x :A Γ λx.t : A ⇒ B Γ ts : B Γ t:A Γ t : ∀X .A X ∈ FV (Γ) / Γ t : ∀X .A Γ t : A[B/X ] Adding conjunction Γ t:A Γ r:B Γ t, r :A∧B 3 / 10
  • 6. Minimal second order propositional logic Γ, x : A t:B Γ t:A⇒B Γ s:A Γ, x : A x :A Γ λx.t : A ⇒ B Γ ts : B Γ t:A Γ t : ∀X .A X ∈ FV (Γ) / Γ t : ∀X .A Γ t : A[B/X ] Adding conjunction Γ t:A Γ r:B Γ t, r :A∧B We want A ∧ B = B ∧A A ∧ (B ∧ C ) = (A ∧ B) ∧ C so t, r = r, t t, r, s = t, r , s 3 / 10
  • 7. Minimal second order propositional logic Γ, x : A t:B Γ t:A⇒B Γ s:A Γ, x : A x :A Γ λx.t : A ⇒ B Γ ts : B Γ t:A Γ t : ∀X .A X ∈ FV (Γ) / Γ t : ∀X .A Γ t : A[B/X ] Adding conjunction Γ t:A Γ r:B Γ t+r :A∧B We want A ∧ B = B ∧A We write A ∧ (B ∧ C ) = (A ∧ B) ∧ C t+r=r+t so t, r = r, t t + (r + s) = (t + r) + s t, r, s = t, r , s 3 / 10
  • 8. Minimal second order propositional logic Γ, x : A t:B Γ t:A⇒B Γ s:A Γ, x : A x :A Γ λx.t : A ⇒ B Γ ts : B Γ t:A Γ t : ∀X .A X ∈ FV (Γ) / Γ t : ∀X .A Γ t : A[B/X ] Adding conjunction Γ t:A Γ r:B Γ t+r :A∧B We want A ∧ B = B ∧A We write A ∧ (B ∧ C ) = (A ∧ B) ∧ C t+r=r+t so t, r = r, t t + (r + s) = (t + r) + s t, r, s = t, r , s λx.(t + r) = λx.t + λx.r Also A ⇒ (B ∧ C ) = (A ⇒ B) ∧ (A ⇒ C ) induces (t + r)s = ts + rs 3 / 10
  • 9. What about ∧-elimination? Γ t+r:A∧B Γ π1 (t + r) : A 4 / 10
  • 10. What about ∧-elimination? Γ t+r:A∧B Γ t+r:B ∧A But A ∧ B = B ∧ A !! Γ π1 (t + r) : A Γ π1 (t + r) : B Moreover t+r=r+t so π1 (t + r) = π1 (r + t) !! 4 / 10
  • 11. What about ∧-elimination? Γ t+r:A∧B Γ t+r:B ∧A But A ∧ B = B ∧ A !! Γ π1 (t + r) : A Γ π1 (t + r) : B Moreover t+r=r+t so π1 (t + r) = π1 (r + t) !! Workaround: Church-style. Project w.r.t. a type If Γ t : A then πA (t + r) → t 4 / 10
  • 12. What about ∧-elimination? Γ t+r:A∧B Γ t+r:B ∧A But A ∧ B = B ∧ A !! Γ π1 (t + r) : A Γ π1 (t + r) : B Moreover t+r=r+t so π1 (t + r) = π1 (r + t) !! Workaround: Church-style. Project w.r.t. a type If Γ t : A then πA (t + r) → t This induces non-determinism Γ t:A πA (t + r) → t If then Γ r:A πA (t + r) → r 4 / 10
  • 13. What about ∧-elimination? Γ t+r:A∧B Γ t+r:B ∧A But A ∧ B = B ∧ A !! Γ π1 (t + r) : A Γ π1 (t + r) : B Moreover t+r=r+t so π1 (t + r) = π1 (r + t) !! Workaround: Church-style. Project w.r.t. a type If Γ t : A then πA (t + r) → t This induces non-determinism Γ t:A πA (t + r) → t If then Γ r:A πA (t + r) → r We are interested in the proof theory and both t and r are valid proofs of A 4 / 10
  • 14. The calculus Types A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A Equivalences A∧B ≡ B ∧A (A ∧ B) ∧ C ≡ A ∧ (B ∧ C ) A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C ) 5 / 10
  • 15. The calculus Types A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A Equivalences A∧B ≡ B ∧A (A ∧ B) ∧ C ≡ A ∧ (B ∧ C ) A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C ) Terms t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A} | t + r | πA (t) 5 / 10
  • 16. The calculus Types A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A Equivalences A∧B ≡ B ∧A (A ∧ B) ∧ C ≡ A ∧ (B ∧ C ) A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C ) Terms t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A} | t + r | πA (t) Reduction rules (λx A .t)r → t[r/x] (ΛX .t){A} → t[A/X ] πA (t + r) → t (if Γ t : A) 5 / 10
  • 17. The calculus Types A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A Equivalences A∧B ≡ B ∧A (A ∧ B) ∧ C ≡ A ∧ (B ∧ C ) A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C ) Terms t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A} | t + r | πA (t) Reduction rules (λx A .t)r → t[r/x] (ΛX .t){A} → t[A/X ] πA (t + r) → t (if Γ t : A) t+r r+t (t + r) + s t + (r + s) (t + r)s ts + rs λx A .(t + r) λx A .t + λx A .r πA⇒B (t)r πB (tr) (if Γ t : A ⇒ (B ∧ C )) 5 / 10
  • 18. The calculus Types Γ, x : A t:B A, B, C ::= X | A ⇒ B | A ∧ B | ∀X .A ax ⇒I Γ, x : A x :A A Γ λx .t : A ⇒ B Equivalences A∧B ≡ B ∧A Γ t:A⇒B Γ s:A (A ∧ B) ∧ C ≡ A ∧ (B ∧ C ) ⇒E Γ ts : B A ⇒ (B ∧ C ) ≡ (A ⇒ B) ∧ (A ⇒ C ) Γ t:A X ∈ FV (Γ) / Γ t : ∀X .A ∀I ∀E Terms Γ ΛX .t : ∀X .A Γ t{B} : A[B/X ] t, r, s ::= x A | λx A .t | tr | ΛX .t | t{A} | t + r | πA (t) Γ t:A Γ r:B Γ t:A∧B Reduction rules ∧I ∧E (λx A .t)r → t[r/x] Γ t+r:A∧B Γ πA (t) : A (ΛX .t){A} → t[A/X ] Γ t:A A≡B πA (t + r) → t (if Γ t : A) ≡ t+r r+t Γ t:B (t + r) + s t + (r + s) (t + r)s ts + rs Theorem (Subject reduction) λx A .(t + r) λx A .t + λx A .r πA⇒B (t)r πB (tr) If Γ t : A and t → r then Γ r:A (if Γ t : A ⇒ (B ∧ C )) with → := → or 5 / 10
  • 19. Example (I) λx A∧B .x : (A ∧ B) ⇒ (A ∧ B) 6 / 10
  • 20. Example (I) λx A∧B .x : (A ∧ B) ⇒ (A ∧ B) (A ∧ B) ⇒ (A ∧ B) ≡ ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B) 6 / 10
  • 21. Example (I) λx A∧B .x : (A ∧ B) ⇒ (A ∧ B) (A ∧ B) ⇒ (A ∧ B) ≡ ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B) Hence π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A 6 / 10
  • 22. Example (I) λx A∧B .x : (A ∧ B) ⇒ (A ∧ B) (A ∧ B) ⇒ (A ∧ B) ≡ ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B) Hence π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A Let r:A∧B 6 / 10
  • 23. Example (I) λx A∧B .x : (A ∧ B) ⇒ (A ∧ B) (A ∧ B) ⇒ (A ∧ B) ≡ ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B) Hence π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A Let r:A∧B π(A∧B)⇒A (λx A∧B .x) r : A 6 / 10
  • 24. Example (I) λx A∧B .x : (A ∧ B) ⇒ (A ∧ B) (A ∧ B) ⇒ (A ∧ B) ≡ ((A ∧ B) ⇒ A) ∧ ((A ∧ B) ⇒ B) Hence π(A∧B)⇒A (λx A∧B .x) : (A ∧ B) ⇒ A Let r:A∧B π(A∧B)⇒A (λx A∧B .x) r : A π(A∧B)⇒A (λx A∧B .x)r πA ((λx A∧B .x)r) → πA (r) 6 / 10
  • 25. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) 7 / 10
  • 26. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) B ⇒ B ⇒ (B ∧ B) ≡ (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B) 7 / 10
  • 27. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) B ⇒ B ⇒ (B ∧ B) ≡ (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B) πB⇒B⇒B (TF) : B ⇒ B ⇒ B 7 / 10
  • 28. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) B ⇒ B ⇒ (B ∧ B) ≡ (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B) πB⇒B⇒B (TF) : B ⇒ B ⇒ B Let t:B and f:B 7 / 10
  • 29. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) B ⇒ B ⇒ (B ∧ B) ≡ (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B) πB⇒B⇒B (TF) : B ⇒ B ⇒ B Let t:B and f:B πB⇒B⇒B (TF) t f 7 / 10
  • 30. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) B ⇒ B ⇒ (B ∧ B) ≡ (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B) πB⇒B⇒B (TF) : B ⇒ B ⇒ B Let t:B and f:B πB⇒B⇒B (TF) t f πB⇒B ((TF)t) f 7 / 10
  • 31. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) B ⇒ B ⇒ (B ∧ B) ≡ (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B) πB⇒B⇒B (TF) : B ⇒ B ⇒ B Let t:B and f:B πB⇒B⇒B (TF) t f πB⇒B ((TF)t) f πB ((TF)tf) 7 / 10
  • 32. Example (II) TF = λx B .λy B .(x + y ) TF : B ⇒ B ⇒ (B ∧ B) B ⇒ B ⇒ (B ∧ B) ≡ (B ⇒ B ⇒ B) ∧ (B ⇒ B ⇒ B) πB⇒B⇒B (TF) : B ⇒ B ⇒ B Let t:B and f:B πB⇒B⇒B (TF) t f πB⇒B ((TF)t) f πB ((TF)tf) 7Õ 3t → πB (t + f) % y +f 7 / 10
  • 33. Confluence (some ideas) Of course, a non-deterministic calculus is not confluent! Counterexample πA (x A + y A ) x & xA yA | | ' w ? 8 / 10
  • 34. Confluence (some ideas) Of course, a non-deterministic calculus is not confluent! Counterexample πA (x A + y A ) x & xA yA | | ' w ? However, we can prove it keeps some coherence Confluence of the deterministic fragment Confluence of the “term ensembles” e.g. t z " {ri }i t # } {ri }i [Arrighi,Díaz-Caro,Gadella,Grattage’08] 8 / 10
  • 35. Conclusions (with some examples) Proof system Let t be a proof of A and r be a proof of B so t + r is a proof of both A ∧ B and B ∧ A Non deterministic calculus t = ΛX .λx X .λy X .x t ff = ΛX .λx X .λy X .y B = ∀X .X ⇒ X ⇒ X t + ff : B ∧ B πB (t + ff ) : B t { # t ff So far: - Proof system where (three) isomorphic types get the same proofs - Non-deterministic calculus 9 / 10
  • 36. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 10 / 10
  • 37. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong) 10 / 10
  • 38. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong) A more interesting open question: Can we use this no determinism to define a probabilistic/quantum language? 10 / 10
  • 39. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong) A more interesting open question: Can we use this no determinism to define a probabilistic/quantum language? Some clues: Similar to the linear-algebraic lambda-calculus [Arrighi,Dowek] 10 / 10
  • 40. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong) A more interesting open question: Can we use this no determinism to define a probabilistic/quantum language? Some clues: Similar to the linear-algebraic lambda-calculus [Arrighi,Dowek] We need call-by-value (no-cloning) 10 / 10
  • 41. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong) A more interesting open question: Can we use this no determinism to define a probabilistic/quantum language? Some clues: Similar to the linear-algebraic lambda-calculus [Arrighi,Dowek] We need call-by-value (no-cloning) In call-by-value, t(r + s) tr + ts 10 / 10
  • 42. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong) A more interesting open question: Can we use this no determinism to define a probabilistic/quantum language? Some clues: Similar to the linear-algebraic lambda-calculus [Arrighi,Dowek] We need call-by-value (no-cloning) In call-by-value, t(r + s) tr + ts But (A ∧ B) ⇒ C ≡ (A ⇒ C ) ∧ (B ⇒ C ) 10 / 10
  • 43. Future directions (open problems) Can we continue adding Di Cosmo’s isomorphisms? e.g. A ∧ T ≡ A induces t + 0 t and A ⇒ T ≡ T induces λx.0 0 But if T ⇒ T ≡ T then (λx T .xx)(λx T .xx) : T (wrong) A more interesting open question: Can we use this no determinism to define a probabilistic/quantum language? Some clues: Similar to the linear-algebraic lambda-calculus [Arrighi,Dowek] We need call-by-value (no-cloning) In call-by-value, t(r + s) tr + ts But (A ∧ B) ⇒ C ≡ (A ⇒ C ) ∧ (B ⇒ C ) Workaround: Use polymorphism: ∀X .X ⇒ CX [Arrighi,Díaz-Caro] 10 / 10