SlideShare a Scribd company logo
Towards a quantum λ-calculus
with quantum control
arXiv:1601.04294
Alejandro Díaz-Caro
UNIVERSIDAD NACIONAL DE QUILMES
Joint work with
Gilles Dowek
Inria & ENS-Cachan
V Congreso Latinoamericano de Matemáticos
Logic and Computability Session
Barranquilla, Colombia, July 14, 2016
Goal
We want a pure functional
extension of lambda calculusi.e. we do not want clasical control / quantum data
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 2 / 26
Overview
Some quantum properties (with dead and alive cats)
Projective measurement
Destructive interference
No-cloning
Entanglement and separability
Expressing those properties in the lambda-calculus
Superpositions, no-cloning and measurement
Examples
Deutsch algorithm
Teleportation algorithm
Projective measurement
α + β
Projective measurement
α + β
|α|2
|β| 2
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 4 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
+
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α + β
α|2
+ |β
2
= 1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α − β
α|2
+ |−β
2
= 1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α − β
α|2
+ |−β
2
= 1
1
2
1
2
+
1
2
+
1
2
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α − β
α|2
+ |−β
2
= 1
1
2
1
2
+
1
2
+
1
2
α + β
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α − β
α|2
+ |−β
2
= 1
1
2
1
2
+
1
2
+
1
2
3
4
+
1
4
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α − β
α|2
+ |−β
2
= 1
1
2
1
2
+
1
2
+
1
2
3
4
+
1
4
5
8
+
3
8
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α − β
α|2
+ |−β
2
= 1
1
2
1
2
+
1
2
+
1
2
3
4
+
1
4
5
8
+
3
8
1
√
2
1
√
2
+
1
√
2
+
1
√
2
1
√
2
−
1
√
2
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
Probabilistic vs. Quantum
Destructive interference
Probabilistic
a + b
(a + b = 1)
Quantum
α − β
α|2
+ |−β
2
= 1
1
2
1
2
+
1
2
+
1
2
3
4
+
1
4
5
8
+
3
8
1
√
2
1
√
2
+
1
√
2
+
1
√
2
1
√
2
−
1
√
2
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
No-cloning
Superpositions vs. basis states
There is no universal cloning machine
for quantum states
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 6 / 26
No-cloning
Superpositions vs. basis states
There is no universal cloning machine
for quantum states
α + β
No-cloning
Superpositions vs. basis states
There is no universal cloning machine
for quantum states
α + β
α + β
α ⊗ + β ⊗
=
α + β ⊗ α + β
α2
⊗ +αβ ⊗ +βα ⊗ +β2
⊗
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 6 / 26
Entanglement and separability
Example 1
α ⊗ +β ⊗
=
α + β
Superposed state
⊗
Basis state
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 7 / 26
Entanglement and separability
Example 1
α ⊗ +β ⊗
=
α + β
Superposed state
⊗
Basis stateExample 2
α1α2 ⊗ +α1β1 ⊗ +β2α2 ⊗ +β1β2 ⊗
α1 + β1
Superposed state
⊗ α2 + β2
Superposed state
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 7 / 26
Entanglement and separability
Example 1
α ⊗ +β ⊗
=
α + β
Superposed state
⊗
Basis stateExample 2
α1α2 ⊗ +α1β1 ⊗ +β2α2 ⊗ +β1β2 ⊗
α1 + β1
Superposed state
⊗ α2 + β2
Superposed state
Example 3
α ⊗ + β ⊗
Entangled (and superposed) state
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 7 / 26
Overview
Some quantum properties (with dead and alive cats)
Projective measurement
Destructive interference
No-cloning
Entanglement and separability
Expressing those properties in the lambda-calculus
Superpositions, no-cloning and measurement
Examples
Deutsch algorithm
Teleportation algorithm
Logical linearity vs. algebraic linearity
No-cloning =⇒ logical-linear terms
e.g. λx.x ⊗ x forbidden
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
Logical linearity vs. algebraic linearity
No-cloning =⇒ logical-linear terms
e.g. λx.x ⊗ x forbidden
Another way
No-cloning =⇒ algebraic-linear operators
e.g. M(α. |0 + β. |1 ) → α.M |0 + β.M |1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
Logical linearity vs. algebraic linearity
No-cloning =⇒ logical-linear terms
e.g. λx.x ⊗ x forbidden
Another way
No-cloning =⇒ algebraic-linear operators
e.g. M(α. |0 + β. |1 ) → α.M |0 + β.M |1
What about measurement?
(λx.πx) (α. |0 + β. |1 )
(Measurement operator)
α.(λx.πx) |0 + β.(λx.πx) |1 ← Wrong!
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
Logical linearity vs. algebraic linearity
No-cloning =⇒ logical-linear terms
e.g. λx.x ⊗ x forbidden
Another way
No-cloning =⇒ algebraic-linear operators
e.g. M(α. |0 + β. |1 ) → α.M |0 + β.M |1
What about measurement?
(λx.πx) (α. |0 + β. |1 )
(Measurement operator)
α.(λx.πx) |0 + β.(λx.πx) |1 ← Wrong!
We can use a combination of both:
Logical-linear for abstractions taking superpositions
Algebraic-linear for abstractions taking basis states
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
Key point
We need to distinguish
superposed states
from
basis states
Basis states can be cloned
Superposed states cannot
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 10 / 26
Grammars
First version, without tensor
Types
Ψ := Q | S(Ψ) Qubit types
A := Ψ | Ψ ⇒ A | S(A) Types
Terms
b := x | λxΨ
.t | |0 | |1 Basis terms
v := b | v + v | α.v | 0S(A) Values
t := v | tt | t + t | α.t | πt | ?· Terms
where α ∈ C
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 11 / 26
Two types of linearity
(λxQ
.t) b
Q
→ t[b/x] call-by-base
(λxS(Ψ)
.t)
linear abstraction
u
S(Ψ)
→ t[u/x] call-by-name
(λxQ
.t) (b1 + b2)
S(Q)
→ (λxQ
.t) b1
Q
+(λxQ
.t) b2
Q
linear distribution
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
Two types of linearity
(λxQ
.t) b
Q
→ t[b/x] call-by-base
(λxS(Ψ)
.t)
linear abstraction
u
S(Ψ)
→ t[u/x] call-by-name
(λxQ
.t) (b1 + b2)
S(Q)
→ (λxQ
.t) b1
Q
+(λxQ
.t) b2
Q
linear distribution
Problem?
λxQ⇒Q
.x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
Two types of linearity
(λxQ
.t) b
Q
→ t[b/x] call-by-base
(λxS(Ψ)
.t)
linear abstraction
u
S(Ψ)
→ t[u/x] call-by-name
(λxQ
.t) (b1 + b2)
S(Q)
→ (λxQ
.t) b1
Q
+(λxQ
.t) b2
Q
linear distribution
Problem?
λxQ⇒Q
.x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition)
No problem
It is a function which produces a superposition, is not a superposition
It can be cloned
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
Two types of linearity
(λxQ
.t) b
Q
→ t[b/x] call-by-base
(λxS(Ψ)
.t)
linear abstraction
u
S(Ψ)
→ t[u/x] call-by-name
(λxQ
.t) (b1 + b2)
S(Q)
→ (λxQ
.t) b1
Q
+(λxQ
.t) b2
Q
linear distribution
Problem?
λxQ⇒Q
.x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition)
No problem
It is a function which produces a superposition, is not a superposition
It can be cloned
What about λyS(Q)
.λxQ
.xy ?
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
Two types of linearity
(λxQ
.t) b
Q
→ t[b/x] call-by-base
(λxS(Ψ)
.t)
linear abstraction
u
S(Ψ)
→ t[u/x] call-by-name
(λxQ
.t) (b1 + b2)
S(Q)
→ (λxQ
.t) b1
Q
+(λxQ
.t) b2
Q
linear distribution
Problem?
λxQ⇒Q
.x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition)
No problem
It is a function which produces a superposition, is not a superposition
It can be cloned
What about λyS(Q)
.λxQ
.xy ?
Ok, let’s stay in first order for now
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
Typing applications
Γ t : Ψ ⇒ A ∆ u : Ψ
Γ, ∆ tu : A
⇒E
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
Typing applications
Γ t : Ψ ⇒ A ∆ u : Ψ
Γ, ∆ tu : A
⇒E
What about (λxQ
.t) (b1 + b2)
S(Q)
?
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
Typing applications
Γ t : Ψ ⇒ A ∆ u : Ψ
Γ, ∆ tu : A
⇒E
What about (λxQ
.t) (b1 + b2)
S(Q)
?
Γ t : Ψ ⇒ A ∆ u : S(Ψ)
Γ, ∆ tu : S(A)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
Typing applications
Γ t : Ψ ⇒ A ∆ u : Ψ
Γ, ∆ tu : A
⇒E
What about (λxQ
.t) (b1 + b2)
S(Q)
?
Γ t : Ψ ⇒ A ∆ u : S(Ψ)
Γ, ∆ tu : S(A)
What about ((λxQ
.t) + (λyQ
.u))
S(Q⇒A)
v?
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
Typing applications
Γ t : Ψ ⇒ A ∆ u : Ψ
Γ, ∆ tu : A
⇒E
What about (λxQ
.t) (b1 + b2)
S(Q)
?
Γ t : Ψ ⇒ A ∆ u : S(Ψ)
Γ, ∆ tu : S(A)
What about ((λxQ
.t) + (λyQ
.u))
S(Q⇒A)
v?
Γ t : S(Ψ ⇒ A) ∆ u : S(Ψ)
Γ, ∆ tu : S(A)
⇒ES
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
Example
f : Q ⇒ A g : Q ⇒ A
f + g : S(Q ⇒ A)
S+
I
|0 : Q
Ax|0
|0 : S(Q)
(f + g) |0 : S(A)
⇒ES
⇓
f : Q ⇒ A |0 : Q
Ax|0
f |0 : A
⇒E
g : Q ⇒ A |0 : Q
Ax|0
g |0 : A
⇒E
f |0 + g |0 : S(A)
S+
I
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 14 / 26
Measurement
π(
n
i=1
[αi.]bi) −→ |αk|2
n
i=1 |αi|2
bk
∀i, bi = |0 or bi = |1 .
n
i=1 αi .bi is normal (and hence 1 ≤ n ≤ 2).
k ≤ n
Example
π(i. |0 + 2. |1 )
|0
|1
1
3
2
3
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 15 / 26
Adding tensor products
Intepretation of types
S(Q) vs. Q
Q = {|0 , |1 } ⊆ C2
A ⊗ B = A × B
S(A) = G A
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 16 / 26
Adding tensor products
Intepretation of types
S(Q) vs. Q
Q = {|0 , |1 } ⊆ C2
A ⊗ B = A × B
S(A) = G A
Examples
(1/
√
2. |0 + 1/
√
2. |1 ) ⊗ |0 ∈ S(Q) ⊗ Q
= G({|0 , |1 }) × {|0 , |1 }
= C2
× {|0 , |1 }
1/
√
2. |0 ⊗ |0 + 1/
√
2. |1 ⊗ |1 ∈ S(Q ⊗ Q)
= G({|0 , |1 } × {|0 , |1 })
= G({|0 ⊗ |0 , |0 ⊗ |1 , |1 ⊗ |0 , |1 ⊗ |1 })
= C2
⊗ C2
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 16 / 26
Some information is lost on reduction
Subtyping
{|0 , |1 } ⊂ C2
then Q ≤ S(Q)
G(GA) = GA then S(S(Q)) ≤ S(Q)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
Some information is lost on reduction
Subtyping
{|0 , |1 } ⊂ C2
then Q ≤ S(Q)
G(GA) = GA then S(S(Q)) ≤ S(Q)
{|0 , |1 } × C2
⊂ C2
⊗ C2
then Q ⊗ S(Q) ≤ S(Q ⊗ Q)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
Some information is lost on reduction
Subtyping
{|0 , |1 } ⊂ C2
then Q ≤ S(Q)
G(GA) = GA then S(S(Q)) ≤ S(Q)
{|0 , |1 } × C2
⊂ C2
⊗ C2
then Q ⊗ S(Q) ≤ S(Q ⊗ Q)
|0 ⊗ (|0 + |1 ) : Q ⊗ S(Q)
|0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
Some information is lost on reduction
Subtyping
{|0 , |1 } ⊂ C2
then Q ≤ S(Q)
G(GA) = GA then S(S(Q)) ≤ S(Q)
{|0 , |1 } × C2
⊂ C2
⊗ C2
then Q ⊗ S(Q) ≤ S(Q ⊗ Q)
|0 ⊗ (|0 + |1 ) : Q ⊗ S(Q)
|0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
Some information is lost on reduction
Subtyping
{|0 , |1 } ⊂ C2
then Q ≤ S(Q)
G(GA) = GA then S(S(Q)) ≤ S(Q)
{|0 , |1 } × C2
⊂ C2
⊗ C2
then Q ⊗ S(Q) ≤ S(Q ⊗ Q)
|0 ⊗ (|0 + |1 ) : Q ⊗ S(Q)
|0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q)
Same happens in math!
(X − 1)(X − 2) −→ X2
− 3X + 2
we lost the information that it was a product
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
Some information is lost on reduction
Subtyping
{|0 , |1 } ⊂ C2
then Q ≤ S(Q)
G(GA) = GA then S(S(Q)) ≤ S(Q)
{|0 , |1 } × C2
⊂ C2
⊗ C2
then Q ⊗ S(Q) ≤ S(Q ⊗ Q)
|0 ⊗ (|0 + |1 ) : Q ⊗ S(Q)
|0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q)
Same happens in math!
(X − 1)(X − 2) −→ X2
− 3X + 2
we lost the information that it was a product
Solution: casting
|0 ⊗ (|0 + |1 ) |0 ⊗ |0 + |0 ⊗ |1
⇑
S(Q⊗Q)
Q⊗S(Q) |0 ⊗ (|0 + |1 ) → |0 ⊗ |0 + |0 ⊗ |1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
Full grammars
Types
Q := Q | Q ⊗ Q Basis qubit types
Ψ := Q | S(Ψ) | Ψ ⊗ Ψ Qubit types
A := Ψ | Ψ ⇒ A | S(A) | A ⊗ A Types
Terms
b := x | λxΨ
.t | |0 | |1 | b ⊗ b Basis terms
v := b | v + v | α.v | 0S(A) | v ⊗ v Values
t := v | tt | t + t | α.t | πj t | ?·
| t ⊗ t | head t | tail t | ⇑
S(B⊗C)
S(A) t
Terms
where α ∈ C
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 18 / 26
Measurement of the first j qubits
πj (
n
i=1
[αi .](b1i ⊗ · · · ⊗ bmi ))
−→


