Slides QuAND 2011

Click here to load reader

  • date post

    18-Dec-2014
  • Category

    Technology

  • view

    118
  • download

    0

Embed Size (px)

description

The linear-algebraic λ-calculus and the algebraic λ-calculus are untyped λ-calculi extended with arbitrary linear combinations of terms. The former presents the axioms of linear algebra in the form of a rewrite system, while the latter uses equalities. When given by rewrites, algebraic λ-calculi are not confluent unless further restrictions are added. We provide a type system for the linear-algebraic λ-calculus enforcing strong normalisation, which gives back confluence. The type system allows an interpretation in System F.

Transcript of Slides QuAND 2011

  • 1. Conuence via strong normalisation in an algebraic -calculus with rewriting Accepted in LSFA 2011. To appear in EPTCS Pablo Buiras1 Alejandro Daz-Caro2 Mauro Jaskelio1,3 1 Universidad Nacional de Rosario, FCEIA, Argentina 2 Universit de Grenoble, LIG, France 3 CIFASIS-CONICET, Argentina Recontre QuAND July 18, 2011 Marseille, France
  • 2. M, N ::= x | x.M | (M)N | M + N | .M | 0 Beta reduction: (x.M)N M[x := N] Algebraic reductions: .M + .M ( + ).M, (M)(N1 + N2 ) (M)N1 + (M)N2 , ... ... ... (oriented version of the axioms of vectorial spaces)Two origins: Dierential -calculus: capturing linearity la Linear Logic Removing the dierential operator : Algebraic -calculus (alg ) [Vaux09] Quantum computing: superposition of programs Linearity as in algebra: Linear-algebraic -calculus (lin )[Arrighi,Dowek08] 2 / 15
  • 3. M, N ::= x | x.M | (M)N | M + N | .M | 0 Beta reduction: (x.M)N M[x := N] Algebraic reductions: .M + .M ( + ).M, (M)(N1 + N2 ) (M)N1 + (M)N2 , ... ... ... (oriented version of the axioms of vectorial spaces) alg lin Origin Linear Logic Quantum computingStrategy Call-by-name Call-by-value 2 / 15
  • 4. Conuence issues YB = (x.(B + (x)x))x.(B + (x)x) YB B + YB B + B + YB . . . 3 / 15
  • 5. Conuence issues YB = (x.(B + (x)x))x.(B + (x)x) YB B + YB B + B + YB . . . YB + (1).YB (1 1).YB 0 B + YB + (1).YB B 3 / 15
  • 6. Conuence issues YB = (x.(B + (x)x))x.(B + (x)x) YB B + YB B + B + YB . . . YB + (1).YB (1 1).YB 0 B + YB + (1).YB Solution 1 (lin ): .M + .M ( + ).M only if M is closed-normal B and others similar restrictions 3 / 15
  • 7. Conuence issues YB = (x.(B + (x)x))x.(B + (x)x) YB B + YB B + B + YB . . . YB + (1).YB (1 1).YB 0 B + YB + (1).YB Solution 1 (lin ): .M + .M ( + ).M only if M is closed-normal B and others similar restrictions Solution 2 (alg ): Only positive numbers 3 / 15
  • 8. Conuence issues YB = (x.(B + (x)x))x.(B + (x)x) YB B + YB B + B + YB . . . YB + (1).YB (1 1).YB 0 B + YB + (1).YB Solution 1 (lin ): .M + .M ( + ).M only if M is closed-normal B and others similar restrictions Solution 2 (alg ): Only positive numbers YB + YB B + YB + YB B + 2.YB 2.YB ... and equalities 3 / 15
  • 9. Conuence issues YB = (x.(B + (x)x))x.(B + (x)x) YB B + YB B + B + YB . . . YB + (1).YB (1 1).YB 0 B + YB + (1).YB Solution 1 (lin ): .M + .M ( + ).M only if M is closed-normal B and others similar restrictions Solution 2 (alg ): Only positive numbers YB + YB B + YB + YB B + 2.YB 2.YB ... and equalities Objective: to forbid 3 / 15
  • 10. Conuence issues YB = (x.(B + (x)x))x.(B + (x)x) YB B + YB B + B + YB . . . YB + (1).YB (1 1).YB 0 B + YB + (1).YB Solution 1 (lin ): .M + .M ( + ).M only if M is closed-normal B and others similar restrictions Solution 2 (alg ): Only positive numbers Solution 3: YB + YB B + YB + YB B + 2.YB forbid ! (type system) 2.YB ... and equalities Objective: to forbid 3 / 15
  • 11. Possible type systems Straightforward extension of a classic type system M:T N:T M:T +I I 0I M +N :T .M : T 0:T Pros: Cons: Simple Too restrictive 4 / 15
  • 12. Possible type systems Straightforward extension of a classic type system M:T N:T M:T +I I 0I M +N :T .M : T 0:T Pros: Cons: Simple Too restrictive Scalar type system [Arrighi, Daz-Caro 2009] M : .T N : .T M:T +I I 0I M + N : ( + ).T .M : .T 0 : 0.T Pros: Cons: Characterises the amount Still too restrictive of terms 4 / 15
  • 13. Possible type systems Additive type system [Daz-Caro, Petit 2010] M:T N:R XXX : T M +I X 0I M +N :T +R XXX I .M : .T X 0:0 Pros: Cons: More versatile Dened for a fragment Interpretation in System F (no scalars!) with pairs 5 / 15
  • 14. Possible type systems Additive type system [Daz-Caro, Petit 2010] M:T N:R XXX : T M +I X 0I M +N :T +R XXX I .M : .T X 0:0 Pros: Cons: More versatile Dened for a fragment Interpretation in System F (no scalars!) with pairs Vectorial type system [Arrighi, Daz-Caro, Valiron 2011] M:T N:R M:T M:T +I I 0I M +N :T +R .M : .T 0 : 0.T Pros: Cons: Much more versatile Complex Good characterisation of Overkill (conuence!) terms 5 / 15
  • 15. Possible type systems Additive type system [Daz-Caro, Petit 2010] M:T N:R XXX : T M +I X 0I M +N :T +R XXX I .M : .T X 0:0 Pros: Cons: More versatile Dened for a fragment Interpretation in System F (no scalars!) with pairs Vectorial type system [Arrighi, Daz-Caro, Valiron 2011] M:T N:R M:T M:T +I I 0I M +N :T +R .M : .T 0 : 0.T Pros: Cons: Much more versatile Complex Good characterisation of Overkill (conuence!) terms Idea: extend Additive 5 / 15
  • 16. Idea: CA - Extend additive Key idea M:T .M : .T = T + + T 6 / 15
  • 17. Idea: CA - Extend additive Key idea M:T .M : .T = T + + T If M : T, then (0.9).M + (1.1).M : T (0.9).M + (1.1).M 2.M and 2.M : 2.T 6 / 15
  • 18. Idea: CA - Extend additive Key idea M:T .M : .T = T + + T If M : T, then (0.9).M + (1.1).M : T (0.9).M + (1.1).M 2.M and 2.M : 2.T Theorem (weak subject reduction) M N, M:T N : R with T R 6 / 15
  • 19. Unicity of types Second problem: M + M 2.M If M : T and M : R, 2.M :? 7 / 15
  • 20. Unicity of types Second problem: M + M 2.M If M : T and M : R, 2.M :? Solution: Church style 7 / 15
  • 21. Conuence Local conuence + Strong normalisation Conuence 8 / 15
  • 22. Conuence Local conuence + Strong normalisation Conuence Local conuence: Coq proof. 8 / 15
  • 23. Conuence Local conuence + Strong normalisation Conuence Local conuence: Coq proof. Strong normalisation: Plan Translation from CA to lin (i.e. remove annotations) Preservation of reduction by the translation Typability in CA Typability in Vectorial SN in Vectorial SN in CA 8 / 15
  • 24. Strong normalisation |M| is the term M without type annotations 9 / 15
  • 25. Strong normalisation |M| is the term M without type annotations Lemma If M N, then |M| = |N| v where |M| = |N| only when M N is a type beta reduction. 9 / 15
  • 26. Strong normalisation |M| is the term M without type annotations Lemma If M N, then |M| = |N| v where |M| = |N| only when M N is a type beta reduction. Lemma M:T v |M| : R 9 / 15
  • 27. Strong normalisation Lemma There is no innite sequence reduction consisting only of type beta rules 10 / 15
  • 28. Strong normalisation Lemma There is no innite sequence reduction consisting only of type beta rules Proof. Dene: (x : U) = 1 (X .t) = 1 + (t) ([email protected]) = (t) (x : U.t) = (t) ((t) r) = (t) (r) (0) = 1 (.t) = (t) (t + r) = (t) + (r) Induction on M: ((X .M)@T ) > (M[X /T ]). 10 / 15
  • 29. Strong normalisation Theorem (Strong normalisation) M : T M is SN 11 / 15
  • 30. Strong normalisation Theorem (Strong normalisation) M : T M is SN Proof. M:T v |M| : R |M| is SN 11 / 15
  • 31. Strong normalisation Theorem (Strong normalisation) M : T M is SN Proof. M : T v |M| : R |M| is SN Assume M not SN: M M1 M2 11 / 15
  • 32. Strong normalisation Theorem (Strong normalisation) M : T M is SN Proof. M : T v |M| : R |M| is SN Assume M not SN: M M1 M2 Then |M| = |M1 | = |M2 | = v v v 11 / 15
  • 33. Strong normalisation Theorem (Strong normalisation) M : T M is SN Proof. M : T v |M| : R |M| is SN Assume M not SN: M M1 M2 Then |M| = |M1 | = |M2 | = v v v |M| is SN i > n |Mi | = |Mi+1 | 11 / 15
  • 34. Strong normalisation Theorem (Strong normalisation) M : T M is SN Proof. M : T v |M| : R |M| is SN Assume M not SN: M M1 M2 Then |M| = |M1 | = |M2 | = v v v |M| is SN i > n |Mi | = |Mi+1 | Then Mi Mi+1 are type beta reductions. 11 / 15
  • 35. Strong normalisation Theorem (Strong normalisation) M : T M is SN Proof. M : T v |M| : R |M| is SN Assume M not SN: M M1 M2 Then |M| = |M1 | = |M2 | = v v v |M| is SN i > n |Mi | = |Mi+1 | Then Mi Mi+1 are type beta reductions. Then Mi must be SN. Absurd. 11 / 15
  • 36. Abstract interpretation Translation to additive: (.M) = (M) i=1 12 / 15
  • 37. Abstract interpretation Translation to additive: (.M) = (M) i=1 Theorem (Abstract interpretation) (M) a (M ) 12 / 15
  • 38. Abstract interpretation Translation to additive: (.M) = (M) i=1 Theorem (Abstract interpretation) (M) a (M ) Lemma (Typing preservation) M:T a (M) : T 12 / 15
  • 39. Abstract interpretation [] CA / add / Fp a F ( ) ( ) CA / add / Fp [] 13 / 15
  • 40. Contributions Powerful alternative to Vectorial (extension of Additive) (weak) Subject reduction Strong normalisation (via translation to Vectorial) Conuence (via SN) Abstract interpretation in System F with pairs (via Additive) 14 / 15
  • 41. Possible extensions Taking also the ceil to have intervals... [Philippe Jorrand] .M : [ , ].T (better approximations) 15 / 15
  • 42. Possible extensions Taking also the ceil to have intervals... [Philippe Jorrand] .M : [ , ].T (better approximations) pairs to represent negatives... [Simon Perdrix] .M : ( , ).T .M : ( , ).T 15 / 15
  • 43. Possible extensions Taking also the ceil to have intervals... [Philippe Jorrand] .M : [ , ].T (better approximations) pairs to represent negatives... [Simon Perdrix] .M : ( , ).T .M : ( , ).T Complexes... [Simon Perdrix] ( i).M : [( , ), ( , )].T etc. 15 / 15