Hacia una lgica computacional cuntica
Alejandro Daz-Caro
Universit Paris-Ouest Nanterre La Dfense
& INRIA Paris-Roquencourt
23 avenue dItalie, Pars
FCEIA UNR
9 de Agosto de 2013
A proof-as-programs approach to quantum logic
Motivation
Curry-Howard correspondence
Intuitionistic logics
hypotheses
implication elimination (modus ponens)
implication introduction
Typed -calculus
free variables
application
abstraction
A proof is a program
(the formula it proves is a type for the program)
Goal: To find a quantum Curry-Howard correspondence
Between what?
I A quantum -calculus (quantum control/quantum data)
I Any logic, even if we need to define it!
1 / 30
A proof-as-programs approach to quantum logic
Motivation
Curry-Howard correspondence
Intuitionistic logics
Typed -calculus
hypotheses
implication elimination (modus ponens)
implication introduction
free variables
application
abstraction
A proof is a program
(the formula it proves is a type for the program)
Goal: To find a quantum Curry-Howard correspondence
Between what?
I A quantum -calculus (quantum control/quantum data)
I Any logic, even if we need to define it!
Computational quantum logic
We want a logic such that its proofs are quantum programs
1 / 30
Outline
A brief and fast introduction to quantum computing
A brief and fast introduction to -calculus
Starting point: algebraic extensions to -calculus
Simplifying the problem: non-determinism
From non-determinism to probabilities
A brief and fast introduction to quantum computing
A bit of history
Richard Feynmans quote (1982)
Im not happy with all the analyses that go with just the classical theory,
because nature isnt classical, and if you want to make a simulation of
nature, youd better make it quantum mechanical, and by golly its a
wonderful problem, because it doesnt look so easy.
2 / 30
A brief and fast introduction to quantum computing
A bit of history
Richard Feynmans quote (1982)
Im not happy with all the analyses that go with just the classical theory,
because nature isnt classical, and if you want to make a simulation of
nature, youd better make it quantum mechanical, and by golly its a
wonderful problem, because it doesnt look so easy.
1985
1993
1994
1996
1998
2001
David Deutsch
Charles Benett et.al.
Peter Shor
Lov Grover
Isaac Chuang et.al.
Lieven Vandersypen et.al.
1st. model of QTM
Teleportation algorithm
Fast factorisation algorithm
Fast search algorithm
1st (1 qubit) quantum computer
7 qubit quantum computer
2 / 30
A brief and fast introduction to quantum computing
A bit of history
Richard Feynmans quote (1982)
Im not happy with all the analyses that go with just the classical theory,
because nature isnt classical, and if you want to make a simulation of
nature, youd better make it quantum mechanical, and by golly its a
wonderful problem, because it doesnt look so easy.
1985
1993
1994
1996
1998
2001
David Deutsch
Charles Benett et.al.
Peter Shor
Lov Grover
Isaac Chuang et.al.
Lieven Vandersypen et.al.
1st. model of QTM
Teleportation algorithm
Fast factorisation algorithm
Fast search algorithm
1st (1 qubit) quantum computer
7 qubit quantum computer
. . . factorising the number 15
2 / 30
A brief and fast introduction to quantum computing
A bit of history
Richard Feynmans quote (1982)
Im not happy with all the analyses that go with just the classical theory,
because nature isnt classical, and if you want to make a simulation of
nature, youd better make it quantum mechanical, and by golly its a
wonderful problem, because it doesnt look so easy.
1985
1993
1994
1996
1998
2001
David Deutsch
Charles Benett et.al.
Peter Shor
Lov Grover
Isaac Chuang et.al.
Lieven Vandersypen et.al.
1st. model of QTM
Teleportation algorithm
Fast factorisation algorithm
Fast search algorithm
1st (1 qubit) quantum computer
7 qubit quantum computer
. . . factorising the number 15
Quantum logic?
2 / 30
A brief and fast introduction to quantum computing
A bit of history
Richard Feynmans quote (1982)
Im not happy with all the analyses that go with just the classical theory,
because nature isnt classical, and if you want to make a simulation of
nature, youd better make it quantum mechanical, and by golly its a
wonderful problem, because it doesnt look so easy.
1985
1993
1994
1996
1998
2001
David Deutsch
Charles Benett et.al.
Peter Shor
Lov Grover
Isaac Chuang et.al.
Lieven Vandersypen et.al.
1st. model of QTM
Teleportation algorithm
Fast factorisation algorithm
Fast search algorithm
1st (1 qubit) quantum computer
7 qubit quantum computer
. . . factorising the number 15
Quantum logic?
1936 Garret Birkhoff and John von Neumann
Unsurprisingly, not related to computing
2 / 30
A physics free introduction to quantum computing
Quantum vs. Classic, side by side
I
Classic computing Bit: 0, 1
Quantum computing Qubit: Normalised vector from
C2 = Span{|0i, |1i} = {|0i + |1i, , C}
0
1
where |0i =
and |1i =
1
0
3 / 30
A physics free introduction to quantum computing
Quantum vs. Classic, side by side
I
Classic computing Bit: 0, 1
Quantum computing Qubit: Normalised vector from
C2 = Span{|0i, |1i} = {|0i + |1i, , C}
0
1
where |0i =
and |1i =
1
0
CC 2-bits system: one of 00, 01, 10, 00
QC 2-qubits system: C2 C2 = Span{|00i, |01i, |10i, |11i}
where |xy i = |xi |y i
3 / 30
A physics free introduction to quantum computing
Quantum vs. Classic, side by side
I
Classic computing Bit: 0, 1
Quantum computing Qubit: Normalised vector from
C2 = Span{|0i, |1i} = {|0i + |1i, , C}
0
1
where |0i =
and |1i =
1
0
CC 2-bits system: one of 00, 01, 10, 00
QC 2-qubits system: C2 C2 = Span{|00i, |01i, |10i, |11i}
where |xy i = |xi |y i
CC Reading data: No problem
QC Measuring the system: Measurement of |0i + |1i returns a
bit, and the system collapses to
I
I
|0i if 0 was measured, with probability p0 = ||2
|1i if 1 was measured, with probability p1 = ||2 .
3 / 30
A physics free introduction to quantum computing
Quantum vs. Classic, side by side (cont.)
I
Classic computing computation: Logic gates {NOT, AND, etc...}
Quantum computing operations: Unitary matrices (U U = I )
Example:
1
1
H=
1
2
1
1
1
H|0i = (|0i + |1i)
2
1
H|1i = (|0i |1i)
2
We can also combine them:
(H I ) = Apply H to the first qubit, and identity to the second
4 / 30
A physics free introduction to quantum computing
Quantum vs. Classic, side by side (cont.)
I
Classic computing computation: Logic gates {NOT, AND, etc...}
Quantum computing operations: Unitary matrices (U U = I )
Example:
1
1
H=
1
2
1
1
1
H|0i = (|0i + |1i)
2
1
H|1i = (|0i |1i)
2
We can also combine them:
(H I ) = Apply H to the first qubit, and identity to the second
I
No-cloning theorem There is no universal cloning machine
i.e. @U s.t. U|i = |i for an arbitrary qubit |i
4 / 30
A physics free introduction to quantum computing
Quantum vs. Classic, side by side (cont.)
I
Classic computing computation: Logic gates {NOT, AND, etc...}
Quantum computing operations: Unitary matrices (U U = I )
Example:
1
1
H=
1
2
1
1
1
H|0i = (|0i + |1i)
2
1
H|1i = (|0i |1i)
2
We can also combine them:
(H I ) = Apply H to the first qubit, and identity to the second
I
No-cloning theorem There is no universal cloning machine
i.e. @U s.t. U|i = |i for an arbitrary qubit |i
Entanglement n-qubit 6=
|i i
e.g.
1 |00i
2
1 |11i
2
4 / 30
A physics free introduction to quantum computing
Quantum vs. Classic, side by side (cont.)
I
Classic computing computation: Logic gates {NOT, AND, etc...}
Quantum computing operations: Unitary matrices (U U = I )
Example:
1
1
H=
1
2
1
1
1
H|0i = (|0i + |1i)
2
1
H|1i = (|0i |1i)
2
We can also combine them:
(H I ) = Apply H to the first qubit, and identity to the second
I
No-cloning theorem There is no universal cloning machine
i.e. @U s.t. U|i = |i for an arbitrary qubit |i
N
Entanglement n-qubit 6= i |i i
e.g. 12 |00i +
Consequence: Measuring the first qubit... both collapse!
1 |11i
2
4 / 30
A physics free introduction to quantum computing
Example: Deutshs algorithm
Objective: To know if a 1-bit function f : B B is constant or not.
Oracle: Uf |x, y i = |x, y f (x)i where is the addition modulo 2.
Uf |x, 0i = |x, f (x)i
5 / 30
A physics free introduction to quantum computing
Example: Deutshs algorithm
Objective: To know if a 1-bit function f : B B is constant or not.
Oracle: Uf |x, y i = |x, y f (x)i where is the addition modulo 2.
Uf |x, 0i = |x, f (x)i
First attempt:
Uf (H I )|00i = Uf
1
1
(|00i + |10i) = (|0, f (0)i + |1, f (1)i)
2
2
|
{z
}
Superposition of results
Only one call to Uf ... but how to read the results?
5 / 30
A physics free introduction to quantum computing
Example: Deutshs algorithm
Objective: To know if a 1-bit function f : B B is constant or not.
Oracle: Uf |x, y i = |x, y f (x)i where is the addition modulo 2.
Uf |x, 0i = |x, f (x)i
First attempt:
Uf (H I )|00i = Uf
1
1
(|00i + |10i) = (|0, f (0)i + |1, f (1)i)
2
2
|
{z
}
Superposition of results
Only one call to Uf ... but how to read the results?
Deutschs algorithm:
(H I )Uf (H H)|00i = =
|0i|i if f (0) = f (1)
|1i|i if f (0) 6= f (1)
with |i =
1 (|0i
2
|1i)
Measuring the first qubit, we have the answer...
with only one call to the oracle
5 / 30
Outline
A brief and fast introduction to quantum computing
A brief and fast introduction to -calculus
A brief and fast introduction to typed -calculus
How does it relates to intuitionistic logic?
Starting point: algebraic extensions to -calculus
Simplifying the problem: non-determinism
From non-determinism to probabilities
A brief and fast introduction to -calculus
History and intuitions
Introduced in 1936 by Alonzo Church (Alan Turings doctoral adviser)
Motivation: Investigating the foundations of mathematics
(in particular, the concept of recursion)
6 / 30
A brief and fast introduction to -calculus
History and intuitions
Introduced in 1936 by Alonzo Church (Alan Turings doctoral adviser)
Motivation: Investigating the foundations of mathematics
(in particular, the concept of recursion)
Why we still use it
I Recursive functions are fundamental within computer science
I It is the simplest model to study properties of computation
6 / 30
A brief and fast introduction to -calculus
History and intuitions
Introduced in 1936 by Alonzo Church (Alan Turings doctoral adviser)
Motivation: Investigating the foundations of mathematics
(in particular, the concept of recursion)
Why we still use it
I Recursive functions are fundamental within computer science
I It is the simplest model to study properties of computation
Two fundamental simplifications
I Anonymity of functions:
Example:
sqsum(x, y ) = x 2 + y 2
is written anonymously as
(x, y )
7 x2 + y2
No names needed
6 / 30
A brief and fast introduction to -calculus
History and intuitions
Introduced in 1936 by Alonzo Church (Alan Turings doctoral adviser)
Motivation: Investigating the foundations of mathematics
(in particular, the concept of recursion)
Why we still use it
I Recursive functions are fundamental within computer science
I It is the simplest model to study properties of computation
Two fundamental simplifications
I Anonymity of functions:
Example:
sqsum(x, y ) = x 2 + y 2
is written anonymously as
(x, y ) 7 x 2 + y 2
No names needed
I All the functions are in a single variable:
Example:
(x, y ) 7 x 2 + y 2
is written as
x 7 (y 7 x 2 + y 2 )
A 2-vars function is a 1-var function, returning
a 1-var function, which does the calculation
6 / 30
A brief and fast introduction to -calculus
Formalisation
Language of terms (a grammar)
t, r
I
I
I
::=
| x.t | tr
A variable x Vars is a -term
If t is a term, and x is a variable, x.t is a term
If t and r are two terms, tr is a term
(x 7 t)
(application)
These are the only possible terms.
7 / 30
A brief and fast introduction to -calculus
Formalisation
Language of terms (a grammar)
t, r
I
I
I
::=
| x.t | tr
A variable x Vars is a -term
If t is a term, and x is a variable, x.t is a term
If t and r are two terms, tr is a term
(x 7 t)
(application)
These are the only possible terms.
A rewrite rule (-reduction)
(x.t)r t[x := r]
7 / 30
A brief and fast introduction to -calculus
Formalisation
Language of terms (a grammar)
t, r
I
I
I
::=
| x.t | tr
A variable x Vars is a -term
If t is a term, and x is a variable, x.t is a term
If t and r are two terms, tr is a term
(x 7 t)
(application)
These are the only possible terms.
A rewrite rule (-reduction)
(x.t)r t[x := r]
Example: Let x 2 + 1 be a -term (with some encoding)
f (x) = x 2 + 1
is written
x.x 2 + 1
7 / 30
A brief and fast introduction to -calculus
Formalisation
Language of terms (a grammar)
t, r
I
I
I
::=
| x.t | tr
A variable x Vars is a -term
If t is a term, and x is a variable, x.t is a term
If t and r are two terms, tr is a term
(x 7 t)
(application)
These are the only possible terms.
A rewrite rule (-reduction)
(x.t)r t[x := r]
Example: Let x 2 + 1 be a -term (with some encoding)
f (x) = x 2 + 1
x.x 2 + 1
is written
f (t) is written (x.x 2 + 1)t which -reduces to
(x 2 + 1)[x := t]
t2 + 1
7 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
8 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
= (x.xx)(x.xx)
8 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
= (x.xx)(x.xx) xx[x := x.xx]
8 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
= (x.xx)(x.xx) xx[x := x.xx] = (x.xx)(x.xx) =
So
8 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
= (x.xx)(x.xx) xx[x := x.xx] = (x.xx)(x.xx) =
So
Normalisation
t is in normal form, if it does not rewrite
e.g.
x.x
8 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
= (x.xx)(x.xx) xx[x := x.xx] = (x.xx)(x.xx) =
So
Normalisation
t is in normal form, if it does not rewrite
t is normalising if it can end
e.g.
e.g.
x.x
(x.y .y )
8 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
= (x.xx)(x.xx) xx[x := x.xx] = (x.xx)(x.xx) =
So
Normalisation
t is in normal form, if it does not rewrite
t is normalising if it can end
t is strongly normalising if it always ends
e.g.
x.x
e.g.
(x.y .y )
e.g. (x.x)(x.x)
8 / 30
A brief and fast introduction to -calculus
Normal form
Not every computation ends well...
Consider x.xx
(the function that takes an argument, and applies it to itself)
= (x.xx)(x.xx) xx[x := x.xx] = (x.xx)(x.xx) =
So
Normalisation
t is in normal form, if it does not rewrite
t is normalising if it can end
t is strongly normalising if it always ends
e.g.
x.x
e.g.
(x.y .y )
e.g. (x.x)(x.x)
How can we know if a -term is (strongly) normalising?
8 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
, x T ` x : T
ax
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
, x T ` t : R
ax
T
I
, x ` x : T
` x.t : T R
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
`t:T R `r:T
, x T ` t : R
ax
E
T
I
, x ` x : T
` tr : R
` x.t : T R
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
`t:T R `r:T
, x T ` t : R
ax
E
T
I
, x ` x : T
` tr : R
` x.t : T R
Example of type derivation
ax
xT ` x : T
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
`t:T R `r:T
, x T ` t : R
ax
E
T
I
, x ` x : T
` tr : R
` x.t : T R
Example of type derivation
ax
xT ` x : T
I
` x.x : T T
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
`t:T R `r:T
, x T ` t : R
ax
E
T
I
, x ` x : T
` tr : R
` x.t : T R
Example of type derivation
ax
ax
x T T ` x : T T
xT ` x : T
I
I
` x.x : (T T ) (T T )
` x.x : T T
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
`t:T R `r:T
, x T ` t : R
ax
E
T
I
, x ` x : T
` tr : R
` x.t : T R
Example of type derivation
ax
ax
x T T ` x : T T
xT ` x : T
I
I
` x.x : (T T ) (T T )
` x.x : T T
E
` (x.x)(x.x) : T T
9 / 30
A brief and fast introduction to typed -calculus
Simply types
Static way of classify -terms (i.e. without reducing it)
Terms
Types
I
c is a base type
t, r ::= x
T , R ::= c
I
| x.t | tr
| T R
T R is the functional type
Context: set of typed variables
= x1T1 , . . . , xnTn
`t:T
t has type T in context
Typing rules
`t:T R `r:T
, x T ` t : R
ax
E
T
I
, x ` x : T
` tr : R
` x.t : T R
Example of type derivation
ax
ax
x T T ` x : T T
xT ` x : T
I
I
` x.x : (T T ) (T T )
` x.x : T T
E
` (x.x)(x.x) : T T
Verification: (x.x)(x.x) rewrites to x.x (of type T T )
9 / 30
A brief and fast introduction to typed -calculus
Normalisation
does not have a type in this theory
10 / 30
A brief and fast introduction to typed -calculus
Normalisation
does not have a type in this theory
Moreover...
Theorem (Strong normalisation)
If t has a type, t is strongly normalising
10 / 30
A brief and fast introduction to typed -calculus
Normalisation
does not have a type in this theory
Moreover...
Theorem (Strong normalisation)
If t has a type, t is strongly normalising
Slogan Well-typed programs cannot go wrong [R. Milner78]
10 / 30
How does it relates to intuitionistic logics?
A word on the Curry-Howard correspondence
Classical logic: a well-formed statement assumed true or false
11 / 30
How does it relates to intuitionistic logics?
A word on the Curry-Howard correspondence
Classical logic: a well-formed statement assumed true or false
Intuitionistic logic: a statement is true (false) if there is a constructive
proof that it is true (false)
Law of excluded middle is not an axiom!
(and cannot be proved neither) in intuitionistic logic
11 / 30
How does it relates to intuitionistic logics?
A word on the Curry-Howard correspondence
Classical logic: a well-formed statement assumed true or false
Intuitionistic logic: a statement is true (false) if there is a constructive
proof that it is true (false)
Law of excluded middle is not an axiom!
(and cannot be proved neither) in intuitionistic logic
Minimal intuitionistic logic
, T ` R
ax
I
, T ` T
`T R
`T R
`R
`T
11 / 30
How does it relates to intuitionistic logics?
A word on the Curry-Howard correspondence
Classical logic: a well-formed statement assumed true or false
Intuitionistic logic: a statement is true (false) if there is a constructive
proof that it is true (false)
Law of excluded middle is not an axiom!
(and cannot be proved neither) in intuitionistic logic
Minimal intuitionistic logic
, T ` R
ax
I
, T ` T
`T R
`T R
`T
`R
Typing rules
, x
`x :T
ax
, x T ` t : R
` x.t : T R
`t:T R
I
`r:T
` tr : R
11 / 30
How does it relates to intuitionistic logics?
A word on the Curry-Howard correspondence
Classical logic: a well-formed statement assumed true or false
Intuitionistic logic: a statement is true (false) if there is a constructive
proof that it is true (false)
Law of excluded middle is not an axiom!
(and cannot be proved neither) in intuitionistic logic
Minimal intuitionistic logic
, T ` R
ax
I
, T ` T
`T R
`T R
`T
`R
Typing rules
, x
`x :T
ax
, x T ` t : R
` x.t : T R
`t:T R
I
`r:T
` tr : R
The -term is the proof of the statement
Haskell Curry and William Howard,
Proofs... are programs!
between 1934 and 1969
11 / 30
How does it relates to intuitionistic logics?
A word on the Curry-Howard correspondence
Classical logic: a well-formed statement assumed true or false
Intuitionistic logic: a statement is true (false) if there is a constructive
proof that it is true (false)
Law of excluded middle is not an axiom!
(and cannot be proved neither) in intuitionistic logic
Minimal intuitionistic logic
, T ` R
ax
I
, T ` T
`T R
`T R
`T
`R
Typing rules
, x
`x :T
ax
, x T ` t : R
` x.t : T R
`t:T R
I
`r:T
` tr : R
The -term is the proof of the statement
Haskell Curry and William Howard,
Proofs... are programs!
between 1934 and 1969
More complex logics corresponds to more complex typing systems
11 / 30
Outline
A brief and fast introduction to quantum computing
A brief and fast introduction to -calculus
Starting point: algebraic extensions to -calculus
Untyped Lineal
Typed Lineal : Vectorial
Simplifying the problem: non-determinism
From non-determinism to probabilities
Untyped algebraic extensions to -calculus
Two origins:
I
Alg [Vaux09] (from Linear Logic)
Lineal [Arrighi,Dowek08] (for Quantum computing)
Equivalent formalisms [Daz-Caro,Perdrix,Tasson,Valiron10]
12 / 30
Untyped algebraic extensions to -calculus
Two origins:
I
Alg [Vaux09] (from Linear Logic)
Lineal [Arrighi,Dowek08] (for Quantum computing)
Equivalent formalisms [Daz-Caro,Perdrix,Tasson,Valiron10]
t, r ::= v | tr | t + r | .t | 0 (S, +, ), a ring
v ::= x | x.t
12 / 30
Untyped algebraic extensions to -calculus
Two origins:
I
Alg [Vaux09] (from Linear Logic)
Lineal [Arrighi,Dowek08] (for Quantum computing)
Equivalent formalisms [Daz-Caro,Perdrix,Tasson,Valiron10]
t, r ::= v | tr | t + r | .t | 0 (S, +, ), a ring
v ::= x | x.t
-reduction: (x.t)v t[x := v]
Algebraic reductions:
.t + .t ( + ).t,
..t ( ).t,
t(r1 + r2 ) tr1 + tr2 ,
(t1 + t2 )r t1 r + t2 r,
...
(oriented version of the axioms of
vectorial spaces)
12 / 30
Untyped algebraic extensions to -calculus
Two origins:
I
Alg [Vaux09] (from Linear Logic)
Lineal [Arrighi,Dowek08] (for Quantum computing)
Equivalent formalisms [Daz-Caro,Perdrix,Tasson,Valiron10]
t, r ::= v | tr | t + r | .t | 0 (S, +, ), a ring
v ::= x | x.t
-reduction: (x.t)v t[x := v]
Algebraic reductions:
.t + .t ( + ).t,
..t ( ).t,
t(r1 + r2 ) tr1 + tr2 ,
(t1 + t2 )r t1 r + t2 r,
...
Vectorial space of values
B = { vars. and abs. }
Space of values ::= Span(B)
(oriented version of the axioms of
vectorial spaces)
12 / 30
Example: simple encoding of quantum computing
[Arrighi,Dowek08]
Two base vectors:
|0i = x.y .x
|1i = x.y .y
13 / 30
Example: simple encoding of quantum computing
[Arrighi,Dowek08]
Two base vectors:
|0i = x.y .x
|1i = x.y .y
|+i
}|
{
1
H|0i (|0i + |1i)
2
We want a linear map H s.t.
1
H|1i (|0i |1i)
2
|
{z
}
|i
13 / 30
Example: simple encoding of quantum computing
[Arrighi,Dowek08]
Two base vectors:
|0i = x.y .x
|1i = x.y .y
|+i
}|
{
1
H|0i (|0i + |1i)
2
We want a linear map H s.t.
1
H|1i (|0i |1i)
2
|
{z
}
|i
H := x. {x [|+i] [|i]}
13 / 30
Example: simple encoding of quantum computing
[Arrighi,Dowek08]
Two base vectors:
|0i = x.y .x
|1i = x.y .y
|+i
}|
{
1
H|0i (|0i + |1i)
2
We want a linear map H s.t.
1
H|1i (|0i |1i)
2
|
{z
}
|i
H := x. {x [|+i] [|i]}
1
1
1
H|+i = H( (|0i + |1i)) (H|0i + H|1i) (|+i + |i)
2
2
2
1
1
1
1
(|0i + |1i) + (|0i |1i) ( 2|0i) |0i
=
2
2
2
2
13 / 30
Typed Lineal : vec
(or the Vectorial System)
[Arrighi,Daz-Caro,Valiron1213]
T , R ::= U | X | .T | T + R
U ::= X | U T | X.U | X.U
T +R
T + (R + S)
1.T
.(.T )
.T + .R
.T + .T
R +T
(T + R) + S
T
( ).T
.(T + R)
( + ).T
14 / 30
Typed Lineal : vec
(or the Vectorial System)
[Arrighi,Daz-Caro,Valiron1213]
T , R ::= U | X | .T | T + R
U ::= X | U T | X.U | X.U
T +R
T + (R + S)
1.T
.(.T )
.T + .R
.T + .T
R +T
(T + R) + S
T
( ).T
.(T + R)
( + ).T
Most important property of vec
P
` t : i i .Ti
P
t i i .ri
P
t i i .ri
P
` t : i i .Ti + 0.R
where ` ri : Ti
14 / 30
Typed Lineal : vec
(or the Vectorial System)
[Arrighi,Daz-Caro,Valiron1213]
T , R ::= U | X | .T | T + R
U ::= X | U T | X.U | X.U
T +R
T + (R + S)
1.T
.(.T )
.T + .R
.T + .T
R +T
(T + R) + S
T
( ).T
.(T + R)
( + ).T
Most important property of vec
P
` t : i i .Ti
P
t i i .ri
P
t i i .ri
P
` t : i i .Ti + 0.R
where ` ri : Ti
A type system capturing the vectorial structure of terms
. . . able to type matrices and vectors
. . . able to check for probability distributions
. . . or whatever application needing the structure of the vector
14 / 30
Example: Typing vectors and matrices
|0i
|+i
T
}|
{
1
1
H|0i (|0i + |1i) : (T + F)
2
2
1
1
` x.y .y : XY.X
{z Y Y} H|1i 2 (|0i |1i) : 2 (T F)
| {z } |
|
{z
} |
{z
}
F
|1i
z }| { z
}|
{
` x.y .x : XY.X Y X
|i
{ z
}|
15 / 30
Example: Typing vectors and matrices
|+i
|0i
}|
{
1
1
H|0i (|0i + |1i) : (T + F)
2
2
1
1
` x.y .y : XY.X
{z Y Y} H|1i 2 (|0i |1i) : 2 (T F)
| {z } |
|
{z
} |
{z
}
F
|1i
z }| { z
}|
{
` x.y .x : XY.X Y X
|i
{ z
}|
` x. {x [|+i] [|i]} : X.([] [] [X]) X
|
{z
}
H
15 / 30
Example: Typing vectors and matrices
|+i
|0i
}|
{
1
1
H|0i (|0i + |1i) : (T + F)
2
2
1
1
` x.y .y : XY.X
{z Y Y} H|1i 2 (|0i |1i) : 2 (T F)
| {z } |
|
{z
} |
{z
}
F
|1i
z }| { z
}|
{
` x.y .x : XY.X Y X
{ z
|i
}|
` x. {x [|+i] [|i]} : X.([] [] [X]) X
|
{z
}
H
` H( 12 (|0i + |1i)) :
(
2
+ ) T
15 / 30
Example: Typing vectors and matrices
|+i
|0i
}|
{
1
1
H|0i (|0i + |1i) : (T + F)
2
2
1
1
` x.y .y : XY.X
{z Y Y} H|1i 2 (|0i |1i) : 2 (T F)
| {z } |
|
{z
} |
{z
}
F
|1i
z }| { z
}|
{
` x.y .x : XY.X Y X
{ z
|i
}|
` x. {x [|+i] [|i]} : X.([] [] [X]) X
|
{z
}
H
In
general
0
..
.
1 := x1 . . . xn .xi
..
.
0
` H( 12 (|0i + |1i)) :
(
2
+ ) T
c1 c2 . . . cn = x.{x[c1 ][c2 ] . . . [cn ]}
X.([C1 ] [C2 ] [Cn ] [X]) X
X1 Xn .X1 Xn Xi
15 / 30
Still far from the main goal
(for a quantum Curry-Howard correspondence)
vec vectorial programs, not only quantum
matrices can be not unitary, vectors not normalised, etc
16 / 30
Still far from the main goal
(for a quantum Curry-Howard correspondence)
vec vectorial programs, not only quantum
matrices can be not unitary, vectors not normalised, etc
The logic behind not easy to visualise
16 / 30
Outline
A brief and fast introduction to quantum computing
A brief and fast introduction to -calculus
Starting point: algebraic extensions to -calculus
Simplifying the problem: non-determinism
Linearity of Lineal
Type isomorphisms, Curry-Howard...
From non-determinism to probabilities
Non-determinism
Simplifying Lineal
t, r ::= x | x.t | tr | t + r
17 / 30
Non-determinism
Simplifying Lineal
t, r ::= x | x.t | tr | t + r | t k r
t+rt
t+rr
17 / 30
Non-determinism
Simplifying Lineal
t, r ::= x | x.t | tr | t + r | t k r
t+rt
t+rr
Restricting to Linear Logic: Highly informative quantitative version
of strong normalisation [Daz-Caro,Manzonetto,Pagani13].
Based on [Ehrhard12], and this on second Girards
translation of Intuitionistic Logic into LL
17 / 30
Non-determinism
Simplifying Lineal
t, r ::= x | x.t | tr | t + r | t k r
t+rt
t+rr
Restricting to Linear Logic: Highly informative quantitative version
of strong normalisation [Daz-Caro,Manzonetto,Pagani13].
Based on [Ehrhard12], and this on second Girards
translation of Intuitionistic Logic into LL
I
However this is a restriction (everything must be linear)
17 / 30
Non-determinism
Simplifying Lineal
t, r ::= x | x.t | tr | t + r
Restricting to Linear Logic: Highly informative quantitative version
of strong normalisation [Daz-Caro,Manzonetto,Pagani13].
Based on [Ehrhard12], and this on second Girards
translation of Intuitionistic Logic into LL
I
However this is a restriction (everything must be linear)
Full calculus: 2nd order intuitionistic logic [Daz-Caro,Petit12]
17 / 30
Non-determinism
Simplifying Lineal
t, r ::= x | x.t | tr | t + r
Restricting to Linear Logic: Highly informative quantitative version
of strong normalisation [Daz-Caro,Manzonetto,Pagani13].
Based on [Ehrhard12], and this on second Girards
translation of Intuitionistic Logic into LL
I
However this is a restriction (everything must be linear)
Full calculus: 2nd order intuitionistic logic [Daz-Caro,Petit12]
I
2nd order intuitionistic logic A non linear fragment of Linear Logic
First logic related to (a fragment of) Lineal
17 / 30
Non-determinism: +
[Daz-Caro,Dowek1213]
t + r t and t + r r
Uncontrolled non-determinism
18 / 30
Non-determinism: +
[Daz-Caro,Dowek1213]
t + r t and t + r r
(t + r) t and (t + r) r
Uncontrolled non-determinism
A projector controlling it
18 / 30
Non-determinism: +
[Daz-Caro,Dowek1213]
t + r t and t + r r
(t + r) t and (t + r) r
Uncontrolled non-determinism
A projector controlling it
Non-determinism naturally arise by taking some type isomorphisms
as equalities (related to the univalence axiom)
Isomorphic propositions get the same proofs
18 / 30
Non-determinism: +
[Daz-Caro,Dowek1213]
t + r t and t + r r
(t + r) t and (t + r) r
Uncontrolled non-determinism
A projector controlling it
Non-determinism naturally arise by taking some type isomorphisms
as equalities (related to the univalence axiom)
Isomorphic propositions get the same proofs
AB B A
We want t + r = r + t
18 / 30
Non-determinism: +
[Daz-Caro,Dowek1213]
t + r t and t + r r
(t + r) t and (t + r) r
Uncontrolled non-determinism
A projector controlling it
Non-determinism naturally arise by taking some type isomorphisms
as equalities (related to the univalence axiom)
Isomorphic propositions get the same proofs
AB B A
We want t + r = r + t
1 (t + r) does not make any sense in this setting
18 / 30
Non-determinism: +
[Daz-Caro,Dowek1213]
t + r t and t + r r
(t + r) t and (t + r) r
Uncontrolled non-determinism
A projector controlling it
Non-determinism naturally arise by taking some type isomorphisms
as equalities (related to the univalence axiom)
Isomorphic propositions get the same proofs
AB B A
We want t + r = r + t
1 (t + r) does not make any sense in this setting
Instead: A (t + r) t (when t : A)
18 / 30
Non-determinism: +
[Daz-Caro,Dowek1213]
t + r t and t + r r
(t + r) t and (t + r) r
Uncontrolled non-determinism
A projector controlling it
Non-determinism naturally arise by taking some type isomorphisms
as equalities (related to the univalence axiom)
Isomorphic propositions get the same proofs
AB B A
We want t + r = r + t
1 (t + r) does not make any sense in this setting
Instead: A (t + r) t (when t : A)
If both have type A, then this is a non-deterministic projector
18 / 30
Non-determinism: +
Through type isomorphisms
AB
(A B) C
A (B C )
B A
A (B C )
(A B) (A C )
t:A
AB
t:B
19 / 30
Non-determinism: +
Through type isomorphisms
AB
(A B) C
A (B C )
B A
A (B C )
(A B) (A C )
t:A
AB
t:B
A (t + r) t (if t : A)
19 / 30
Non-determinism: +
Through type isomorphisms
AB
(A B) C
A (B C )
B A
A (B C )
(A B) (A C )
t:A
AB
t:B
A (t + r) t (if t : A)
t+r
(t + r) + s
(t + r)s
AB (t)r
r+t
t + (r + s)
ts + rs
B (tr) (if t : A (B C ))
19 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
20 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
B B (B B)
(B B B) (B B B)
20 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
B B (B B)
(B B B) (B B B)
BBB (TF) : B B B
20 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
B B (B B)
(B B B) (B B B)
BBB (TF) : B B B
Let
t:B
and
f:B
20 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
B B (B B)
(B B B) (B B B)
BBB (TF) : B B B
Let
t:B
and
f:B
BBB (TF) t f
20 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
B B (B B)
(B B B) (B B B)
BBB (TF) : B B B
Let
t:B
and
BBB (TF) t f
f:B
BB ((TF)t) f
20 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
B B (B B)
(B B B) (B B B)
BBB (TF) : B B B
Let
t:B
and
BBB (TF) t f
f:B
BB ((TF)t) f
B ((TF)tf)
20 / 30
Example
TF = x B .y B .(x + y )
TF : B B (B B)
B B (B B)
(B B B) (B B B)
BBB (TF) : B B B
Let
t:B
and
BBB (TF) t f
f:B
BB ((TF)t) f
%
, B (t + f) y
B ((TF)tf)
3t
+f
20 / 30
Non-determinism: +
A proof system where equivalent propositions get the same proofs
Curry-Howard correspondence with 2nd order intuitionistic logic
Non-deterministic projector
21 / 30
Outline
A brief and fast introduction to quantum computing
A brief and fast introduction to -calculus
Starting point: algebraic extensions to -calculus
Simplifying the problem: non-determinism
From non-determinism to probabilities
From non-determinism to probabilities
How to get rid of scalars [Daz-Caro,Dowek13]
A (t + A (r + s) + s)
A (r + s)
r
'
22 / 30
From non-determinism to probabilities
How to get rid of scalars [Daz-Caro,Dowek13]
A (t + A (r + s) + s)
A (t + A (r + s) + s)
1
3
A (r + s)
r
1
3
A (r + s)
7
1
3
'
1
2
1
2
r
'
1
1
1
t+ r+ s
3
6
2
22 / 30
From non-determinism to probabilities
How to get rid of scalars [Daz-Caro,Dowek13]
A (t + A (r + s) + s)
A (t + A (r + s) + s)
1
3
A (r + s)
1
3
A (r + s)
7
1
3
r
'
1
2
1
2
r
'
1
1
1
t+ r+ s
3
6
2
An easier way. . .
(r + r + s + t + t + t)
rt
1
6
1
6
1
6
16
t
$6
t
1
6
*t
22 / 30
From non-determinism to probabilities
Generalising the problem to abstract rewrite systems
Idea: to define a variant of a Lebesgue measure for sets of real
numbers, on the space of traces
23 / 30
From non-determinism to probabilities
Generalising the problem to abstract rewrite systems
Idea: to define a variant of a Lebesgue measure for sets of real
numbers, on the space of traces
1st Define an intuitive measure on single rewrites
1
2
e.g. If
1
3
<b
1
3
/c
1
3
"
1
2
7d
/e
then p(a c) =
1
3
p(a b; b d) =
1
3
and
1
3
1
2
1
6
23 / 30
From non-determinism to probabilities
Generalising the problem to abstract rewrite systems
Idea: to define a variant of a Lebesgue measure for sets of real
numbers, on the space of traces
1st Define an intuitive measure on single rewrites
1
2
e.g. If
1
3
<b
1
3
/c
1
3
"
1
2
7d
/e
then p(a c) =
1
3
p(a b; b d) =
1
3
and
1
3
1
2
1
6
2nd Generalise it to arbitrary sets of rewrites taking the minimal cover with
sets of single rewrites
Skip details
23 / 30
From non-determinism to probabilities
Strategies
: set of objects
: N
a b notation for (a, b) 6= 0.
24 / 30
From non-determinism to probabilities
Strategies
: set of objects
: N
a b notation for (a, b) 6= 0.
7b
Definition (Degree)
(a) =
X
b
e.g.
(a, b)
/b
'
c
(a) = 3
24 / 30
From non-determinism to probabilities
Strategies
: set of objects
: N
a b notation for (a, b) 6= 0.
7b
Definition (Degree)
(a) =
e.g.
(a, b)
/b
'
c
(a) = 3
Definition (Strategy)
f (a) = b implies a b
= set of all the strategies
24 / 30
From non-determinism to probabilities
Strategies
: set of objects
: N
a b notation for (a, b) 6= 0.
7b
Definition (Degree)
(a) =
e.g.
(a, b)
/b
'
c
(a) = 3
Definition (Strategy)
f (a) = b implies a b
= set of all the strategies
e.g. Rewrite system
= {f , g , h, i}, with
a
b
f (a) = b
f (c) = d
g (a) = b
g (c) = e
h(a) = c
h(c) = d
i(a) = c
i(c) = e
c
e
24 / 30
From non-determinism to probabilities
Boxes
Definition (Box)
B of the form
B = {f | f (a1 ) = b1 , . . . , f (an ) = bn }
25 / 30
From non-determinism to probabilities
Boxes
e.g. Rewrite system:
a
Definition (Box)
B of the form
B = {f | f (a1 ) = b1 , . . . , f (an ) = bn }
d
f1 =
c ; f2 =
d
c
Box
a
=
b
{f1 ; f2 } = {f | f (a) = b}
25 / 30
From non-determinism to probabilities
Measure on boxes
Definition (Measure on boxes)
If B = {f | f (a1 ) = b1 , . . . , f (an ) = bn } then
p(B) =
n
Y
(ai , bi )
i=1
(ai )
(ai , bi )
ways to arrive to bi from
(ai )
nb. of rewrites from ai
ai
26 / 30
From non-determinism to probabilities
Measure on boxes
Definition (Measure on boxes)
If B = {f | f (a1 ) = b1 , . . . , f (an ) = bn } then
p(B) =
n
Y
(ai , bi )
(ai )
i=1
(ai , bi )
ways to arrive to bi from
(ai )
nb. of rewrites from ai
e.g.
B=
ai
Box
f1 =
c ; f2 =
d
a
b
p(B) =
a
=
{f | f(a)=b}
(a, b)
1
=
(a)
2
26 / 30
From non-determinism to probabilities
Probability function
Definition (Probability function)
Let S P(), S 6=
P() = 0
(
P(S) = inf
)
X
BC
p(B) | C is a countable family of boxes s.t. S
BC
27 / 30
From non-determinism to probabilities
Probability function
Definition (Probability function)
Let S P(), S 6=
P() = 0
(
P(S) = inf
)
X
p(B) | C is a countable family of boxes s.t. S
BC
e.g.
S=
f1 =
BC
a
b
c ; f2 =
d
P(S) = p(B1 ) + p(B2 ) =
c
= {f1 } {f2 }
|{z} |{z}
B1
B2
1
1 1 1 1
+ =
2 2 2 2
2
27 / 30
From non-determinism to probabilities
Lebesgue measure and probability space
Definition (Lebesgue measurable)
A is Lebesgue measurable if S P()
P(S) = P(S A) + P(S A )
A = {A | A is Lebesgue measurable}
28 / 30
From non-determinism to probabilities
Lebesgue measure and probability space
Definition (Lebesgue measurable)
A is Lebesgue measurable if S P()
P(S) = P(S A) + P(S A )
A = {A | A is Lebesgue measurable}
Theorem
(, A, P) is a probability space
I
is the set of all possible strategies
A is the set of events
P is the probability function
Proof.
We show that it satisfies the Kolmogorov axioms.
28 / 30
From non-determinism to probabilities
Encoding an algebraic calculus
p+
AlgFp
|{z}
|{z}
Algebraic calculus with
+ with probability rewriting
scalars taken from Q(0,1]
29 / 30
From non-determinism to probabilities
Encoding an algebraic calculus
p+
AlgFp
|{z}
|{z}
Algebraic calculus with
+ with probability rewriting
scalars taken from Q(0,1]
Theorem (From AlgFp to p+ )
P
r i pi .ti
If
JtK si
then JrK si with probability
pi
p1 ++pn
29 / 30
From non-determinism to probabilities
Encoding an algebraic calculus
p+
AlgFp
|{z}
|{z}
Algebraic calculus with
+ with probability rewriting
scalars taken from Q(0,1]
Theorem (From AlgFp to p+ )
P
r i pi .ti
If
JtK si
then JrK si with probability
pi
p1 ++pn
Theorem (From p+ to AlgFp )
r ti with probability pi , for i = 1, . . . , n
LrM
pi .Lti M
29 / 30
Summarising
The long-term aim is to define a computational quantum logic
30 / 30
Summarising
The long-term aim is to define a computational quantum logic
We have
I
A -calculus extension able to express quantum programs
A complex type system characterising vectors and matrices
A linear non-deterministic model related to linear logic
A Curry-Howard correspondence between + and 2nd order
intuitionistic logic
An easy way to move from non-determinism to probabilities, without
back
changing the model
30 / 30
Summarising
The long-term aim is to define a computational quantum logic
We have
I
A -calculus extension able to express quantum programs
A complex type system characterising vectors and matrices
A linear non-deterministic model related to linear logic
A Curry-Howard correspondence between + and 2nd order
intuitionistic logic
An easy way to move from non-determinism to probabilities, without
back
changing the model
We need
I To move from probabilities to quantum, without loosing the
connections to logic
I
I
No-cloning (Move back to call-by-value [Arrighi,Dowek08])
Measurement: we need to check for orthogonality
.M + .N M with prob. ||2 ,
if M N
30 / 30