in computation Kestrel Institute and Oxford University - Oxford, August 2008
Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in Category of measurements -
Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in Category of measurements Quantum programming λ- -
What do programmers do? Quantum programming λ- f x Z m 2 f(x) Z n 2 -
What do programmers do? x f x Z m 2 f(x) Z n 2 x Quantum programming λ- - y f(x) y
What do programmers do? Quantum programming λ- x x B m = C Zm 2 U f f - y f(x) y B n = C Zn 2
What do programmers do? Quantum programming λ- z H m x z = P x ( 1)z x x f x H m z x = P z ( 1)x z z - U f y f(x) y
What do programmers do? Simon s algorithm f : Z m 2 Zn 2 : x f(x) f : Z m+n 2 Z m+n 2 : x, y x, f(x) y U f : C Zm+n 2 C Zm+n 2 : x, y x, f(x) y Simon = (H m id)u f (H m id) 0, 0 = ( 1) x z z, f(x) Quantum programming λ- - x,z Z m 2
What do programmers do? Simon s algorithm f : Z m 2 Zn 2 : x f(x) f : Z m+n 2 Z m+n 2 : x, y x, f(x) y U f : C Zm+n 2 C Zm+n 2 : x, y x, f(x) y Simon = (H m id)u f (H m id) 0, 0 = ( 1) x z z, f(x) Quantum programming λ- - x,z Z m 2... to find a hidden subgroup measurement find c such that f(x + c) = f(x)
What do programmers do? Shor s algorithm f : Z m+n q U f : C Zm+n q f : Z m q Z n q : x a x mod q Z m+n q : x, y x, a x + y mod q C Zm+n q : x, y x, a x + y mod q Quantum programming λ- - Shor = (FT m id)u f (FT m id) 0, 0 = ( 1) x z z, f(x) x,z Z m q... to find a hidden subgroup measurement find c such that a x+c = a x mod q
What do programmers do? Hallgren s algorithm h : Z m Z n : x I x (fraction ideal) h : Z m+n Z m+n : x, y x, y h(x) U h : C Zm+n C Zm+n : x, y x, y h(x) Hallgren = (FT m id)u h (FT m id) d, d = x,z Z m ( 1) x z z, h(x) Quantum programming λ- -... to find a hidden subgroup measurement find R such that h(x + R) = h(x)
General design pattern of software engineering ;) CLASS QUAN T Quantum programming λ- - MEAS T CLASS
Quantum prog. = functional prog. + superposition + entanglement CLASS QUAN T superposition entanglement MEAS T Quantum programming λ- - CLASS
Standard type universes where programmers work CLASS FSet, FSet op, FFMod R... Quantum programming λ- QUAN T FHilb, CPM(FHilb)... - MEAS T FHilb, CPM(FHilb)... CLASS
Function in programming CLASS[x] QUAN T [x] FSet[x],FSet op [x], FFMod R[x]... FHilb[x], CPM(FHilb)[x]... Quantum programming λ- - MEAS T {x} FHilb{x}, CPM(FHilb){x}... CLASS
Function in programming CLASS[x] QUAN T [x] = KL (X ) = KL (X ) Quantum programming λ- - MEAS T {x} EM(X ) CLASS
λ- 2x 3 + 3x + 1 in Z[x] λx. 2x 3 + 3x + 1 in Z Z Z[x] x ad x Quantum programming λ- - Z f a f S a
λ- in cartesian closed categories S p(x) : B in S[x : X] λx. p(x) : B X in S S[x] 1 x X ad x F a Quantum programming λ- - F C 1 a FX
λ- in cartesian closed categories S A q(x) B in S[x : X] A λx.q(x) B X in S S[x] 1 x X ad x F a Quantum programming λ- - F C 1 a FX
λ- in cartesian closed categories A ϕ,x B X X ǫ B A ϕ B X S[x](A, B) S(A, B X ) A q(x) B A λx.q(x) B X S[x] 1 x X ad x Quantum programming λ- - S F a F C 1 a FX
λ- in cartesian closed categories Theorem (Lambek, Adv. in Math. 79) Let S be a cartesian closed category, and S[x] the free cartesian closed category generated by S and x : 1 X. Quantum programming λ- -
λ- in cartesian closed categories Theorem (Lambek, Adv. in Math. 79) Let S be a cartesian closed category, and S[x] the free cartesian closed category generated by S and x : 1 X. Then the inclusion ad x : S S[x] has a right adjoint ab x : S[x] S : A A X and the transpositions A ϕ,x B X X ǫ B A ϕ B X S[x](ad x A, B) S(A, ab x B) A q(x) B A λx.q(x) B X Quantum programming λ- - model λ- and application.
λ- in cartesian closed categories Theorem (Lambek, Adv. in Math. 79) Let S be a cartesian closed category, and S[x] the free cartesian closed category generated by S and x : 1 X. Then the inclusion ad x : S S[x] has a right adjoint ab x : S[x] S : A A X and the transpositions A ϕ,x B X X ǫ B A ϕ B X S[x](ad x A, B) S(A, ab x B) A q(x) B A λx.q(x) B X Quantum programming λ- - model λ- and application. S[x] is isomorphic with the Kleisli category for the power monad ( ) X.
κ- in cartesian Theorem (Lambek, Adv. in Math. 79) categories Let S be a cartesian category, and S[x] the free cartesian category generated by S and x : 1 X. Then the inclusion ad x : S S[x] has a left adjoint ab x : S[x] S : A X A and the transpositions A x,id X A ϕ B X A ϕ B S[x](A, ad x B) S(ab x A, B) A f x B X A κ x.fx B Quantum programming λ- - model first order and application. S[x] is isomorphic with the Kleisli category for the product comonad X ( ).
κ- in monoidal Theorem (DP, MSCS 95) categories Let C be a monoidal category, and C[x] the free monoidal category generated by C and x : 1 X. Then the strong adjunctions ab x ad x : C C[x] are in one-to-one correspondence with the internal comonoid structures on X. The transpositions A X A x A B ϕ C[x](A, ad x B) A f x B Quantum programming λ- - X A ϕ B C(ab x A, B) X A κ x.fx B model action and application. C[x] is isomorphic with the Kleisli category for the comonad X ( ), induced by any of the comonoid structures.
κ- in monoidal categories Task Extend this to. Quantum programming λ- -
κ- in monoidal categories Task Extend this to. Problem Lots of complicated diagram chasing. Quantum programming λ- -
κ- in monoidal categories Task Extend this to. Problem Lots of complicated diagram chasing. Solution? What does mean graphically? Quantum programming λ- -
Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in Category of measurements -
Objects X A B D X A B D -
Identities X A B D X A B D X A B D X A B D id -
Morphisms B X B X h h - X A B D X A B D
Tensor (parallel composition) B X C B X C h f h f - X A B D X X A B D X
Sequential composition B X C B X C h f h f - X A B D X X A B D X g X A B g D D X X A B D D X
Elements (vectors) and coelements (functionals) b B X C h f B X B X b B X C h f - X A B D X X A B D X g X A B g a D D X X A B D D X X a D D X X I D D X
Symmetry b B X C h f B X c D g B X B X b B X C h f X A D B X X A c X X A B D X X A B g - X A a B D D X X A B D D X X a D D X X I D D X
Polynomials X b B X C h f B X c D g A B D D X a B X B X b B X C h f X A D B X id x X A D B I X A c r X A B D X A B g X A B D D X x a D D x I I D D I -
Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in Category of measurements Abstraction with pictures Consequences -
Abstraction with pictures Theorem (again) Let C be a symmetric monoidal category, and C[x] the free symmetric monoidal category generated by C and x : 1 X. Then there is a one-to-one correspondence between adjunctions ab x ad x : C C[x] satisfying 1. ab x (A B) = ab x (A) B 2. η(a B) = η(a) B 3. η I = x and commutative comonoids on X. Abstraction with pictures Consequences -
Abstraction with pictures Theorem (again) Let C be a symmetric monoidal category, and C[x] the free symmetric monoidal category generated by C and x : 1 X. Then there is a one-to-one correspondence between adjunctions ab x ad x : C C[x] satisfying 1. ab x (A B) = ab x (A) B 2. η(a B) = η(a) B 3. η I = x and commutative comonoids on X. Abstraction with pictures Consequences - C[x] is isomorphic with the Kleisli category for the commutative comonad X ( ), induced by any of the comonoid structures.
Proof ( ) Given ab x ad x : C C[x], conditions 1.-3. imply ab x (A) = X A η(a) = x A Abstraction with pictures Consequences -
Proof ( ) Therefore the correspondence C ( ab x (A), B ) C[x] ( A, ad x (B) ) Abstraction with pictures Consequences -
Proof ( )... is actually C(X A, B) C[x](A, B) Abstraction with pictures Consequences -
Proof ( )... with C(X A, B) C[x](A, B) B f X A ( ) (x A) B f A Abstraction with pictures Consequences -
Proof ( )... and C(X A, B) C[x](A, B) h f κx. h f Abstraction with pictures Consequences - g g X
Proof ( ) The bijection corresponds to the conversion: ( ) (x A) C(X A, B) = C[x](A, B) κx. ( ) ( κx. ϕ(x) x A) = ϕ(x) (β-rule Abstraction with pictures Consequences - κx. ( f (x A) ) = f (η-rule
Proof ( ) The comonoid structure (X,, ) is = κx. = κx. X X id I Abstraction with pictures Consequences -
Proof ( ) The conversion rules imply the comonoid laws = = Abstraction with pictures Consequences - = =
Proof ( ) Given (X,, ), use its copying and deleting power, and the symmetries, to normalize every C[x]-arrow: ϕ(x) = ϕ (x A) h f h f Abstraction with pictures Consequences - g g
Proof ( ) Then set κx. ϕ(x) = ϕ to get ( ) (x A) C(X A, B) = C[x](A, B) κx. ( ) ( κx. ϕ(x) x A) = ϕ(x) (β-rule Abstraction with pictures Consequences - κx. ( f (x A) ) = f (η-rule
Remark C[x] = C X and C[x, y] = C X Y = KL(X Y ), reduce the finite polynomials to the Kleisli morphisms. Abstraction with pictures Consequences -
Remark C[x] = C X and C[x, y] = C X Y = KL(X Y ), reduce the finite polynomials to the Kleisli morphisms. But the extensions C[X], where X is large are also of interest. Abstraction with pictures Consequences -
Remark C[x] = C X and C[x, y] = C X Y = KL(X Y ), reduce the finite polynomials to the Kleisli morphisms. But the extensions C[X], where X is large are also of interest. Abstraction with pictures Consequences - Cf. N[N], Set[Set], and CPM(C).
Interpretation Abstraction with pictures Consequences -
Interpretation Upshot In symmetric monoidal categories, applies just to copiable and deletable data. Abstraction with pictures Consequences -
Interpretation Upshot In symmetric monoidal categories, applies just to copiable and deletable data. Definition A vector ϕ C(I, X) is a base vector (or a set-like element) with respect to the operation κx if it can be copied and deleted in C[x] (κx.x x) ϕ = ϕ ϕ Abstraction with pictures Consequences - (κx.id I ) ϕ = id I
Interpretation Upshot In symmetric monoidal categories, applies just to copiable and deletable data. Definition A vector ϕ C(I, X) is a base vector (or a set-like element) with respect to the operation κx if it can be copied and deleted in C[x] (κx.x x) ϕ = ϕ ϕ Abstraction with pictures Consequences - (κx.id I ) ϕ = id I Proposition ϕ C(I, X) is a base vector with respect to κx if and only if it is a homomorphism for the comonoid structure X X X I corresponding to κx.
Interpretation Upshot In other words, only the base vectors can be substituted for variables. Abstraction with pictures Consequences -
Interpretation Upshot In other words, only the base vectors can be substituted for variables. Definition Substitution is a structure preserving ioof C[x] C. Abstraction with pictures Consequences -
Interpretation Upshot In other words, only the base vectors can be substituted for variables. Definition Substitution is a structure preserving ioof C[x] C. Corollary The substitution functors C[x] C are in one-to-one correspondence with the base vectors of type X. Abstraction with pictures Consequences -
Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in - Abstraction in Category of measurements
Definitions A -category C is given with an involutive ioof : C op C. - Abstraction in
Definitions A -category C is given with an involutive ioof : C op C. A morphism f in a -category C is called unitary if f = f 1. - Abstraction in
Definitions A -category C is given with an involutive ioof : C op C. A morphism f in a -category C is called unitary if f = f 1. A (symmetric) monoidal category C is -monoidal if its monoidal isomorphisms are unitary. - Abstraction in
Using the monoidal s for: vectors: C(A) = C(I, A) scalars: I = C(I, I) - Abstraction in
Using the monoidal s for: vectors: C(A) = C(I, A) scalars: I = C(I, I) in every -monoidal category we can define abstract inner product A : C(A) C(A) I ( ) ϕ (ϕ, ψ : I A) I A ψ I - Abstraction in
Using the monoidal s for: vectors: C(A) = C(I, A) scalars: I = C(I, I) in every -monoidal category we can define abstract inner product A : C(A) C(A) I ( ) ϕ (ϕ, ψ : I A) I A ψ I partial inner product AB : C(A B) C(A) C(B) ( ) (ϕ : I A B, ψ : I A) ϕ I A B ψ B B - Abstraction in
Using the monoidal s for: vectors: C(A) = C(I, A) scalars: I = C(I, I) in every -monoidal category we can define abstract inner product A : C(A) C(A) I ( ) ϕ (ϕ, ψ : I A) I A ψ I partial inner product AB : C(A B) C(A) C(B) ( ) (ϕ : I A B, ψ : I A) ϕ I A B ψ B B - Abstraction in entangled vectors η C(A A), such that ϕ C(A) η ϕ AA = ϕ
Using entangled vectors ηa : I A A and, ηb : I B Band their adjoints εa = η A : A A I and εb = η B : B B I - Abstraction in
Using entangled vectors ηa : I A A and, ηb : I B Band their adjoints εa = η A : A A I and εb = η B : B B I we can define for every f : A B the dual f : B A - Abstraction in f = B Bη BAA BfA BBA εa A
Using entangled vectors ηa : I A A and, ηb : I B Band their adjoints εa = η A : A A I and εb = η B : B B I we can define for every f : A B the dual f : B A - Abstraction in f = B Bη BAA BfA BBA εa A the conjugate f : A B f = f = f
Proposition For every object A in a -monoidal category C holds (a) (b) = (c), - Abstraction in
Proposition For every object A in a -monoidal category C holds (a) (b) = (c), where (a) η C(A A) is entangled - Abstraction in
Proposition For every object A in a -monoidal category C holds (a) (b) = (c), where (a) η C(A A) is entangled (b) ε = η C(A A, I) internalizes the inner product ε (ψ ϕ) = ϕ ψ - Abstraction in
Proposition For every object A in a -monoidal category C holds (a) (b) = (c), where (a) η C(A A) is entangled (b) ε = η C(A A, I) internalizes the inner product ε (ψ ϕ) = ϕ ψ (c) (η,ε) realize the self-adjunction A A, in the sense - Abstraction in A η A A A A A ε A = id A A A η A A A ε A A = id A The three conditions are equivalent if I generates C.
Proposition in pictures For every object A in a -monoidal category C holds (a) (b) = (c), where (a) (b) ψ η η ψ ϕ = = ψ ψ ϕ - Abstraction in (c) η η = = X η η
Definition A object in a -monoidal category is an object equipped with the structure from the preceding proposition. - Abstraction in
Definition A object in a -monoidal category is an object equipped with the structure from the preceding proposition. - Remark The subcategory of objects in any -monoidal category is -compact (strongly compact) with all objects self-adjoint. Abstraction in
Abstraction in Theorem Let C be a -monoidal category, and X X X I a comonoid that induces ab x ad x : C C[x]. - Abstraction in
Abstraction in Theorem Let C be a -monoidal category, and X X X I a comonoid that induces ab x ad x : C C[x]. Then the following conditions are equivalent: - Abstraction in
Abstraction in Theorem Let C be a -monoidal category, and X X X I a comonoid that induces ab x ad x : C C[x]. Then the following conditions are equivalent: (a) ad x : C C[x] creates : C[x] op C[x] such that x x = x x = id I. - Abstraction in
Abstraction in Theorem Let C be a -monoidal category, and X X X I a comonoid that induces ab x ad x : C C[x]. Then the following conditions are equivalent: (a) ad x : C C[x] creates : C[x] op C[x] such that x x = x x = id I. (b) η = and ε = η = realize X X. - Abstraction in
Abstraction in Theorem Let C be a -monoidal category, and X X X I a comonoid that induces ab x ad x : C C[x]. Then the following conditions are equivalent: (a) ad x : C C[x] creates : C[x] op C[x] such that x x = x x = id I. (b) η = and ε = η = realize X X. (c) (X ) ( X) = = ( X) (X ) - Abstraction in
Abstraction in Theorem Let C be a -monoidal category, and X X X I a comonoid that induces ab x ad x : C C[x]. Then the following conditions are equivalent: (a) ad x : C C[x] creates : C[x] op C[x] such that x x = x x = id I. (b) η = and ε = η = realize X X. (c) (X ) ( X) = = ( X) (X ) - Abstraction in where X X X I is the induced monoid = =
Abstraction in Theorem in pictures (b) = = X - Abstraction in
Abstraction in Theorem in pictures (c) = = - Abstraction in
Proof of (b)= (c) Lemma 1 If (b) holds then - = = Abstraction in
Proof of (b)= (c) Then (c) also holds because = = = - Abstraction in =
Proof of Lemma 1 Lemma 2 If η ε = = X ε η - Abstraction in then η ε ε = = X X ε ε η η η
Proof of Lemma 1 Using Lemma 2, and the fact that (b) implies = =, we get ε ε = η = η = - Abstraction in η η = η
The message of the proof - Abstraction in
The message of the proof There is more to categories than just diagram chasing. - Abstraction in
The message of the proof There is more to categories than just diagram chasing. - There is also picture chasing. Abstraction in
Definition A classical object in a -monoidal category C is a comonoid X X X I satisfying the equivalent conditions from the preceding theorem. - Abstraction in
Definition A classical object in a -monoidal category C is a comonoid X X X I satisfying the equivalent conditions from the preceding theorem. Let C be the category of classical objects and comonoid homomorphisms in C. - Abstraction in
Definition A classical object in a -monoidal category C is a comonoid X X X I satisfying the equivalent conditions from the preceding theorem. Let C be the category of classical objects and comonoid homomorphisms in C. Question: What is classical about classical objects? - Abstraction in
Definition A classical object in a -monoidal category C is a comonoid X X X I satisfying the equivalent conditions from the preceding theorem. Let C be the category of classical objects and comonoid homomorphisms in C. Question: What is classical about classical objects? classical structure structure - Abstraction in
Definition A classical object in a -monoidal category C is a comonoid X X X I satisfying the equivalent conditions from the preceding theorem. Let C be the category of classical objects and comonoid homomorphisms in C. Question: What is classical about classical objects? classical structure structure Answer: classical elements = base vectors - Abstraction in
Definition A classical object in a -monoidal category C is a comonoid X X X I satisfying the equivalent conditions from the preceding theorem. Let C be the category of classical objects and comonoid homomorphisms in C. Question: What is classical about classical objects? classical structure structure Answer: classical elements = base vectors is neither injective or surjective - Abstraction in
Consequences Upshot The Frobenius condition (c) assures the preservation of the operation under. - Abstraction in
Consequences Upshot The Frobenius condition (c) assures the preservation of the operation under. This leads to entanglement. - Abstraction in
Consequences Proposition The vectors C(X) of any classical object X form a -algebra. - Abstraction in
Consequences Proposition The vectors C(X) of any classical object X form a -algebra. - Abstraction in ϕ ψ = (ϕ ψ) ǫ = ϕ = ϕ = ϕ
Definition Two vectors ϕ, ψ C(A) in a -monoidal category are orthonormal if their inner product is idempotent: ϕ ψ = ϕ ψ 2 - Abstraction in
Definition Two vectors ϕ, ψ C(A) in a -monoidal category are orthonormal if their inner product is idempotent: ϕ ψ = ϕ ψ 2 - Proposition Any two base vectors are orthonormal. In particular, any two variables in a polynomial category are orthonormal. Abstraction in
Definition A classical object X is standard if it is (regularly) generated by its base vectors B(X) = {ϕ C(X) (κx. x x)ϕ = ϕ ϕ (κx. id I )ϕ = id I } - Abstraction in
Definition A classical object X is standard if it is (regularly) generated by its base vectors in the sense B(X) = {ϕ C(X) (κx. x x)ϕ = ϕ ϕ (κx. id I )ϕ = id I } f, g C(X, Y). ( ϕ B(X). fϕ = gϕ) = f = g - Abstraction in A base is regular if C(X, Y) C(Y) B(X) splits.
Proposition 1. All standard classical structures, that an object X C may carry, induce the bases with the same number of elements. - Abstraction in
Proposition 1. All standard classical structures, that an object X C may carry, induce the bases with the same number of elements. - Abstraction in Proposition 2. Let X C be a classical object with a regular base. Then the equipotent regular bases on any Y C are in one-to-one correspondence with the unitaries X Y.
Definition A qubit type in an arbitrary -monoidal category C is a classical object B with a unitary H of order 2. The induced bases are usually denoted by 0, 1, and +,. - Abstraction in
Definition A qubit type in an arbitrary -monoidal category C is a classical object B with a unitary H of order 2. The induced bases are usually denoted by 0, 1, and +,. - Computing with qubits A -monoidal category with B suffices for the basic algorithms. Abstraction in
Definition A qubit type in an arbitrary -monoidal category C is a classical object B with a unitary H of order 2. The induced bases are usually denoted by 0, 1, and +,. - Computing with qubits A -monoidal category with B suffices for the basic algorithms. A Klein group of unitaries on B suffices for all teleportation and dense coding schemes. Abstraction in
Proposition (Coecke, Vicary, P) Every classical object X in FHilb is regular, and X = C n. The classical structure is induced by a base B(X) = { i i n }, with i = ii = 1 n n i i=1 - Abstraction in
Proposition (Coecke, Vicary, P) Every classical object X in FHilb is regular, and X = C n. The classical structure is induced by a base B(X) = { i i n }, with i = ii = 1 n n i i=1 - Abstraction in Moreover, FHilb FSet
Proof A -algebra in FHilb is a C -algebra. - Abstraction in
Proof A -algebra in FHilb is a C -algebra. Thus for a classical X FHilb, : FHilb(X) FHilb(X, X) ( ) ϕ I X ( X ϕ X X X X ) is a representation of a commutative C -algebra. - Abstraction in
Proof Working through the Gelfand-Naimark duality, we get X = C n - Abstraction in
Proof Working through the Gelfand-Naimark duality, we get X = C n - Abstraction in because the spectrum of a commutative finitely dimensional C -algebra is a discrete set n of minimal central projections, while the representing spaces are the full matrix algebras C(1)
Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in Category of measurements -
Category of measurements ((this was not presented)) -
Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in Category of measurements -
Claim: Task: Simple algorithms have simple categorical semantics. Implement and analyze algorithms in nonstandard models: network computation, data mining. -