Typing quantum superpositions and measurement Alejandro Díaz-Caro Gilles Dowek I NRIA , LSV, ENS P ARIS -S ACLAY U NIVERSIDAD N ACIONAL DE Q UILMES & CONICET Cachan, France Buenos Aires, Argentina TPNC 2017 December 18-20, 2017, Prague, Czech Republic
Motivation We are interested in the most natural way of forbidding dupplication in quantum programming languages and formal logics A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 1 / 17
Outline Quantum mechanics, in two slides Simply typed lambda calculus, in two slides Motivation, better explained Our work: A quantum lambda calculus
Quantum mechanics, in two slides (I) The postulates 1 and 2 Postulate 1: Quantum states Postulate 2: Evolution & & = & & (A bit) more precisely: Normalized vectors ∈ C 2 n � α � = α | 0 � + β | 1 � ∈ C 2 β (A bit) more precisely: Unitary transformation (matrix) α � α � β U = U ( α | 0 � + β | 1 � ) = α ( | 0 � ⊗ | 0 � ) + β ( | 0 � ⊗ | 1 � ) β γ � � + γ ( | 1 � ⊗ | 0 � ) + δ ( | 1 � ⊗ | 1 � ) δ δ = δ | 0 � + γ | 1 � = ∈ C 4 γ A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 2 / 17
Quantum computing, in two slides (II) The postulates 3 and 4 Postulate 3: Measurement Postulate 4: Composition ⊗ & & More precisely: Tensor product & αγ � � � � α γ αδ ∈ C 2 ⊗ C 2 = C 4 ⊗ = β δ βγ (A bit) more precisely: βδ � 2 n i = 0 α i | i � collapses to | k � with probability | α k | 2 Consequence: No cloning A superposed state cannot be cloned & & ⊗ & A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 3 / 17
Simply typed lambda calculus, in two slides (I) History, definitions, and intuitions Introduced in 1936 by Alonzo Church Motivation : Studying the foundations of mathematics (in particular, the concept of recursion) Why we still use it? ◮ Simplest model to study properties of programming languages (base of functional programming) ◮ Connection with logics (Curry-Howard isomorphism) Grammar t := x | λ x . t | tt Rewrite rule ( λ x . t ) r → t [ r / x ] Example: Let x 2 + 1 be a λ -term (with some codification) f ( x ) = x 2 + 1 λ x . x 2 + 1 would be written f ( t ) is written ( λ x . x 2 + 1 ) t and reduces to ( x 2 + 1 )[ t / x ] t 2 + 1 = A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 4 / 17
Simply typed lambda calculus, in two slides (II) Types and logic x | λ x A . t | tt Terms := t Types := τ | A ⇒ A A ◮ τ is a basic type ◮ A ⇒ B is the function type Γ = x A 1 1 , . . . , x A n Context: A set of typed variables: n Typing rules | Derivation rules Γ , x A ⊢ t : B Γ ⊢ t : A ⇒ B Γ ⊢ r : A Γ , x A ⊢ x : A Γ ⊢ λ x A . t : A ⇒ B Γ ⊢ tr : B Example of type derivation y A ⇒ A ⊢ y : A ⇒ A x A ⊢ x : A ⊢ λ y A ⇒ A . y : ( A ⇒ A ) ⇒ ( A ⇒ A ) ⊢ λ x A . x : A ⇒ A ⊢ ( λ y A ⇒ A . y ) ( λ x A . x ) : A ⇒ A Verification: ( λ y A ⇒ A . y ) ( λ x A . x ) rewrites to λ x A . x (of type A ⇒ A ) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 5 / 17
Motivation Two approaches in the literature to deal with no cloning Linear-logic approach Linear-algebra approach & & e.g. f ( α | 0 � + β | 1 � ) → α f ( | 0 � ) + β f ( | 1 � ) e.g. λ x . ( x ⊗ x ) is forbidden A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 6 / 17
Motivation Measurement & & The linear-algebra approach does . . . but the linear-logic not make sense here. . . one, does e.g. ( λ x .π x ) ( α. | 0 � + β. | 1 � ) − → α. ( λ x .π x ) | 0 � + β. ( λ x .π x ) | 1 � Wrong! (Measurement operator) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 7 / 17
Key point We need to distinguish superposed states from basis states using types Basis states can be cloned Superposed states cannot Functions receiving superposed states, cannot clone its argument A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 8 / 17
Grammars First version, without tensor Types Ψ := B | S (Ψ) Qubit types A := Ψ | Ψ ⇒ A | S ( A ) Types Terms t := x | λ x Ψ . t | | 0 � | | 1 � | tt | π t | ? · | t + t | α. t | � 0 S ( A ) � �� � � �� � basis terms linear combinations where α ∈ C A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 9 / 17
Typing applications Γ ⊢ t : Ψ ⇒ A ∆ ⊢ u : Ψ ⇒ E Γ , ∆ ⊢ tu : A What about ( λ x B . t ) ( b 1 + b 2 ) ? � �� � S ( B ) Γ ⊢ t : Ψ ⇒ A ∆ ⊢ u : S (Ψ) Γ , ∆ ⊢ tu : S ( A ) What about (( λ x B . t ) + ( λ y B . u )) v ? � �� � S ( B ⇒ A ) Γ ⊢ t : S (Ψ ⇒ A ) ∆ ⊢ u : S (Ψ) ⇒ ES Γ , ∆ ⊢ tu : S ( A ) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 10 / 17
Measurement � b k π ( α 1 . b 1 + α 2 . b 2 ) − → � | α k | 2 | α 1 | 2 + | α 2 | 2 ◮ For i = 1 , 2, b i = | 0 � or b i = | 1 � . ◮ k = 1 , 2 Example | 0 � � 1 � π ( i . | 0 � + 2 . | 1 � ) 5 | 1 � � 4 � 5 A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 11 / 17
Adding tensor products Intepretation of types S ( B ) vs. B � B � = {| 0 � , | 1 �} ⊆ C 2 � A ⊗ B � = � A � × � B � � S ( A ) � = G � A � Examples √ √ ∈ {| 0 � , | 1 �} × C 2 | 0 � ⊗ ( 1 / 2 . | 0 � + 1 / 2 . | 1 � ) ���� � �� � B S ( B ) ∈ C 2 ⊗ C 2 √ √ 1 / 2 . ( | 0 � ⊗ | 0 � ) + 1 / 2 . ( | 0 � ⊗ | 1 � ) � �� � S ( B ⊗ B ) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 12 / 17
Some information is lost on reduction Subtyping {| 0 � , | 1 �} ⊂ C 2 then B ≤ S ( B ) G ( G A ) = G A S ( S ( B )) ≤ S ( B ) then {| 0 � , | 1 �} × C 2 ⊂ C 2 ⊗ C 2 then B ⊗ S ( B ) ≤ S ( B ⊗ B ) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 13 / 17
Some information is lost on reduction Subtyping {| 0 � , | 1 �} ⊂ C 2 then B ≤ S ( B ) G ( G A ) = G A S ( S ( B )) ≤ S ( B ) then {| 0 � , | 1 �} × C 2 ⊂ C 2 ⊗ C 2 then B ⊗ S ( B ) ≤ S ( B ⊗ B ) | 0 � ⊗ ( | 0 � + | 1 � ) : B ⊗ S ( B ) | 0 � ⊗ | 0 � + | 0 � ⊗ | 1 � : S ( B ⊗ B ) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 13 / 17
Some information is lost on reduction Subtyping {| 0 � , | 1 �} ⊂ C 2 then B ≤ S ( B ) G ( G A ) = G A S ( S ( B )) ≤ S ( B ) then {| 0 � , | 1 �} × C 2 ⊂ C 2 ⊗ C 2 then B ⊗ S ( B ) ≤ S ( B ⊗ B ) | 0 � ⊗ ( | 0 � + | 1 � ) : B ⊗ S ( B ) | 0 � ⊗ | 0 � + | 0 � ⊗ | 1 � : S ( B ⊗ B ) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 13 / 17
Some information is lost on reduction Subtyping {| 0 � , | 1 �} ⊂ C 2 then B ≤ S ( B ) G ( G A ) = G A S ( S ( B )) ≤ S ( B ) then {| 0 � , | 1 �} × C 2 ⊂ C 2 ⊗ C 2 then B ⊗ S ( B ) ≤ S ( B ⊗ B ) | 0 � ⊗ ( | 0 � + | 1 � ) : B ⊗ S ( B ) | 0 � ⊗ | 0 � + | 0 � ⊗ | 1 � : S ( B ⊗ B ) Same happens in math! X 2 − 3 X + 2 ( X − 1 )( X − 2 ) − → we lost the information that it was a product A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 13 / 17
Some information is lost on reduction Subtyping {| 0 � , | 1 �} ⊂ C 2 then B ≤ S ( B ) G ( G A ) = G A S ( S ( B )) ≤ S ( B ) then {| 0 � , | 1 �} × C 2 ⊂ C 2 ⊗ C 2 then B ⊗ S ( B ) ≤ S ( B ⊗ B ) | 0 � ⊗ ( | 0 � + | 1 � ) : B ⊗ S ( B ) | 0 � ⊗ | 0 � + | 0 � ⊗ | 1 � : S ( B ⊗ B ) Same happens in math! X 2 − 3 X + 2 ( X − 1 )( X − 2 ) − → we lost the information that it was a product Solution: casting | 0 � ⊗ ( | 0 � + | 1 � ) � | 0 � ⊗ | 0 � + | 0 � ⊗ | 1 � ⇑ S ( B ⊗ B ) B ⊗ S ( B ) | 0 � ⊗ ( | 0 � + | 1 � ) → | 0 � ⊗ | 0 � + | 0 � ⊗ | 1 � A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 13 / 17
Full grammars Types Q := B | Q ⊗ Q Basis qubit types Ψ := Q | S (Ψ) | Ψ ⊗ Ψ Qubit types A := Ψ | Ψ ⇒ A | S ( A ) | A ⊗ A Types Terms t := x | λ x Ψ . t | | 0 � | | 1 � | tt | π j t | ? · | t + t | α. t | � 0 S ( A ) | t ⊗ t | head t | tail t | ⇑ S ( B ⊗ C ) t S ( A ) where α ∈ C A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 14 / 17
Measurement of the first j qubits Example π 2 ( 2 . ( | 0 � ⊗ | 1 � ⊗ | 1 � ) + | 0 � ⊗ | 1 � ⊗ | 0 � + 3 . ( | 1 � ⊗ | 1 � ⊗ | 1 � ) ) ( 5 ( 9 14 ) 14 ) | 0 � ⊗ | 1 � ⊗ ( 2 1 5 . | 1 � + 5 . | 0 � ) √ √ | 1 � ⊗ | 1 � ⊗ ( 1 . | 1 � ) A. Díaz-Caro & G. Dowek Typing quantum superpositions and measurement 15 / 17
Recommend
More recommend