i∈P



|αi |2
n
i=1
|αi |2






j
h=1
bhk ⊗
i∈P




αi
i∈P
|αi |2



 .(bj+1,i ⊗ · · · ⊗ bmi )
P ⊆ N≤n
, such that
∀i ∈ P, ∀h ≤ j,
bhi = bhk .
Example
π2( 2.(|0 ⊗ |1 ⊗ |1 ) + |0 ⊗ |1 ⊗ |0 + 3.(|1 ⊗ |1 ⊗ |1 ) )
|0 ⊗ |1 ⊗ ( 2√
5
. |1 + 1√
5
. |0 ) |1 ⊗ |1 ⊗ (1. |1 )
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 19 / 26
Overview
Some quantum properties (with dead and alive cats)
Projective measurement
Destructive interference
No-cloning
Entanglement and separability
Expressing those properties in the lambda-calculus
Superpositions, no-cloning and measurement
Examples
Deutsch algorithm
Teleportation algorithm
Deutsch algorithm
Preliminaries
Hadamard
H |0 =
1
√
2
|0 +
1
√
2
|1 H |1 =
1
√
2
|0 −
1
√
2
|1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
Deutsch algorithm
Preliminaries
Hadamard
H |0 =
1
√
2
|0 +
1
√
2
|1 H |1 =
1
√
2
|0 −
1
√
2
|1
H = λxQ
.1/
√
2.(|0 + x?−|1 ·|1 )
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
Deutsch algorithm
Preliminaries
Hadamard
H |0 =
1
√
2
|0 +
1
√
2
|1 H |1 =
1
√
2
|0 −
1
√
2
|1
H = λxQ
.1/
√
2.(|0 + x?−|1 ·|1 )
Oracle
A “black box” implementing a function f : {0, 1} → {0, 1}
Uf (|x ⊗ |y ) = |x ⊗ |y ⊕ f (x)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
Deutsch algorithm
Preliminaries
Hadamard
H |0 =
1
√
2
|0 +
1
√
2
|1 H |1 =
1
√
2
|0 −
1
√
2
|1
H = λxQ
.1/
√
2.(|0 + x?−|1 ·|1 )
Oracle
A “black box” implementing a function f : {0, 1} → {0, 1}
Uf (|x ⊗ |y ) = |x ⊗ |y ⊕ f (x)
not = λxQ
.x?|0 ·|1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
Deutsch algorithm
Preliminaries
Hadamard
H |0 =
1
√
2
|0 +
1
√
2
|1 H |1 =
1
√
2
|0 −
1
√
2
|1
H = λxQ
.1/
√
2.(|0 + x?−|1 ·|1 )
Oracle
A “black box” implementing a function f : {0, 1} → {0, 1}
Uf (|x ⊗ |y ) = |x ⊗ |y ⊕ f (x)
not = λxQ
.x?|0 ·|1
Uf = λxQ⊗Q
.(head x) ⊗ ((tail x)?not(f (head x))·f (head x))
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
Deutsch algorithm
Goal:
Given an oracle Uf determine whether f is constant or not
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
Deutsch algorithm
Goal:
Given an oracle Uf determine whether f is constant or not
|0 H
Uf
H
|1 H
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
Deutsch algorithm
Goal:
Given an oracle Uf determine whether f is constant or not
|0 H
Uf
H ± |f (0) ⊕ f (1)
|1 H
1√
2
|0 − 1√
2
|1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
Deutsch algorithm
Goal:
Given an oracle Uf determine whether f is constant or not
|0 H
Uf
H ± |f (0) ⊕ f (1)
|1 H
1√
2
|0 − 1√
2
|1
If f constant, f (0) ⊕ f (1) = 0
± |0 ⊗
1
√
2
|0 −
1
√
2
|1
If f not constant, f (0) ⊕ f (1) = 1
± |1 ⊗
1
√
2
|0 −
1
√
2
|1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
Deutsch in λ
|0 H
Uf
H ± |f (0) ⊕ f (1)
|1 H
1√
2
|0 − 1√
2
|1
not = λxQ
.x?|0 ·|1
H = λxQ
.1/
√
2.(|0 + x?−|1 ·|1 )
Hboth = λxQ⊗Q
.(H(head x)) ⊗ (H(tail x))
Uf = λxQ⊗Q
.(head x) ⊗ ((tail x)?not(f (head x))·f (head x))
H1 = λxQ⊗Q
.(H(head x)) ⊗ (tail x)
Deutschf = π1(⇑
S(Q⊗Q)
S(S(Q)⊗Q) H1(Uf ⇑
S(Q⊗Q)
S(Q⊗S(Q))⇑
S(Q⊗S(Q))
S(S(Q)⊗S(Q)) Hboth(|0 ⊗ |1 )
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 23 / 26
Deutsch in λ
|0 H
Uf
H ± |f (0) ⊕ f (1)
|1 H
1√
2
|0 − 1√
2
|1
not = λxQ
.x?|0 ·|1
H = λxQ
.1/
√
2.(|0 + x?−|1 ·|1 )
Hboth = λxQ⊗Q
.(H(head x)) ⊗ (H(tail x))
Uf = λxQ⊗Q
.(head x) ⊗ ((tail x)?not(f (head x))·f (head x))
H1 = λxQ⊗Q
.(H(head x)) ⊗ (tail x)
Deutschf = π1(⇑
S(Q⊗Q)
S(S(Q)⊗Q) H1(Uf ⇑
S(Q⊗Q)
S(Q⊗S(Q))⇑
S(Q⊗S(Q))
S(S(Q)⊗S(Q)) Hboth(|0 ⊗ |1 )
Deutschf : Q ⊗ Q ⇒ Q ⊗ S(Q)
Deutschid −→∗
(1) π1(1/
√
2. |1 ⊗ |0 − 1/
√
2. |1 ⊗ |1 )
−→(1) |1 ⊗ (1/
√
2. |0 − 1/
√
2. |1 )
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 23 / 26
Teleportation
Goal:
To send a qubit, using an entangled pair, by sending only two bits
of information
Alice
|ψ • H
β00
Zb1
notb2 |ψ
Bob
where β00 = 1√
2
|0 ⊗ |0 + 1√
2
|1 ⊗ |1
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 24 / 26
Teleportation in λ
Alice
|ψ • H
β00
Zb1
notb2 |ψ
Bob
Teleportation : S(Q) ⇒ S(Q)
Teleportation q −→(1) q
Alice =
λxS(Q)⊗S(Q⊗Q)
.π2(⇑
S(Q⊗Q⊗Q)
S(S(Q)⊗Q⊗Q) H3
1 (cnot3
12 ⇑
S(Q⊗Q⊗Q)
S(Q⊗S(Q⊗Q))⇑
S(Q⊗S(Q⊗Q))
S(S(Q)⊗S(Q⊗Q)) x))
Ub
= λbQ
.λxQ
.b?Ux·x
Bob = λxQ⊗Q⊗Q
.Zhead x
nothead tail x
.(tail tail x)
β00 = 1/
√
2. |0 ⊗ |0 + 1/
√
2. |1 ⊗ |1
Teleportation = λqS(Q)
.Bob (⇑
S(Q⊗Q⊗Q)
S(Q⊗Q⊗S(Q)) Alice x ⊗ β00)
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 25 / 26
Summarising
Extension of (pure) first-order lambda-calculus for
quantum computing
Logical-linearity and algebraic-linearity both used for
no-cloning
Denotational semantics:
Types: sets of vectors or vector spaces
Terms: vectors
If Γ t : A then t φΓ
⊆ A
Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 26 / 26

More Related Content

PDF
A Unifying Review of Gaussian Linear Models (Roweis 1999)
PDF
A System F accounting for scalars
PDF
Chapter02
PPT
Qualifier
PDF
First-order cosmological perturbations produced by point-like masses: all sca...
PPT
Arima model (time series)
PDF
ALL-SCALE cosmological perturbations and SCREENING OF GRAVITY in inhomogeneou...
PDF
Shanghai tutorial
A Unifying Review of Gaussian Linear Models (Roweis 1999)
A System F accounting for scalars
Chapter02
Qualifier
First-order cosmological perturbations produced by point-like masses: all sca...
Arima model (time series)
ALL-SCALE cosmological perturbations and SCREENING OF GRAVITY in inhomogeneou...
Shanghai tutorial

What's hot (20)

PDF
Chapter06
PPT
1514 concept of a limit
PDF
On the Numerical Solution of Differential Equations
PPTX
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...
PDF
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
PDF
PDF
Time series modelling arima-arch
PDF
NIACFDS2015-09-29_HiroNishikawa_HNS20
PPTX
Chapter v
PPTX
Time series Modelling Basics
PDF
A Markov Chain Monte Carlo approach to the Steiner Tree Problem in water netw...
PDF
Anomaly Detection in Sequences of Short Text Using Iterative Language Models
PPTX
Numerical solution of ordinary differential equation
PDF
Chapter 2 dynamic characteristics of instruments
PDF
Gauss Elimination Method With Partial Pivoting
PDF
Nonnegative Matrix Factorization with Side Information for Time Series Recove...
PDF
Metropolis-Hastings MCMC Short Tutorial
PDF
Randomization
PPTX
Time series Analysis
PDF
Braneworld Cosmology and Tachyon Inflation - RSII Numerical Models
Chapter06
1514 concept of a limit
On the Numerical Solution of Differential Equations
A new approach in specifying the inverse quadratic matrix in modulo-2 for con...
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
Time series modelling arima-arch
NIACFDS2015-09-29_HiroNishikawa_HNS20
Chapter v
Time series Modelling Basics
A Markov Chain Monte Carlo approach to the Steiner Tree Problem in water netw...
Anomaly Detection in Sequences of Short Text Using Iterative Language Models
Numerical solution of ordinary differential equation
Chapter 2 dynamic characteristics of instruments
Gauss Elimination Method With Partial Pivoting
Nonnegative Matrix Factorization with Side Information for Time Series Recove...
Metropolis-Hastings MCMC Short Tutorial
Randomization
Time series Analysis
Braneworld Cosmology and Tachyon Inflation - RSII Numerical Models
Ad

Similar to Towards a quantum lambda-calculus with quantum control (20)

PDF
Typing quantum superpositions and measurement
PDF
Vectorial types, non-determinism and probabilistic systems: Towards a computa...
PDF
Grovers Algorithm
PPT
2007 001-motivation-to-quantum-computing
PPTX
quantum computing Fundamentals and Applicaiton
PPTX
A short introduction to Quantum Computing and Quantum Cryptography
PDF
A lambda calculus for density matrices with classical and probabilistic controls
PPTX
Quantum Computation 101 (Almost)
PPTX
Lambda Calculus
PDF
Origins of Free
PDF
Slides used during my thesis defense "Du typage vectoriel"
PDF
Lambda Calculus by Dustin Mulcahey
PDF
Quantum Cryptography
PDF
Some_Properties_for_the_Commutators_of_Special_Linear_Quantum_Groups (12).pdf
PDF
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
PDF
Quantum Algorithms Via Linear Algebra A Primer Richard J Lipton Kenneth W Regan
PDF
The Extraordinary World of Quantum Computing
PDF
Lambda Calculus
PDF
MMath Paper, Canlin Zhang
PPTX
Asima Final Presentation.pptx
Typing quantum superpositions and measurement
Vectorial types, non-determinism and probabilistic systems: Towards a computa...
Grovers Algorithm
2007 001-motivation-to-quantum-computing
quantum computing Fundamentals and Applicaiton
A short introduction to Quantum Computing and Quantum Cryptography
A lambda calculus for density matrices with classical and probabilistic controls
Quantum Computation 101 (Almost)
Lambda Calculus
Origins of Free
Slides used during my thesis defense "Du typage vectoriel"
Lambda Calculus by Dustin Mulcahey
Quantum Cryptography
Some_Properties_for_the_Commutators_of_Special_Linear_Quantum_Groups (12).pdf
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
Quantum Algorithms Via Linear Algebra A Primer Richard J Lipton Kenneth W Regan
The Extraordinary World of Quantum Computing
Lambda Calculus
MMath Paper, Canlin Zhang
Asima Final Presentation.pptx
Ad

More from Alejandro Díaz-Caro (10)

PDF
Affine computation and affine automaton
PDF
Simply typed lambda-calculus modulo isomorphisms
PDF
The probability of non-confluent systems
PDF
Quantum computing, non-determinism, probabilistic systems... and the logic be...
PDF
Non determinism through type isomophism
PDF
Call-by-value non-determinism in a linear logic type discipline
PDF
Linearity in the non-deterministic call-by-value setting
PDF
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
PDF
Slides QuAND 2011
PDF
Equivalence of algebraic λ-calculi
Affine computation and affine automaton
Simply typed lambda-calculus modulo isomorphisms
The probability of non-confluent systems
Quantum computing, non-determinism, probabilistic systems... and the logic be...
Non determinism through type isomophism
Call-by-value non-determinism in a linear logic type discipline
Linearity in the non-deterministic call-by-value setting
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
Slides QuAND 2011
Equivalence of algebraic λ-calculi

Recently uploaded (20)

PPTX
Application of enzymes in medicine (2).pptx
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PPTX
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
Science Quipper for lesson in grade 8 Matatag Curriculum
PPTX
2. Earth - The Living Planet earth and life
PPTX
C1 cut-Methane and it's Derivatives.pptx
PPTX
Introduction to Cardiovascular system_structure and functions-1
PDF
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
PDF
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
PDF
Lymphatic System MCQs & Practice Quiz – Functions, Organs, Nodes, Ducts
PPTX
Pharmacology of Autonomic nervous system
PPTX
famous lake in india and its disturibution and importance
PDF
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
PPTX
2. Earth - The Living Planet Module 2ELS
PDF
Placing the Near-Earth Object Impact Probability in Context
PPTX
TOTAL hIP ARTHROPLASTY Presentation.pptx
PPTX
7. General Toxicologyfor clinical phrmacy.pptx
PPTX
POULTRY PRODUCTION AND MANAGEMENTNNN.pptx
PDF
An interstellar mission to test astrophysical black holes
Application of enzymes in medicine (2).pptx
Phytochemical Investigation of Miliusa longipes.pdf
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
ECG_Course_Presentation د.محمد صقران ppt
Science Quipper for lesson in grade 8 Matatag Curriculum
2. Earth - The Living Planet earth and life
C1 cut-Methane and it's Derivatives.pptx
Introduction to Cardiovascular system_structure and functions-1
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
Lymphatic System MCQs & Practice Quiz – Functions, Organs, Nodes, Ducts
Pharmacology of Autonomic nervous system
famous lake in india and its disturibution and importance
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
2. Earth - The Living Planet Module 2ELS
Placing the Near-Earth Object Impact Probability in Context
TOTAL hIP ARTHROPLASTY Presentation.pptx
7. General Toxicologyfor clinical phrmacy.pptx
POULTRY PRODUCTION AND MANAGEMENTNNN.pptx
An interstellar mission to test astrophysical black holes

Towards a quantum lambda-calculus with quantum control

  • 1. Towards a quantum λ-calculus with quantum control arXiv:1601.04294 Alejandro Díaz-Caro UNIVERSIDAD NACIONAL DE QUILMES Joint work with Gilles Dowek Inria & ENS-Cachan V Congreso Latinoamericano de Matemáticos Logic and Computability Session Barranquilla, Colombia, July 14, 2016
  • 2. Goal We want a pure functional extension of lambda calculusi.e. we do not want clasical control / quantum data Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 2 / 26
  • 3. Overview Some quantum properties (with dead and alive cats) Projective measurement Destructive interference No-cloning Entanglement and separability Expressing those properties in the lambda-calculus Superpositions, no-cloning and measurement Examples Deutsch algorithm Teleportation algorithm
  • 5. Projective measurement α + β |α|2 |β| 2 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 4 / 26
  • 6. Probabilistic vs. Quantum Destructive interference Probabilistic + Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 7. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 8. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α + β α|2 + |β 2 = 1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 9. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α − β α|2 + |−β 2 = 1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 10. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α − β α|2 + |−β 2 = 1 1 2 1 2 + 1 2 + 1 2 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 11. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α − β α|2 + |−β 2 = 1 1 2 1 2 + 1 2 + 1 2 α + β Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 12. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α − β α|2 + |−β 2 = 1 1 2 1 2 + 1 2 + 1 2 3 4 + 1 4 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 13. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α − β α|2 + |−β 2 = 1 1 2 1 2 + 1 2 + 1 2 3 4 + 1 4 5 8 + 3 8 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 14. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α − β α|2 + |−β 2 = 1 1 2 1 2 + 1 2 + 1 2 3 4 + 1 4 5 8 + 3 8 1 √ 2 1 √ 2 + 1 √ 2 + 1 √ 2 1 √ 2 − 1 √ 2 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 15. Probabilistic vs. Quantum Destructive interference Probabilistic a + b (a + b = 1) Quantum α − β α|2 + |−β 2 = 1 1 2 1 2 + 1 2 + 1 2 3 4 + 1 4 5 8 + 3 8 1 √ 2 1 √ 2 + 1 √ 2 + 1 √ 2 1 √ 2 − 1 √ 2 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 5 / 26
  • 16. No-cloning Superpositions vs. basis states There is no universal cloning machine for quantum states Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 6 / 26
  • 17. No-cloning Superpositions vs. basis states There is no universal cloning machine for quantum states α + β
  • 18. No-cloning Superpositions vs. basis states There is no universal cloning machine for quantum states α + β α + β α ⊗ + β ⊗ = α + β ⊗ α + β α2 ⊗ +αβ ⊗ +βα ⊗ +β2 ⊗ Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 6 / 26
  • 19. Entanglement and separability Example 1 α ⊗ +β ⊗ = α + β Superposed state ⊗ Basis state Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 7 / 26
  • 20. Entanglement and separability Example 1 α ⊗ +β ⊗ = α + β Superposed state ⊗ Basis stateExample 2 α1α2 ⊗ +α1β1 ⊗ +β2α2 ⊗ +β1β2 ⊗ α1 + β1 Superposed state ⊗ α2 + β2 Superposed state Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 7 / 26
  • 21. Entanglement and separability Example 1 α ⊗ +β ⊗ = α + β Superposed state ⊗ Basis stateExample 2 α1α2 ⊗ +α1β1 ⊗ +β2α2 ⊗ +β1β2 ⊗ α1 + β1 Superposed state ⊗ α2 + β2 Superposed state Example 3 α ⊗ + β ⊗ Entangled (and superposed) state Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 7 / 26
  • 22. Overview Some quantum properties (with dead and alive cats) Projective measurement Destructive interference No-cloning Entanglement and separability Expressing those properties in the lambda-calculus Superpositions, no-cloning and measurement Examples Deutsch algorithm Teleportation algorithm
  • 23. Logical linearity vs. algebraic linearity No-cloning =⇒ logical-linear terms e.g. λx.x ⊗ x forbidden Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
  • 24. Logical linearity vs. algebraic linearity No-cloning =⇒ logical-linear terms e.g. λx.x ⊗ x forbidden Another way No-cloning =⇒ algebraic-linear operators e.g. M(α. |0 + β. |1 ) → α.M |0 + β.M |1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
  • 25. Logical linearity vs. algebraic linearity No-cloning =⇒ logical-linear terms e.g. λx.x ⊗ x forbidden Another way No-cloning =⇒ algebraic-linear operators e.g. M(α. |0 + β. |1 ) → α.M |0 + β.M |1 What about measurement? (λx.πx) (α. |0 + β. |1 ) (Measurement operator) α.(λx.πx) |0 + β.(λx.πx) |1 ← Wrong! Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
  • 26. Logical linearity vs. algebraic linearity No-cloning =⇒ logical-linear terms e.g. λx.x ⊗ x forbidden Another way No-cloning =⇒ algebraic-linear operators e.g. M(α. |0 + β. |1 ) → α.M |0 + β.M |1 What about measurement? (λx.πx) (α. |0 + β. |1 ) (Measurement operator) α.(λx.πx) |0 + β.(λx.πx) |1 ← Wrong! We can use a combination of both: Logical-linear for abstractions taking superpositions Algebraic-linear for abstractions taking basis states Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 9 / 26
  • 27. Key point We need to distinguish superposed states from basis states Basis states can be cloned Superposed states cannot Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 10 / 26
  • 28. Grammars First version, without tensor Types Ψ := Q | S(Ψ) Qubit types A := Ψ | Ψ ⇒ A | S(A) Types Terms b := x | λxΨ .t | |0 | |1 Basis terms v := b | v + v | α.v | 0S(A) Values t := v | tt | t + t | α.t | πt | ?· Terms where α ∈ C Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 11 / 26
  • 29. Two types of linearity (λxQ .t) b Q → t[b/x] call-by-base (λxS(Ψ) .t) linear abstraction u S(Ψ) → t[u/x] call-by-name (λxQ .t) (b1 + b2) S(Q) → (λxQ .t) b1 Q +(λxQ .t) b2 Q linear distribution Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
  • 30. Two types of linearity (λxQ .t) b Q → t[b/x] call-by-base (λxS(Ψ) .t) linear abstraction u S(Ψ) → t[u/x] call-by-name (λxQ .t) (b1 + b2) S(Q) → (λxQ .t) b1 Q +(λxQ .t) b2 Q linear distribution Problem? λxQ⇒Q .x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
  • 31. Two types of linearity (λxQ .t) b Q → t[b/x] call-by-base (λxS(Ψ) .t) linear abstraction u S(Ψ) → t[u/x] call-by-name (λxQ .t) (b1 + b2) S(Q) → (λxQ .t) b1 Q +(λxQ .t) b2 Q linear distribution Problem? λxQ⇒Q .x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition) No problem It is a function which produces a superposition, is not a superposition It can be cloned Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
  • 32. Two types of linearity (λxQ .t) b Q → t[b/x] call-by-base (λxS(Ψ) .t) linear abstraction u S(Ψ) → t[u/x] call-by-name (λxQ .t) (b1 + b2) S(Q) → (λxQ .t) b1 Q +(λxQ .t) b2 Q linear distribution Problem? λxQ⇒Q .x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition) No problem It is a function which produces a superposition, is not a superposition It can be cloned What about λyS(Q) .λxQ .xy ? Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
  • 33. Two types of linearity (λxQ .t) b Q → t[b/x] call-by-base (λxS(Ψ) .t) linear abstraction u S(Ψ) → t[u/x] call-by-name (λxQ .t) (b1 + b2) S(Q) → (λxQ .t) b1 Q +(λxQ .t) b2 Q linear distribution Problem? λxQ⇒Q .x(|0 +|1 ) : (Q ⇒ Q) ⇒ Q Non-linear! (not a superposition) No problem It is a function which produces a superposition, is not a superposition It can be cloned What about λyS(Q) .λxQ .xy ? Ok, let’s stay in first order for now Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 12 / 26
  • 34. Typing applications Γ t : Ψ ⇒ A ∆ u : Ψ Γ, ∆ tu : A ⇒E Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
  • 35. Typing applications Γ t : Ψ ⇒ A ∆ u : Ψ Γ, ∆ tu : A ⇒E What about (λxQ .t) (b1 + b2) S(Q) ? Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
  • 36. Typing applications Γ t : Ψ ⇒ A ∆ u : Ψ Γ, ∆ tu : A ⇒E What about (λxQ .t) (b1 + b2) S(Q) ? Γ t : Ψ ⇒ A ∆ u : S(Ψ) Γ, ∆ tu : S(A) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
  • 37. Typing applications Γ t : Ψ ⇒ A ∆ u : Ψ Γ, ∆ tu : A ⇒E What about (λxQ .t) (b1 + b2) S(Q) ? Γ t : Ψ ⇒ A ∆ u : S(Ψ) Γ, ∆ tu : S(A) What about ((λxQ .t) + (λyQ .u)) S(Q⇒A) v? Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
  • 38. Typing applications Γ t : Ψ ⇒ A ∆ u : Ψ Γ, ∆ tu : A ⇒E What about (λxQ .t) (b1 + b2) S(Q) ? Γ t : Ψ ⇒ A ∆ u : S(Ψ) Γ, ∆ tu : S(A) What about ((λxQ .t) + (λyQ .u)) S(Q⇒A) v? Γ t : S(Ψ ⇒ A) ∆ u : S(Ψ) Γ, ∆ tu : S(A) ⇒ES Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 13 / 26
  • 39. Example f : Q ⇒ A g : Q ⇒ A f + g : S(Q ⇒ A) S+ I |0 : Q Ax|0 |0 : S(Q) (f + g) |0 : S(A) ⇒ES ⇓ f : Q ⇒ A |0 : Q Ax|0 f |0 : A ⇒E g : Q ⇒ A |0 : Q Ax|0 g |0 : A ⇒E f |0 + g |0 : S(A) S+ I Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 14 / 26
  • 40. Measurement π( n i=1 [αi.]bi) −→ |αk|2 n i=1 |αi|2 bk ∀i, bi = |0 or bi = |1 . n i=1 αi .bi is normal (and hence 1 ≤ n ≤ 2). k ≤ n Example π(i. |0 + 2. |1 ) |0 |1 1 3 2 3 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 15 / 26
  • 41. Adding tensor products Intepretation of types S(Q) vs. Q Q = {|0 , |1 } ⊆ C2 A ⊗ B = A × B S(A) = G A Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 16 / 26
  • 42. Adding tensor products Intepretation of types S(Q) vs. Q Q = {|0 , |1 } ⊆ C2 A ⊗ B = A × B S(A) = G A Examples (1/ √ 2. |0 + 1/ √ 2. |1 ) ⊗ |0 ∈ S(Q) ⊗ Q = G({|0 , |1 }) × {|0 , |1 } = C2 × {|0 , |1 } 1/ √ 2. |0 ⊗ |0 + 1/ √ 2. |1 ⊗ |1 ∈ S(Q ⊗ Q) = G({|0 , |1 } × {|0 , |1 }) = G({|0 ⊗ |0 , |0 ⊗ |1 , |1 ⊗ |0 , |1 ⊗ |1 }) = C2 ⊗ C2 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 16 / 26
  • 43. Some information is lost on reduction Subtyping {|0 , |1 } ⊂ C2 then Q ≤ S(Q) G(GA) = GA then S(S(Q)) ≤ S(Q) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
  • 44. Some information is lost on reduction Subtyping {|0 , |1 } ⊂ C2 then Q ≤ S(Q) G(GA) = GA then S(S(Q)) ≤ S(Q) {|0 , |1 } × C2 ⊂ C2 ⊗ C2 then Q ⊗ S(Q) ≤ S(Q ⊗ Q) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
  • 45. Some information is lost on reduction Subtyping {|0 , |1 } ⊂ C2 then Q ≤ S(Q) G(GA) = GA then S(S(Q)) ≤ S(Q) {|0 , |1 } × C2 ⊂ C2 ⊗ C2 then Q ⊗ S(Q) ≤ S(Q ⊗ Q) |0 ⊗ (|0 + |1 ) : Q ⊗ S(Q) |0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
  • 46. Some information is lost on reduction Subtyping {|0 , |1 } ⊂ C2 then Q ≤ S(Q) G(GA) = GA then S(S(Q)) ≤ S(Q) {|0 , |1 } × C2 ⊂ C2 ⊗ C2 then Q ⊗ S(Q) ≤ S(Q ⊗ Q) |0 ⊗ (|0 + |1 ) : Q ⊗ S(Q) |0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
  • 47. Some information is lost on reduction Subtyping {|0 , |1 } ⊂ C2 then Q ≤ S(Q) G(GA) = GA then S(S(Q)) ≤ S(Q) {|0 , |1 } × C2 ⊂ C2 ⊗ C2 then Q ⊗ S(Q) ≤ S(Q ⊗ Q) |0 ⊗ (|0 + |1 ) : Q ⊗ S(Q) |0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q) Same happens in math! (X − 1)(X − 2) −→ X2 − 3X + 2 we lost the information that it was a product Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
  • 48. Some information is lost on reduction Subtyping {|0 , |1 } ⊂ C2 then Q ≤ S(Q) G(GA) = GA then S(S(Q)) ≤ S(Q) {|0 , |1 } × C2 ⊂ C2 ⊗ C2 then Q ⊗ S(Q) ≤ S(Q ⊗ Q) |0 ⊗ (|0 + |1 ) : Q ⊗ S(Q) |0 ⊗ |0 + |0 ⊗ |1 : S(Q ⊗ Q) Same happens in math! (X − 1)(X − 2) −→ X2 − 3X + 2 we lost the information that it was a product Solution: casting |0 ⊗ (|0 + |1 ) |0 ⊗ |0 + |0 ⊗ |1 ⇑ S(Q⊗Q) Q⊗S(Q) |0 ⊗ (|0 + |1 ) → |0 ⊗ |0 + |0 ⊗ |1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 17 / 26
  • 49. Full grammars Types Q := Q | Q ⊗ Q Basis qubit types Ψ := Q | S(Ψ) | Ψ ⊗ Ψ Qubit types A := Ψ | Ψ ⇒ A | S(A) | A ⊗ A Types Terms b := x | λxΨ .t | |0 | |1 | b ⊗ b Basis terms v := b | v + v | α.v | 0S(A) | v ⊗ v Values t := v | tt | t + t | α.t | πj t | ?· | t ⊗ t | head t | tail t | ⇑ S(B⊗C) S(A) t Terms where α ∈ C Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 18 / 26
  • 50. Measurement of the first j qubits πj ( n i=1 [αi .](b1i ⊗ · · · ⊗ bmi )) −→   i∈P    |αi |2 n i=1 |αi |2       j h=1 bhk ⊗ i∈P     αi i∈P |αi |2     .(bj+1,i ⊗ · · · ⊗ bmi ) P ⊆ N≤n , such that ∀i ∈ P, ∀h ≤ j, bhi = bhk . Example π2( 2.(|0 ⊗ |1 ⊗ |1 ) + |0 ⊗ |1 ⊗ |0 + 3.(|1 ⊗ |1 ⊗ |1 ) ) |0 ⊗ |1 ⊗ ( 2√ 5 . |1 + 1√ 5 . |0 ) |1 ⊗ |1 ⊗ (1. |1 ) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 19 / 26
  • 51. Overview Some quantum properties (with dead and alive cats) Projective measurement Destructive interference No-cloning Entanglement and separability Expressing those properties in the lambda-calculus Superpositions, no-cloning and measurement Examples Deutsch algorithm Teleportation algorithm
  • 52. Deutsch algorithm Preliminaries Hadamard H |0 = 1 √ 2 |0 + 1 √ 2 |1 H |1 = 1 √ 2 |0 − 1 √ 2 |1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
  • 53. Deutsch algorithm Preliminaries Hadamard H |0 = 1 √ 2 |0 + 1 √ 2 |1 H |1 = 1 √ 2 |0 − 1 √ 2 |1 H = λxQ .1/ √ 2.(|0 + x?−|1 ·|1 ) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
  • 54. Deutsch algorithm Preliminaries Hadamard H |0 = 1 √ 2 |0 + 1 √ 2 |1 H |1 = 1 √ 2 |0 − 1 √ 2 |1 H = λxQ .1/ √ 2.(|0 + x?−|1 ·|1 ) Oracle A “black box” implementing a function f : {0, 1} → {0, 1} Uf (|x ⊗ |y ) = |x ⊗ |y ⊕ f (x) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
  • 55. Deutsch algorithm Preliminaries Hadamard H |0 = 1 √ 2 |0 + 1 √ 2 |1 H |1 = 1 √ 2 |0 − 1 √ 2 |1 H = λxQ .1/ √ 2.(|0 + x?−|1 ·|1 ) Oracle A “black box” implementing a function f : {0, 1} → {0, 1} Uf (|x ⊗ |y ) = |x ⊗ |y ⊕ f (x) not = λxQ .x?|0 ·|1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
  • 56. Deutsch algorithm Preliminaries Hadamard H |0 = 1 √ 2 |0 + 1 √ 2 |1 H |1 = 1 √ 2 |0 − 1 √ 2 |1 H = λxQ .1/ √ 2.(|0 + x?−|1 ·|1 ) Oracle A “black box” implementing a function f : {0, 1} → {0, 1} Uf (|x ⊗ |y ) = |x ⊗ |y ⊕ f (x) not = λxQ .x?|0 ·|1 Uf = λxQ⊗Q .(head x) ⊗ ((tail x)?not(f (head x))·f (head x)) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 21 / 26
  • 57. Deutsch algorithm Goal: Given an oracle Uf determine whether f is constant or not Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
  • 58. Deutsch algorithm Goal: Given an oracle Uf determine whether f is constant or not |0 H Uf H |1 H Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
  • 59. Deutsch algorithm Goal: Given an oracle Uf determine whether f is constant or not |0 H Uf H ± |f (0) ⊕ f (1) |1 H 1√ 2 |0 − 1√ 2 |1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
  • 60. Deutsch algorithm Goal: Given an oracle Uf determine whether f is constant or not |0 H Uf H ± |f (0) ⊕ f (1) |1 H 1√ 2 |0 − 1√ 2 |1 If f constant, f (0) ⊕ f (1) = 0 ± |0 ⊗ 1 √ 2 |0 − 1 √ 2 |1 If f not constant, f (0) ⊕ f (1) = 1 ± |1 ⊗ 1 √ 2 |0 − 1 √ 2 |1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 22 / 26
  • 61. Deutsch in λ |0 H Uf H ± |f (0) ⊕ f (1) |1 H 1√ 2 |0 − 1√ 2 |1 not = λxQ .x?|0 ·|1 H = λxQ .1/ √ 2.(|0 + x?−|1 ·|1 ) Hboth = λxQ⊗Q .(H(head x)) ⊗ (H(tail x)) Uf = λxQ⊗Q .(head x) ⊗ ((tail x)?not(f (head x))·f (head x)) H1 = λxQ⊗Q .(H(head x)) ⊗ (tail x) Deutschf = π1(⇑ S(Q⊗Q) S(S(Q)⊗Q) H1(Uf ⇑ S(Q⊗Q) S(Q⊗S(Q))⇑ S(Q⊗S(Q)) S(S(Q)⊗S(Q)) Hboth(|0 ⊗ |1 ) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 23 / 26
  • 62. Deutsch in λ |0 H Uf H ± |f (0) ⊕ f (1) |1 H 1√ 2 |0 − 1√ 2 |1 not = λxQ .x?|0 ·|1 H = λxQ .1/ √ 2.(|0 + x?−|1 ·|1 ) Hboth = λxQ⊗Q .(H(head x)) ⊗ (H(tail x)) Uf = λxQ⊗Q .(head x) ⊗ ((tail x)?not(f (head x))·f (head x)) H1 = λxQ⊗Q .(H(head x)) ⊗ (tail x) Deutschf = π1(⇑ S(Q⊗Q) S(S(Q)⊗Q) H1(Uf ⇑ S(Q⊗Q) S(Q⊗S(Q))⇑ S(Q⊗S(Q)) S(S(Q)⊗S(Q)) Hboth(|0 ⊗ |1 ) Deutschf : Q ⊗ Q ⇒ Q ⊗ S(Q) Deutschid −→∗ (1) π1(1/ √ 2. |1 ⊗ |0 − 1/ √ 2. |1 ⊗ |1 ) −→(1) |1 ⊗ (1/ √ 2. |0 − 1/ √ 2. |1 ) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 23 / 26
  • 63. Teleportation Goal: To send a qubit, using an entangled pair, by sending only two bits of information Alice |ψ • H β00 Zb1 notb2 |ψ Bob where β00 = 1√ 2 |0 ⊗ |0 + 1√ 2 |1 ⊗ |1 Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 24 / 26
  • 64. Teleportation in λ Alice |ψ • H β00 Zb1 notb2 |ψ Bob Teleportation : S(Q) ⇒ S(Q) Teleportation q −→(1) q Alice = λxS(Q)⊗S(Q⊗Q) .π2(⇑ S(Q⊗Q⊗Q) S(S(Q)⊗Q⊗Q) H3 1 (cnot3 12 ⇑ S(Q⊗Q⊗Q) S(Q⊗S(Q⊗Q))⇑ S(Q⊗S(Q⊗Q)) S(S(Q)⊗S(Q⊗Q)) x)) Ub = λbQ .λxQ .b?Ux·x Bob = λxQ⊗Q⊗Q .Zhead x nothead tail x .(tail tail x) β00 = 1/ √ 2. |0 ⊗ |0 + 1/ √ 2. |1 ⊗ |1 Teleportation = λqS(Q) .Bob (⇑ S(Q⊗Q⊗Q) S(Q⊗Q⊗S(Q)) Alice x ⊗ β00) Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 25 / 26
  • 65. Summarising Extension of (pure) first-order lambda-calculus for quantum computing Logical-linearity and algebraic-linearity both used for no-cloning Denotational semantics: Types: sets of vectors or vector spaces Terms: vectors If Γ t : A then t φΓ ⊆ A Alejandro Díaz-Caro (UNQ) Towards a quantum lambda calculus with quantum control 26 / 26