Professional Documents
Culture Documents
Pablo Arrighi and Alejandro Díaz-Caro - A System F Accounting For Scalars
Pablo Arrighi and Alejandro Díaz-Caro - A System F Accounting For Scalars
Pablo Arrighi and Alejandro Díaz-Caro - A System F Accounting For Scalars
arXiv:0903.3741
Motivation
Linear-Algebraic
-Calculus
System F
Global context
Oddity of Quantum theory
ad hoc
Quantum Logic?
(developed
quantum programs).
Birkho, G. and J. von Neumann, The logic of quantum mechanics, Annals of Mathematics 37 (1936), pp. 823843.
1
Pablo Arrighi and Alejandro Daz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 2/31
Motivation
Linear-Algebraic
-Calculus
System F
Global context
Oddity of Quantum theory
ad hoc
Quantum Logic?
(developed
Birkho, G. and J. von Neumann, The logic of quantum mechanics, Annals of Mathematics 37 (1936), pp. 823843.
1
Pablo Arrighi and Alejandro Daz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 2/31
Motivation
Linear-Algebraic
-Calculus
System F
Global context
Oddity of Quantum theory
ad hoc
Quantum Logic?
(developed
spaces, Micromechanics loses duplicability.) Curry-Howard : (programs,types)=(proofs,logics). Quantum Computation : (quantum programs, quantum types). CH+QC : (quantum th. proofs, quantum th. logics)? Quantum logics : isolating the reasoning behind quantum algorithms?
Birkho, G. and J. von Neumann, The logic of quantum mechanics, Annals of Mathematics 37 (1936), pp. 823843.
1
Pablo Arrighi and Alejandro Daz-Caro, LIG A System F accounting for scalars, arXiv:0903.3741 2/31
Motivation
Linear-Algebraic
-Calculus
System F
Global context
Oddity of Quantum theory
ad hoc
Quantum Logic?
(developed
spaces, Micromechanics loses duplicability.) Curry-Howard : (programs,types)=(proofs,logics). Quantum Computation : (quantum programs, quantum types). CH+QC : (quantum th. proofs, quantum th. logics)? Quantum logics : isolating the reasoning behind quantum algorithms?
Motivation
Linear-Algebraic
-Calculus
System F
Quantum theory
(bi ).
v.
Then
v=
i i bi .
3/31
Motivation
Linear-Algebraic
-Calculus
System F
Quantum theory
(bi ).
v.
Then
v=
i i bi .
v = U v.
3/31
Motivation
Linear-Algebraic
-Calculus
System F
Quantum theory
(bi ).
v.
Then
v=
i i bi .
v = U v.
Systems are put next to one another with Bilinear just like application :
u + v w = u w + v w, u v + w = u v + u w, . . .
3/31
Motivation
Linear-Algebraic
-Calculus
System F
Quantum theory
(bi ).
v.
Then
v=
i i bi .
v = U v.
Systems are put next to one another with Bilinear just like application :
u + v w = u w + v w, u v + w = u v + u w, . . . No-cloning theorem!
3/31
Motivation
Linear-Algebraic
-Calculus
System F
No-cloning theorem
Statement: Proof: Vector space of o.n.b.
U
: U
v = v v.
so
(bi ),
v=
bi = bi bi
U
i bi .
But then
v =
i bi = i U bi i i = i bi bi = i j bi bj i ij = ( i bi ) ( j bj ) i j = vv
U
4/31
Motivation
Linear-Algebraic
-Calculus
System F
No-cloning theorem
Statement: Proof: Vector space of o.n.b.
U
: U
v = v v.
so
(bi ),
v=
bi = bi bi
U
i bi .
But then
v =
i bi = i U bi i i = i bi bi = i j bi bj i ij = ( i bi ) ( j bj ) i j = vv
U
Motivation
Linear-Algebraic
-Calculus
System F
-Calculus2
Arrighi, P. and G. Dowek. Linear-algebraic -calculus: higher-order, encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
2
5/31
Motivation
Linear-Algebraic
-Calculus
System F
-Calculus2
Linear algebra t + t | .t | 0
Arrighi, P. and G. Dowek. Linear-algebraic -calculus: higher-order, encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
2
5/31
Motivation
Linear-Algebraic
-Calculus
System F
-Calculus2
Linear algebra t + t | .t | 0
b an abstraction or a
variable.
Arrighi, P. and G. Dowek. Linear-algebraic -calculus: higher-order, encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
2
5/31
Motivation
Linear-Algebraic
-Calculus
System F
-Calculus2
Linear algebra t + t | .t | 0
Elementary rules such as
b an abstraction or a
variable.
u (v + w) (u v) + (u w).
Arrighi, P. and G. Dowek. Linear-algebraic -calculus: higher-order, encodings and conuence. Lecture Notes in Computer Science (RTA'08), 5117
2
5/31
Motivation
Linear-Algebraic
-Calculus
System F
Untyped
-calculus
+ linear algebra
Cloning?
6/31
Motivation
Linear-Algebraic
-Calculus
System F
Untyped
-calculus
+ linear algebra
Cloning?
x .(x x )
i
( i bi ) (
i bi
i bi bi
i bi )
6/31
Motivation
Linear-Algebraic
-Calculus
System F
Untyped
-calculus
+ linear algebra
Cloning?
x .(x x )
i
( i bi ) (
i bi
i bi bi
i bi )
No-cloning says bottom reduction forbidden. We must delay beta reduction till after linearity. So restrict beta reduction to
vectors i.e.
base
abstractions or variables.
6/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
+ linear algebra
7/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
+ linear algebra
Yb x .(b + (x x )) x .(b + (x x )) Yb b + Yb
7/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
+ linear algebra
Yb x .(b + (x x )) x .(b + (x x )) Yb b + Yb
But whoever says innity says trouble says. . .
7/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
+ linear algebra
Yb x .(b + (x x )) x .(b + (x x )) Yb b + Yb
But whoever says innity says trouble says. . . indenite forms.
7/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
+ linear algebra
Yb x .(b + (x x )) x .(b + (x x )) Yb b + Yb
But whoever says innity says trouble says. . . indenite forms.
Yb Yb b + Yb Yb b
7/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
+ linear algebra
Yb x .(b + (x x )) x .(b + (x x )) Yb b + Yb
But whoever says innity says trouble says. . . indenite forms.
Yb Yb b + Yb Yb b
0
High school teacher says we must restrict factorization rules to
closed-normal forms.
A System F accounting for scalars, arXiv:0903.3741 7/31
Motivation
Linear-Algebraic
-Calculus
System F
0: A
ax0
u: A
v: A
u + v: A
+I
t: A
.t : A
8/31
Motivation
Linear-Algebraic
-Calculus
System F
0: A
ax0
u: A
v: A
u + v: A
+I
t: A
.t : A
t: T
is strongly normalising.
8/31
Motivation
Linear-Algebraic
-Calculus
System F
0: A
ax0
u: A
v: A
u + v: A
+I
t: A
.t : A
t: T
is strongly normalising.
Proof.
8/31
Motivation
Linear-Algebraic
-Calculus
System F
9/31
Motivation
Linear-Algebraic
-Calculus
System F
A subset X
1 2 3 4
SN
is saturated if
w1 . . . w X ;
n
i I , (u wi ) X u
i
7 8 9 10
X;
9/31
Motivation
Linear-Algebraic
-Calculus
System F
A subset X
1 2 3 4
SN
is saturated if
w1 . . . w X ;
n
i I , (u wi ) X u
i
7 8 9 10
X;
SAT
Motivation
Linear-Algebraic
-Calculus
System F
Rening the sketch: The idea is that types correspond to saturated sets.
10/31
Motivation
Linear-Algebraic
-Calculus
System F
Rening the sketch: The idea is that types correspond to saturated sets. This correspondance is achived by a maping from types to
SAT .
10/31
Motivation
Linear-Algebraic
-Calculus
System F
Lemma
1
SN
A B
of members of SAT ,
i Ai SAT ,
11/31
Motivation
Linear-Algebraic
-Calculus
System F
Lemma
1
SN
A B
of members of SAT ,
i Ai SAT ,
Denition (Mapping)
[[X ]] = (X ) [[X .T ]] =
(where
() : TVar SAT )
11/31
Motivation
Linear-Algebraic
-Calculus
System F
Lemma
1
SN
A B
of members of SAT ,
i Ai SAT ,
Denition (Mapping)
[[X ]] = (X ) [[X .T ]] =
(where
() : TVar SAT )
Lemma
Given a valuation
, [[T ]] SAT
A System F accounting for scalars, arXiv:0903.3741 11/31
Motivation
Linear-Algebraic
-Calculus
System F
Denition ( )
For
= x1 : A1 , . . . , xn : An ,
x1
t: T
means that
12/31
Motivation
Linear-Algebraic
-Calculus
System F
Denition ( )
For
= x1 : A1 , . . . , xn : An ,
x1
t: T
means that
t: T t: T
t: T
(In fact
12/31
Motivation
Linear-Algebraic
-Calculus
System F
t: T
13/31
Motivation
Linear-Algebraic
-Calculus
System F
13/31
Motivation
Linear-Algebraic
-Calculus
System F
Then, the proof of the strong normalisation theorem is: Let t: T t: T If (xi : Ai ) , xi [[Ai ]]
then
t [[T ]]
13/31
Motivation
Linear-Algebraic
-Calculus
System F
Then, the proof of the strong normalisation theorem is: Let t: T t: T If (xi : Ai ) , xi [[Ai ]] Note that
x
then
t [[T ]]
i [[Ai ]]
because
[[Ai ]]
is saturated,
13/31
Motivation
Linear-Algebraic
-Calculus
System F
Then, the proof of the strong normalisation theorem is: Let t: T t: T If (xi : Ai ) , xi [[Ai ]] Note that
x
then
t [[T ]]
i [[Ai ]]
because
then
[[Ai ]]
is saturated,
13/31
Motivation
Linear-Algebraic
-Calculus
System F
Linear algebra t + t | .t | 0
Elementary rules such as
b an abstraction or a variable.
.u + .u ( + ).u.
u (v + w) (u v) + (u w).
14/31
Motivation
Linear-Algebraic
-Calculus
System F
Linear algebra t + t | .t | 0
Elementary rules such as
b an abstraction or a variable.
.u + .u ( + ).u.
u (v + w) (u v) + (u w).
14/31
Motivation
Linear-Algebraic
-Calculus
System F
Linear algebra t + t | .t | 0
Elementary rules such as
.u + .u ( + ).u.
u (v + w) (u v) + (u w).
14/31
Motivation
Linear-Algebraic
-Calculus
System F
Linear algebra t + t | .t | 0
Elementary rules such as
b an abstraction or a variable.
normalizing
.u + .u ( + ).u.
u (v + w) (u v) + (u w).
14/31
Motivation
Linear-Algebraic
-Calculus
System F
Types grammar:
T = U | X .T | .T | 0, U = X | U T | X .U
where
and
(S, +, )
is a conmutative ring.
15/31
Motivation
Linear-Algebraic
-Calculus
System F
ax U
[ ]
, x : U
:U , x : U
u: U T
(u v) : T
v: U
t: T
x t : U T I [X ] with
I [U ]
u : X .T u : T [U /X ]
E [X := U ]
u: T u : X .T
FV () /
16/31
Motivation
Linear-Algebraic
-Calculus
System F
ax U
[ ]
, x : U
:U , x : U
u: U T
(u v) : T
v: U
t: T
x t : U T I [X ] with
I [U ]
u : X .T u : T [U /X ]
ax0
E [X := U ]
u: T u : X .T
FV () /
u: T
v: T
0: T
u + v: T
+I
u: T
.u : T
16/31
Motivation
Linear-Algebraic
-Calculus
System F
ax U
[ ]
, x : U
:U , x : U
u : .(U T )
v : .U
(u v) : ( ).T E [X := U ]
t: T
x t : U T I [X ] with
I [U ]
u : X .T u : T [U /X ]
ax
u: T u : X .T
FV () /
0: 0
u : .T
v : .T
u + v : ( + ).T
+I
u: T
.u : .T
sI
[]
Where U
U.
17/31
Motivation
Linear-Algebraic
-Calculus
System F
()
: map that take types and remove all the scalars on it.
18/31
Motivation
Linear-Algebraic
-Calculus
System F
()
: map that take types and remove all the scalars on it.
Example:
(U .X ) = U X
18/31
Motivation
Linear-Algebraic
-Calculus
System F
()
: map that take types and remove all the scalars on it.
Example:
(U .X ) = U X =T
for some T without scalars.
We also dene 0
18/31
Motivation
Linear-Algebraic
-Calculus
System F
()
: map that take types and remove all the scalars on it.
Example:
(U .X ) = U X =T
for some T without scalars.
We also dene 0
t: T
2la t : T
18/31
Motivation
Linear-Algebraic
-Calculus
System F
()
: map that take types and remove all the scalars on it.
Example:
(U .X ) = U X =T
for some T without scalars.
We also dene 0
t: T
2la t : T
t: T
is strongly normalising.
Proof.
By previous lemma
2la
t: T
, then
t is strong
normalising.
18/31
Motivation
Linear-Algebraic
-Calculus
System F
t . Then
:T
:T
19/31
Motivation
Linear-Algebraic
-Calculus
System F
t . Then
:T
:T
using that rule and
Proof.
(sketch)
t : T , then t : T .
tt
In general, the method is to take the term into its small parts and recompose to
t.
t, decompose it
19/31
Motivation
Linear-Algebraic
-Calculus
System F
20/31
Motivation
Linear-Algebraic
-Calculus
System F
>B
if either
B
X .A or X .C and
C [U /X ] for some
U.
>.
20/31
Motivation
Linear-Algebraic
-Calculus
System F
>B
if either
B
X .A or X .C and
C [U /X ] for some
U.
>.
t: A t : X .A
with
FV () /
or
t : X .C t : C [U /X ]
20/31
Motivation
Linear-Algebraic
-Calculus
System F
21/31
Motivation
Linear-Algebraic
-Calculus
System F
and
t: A t: B
21/31
Motivation
Linear-Algebraic
-Calculus
System F
B and t : A A B A B
A
t: B
21/31
Motivation
Linear-Algebraic
-Calculus
System F
B and t : A A B A B
A
t: B
(u v) : .T ,
then
u : .U T v : .U T T =
21/31
Motivation
Linear-Algebraic
-Calculus
System F
B and t : A A B A B
A
t: B
(u v) : .T ,
then
u : .U T v : .U T T =
4
u + v : .T , u : .T v : .T =+
A System F accounting for scalars, arXiv:0903.3741
then
21/31
Motivation
Linear-Algebraic
-Calculus
System F
Example: Rule
( u + v) w ( u w ) + ( v w ) .
22/31
Motivation
Linear-Algebraic
-Calculus
System F
( u + v) w ( u w ) + ( v w ) .
(u + v) w : T .
22/31
Motivation
Linear-Algebraic
-Calculus
System F
( u + v) w ( u w ) + ( v w ) .
(u + v) w : T .
where
= 1,
is some scalar.
22/31
Motivation
Linear-Algebraic
-Calculus
System F
Then
u : ( ).U T
w : .U
(u w) : ( ).T .T
23/31
Motivation
Linear-Algebraic
-Calculus
System F
Then
u : ( ).U T
w : .U
(u w) : ( ).T .T
Also,
v : ((1 ) ).(U T )
w : .U
23/31
Motivation
Linear-Algebraic
-Calculus
System F
Then
u : ( ).U T
w : .U
(u w) : ( ).T .T
Also,
So
v : ((1 ) ).(U T )
w : .U
(u w) + (v w) : T
+I
and
23/31
Motivation
Linear-Algebraic
-Calculus
System F
Conditional
functions
24/31
Motivation
Linear-Algebraic
-Calculus
System F
Conditional
functions
probabilistic type
24/31
Motivation
Linear-Algebraic
-Calculus
System F
Conditional
functions
probabilistic type
with the type system serving as a guarantee that the function conserves probabilities summing to one.
24/31
Motivation
Linear-Algebraic
-Calculus
System F
We dene the probabilistic type system to be the scalar type system with the following restrictions:
25/31
Motivation
Linear-Algebraic
-Calculus
System F
We dene the probabilistic type system to be the scalar type system with the following restrictions:
S = R+ ,
25/31
Motivation
Linear-Algebraic
-Calculus
System F
We dene the probabilistic type system to be the scalar type system with the following restrictions:
S = R+ ,
Contexts: Types in contexts are classic types (C ), i.e. types in
25/31
Motivation
Linear-Algebraic
-Calculus
System F
We dene the probabilistic type system to be the scalar type system with the following restrictions:
S = R+ ,
Contexts: Types in contexts are classic types (C ), i.e. types in
to
t : X .T t : T [C /X ]
with
25/31
Motivation
Linear-Algebraic
-Calculus
System F
We dene the probabilistic type system to be the scalar type system with the following restrictions:
S = R+ ,
Contexts: Types in contexts are classic types (C ), i.e. types in
to
t : X .T t : T [C /X ]
with
25/31
Motivation
Linear-Algebraic
-Calculus
System F
: R+
26/31
Motivation
Linear-Algebraic
-Calculus
System F
: R+
(t ) = 1.
Proof.
We prove that
induction over
t .
t : .C (t ) = by structural
26/31
Motivation
Linear-Algebraic
-Calculus
System F
: R+
(t ) = 1.
Proof.
We prove that
induction over
t .
1 2
t : .C (t ) = by structural
Example: 2.(x
.x )
26/31
Motivation
Linear-Algebraic
-Calculus
System F
: R+
(t ) = 1.
Proof.
We prove that
induction over
t .
1 2
t : .C (t ) = by structural
1 2
Example: 2.(x
.x )
(2.(x
Pablo Arrighi and Alejandro Daz-Caro, LIG
.x ) y ) = 2
A System F accounting for scalars, arXiv:0903.3741 26/31
Motivation
Linear-Algebraic
-Calculus
System F
: R+
(t ) = 1.
Proof.
We prove that
induction over
t .
1 2
t : .C (t ) = by structural
1 2
Example: 2.(x
.x )
y .x ) y ) = 2 (y ) = 1
26/31
(2.(x
Pablo Arrighi and Alejandro Daz-Caro, LIG
Motivation
Linear-Algebraic
-Calculus
System F
or
k (S ) h
P
or
h ( S )
P
n
R P
max{k , h}
= n 1,
is a typing rule, and is a sequent such that the resulting derivation tree is
well-formed.
27/31
Motivation
Linear-Algebraic
-Calculus
System F
or
k (S ) h
P
or
h ( S )
P
n
R P
max{k , h}
= n 1,
is a typing rule, and is a sequent such that the resulting derivation tree is
well-formed. C
(n (S ))
n (S ).
27/31
Motivation
Linear-Algebraic
-Calculus
System F
Examples:
S P
1 ( S ) =
28/31
Motivation
Linear-Algebraic
-Calculus
System F
Examples:
S P
1 ( S ) =
1 (
t: T) =
t: T t : X .T
28/31
Motivation
Linear-Algebraic
-Calculus
System F
Examples:
S P
1 ( S ) =
1 (
t: T) =
t: T t : X .T
28/31
Motivation
Linear-Algebraic
-Calculus
System F
Examples:
S P
1 ( S ) =
1 (
t: T) =
t: T t : X .T
means that PS can be derived from S by using S once, with the xed proof method
28/31
Motivation
Linear-Algebraic
-Calculus
System F
Proof.
29/31
Motivation
Linear-Algebraic
-Calculus
System F
Proof.
T , C (n (
)) =
T.
where A
29/31
Motivation
Linear-Algebraic
-Calculus
System F
Proof.
T , C (n (
)) =
T.
where A
Proof.
T , T .U
with U
29/31
Motivation
Linear-Algebraic
-Calculus
System F
Proof.
T , C (n (
)) =
T.
where A
Proof.
T , T .U
2
with U
T .U .U .(U U ) = (1 2 + 0).(U U ).
29/31
Motivation
Linear-Algebraic
-Calculus
System F
Proof.
T , C (n (
)) =
T.
where A
Proof.
T , T .U
2
with U
T .U .U .(U U ) = (1 2 + 0).(U U ).
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
by lifting
30/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
by lifting
30/31
Motivation
Linear-Algebraic
-Calculus
System F
-calculus
by lifting
probabilistic
-calculus.
30/31
Motivation
Linear-Algebraic
-Calculus
System F
31/31
Motivation
Linear-Algebraic
-Calculus
System F
Captured no-cloning theorem is a way that is faithful to quantum theory and linear algebra, unlike LL:
one can nd a copying proof method, but there is no for cloning all A. Algebraic linearity is about taking .U to something in + . . . not just for = 1 = + 1.
A proof method
For all
31/31
Motivation
Linear-Algebraic
-Calculus
System F
Captured no-cloning theorem is a way that is faithful to quantum theory and linear algebra, unlike LL:
one can nd a copying proof method, but there is no for cloning all A. Algebraic linearity is about taking .U to something in + . . . not just for = 1 = + 1.
A proof method
For all
C.-H.+Q.C.=(quantum th. proofs, quantum th. logics)? Need a Vectorial type system:
Scalar type system magnitude and signs for type vectors. Future system direction, (i.e. addition and orthogonality of types). Then it would be possible to check norm on amplitudes rather than probabilities.
31/31