101

A System F accounting for scalars

Embed Size (px)

DESCRIPTION

The linear-algebraic lambda-calculus (arXiv:quant-ph/0612199) extends the lambda-calculus with the possibility of making arbitrary linear combinations of lambda-calculus terms a.t+b.u. In this paper we provide a System F -like type system for the linear-algebraic lambda-calculus, which keeps track of \'the amount of a type\' that is present in a term. We show that this scalar type system enjoys both the subject-reduction property and the strong-normalisation property, which constitute our main technical results. The latter yields a significant simplification of the linear-algebraic lambda-calculus itself, by removing the need for some restrictions in its reduction rules - and thus leaving it more intuitive. More importantly we show that our type system can readily be modified into a probabilistic type system, which guarantees that terms define correct probabilistic functions. Thus we are able to specialize the linear-algebraic lambda-calculus into a higher-order, probabilistic lambda-calculus. Finally we discuss the more long-term aims of this reseach in terms of establishing connections with linear logic, and building up towards a quantum physical logic through the Curry-Howard isomorphism. Thus we begin to investigate the logic induced by the scalar type system, and prove a no-cloning theorem expressed solely in terms of the possible proof methods in this logic.

Citation preview

Page 1: A System F accounting for scalars

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)

Page 2: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Global context

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

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

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

What are quantum types?

1Birkho�, G. and J. von Neumann, The logic of quantum mechanics,Annals of Mathematics 37 (1936), pp. 823�843.

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

Page 3: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Global context

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

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

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

What are quantum types?

1Birkho�, G. and J. von Neumann, The logic of quantum mechanics,Annals of Mathematics 37 (1936), pp. 823�843.

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

Page 4: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Global context

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

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

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

What are quantum types?

1Birkho�, G. and J. von Neumann, The logic of quantum mechanics,Annals of Mathematics 37 (1936), pp. 823�843.

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

Page 5: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Global context

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

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

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

What are quantum types?

1Birkho�, G. and J. von Neumann, The logic of quantum mechanics,Annals of Mathematics 37 (1936), pp. 823�843.

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

Page 6: A System F accounting for scalars

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 αibi .

Evolutions are (unitary) linear operators U.v′ = Uv.

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

Page 7: A System F accounting for scalars

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 αibi .

Evolutions are (unitary) linear operators U.v′ = Uv.

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

Page 8: A System F accounting for scalars

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 αibi .

Evolutions are (unitary) linear operators U.v′ = Uv.

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

Page 9: A System F accounting for scalars

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 αibi .

Evolutions are (unitary) linear operators U.v′ = Uv.

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

Page 10: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

No-cloning theorem

Statement: 6 ∃U / ∀v : Uv = v⊗ v.Proof:Vector space of o.n.b. (bi ), so v =

∑i

αibi . We can have

Ubi = bi ⊗ bi (=copying, OK)But then

Uv = U∑i

αibi =∑i

αiUbi

=∑i

αibi ⊗ bi 6=∑ij

αiαjbi ⊗ bj

= (∑i

αibi )⊗ (∑j

αjbj)

= v⊗ v (=cloning, Not OK)

Con�icts with β-reduction?

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

Page 11: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

No-cloning theorem

Statement: 6 ∃U / ∀v : Uv = v⊗ v.Proof:Vector space of o.n.b. (bi ), so v =

∑i

αibi . We can have

Ubi = bi ⊗ bi (=copying, OK)But then

Uv = U∑i

αibi =∑i

αiUbi

=∑i

αibi ⊗ bi 6=∑ij

αiαjbi ⊗ bj

= (∑i

αibi )⊗ (∑j

αjbj)

= v⊗ v (=cloning, Not OK)

Con�icts with β-reduction?

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

Page 12: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-Calculus2The language

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or avariable.

(**) u closed normal.(***) u and u + v closed normal.

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u+β.u→ (α+β).u. (**)

