Escolar Documentos
Profissional Documentos
Cultura Documentos
Apanhado Geral
Motivação
Arquiteturas para Computação Quântica
Propriedades dos dados quânticos
Linguagens com dados quânticos e controle clássico
QCL - Bernhard Ömer, 1998
QPL - Peter Selinger, 2004
Propriedades do controle quântico
Linguagens com dados e controle quânticos
QML - Altenkirch e Grattage, 2005
QHaskell - Vizzotto e Rocha Costa, 2006
Motivação I - Computação Quântica
Programação quântica:
Compreensão das estruturas de dados e controle quânticos
Entendimento da lógica de programação quântica
Impulsionar o desenvolvimento de algoritmos quânticos
Motivação III - Programação Quântica
Resultados de
saida Medidas
classica representacao fisica
dos recursos quanticos
Arquiteturas para Programação Quântica
α|0i + β|1i
f (α|0i + β|1i)
Propriedades dos Dados Quânticos
α|00i + β|11i
α|0i + β|1i
Registradores quânticos
Qubits: registradores quânticos de tamanho 1.
Algoritmo de Deutsch
Algoritmo probabilı́stico: com uma aplicação da função
f : B → B consegue-se calcular f (0) ⊕ f (1) com probabilidade
1/2 com uma única aplicação de f .
Algoritmo de Deutsch
procedure deutsch(){
qureg x[1];
qureg y[1];
int m
{ reset ;
U(x,y);
measure y,m
} until m ≡ 1;
measure x,m;
print "g(0) xor g(1) = ",m;
reset;
}
Linguagens com Dados Quânticos e Controle Clássico
p,q:qbit p,q:qbit A B
C D
measure p A 0 measure p
0 0 0 0
p,q:qbit p,q:qbit p,q:qbit p,q:qbit
0 D
q *= N p *= N q *= N p *= N
D 0
p,q:qbit p,q:qbit p,q:qbit p,q:qbit
0 0
NAN*0
0 0
p,q:qbit p,q:qbit NAN*+D0
0 0
output p,q :qbit output p,q :qbit
QPL
Diagramas básicos:
A B
Gamma = A q:qbit,Gamma =
C D
A 0 Gamma = A + D
q:qbit,Gamma =
0 0
QPL
Diagramas básicos:
measure p
q *= S
q:qbit, Gamma = q:qbit, Gamma =
q:qbit, Gamma = (SXI)A(SXI)*
A 0 0 1 0 0
0 0 0 D
QPL
Gamma = A
new qbit q := 0
p:qbit,Gamma A
= 0
0 0
q *= H
= AA
p:qbit,Gamma1/2
AA
measure q
q:qbit,Gamma= q:qbit,Gamma=
0 1
A 0 0 0
0 0 0 A
discard q discard q
new qbit q := 0
p:qbit,Gamma A
= 0
0 0
a:qbit
q *= H
= AA
p:qbit,Gamma1/2 input a
AA
coin toss
measure q
output1 b output2 a
q:qbit,Gamma= q:qbit,Gamma=
0 1 b:qbit a:qbit
A 0 0 0
0 0 0 A
discard q discard q
[Q, L, M] →p [Q ′ , L′ , M ′ ]
Exemplo de redução:
[|0>,(λx ⋅ plus x x) ( meas (H p0))]
→1 [1/sqrt(2)(|0>+|1>),(λx ⋅ plus x x) ( meas p0)]
→1/2 { [|0>,(λx ⋅ plus x x) (0)],
[|1>,(λx ⋅ plus x x) (1)]}
→1/2 { [|0>, plus 0 0],
[|1>, plus 1 1] }
→1/2 { [|0>,0],
[|1>,0]}
Lambda QPL
Sistema de Tipos!
Lambda QPL
Sistema de Tipos
Baseado na lógica linear!
Capturar quais termos podem ser duplicados!
Um termo do tipo A não pode ser duplicado!
Um termo do tipo !A pode ser duplicado!
Lambda QPL
Exemplo: teleportação
EPR = λ x ⋅ CNOT<H (new 0), new 0>
BellMeasure =
λ q2 ⋅ λ q1 ⋅ ( let (p, p’) = CNOT<q1 ,q2 >
in <meas H(p), meas p’>)
U = λ q⋅ λ <x,y> ⋅ if x then ( if y then
U11q else U10q)
else ( if y then U01q else U00q)
Lambda QPL
Exemplo: teleportação
Teleport = let <p,p’> = EPR *
in let f = BellMeasure p
in let g = U p’
in <f,g>
Linguagens com Dados e Controle Quânticos
Sistema de Tipos
Regras de tipo baseadas na lógica linear estrita
Contrações são implı́citas.
Weakenings não são permitidos.
QML
Contexto de tipos
Γ = • | Γ,x:σ
QML
Contexto de tipos
Γ = • | Γ,x:σ
QML
var
x :σ⊢x :σ
QML
Ortogonalidade
if ◦ x then true else true
if ◦ x then t else u
A expressão somente deve ser aceita se t e u são valores quânticos
ortogonais (t ⊥ u).
t ⊥ u holds if ht|ui = 0
QML
Ortogonalidade
if ◦ x then true else true
if ◦ x then t else u
A expressão somente deve ser aceita se t e u são valores quânticos
ortogonais (t ⊥ u).
t ⊥ u holds if ht|ui = 0
QML
Ortogonalidade
if ◦ x then true else true
if ◦ x then t else u
A expressão somente deve ser aceita se t e u são valores quânticos
ortogonais (t ⊥ u).
t ⊥ u holds if ht|ui = 0
QML
Ortogonalidade
if ◦ x then true else true
if ◦ x then t else u
A expressão somente deve ser aceita se t e u são valores quânticos
ortogonais (t ⊥ u).
t ⊥ u holds if ht|ui = 0
QML
By definition of H
H(H x) = if ◦ ( if ◦ x
then ( false + (−1)*true )
else ( false + true ))
then ( false + (−1)*true )
else ( false + true )
QML: teoria equacional
By ifo
= if ◦ x
then ( if ◦ false
then (false + (−1)*true )
else ( false + true ) +
(−1) if ◦ true
then (false + (−1)*true )
else ( false + true ) )
else ( ◦
if false
then (false + (−1)*true )
else ( false + true ) +
(−1) if ◦ true
then (false + (−1)*true )
else ( false + true ) )
QML: teoria equacional
By β
= if ◦ x
then ( false − false + true + true )
else ( false + false + true − true )
By η-rule for if o
= x
QML: teoria equacional
By β
= if ◦ x
then ( false − false + true + true )
else ( false + false + true − true )
By η-rule for if o
= x
QML: teoria equacional
By β
= if ◦ x
then ( false − false + true + true )
else ( false + false + true − true )
By η-rule for if o
= x
QHaskell: sintaxe
x, y, ... ∈ Vars
κ, ι ∈ C
d ::= false | true | κ * d | q + r
p ::= e | x | meas x
| if x then p1 else p2
| proc xl → do cl
| pr −< xl
| let x = p1 in p2
| x ← e
| p1;p2
| qif x then p1 else p2
| returnA −< xl
QHaskell: exemplos
qnot = proc x → do
qif x then x’ ← false
else x’ ← qtrue
returnA −< x’
hadamar = proc x → do
qif x then x’ ← (false + (−1) * true)
else x’ ← false + true
returnA −< x’
QHaskell: exemplos
Sistema de tipos
Controlar o uso de variáveis!!
Sistema de tipos baseado na lógica linear!
Tipos clássicos:
σ = 1 | Bool | σ ⊗ τ
Tipos quânticos:
θ = Q1 | QBool | θ ⊗ υ
QHaskell
Sistema de tipos
Valores clássicos:
false true
• ◭ Γ ⊢ false : Bool • ◭ Γ ⊢ true : Bool
Variáveis:
cvar qvar
• ◭ x : σ, Γ ⊢ x : σ x :θ◭ Γ⊢x :θ
QHaskell
Sistema de tipos
Medida: transforma dado quântico em clássico
Θ ◭ x : |θ|, Γ ⊢ x
meas
x : θ ⊗ Θ ◭ Γ ⊢ meas x
QHaskell
Sistema de tipos
returnA: todas e somente todas as variáveis quânticas
retornas em um procedimento quântico devem ser provadas!
Sistema de tipos
Procedimentos quânticos:
Obrigada!