Application rules such asu (v + w)→ (u v) + (u w).(***)

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

encodings and con�uence. Lecture Notes in Computer Science (RTA'08), 5117(2008), pp. 17�31.

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

Page 13: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-Calculus2The language

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or avariable.

(**) u closed normal.(***) u and u + v closed normal.

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u+β.u→ (α+β).u. (**)

Application rules such asu (v + w)→ (u v) + (u w).(***)

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

encodings and con�uence. Lecture Notes in Computer Science (RTA'08), 5117(2008), pp. 17�31.

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

Page 14: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-Calculus2The language

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or avariable.

(**) u closed normal.(***) u and u + v closed normal.

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u+β.u→ (α+β).u. (**)

Application rules such asu (v + w)→ (u v) + (u w).(***)

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

encodings and con�uence. Lecture Notes in Computer Science (RTA'08), 5117(2008), pp. 17�31.

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

Page 15: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-Calculus2The language

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or avariable.

(**) u closed normal.(***) u and u + v closed normal.

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u+β.u→ (α+β).u. (**)

Application rules such asu (v + w)→ (u v) + (u w).(***)

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

encodings and con�uence. Lecture Notes in Computer Science (RTA'08), 5117(2008), pp. 17�31.

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

Page 16: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : Copying vs Cloning

Untyped λ-calculus + linear algebra ⇒ Cloning?

λx .(x ⊗ x)∑i

αibi →∗∑i

αibi ⊗ bi

(∑i

αibi )⊗ (∑i

αibi )

No-cloning says bottom reduction forbidden. We must delay betareduction 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

Page 17: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : Copying vs Cloning

Untyped λ-calculus + linear algebra ⇒ Cloning?

λx .(x ⊗ x)∑i

αibi →∗∑i

αibi ⊗ bi

(∑i

αibi )⊗ (∑i

αibi )

No-cloning says bottom reduction forbidden. We must delay betareduction 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

Page 18: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : Copying vs Cloning

Untyped λ-calculus + linear algebra ⇒ Cloning?

λx .(x ⊗ x)∑i

αibi →∗∑i

αibi ⊗ bi

(∑i

αibi )⊗ (∑i

αibi )

No-cloning says bottom reduction forbidden. We must delay betareduction 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

Page 19: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : In�nities

Untyped λ-calculus + linear algebra ⇒∞

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

Yb→ b + Yb

But whoever says in�nity says trouble says. . . inde�nite 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

Page 20: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : In�nities

Untyped λ-calculus + linear algebra ⇒∞

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

Yb→ b + Yb

But whoever says in�nity says trouble says. . . inde�nite 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

Page 21: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : In�nities

Untyped λ-calculus + linear algebra ⇒∞

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

Yb→ b + Yb

But whoever says in�nity says trouble says. . .

inde�nite 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

Page 22: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : In�nities

Untyped λ-calculus + linear algebra ⇒∞

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

Yb→ b + Yb

But whoever says in�nity says trouble says. . . inde�nite 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

Page 23: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : In�nities

Untyped λ-calculus + linear algebra ⇒∞

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

Yb→ b + Yb

But whoever says in�nity says trouble says. . . inde�nite 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

Page 24: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

Linear-Algebraic λ-CalculusWhy the restrictions : In�nities

Untyped λ-calculus + linear algebra ⇒∞

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

Yb→ b + Yb

But whoever says in�nity says trouble says. . . inde�nite 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

Page 25: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStraightforward extension of System F (λ2la)

System F rules plus simple rules to type algebraic terms

ax0Γ ` 0 :A

Γ ` u :A Γ ` v :A+I

Γ ` u + v :A

Γ ` t :AαI

Γ ` α.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

Page 26: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStraightforward extension of System F (λ2la)

System F rules plus simple rules to type algebraic terms

ax0Γ ` 0 :A

Γ ` u :A Γ ` v :A+I

Γ ` u + v :A

Γ ` t :AαI

Γ ` α.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

Page 27: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStraightforward extension of System F (λ2la)

System F rules plus simple rules to type algebraic terms

ax0Γ ` 0 :A

Γ ` u :A Γ ` v :A+I

Γ ` u + v :A

Γ ` t :AαI

Γ ` α.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

Page 28: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la

SN: Set of strongly normalising terms

A subset X ∈ SN is saturated if1 ∀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 ⇒((∑

i∈I

ui

)w1

). . . wn ∈ X ;

6 ∀i ∈ I , (u wi ) ∈ X ⇒ u

(∑i∈I

wi

)∈ X ;

7 α.((t1 t2) . . . tn)∈X ⇔ ((t1 t2) . . . α.tk) . . . tn∈X (1≤k≤n);8 0 ∈ X ;9 ∀−→t ∈ SN, (0

−→t ) ∈ X ;

10 ∀t,−→u ∈ SN, (t 0) −→u ∈ X .

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

Page 29: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la

SN: Set of strongly normalising termsA 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 ⇒((∑

i∈I

ui

)w1

). . . wn ∈ X ;

6 ∀i ∈ I , (u wi ) ∈ X ⇒ u

(∑i∈I

wi

)∈ X ;

7 α.((t1 t2) . . . tn)∈X ⇔ ((t1 t2) . . . α.tk) . . . tn∈X (1≤k≤n);8 0 ∈ X ;9 ∀−→t ∈ SN, (0

−→t ) ∈ X ;

10 ∀t,−→u ∈ SN, (t 0) −→u ∈ X .

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

Page 30: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la

SN: Set of strongly normalising termsA 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 ⇒((∑

i∈I

ui

)w1

). . . wn ∈ X ;

6 ∀i ∈ I , (u wi ) ∈ X ⇒ u

(∑i∈I

wi

)∈ X ;

7 α.((t1 t2) . . . tn)∈X ⇔ ((t1 t2) . . . α.tk) . . . tn∈X (1≤k≤n);8 0 ∈ X ;9 ∀−→t ∈ SN, (0

−→t ) ∈ X ;

10 ∀t,−→u ∈ SN, (t 0) −→u ∈ X .

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

Page 31: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la (II)

Re�ning the sketch:

The idea is that types �correspond� to saturated sets.

This correspondance is achived by a maping from types toSAT .

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

Page 32: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la (II)

Re�ning the sketch:

The idea is that types �correspond� to saturated sets.

This correspondance is achived by a maping from types toSAT .

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

Page 33: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la (III)

Lemma1 SN ∈ SAT,

2 A,B ∈ SAT ⇒ A→ B ∈ SAT,

3 For all collection Ai of members of SAT,⋂

i Ai ∈ SAT,

De�nition (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

Page 34: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la (III)

Lemma1 SN ∈ SAT,

2 A,B ∈ SAT ⇒ A→ B ∈ SAT,

3 For all collection Ai of members of SAT,⋂

i Ai ∈ SAT,

De�nition (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

Page 35: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la (III)

Lemma1 SN ∈ SAT,

2 A,B ∈ SAT ⇒ A→ B ∈ SAT,

3 For all collection Ai of members of SAT,⋂

i Ai ∈ SAT,

De�nition (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

Page 36: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la (IV)

De�nition (�)

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

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

Re�ning the sketch: Prove that Γ ` t :T ⇒ Γ � t :T

We prove this by induction on the derivation of Γ ` t :T (In factthe de�nition of � is slightly di�erent to strengthen the inductionhypothesis)

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

Page 37: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FStrong normalization of λ2la (IV)

De�nition (�)

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

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

Re�ning the sketch: Prove that Γ ` t :T ⇒ Γ � t :T

We prove this by induction on the derivation of Γ ` t :T (In factthe de�nition of � is slightly di�erent to strengthen the inductionhypothesis)

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

Page 38: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

xi ∈ [[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

Page 39: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

xi ∈ [[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

Page 40: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

xi ∈ [[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

Page 41: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

xi ∈ [[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

Page 42: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

xi ∈ [[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

Page 43: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FLinear-Algebraic λ-Calculus with λ2la

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or a variable.

Every typable term is strongnormalizingHence Yb is no typable!t− t→ 0 always, so it is notnecesary to reduce t �rst. we canremove the closed-normalrestrictions!

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u + β.u→ (α + β).u.

Application rules such asu (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

Page 44: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FLinear-Algebraic λ-Calculus with λ2la

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or a variable.Every typable term is strongnormalizing

Hence Yb is no typable!t− t→ 0 always, so it is notnecesary to reduce t �rst. we canremove the closed-normalrestrictions!

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u + β.u→ (α + β).u.

Application rules such asu (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

Page 45: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FLinear-Algebraic λ-Calculus with λ2la

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or a variable.Every typable term is strongnormalizingHence Yb is no typable!

t− t→ 0 always, so it is notnecesary to reduce t �rst. we canremove the closed-normalrestrictions!

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u + β.u→ (α + β).u.

Application rules such asu (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

Page 46: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

System FLinear-Algebraic λ-Calculus with λ2la

Higher-order computation

t ::= x |λx .t | (t t) |

λx .t b→ t[b/x ] (∗)

(*) b an abstraction or a variable.Every typable term is strongnormalizingHence Yb is no typable!t− t→ 0 always, so it is notnecesary to reduce t �rst. we canremove the closed-normalrestrictions!

Linear algebra

t + t |α.t | 0

Elementary rules such asu + 0→ u andα.(u + v)→ α.u + α.v.

Factorisation rules such asα.u + β.u→ (α + β).u.

Application rules such asu (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

Page 47: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemGrammar

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

Page 48: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemType inference rules

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

Γ ` u :U → T Γ ` v :U→ E

Γ ` (u v) :T

Γ, x :U ` t :T→ I [U]

Γ ` λx t :U → T

Γ ` u :∀X .T∀E [X := U]

Γ ` u :T [U/X ]

Γ ` u :T∀I [X ] with X /∈ FV (Γ)

Γ ` u :∀X .T

ax0Γ ` 0 :T

Γ ` u :T Γ ` v :T+I

Γ ` u + v :T

Γ ` u :TαI

Γ ` α.u :T

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

Page 49: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemType inference rules

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

Γ ` u :U → T Γ ` v :U→ E

Γ ` (u v) :T

Γ, x :U ` t :T→ I [U]

Γ ` λx t :U → T

Γ ` u :∀X .T∀E [X := U]

Γ ` u :T [U/X ]

Γ ` u :T∀I [X ] with X /∈ FV (Γ)

Γ ` u :∀X .T

ax0Γ ` 0 :T

Γ ` u :T Γ ` v :T+I

Γ ` u + v :T

Γ ` u :TαI

Γ ` α.u :T

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

Page 50: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemType inference rules

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

Γ ` u :α.(U → T ) Γ ` v :β.U→ E

Γ ` (u v) : (α× β).T

Γ, x :U ` t :T→ I [U]

Γ ` λx t :U → T

Γ ` u :∀X .T∀E [X := U]

Γ ` u :T [U/X ]

Γ ` u :T∀I [X ] with X /∈ FV (Γ)

Γ ` u :∀X .T

ax0

Γ ` 0 : 0

Γ ` u :α.T Γ ` v :β.T+I

Γ ` u + v : (α + β).T

Γ ` u :TsI [α]

Γ ` α.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

Page 51: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemStrong normalisation

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

Example: (U → α.X )\ = U\ → X

We also de�ne 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 strongnormalising.

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

Page 52: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemStrong normalisation

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

We also de�ne 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 strongnormalising.

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

Page 53: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemStrong normalisation

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

We also de�ne 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 strongnormalising.

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

Page 54: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemStrong normalisation

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

We also de�ne 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 strongnormalising.

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

Page 55: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemStrong normalisation

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

We also de�ne 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 strongnormalising.

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

Page 56: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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 itinto 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

Page 57: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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 itinto 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

Page 58: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (I)

To show a rule as example, we need some auxiliary lemmas andde�nitions:

Order:

Write A > B if either

B ≡ ∀X .A orA ≡ ∀X .C and B ≡ C [U/X ] for some U ∈ U .

≥ is the re�exive and transitive closure of >.

Instuition of this de�nition:

Types in the numerator of

Γ ` t :A∀I with X /∈ FV (Γ)

Γ ` t :∀X .Aor

Γ ` t :∀X .C∀E

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

Page 59: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (I)

To show a rule as example, we need some auxiliary lemmas andde�nitions:Order:

Write A > B if either

B ≡ ∀X .A orA ≡ ∀X .C and B ≡ C [U/X ] for some U ∈ U .

≥ is the re�exive and transitive closure of >.

Instuition of this de�nition:

Types in the numerator of

Γ ` t :A∀I with X /∈ FV (Γ)

Γ ` t :∀X .Aor

Γ ` t :∀X .C∀E

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

Page 60: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (I)

To show a rule as example, we need some auxiliary lemmas andde�nitions:Order:

Write A > B if either

B ≡ ∀X .A orA ≡ ∀X .C and B ≡ C [U/X ] for some U ∈ U .

≥ is the re�exive and transitive closure of >.

Instuition of this de�nition:

Types in the numerator of

Γ ` t :A∀I with X /∈ FV (Γ)

Γ ` t :∀X .Aor

Γ ` t : ∀X .C∀E

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

Page 61: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (II)

Some lemmas needed:

1 A ≥ B and Γ ` t :A ⇒ Γ ` t :B2 A ≥ B ⇒ αA ≥ αB3 Generation lemma (app): Let Γ ` (u v) : γ.T , then

Γ ` u :β.U → T ′

Γ ` v :α.UT ′ ≥ 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

Page 62: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (II)

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

2 A ≥ B ⇒ αA ≥ αB3 Generation lemma (app): Let Γ ` (u v) : γ.T , then

Γ ` u :β.U → T ′

Γ ` v :α.UT ′ ≥ 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

Page 63: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (II)

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

3 Generation lemma (app): Let Γ ` (u v) : γ.T , thenΓ ` u :β.U → T ′

Γ ` v :α.UT ′ ≥ 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

Page 64: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (II)

Some lemmas needed:1 A ≥ B and Γ ` t :A ⇒ Γ ` t :B2 A ≥ B ⇒ αA ≥ αB3 Generation lemma (app): Let Γ ` (u v) : γ.T , then

Γ ` u :β.U → T ′

Γ ` v :α.UT ′ ≥ 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

Page 65: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject reduction proof: example (II)

Some lemmas needed:1 A ≥ B and Γ ` t :A ⇒ Γ ` t :B2 A ≥ B ⇒ αA ≥ αB3 Generation lemma (app): Let Γ ` (u v) : γ.T , then

Γ ` u :β.U → T ′

Γ ` v :α.UT ′ ≥ 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

Page 66: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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

Page 67: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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

Page 68: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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

Page 69: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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

Page 70: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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

Page 71: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSubject 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

Page 72: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Intuition

Conditional functions → same type on each branch.

By restricting the scalars to positive reals → probabilistic typesystem.

For example, one can type functions such as

λx {x [12.(true + false)] [1

4.true + 3

4.false]} :B → B

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

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

Page 73: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Intuition

Conditional functions → same type on each branch.

By restricting the scalars to positive reals → probabilistic typesystem.

For example, one can type functions such as

λx {x [12.(true + false)] [1

4.true + 3

4.false]} :B → B

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

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

Page 74: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Intuition

Conditional functions → same type on each branch.

By restricting the scalars to positive reals → probabilistic typesystem.

For example, one can type functions such as

λx {x [12.(true + false)] [1

4.true + 3

4.false]} :B → B

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

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

Page 75: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Formalisation

We de�ne the probabilistic type system to be the scalar typesystem with the following restrictions:

S = R+,

Contexts: Types in contexts are classic types (C), i.e. types inU 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

Page 76: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Formalisation

We de�ne the probabilistic type system to be the scalar typesystem with the following restrictions:

S = R+,

Contexts: Types in contexts are classic types (C), i.e. types inU 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

Page 77: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Formalisation

We de�ne the probabilistic type system to be the scalar typesystem with the following restrictions:

S = R+,

Contexts: Types in contexts are classic types (C), i.e. types inU 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

Page 78: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Formalisation

We de�ne the probabilistic type system to be the scalar typesystem with the following restrictions:

S = R+,

Contexts: Types in contexts are classic types (C), i.e. types inU 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

Page 79: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Formalisation

We de�ne the probabilistic type system to be the scalar typesystem with the following restrictions:

S = R+,

Contexts: Types in contexts are classic types (C), i.e. types inU 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

Page 80: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Proof

De�nition (Weight function to check probability distributions)

Let ω : Λ→ R+ be a function de�ned 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 structuralinduction over t↓.Example: 2.(λx 1

2.x) y

→ y

ω(2.(λx 12.x) y) = 2 ω(y) = 1

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

Page 81: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Proof

De�nition (Weight function to check probability distributions)

Let ω : Λ→ R+ be a function de�ned 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 structuralinduction over t↓.

Example: 2.(λx 12.x) y

→ y

ω(2.(λx 12.x) y) = 2 ω(y) = 1

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

Page 82: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Proof

De�nition (Weight function to check probability distributions)

Let ω : Λ→ R+ be a function de�ned 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 structuralinduction over t↓.Example: 2.(λx 1

2.x) y

→ y

ω(2.(λx 12.x) y) = 2 ω(y) = 1

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

Page 83: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Proof

De�nition (Weight function to check probability distributions)

Let ω : Λ→ R+ be a function de�ned 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 structuralinduction over t↓.Example: 2.(λx 1

2.x) y

→ y

ω(2.(λx 12.x) y) = 2

ω(y) = 1

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

Page 84: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemProbabilistic type system: Proof

De�nition (Weight function to check probability distributions)

Let ω : Λ→ R+ be a function de�ned 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 structuralinduction over t↓.Example: 2.(λx 1

2.x) y → y

ω(2.(λx 12.x) y) = 2 ω(y) = 1

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

Page 85: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

De�nition (Proof method of depth n)

Π0(S) = S

Πn(S) =Πn−1(S)

RPS

orΠk(S) πh

RPS

orπk Πh(S)

RPS

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

PS is a sequent such that the resulting derivation tree iswell-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

Page 86: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

De�nition (Proof method of depth n)

Π0(S) = S

Πn(S) =Πn−1(S)

RPS

orΠk(S) πh

RPS

orπk Πh(S)

RPS

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

PS is a sequent such that the resulting derivation tree iswell-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

Page 87: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Examples:

Π1(S) =S∀I

PS

Π1(Γ ` t :T ) =Γ ` t :T

∀IΓ ` t :∀X .T

Πn(Γ ` u :α.A) = Γ ` u :α.A

πn−2

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

Page 88: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Examples:

Π1(S) =S∀I

PS

Π1(Γ ` t :T ) =Γ ` t :T

∀IΓ ` t :∀X .T

Πn(Γ ` u :α.A) = Γ ` u :α.A

πn−2

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

Page 89: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Examples:

Π1(S) =S∀I

PS

Π1(Γ ` t :T ) =Γ ` t :T

∀IΓ ` t :∀X .T

Πn(Γ ` u :α.A) = Γ ` u :α.A

πn−2

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

Page 90: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Examples:

Π1(S) =S∀I

PS

Π1(Γ ` t :T ) =Γ ` t :T

∀IΓ ` t :∀X .T

Πn(Γ ` u :α.A) = Γ ` u :α.A

πn−2

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

Page 91: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Theorem (No-cloning of scalars)

@Πn such that ∀α,C (Πn(Γ ` α.U)) = ∆ ` (δ × αs + γ).V with

δ 6= 0 and γ constants in S, s ∈ N>1 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 ∈ UT ⊗ T ≡ α.U ⊗ α.U ≡ α2.(U ⊗ U) = (1× α2 + 0).(U ⊗ U).

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

Page 92: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Theorem (No-cloning of scalars)

@Πn such that ∀α,C (Πn(Γ ` α.U)) = ∆ ` (δ × αs + γ).V with

δ 6= 0 and γ constants in S, s ∈ N>1 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 ∈ UT ⊗ T ≡ α.U ⊗ α.U ≡ α2.(U ⊗ U) = (1× α2 + 0).(U ⊗ U).

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

Page 93: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Theorem (No-cloning of scalars)

@Πn such that ∀α,C (Πn(Γ ` α.U)) = ∆ ` (δ × αs + γ).V with

δ 6= 0 and γ constants in S, s ∈ N>1 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 ≡ α2.(U ⊗ U) = (1× α2 + 0).(U ⊗ U).

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

Page 94: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Theorem (No-cloning of scalars)

@Πn such that ∀α,C (Πn(Γ ` α.U)) = ∆ ` (δ × αs + γ).V with

δ 6= 0 and γ constants in S, s ∈ N>1 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 ∈ UT ⊗ T ≡ α.U ⊗ α.U ≡ α2.(U ⊗ U) = (1× α2 + 0).(U ⊗ U).

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

Page 95: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

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

Theorem (No-cloning of scalars)

@Πn such that ∀α,C (Πn(Γ ` α.U)) = ∆ ` (δ × αs + γ).V with

δ 6= 0 and γ constants in S, s ∈ N>1 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 ∈ UT ⊗ T ≡ α.U ⊗ α.U ≡ α2.(U ⊗ U) = (1× α2 + 0).(U ⊗ U).

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

Page 96: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSummary of contributions

S.N. : Simpli�ed the Linear-algebraic λ-calculus by liftingmost restrictions. S.R. OK.

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

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

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

Page 97: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSummary of contributions

S.N. : Simpli�ed the Linear-algebraic λ-calculus by liftingmost restrictions. S.R. OK.

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

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

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

Page 98: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemSummary of contributions

S.N. : Simpli�ed the Linear-algebraic λ-calculus by liftingmost restrictions. S.R. OK.

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

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

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

Page 99: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemPolemics, future work

Captured no-cloning theorem is a way that is faithful toquantum theory and linear algebra, unlike LL:

For all A one can �nd a copying proof method, but there is noproof 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 oftypes). Then it would be possible to check norm onamplitudes rather than probabilities.

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

Page 100: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemPolemics, future work

Captured no-cloning theorem is a way that is faithful toquantum theory and linear algebra, unlike LL:

For all A one can �nd a copying proof method, but there is noproof 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 oftypes). Then it would be possible to check norm onamplitudes rather than probabilities.

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

Page 101: A System F accounting for scalars

Motivation Linear-Algebraic λ-Calculus System F The scalar type system Conclusions and future work

The scalar type systemPolemics, future work

Captured no-cloning theorem is a way that is faithful toquantum theory and linear algebra, unlike LL:

For all A one can �nd a copying proof method, but there is noproof 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 oftypes). Then it would be possible to check norm onamplitudes rather than probabilities.

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