Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Demo: The KAK theorem #1227

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

[Draft] Demo: The KAK theorem #1227

wants to merge 11 commits into from

Conversation

dwierichs
Copy link
Contributor

@dwierichs dwierichs commented Oct 3, 2024

Title:
The KAK theorem

Summary:
The KAK theorem is a group theoretical tool to decompose operators into a sequence of smaller operators.
It brings an abstract mathematical structure to direct use in compilation and simulation tasks.

In this demo we will explain the mathematical objects "Lie subalgebra", "Cartan involution", and "symmetric space", which are prerequisites to the KAK theorem.
Then we state the theorem and explain how it powers a standard circuit decomposition/template construction technique, which also proves the universality of single- and two-qubit operations for quantum computing.
All steps are illustrated with mathematical and code examples.

Relevant references:

TBD

Possible Drawbacks:
N/A

Related GitHub Issues:
TBD: FDHS demo PR

[sc-74884]


If you are writing a demonstration, please answer these questions to facilitate the marketing process.

  • GOALS — Why are we working on this now?
  • The theorem uses Lie algebra theory, for which functionalities were recently added to PennyLane.
  • It can be seen as a follow-up/extension/application of the more basic Introduction to Lie algebras demo and it is related to content about Lie algebraic simulation (g-sim| (g+P)-sim).
  • There will be a close follow-up demo on "Fixed-depth Hamiltonian simulation", which makes use of the KAK theorem.
  • AUDIENCE — Who is this for?
  • Researchers/Learners that would like to understand the mathematical structure behind the KAK theorem and Khaneja-Glaser circuit templates.
  • Researchers/Learners that would like to familiarize themselves with Lie algebraic tools in PennyLane beyond a basic introduction and the simulation-related tools in the existing content pieces.
  • Researchers/Learners that would like to read/understand the "Fixed-depth Hamiltonian simulation" demo.
  • KEYWORDS — What words should be included in the marketing post?

"KAK theorem"
"Lie algebra"
"Symmetric space"
"Cartan decomposition" and/or "Cartan involution"
"Khaneja-Glaser decomposition"
"Circuit templates"
"Universality"

  • Which of the following types of documentation is most similar to your file?
    (more details here)
  • Tutorial
  • Demo
  • How-to

Copy link

github-actions bot commented Oct 3, 2024

👋 Hey, looks like you've updated some demos!

🐘 Don't forget to update the dateOfLastModification in the associated metadata files so your changes are reflected in Glass Onion (search and recommendations).

Please hide this comment once the field(s) are updated. Thanks!

Comment on lines 38 to 135
Introduction
------------

Basic mathematical objects
--------------------------

Introduce the mathematical objects that will play together to yield
the KAK theorem.

(Semi-)simple Lie algebras
~~~~~~~~~~~~~~~~~~~~~~~~~~

- Introduce the notion of a Lie algebra very briefly, refer to existing demo(s).
- Focus on vector space notion being clear.
- [optional] Briefly say what a simple/semisimple Lie algebra is.
- [optional] In particular mention that the adjoint representation is faithful for semisimple algebras.

Group and algebra interaction
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Exponential map
- adjoint action of group on algebra
- adjoint action of algebra on algebra -> adjoint representation
- adjoint identity (-> g-sim demo)

Subalgebras and Cartan pairs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Introduce the notion of a subalgebra.
- Explain that there can be vector subspaces that are not subalgebras.
- Define Cartan pairs via commutation relations

Cartan subalgebras
~~~~~~~~~~~~~~~~~~

- Define Cartan subalgebras of :math:`m`.
- Dimension of Cartan subalgebras
- Transition between Cartan subalgebras via :math:`K`

Involutions
~~~~~~~~~~~

- Explain linear maps on (matrix) algebras (-> homomorphism)
- Define involutions.
- Involutions define Cartan pairs (:math:`k = +1 | m = -1` eigenspaces)
- Cartan pairs define involutions :math:`\theta = \Pi_{\mathfrak{k}} - \Pi_{\mathfrak{m}}`

KAK theorem
~~~~~~~~~~~

- KP decomposition
- KAK decomposition
- [optional] implication: KaK on algebra level


Two-qubit KAK decomposition
---------------------------

- Algebra/subalgebra :math:`\mathfrak{g} =\mathfrak{su}(4) | \mathfrak{k} =\mathfrak{su}(2) \oplus \mathfrak{su}(2)`
- Involution: EvenOdd
- CSA: :math:`\mathfrak{a} = \langle\{XX, YY, ZZ\}\rangle_{i\mathbb{R}}`
- KAK decomposition :math:`U= (A\otimes B) \exp(i(\eta_x XX+\eta_y YY +\eta_z ZZ)) (C\otimes D)`.
- [optional] Mention Cartan coordinates

Khaneja-Glaser decomposition
----------------------------

- Important first recursive decomposition showing universality of single- and two-qubit operations
- Used for practical decompositions, replaced by other, similar decompositions by now

A recursive decomposition
~~~~~~~~~~~~~~~~~~~~~~~~~

- Show recursion on qubit count
- display resulting decomposition structure
- Mention that a two-qubit interaction is enough to get the CSA elements
- Universality

The recursion step in detail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Two substeps in each recursion step:
- Algebra/subalgebra :math:`\mathfrak{g}=\mathfrak{su}(2^n) | \mathfrak{k} = \mathfrak{su}(2^{n-1}) \oplus \mathfrak{su}(2^{n-1})`
- Involution TBD
- CSA TBD
- Algebra/subalgebra :math:`\mathfrak{g}=\mathfrak{su}(2^{n-1}) \oplus \mathfrak{su}(2^{n-1}) | \mathfrak{k} = \mathfrak{su}(2^{n-1})`
- Involution TBD
- CSA TBD

Overview of resulting decomposition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Count blocks
- [optional] CNOT count


Conclusion
----------
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Qottmann,
can I ask you for some super-preliminary feedback on this, regarding

  • overall structure/logic of the outline
  • amount of content (also happy about suggestions of things I missed/I should throw out!)

Thanks! 🙏

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a lot of ground to cover with quite involved topics. Do you reckon it is realistic to put this all in a demo? This seems like review paper level thoroughness (which makes me think, should we write a review paper on this stuff for physicists?) I actually wouldnt want to scratch anything because I'd be curious to read all of this myself, I am just wondering if you think it's realistic for you to cover all these things in reasonable time (your own time effort) and in a presentation that is not too long (time effort of a reader)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a very fair question. Taking some of this offline.
For the length I see the following options:

  • I try to do the shortest version of the demo that I deem understandable and we see whether that already is a good length/complexity. This will have to skip over quite a few things from above.
  • We split content up into multiple bits.
  • We cover all the content but go very superficial. Not sure that's so nice to have 🤔

- Introduce the notion of a Lie algebra very briefly, refer to existing demo(s).
- Focus on vector space notion being clear.
- [optional] Briefly say what a simple/semisimple Lie algebra is.
- [optional] In particular mention that the adjoint representation is faithful for semisimple algebras.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good to know! I wasnt aware!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The precise criterion is that the center is trivial, which is a bit more general. But a center would be an Abelian ideal, which semisimple Lie algebras don't have, so semisimple implies faithful ad.rep.

Comment on lines 38 to 135
Introduction
------------

Basic mathematical objects
--------------------------

Introduce the mathematical objects that will play together to yield
the KAK theorem.

(Semi-)simple Lie algebras
~~~~~~~~~~~~~~~~~~~~~~~~~~

- Introduce the notion of a Lie algebra very briefly, refer to existing demo(s).
- Focus on vector space notion being clear.
- [optional] Briefly say what a simple/semisimple Lie algebra is.
- [optional] In particular mention that the adjoint representation is faithful for semisimple algebras.

Group and algebra interaction
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Exponential map
- adjoint action of group on algebra
- adjoint action of algebra on algebra -> adjoint representation
- adjoint identity (-> g-sim demo)

Subalgebras and Cartan pairs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Introduce the notion of a subalgebra.
- Explain that there can be vector subspaces that are not subalgebras.
- Define Cartan pairs via commutation relations

Cartan subalgebras
~~~~~~~~~~~~~~~~~~

- Define Cartan subalgebras of :math:`m`.
- Dimension of Cartan subalgebras
- Transition between Cartan subalgebras via :math:`K`

Involutions
~~~~~~~~~~~

- Explain linear maps on (matrix) algebras (-> homomorphism)
- Define involutions.
- Involutions define Cartan pairs (:math:`k = +1 | m = -1` eigenspaces)
- Cartan pairs define involutions :math:`\theta = \Pi_{\mathfrak{k}} - \Pi_{\mathfrak{m}}`

KAK theorem
~~~~~~~~~~~

- KP decomposition
- KAK decomposition
- [optional] implication: KaK on algebra level


Two-qubit KAK decomposition
---------------------------

- Algebra/subalgebra :math:`\mathfrak{g} =\mathfrak{su}(4) | \mathfrak{k} =\mathfrak{su}(2) \oplus \mathfrak{su}(2)`
- Involution: EvenOdd
- CSA: :math:`\mathfrak{a} = \langle\{XX, YY, ZZ\}\rangle_{i\mathbb{R}}`
- KAK decomposition :math:`U= (A\otimes B) \exp(i(\eta_x XX+\eta_y YY +\eta_z ZZ)) (C\otimes D)`.
- [optional] Mention Cartan coordinates

Khaneja-Glaser decomposition
----------------------------

- Important first recursive decomposition showing universality of single- and two-qubit operations
- Used for practical decompositions, replaced by other, similar decompositions by now

A recursive decomposition
~~~~~~~~~~~~~~~~~~~~~~~~~

- Show recursion on qubit count
- display resulting decomposition structure
- Mention that a two-qubit interaction is enough to get the CSA elements
- Universality

The recursion step in detail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Two substeps in each recursion step:
- Algebra/subalgebra :math:`\mathfrak{g}=\mathfrak{su}(2^n) | \mathfrak{k} = \mathfrak{su}(2^{n-1}) \oplus \mathfrak{su}(2^{n-1})`
- Involution TBD
- CSA TBD
- Algebra/subalgebra :math:`\mathfrak{g}=\mathfrak{su}(2^{n-1}) \oplus \mathfrak{su}(2^{n-1}) | \mathfrak{k} = \mathfrak{su}(2^{n-1})`
- Involution TBD
- CSA TBD

Overview of resulting decomposition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Count blocks
- [optional] CNOT count


Conclusion
----------
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a lot of ground to cover with quite involved topics. Do you reckon it is realistic to put this all in a demo? This seems like review paper level thoroughness (which makes me think, should we write a review paper on this stuff for physicists?) I actually wouldnt want to scratch anything because I'd be curious to read all of this myself, I am just wondering if you think it's realistic for you to cover all these things in reasonable time (your own time effort) and in a presentation that is not too long (time effort of a reader)?

Comment on lines 108 to 130
A recursive decomposition
~~~~~~~~~~~~~~~~~~~~~~~~~

- Show recursion on qubit count
- display resulting decomposition structure
- Mention that a two-qubit interaction is enough to get the CSA elements
- Universality

The recursion step in detail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Two substeps in each recursion step:
- Algebra/subalgebra :math:`\mathfrak{g}=\mathfrak{su}(2^n) | \mathfrak{k} = \mathfrak{su}(2^{n-1}) \oplus \mathfrak{su}(2^{n-1})`
- Involution TBD
- CSA TBD
- Algebra/subalgebra :math:`\mathfrak{g}=\mathfrak{su}(2^{n-1}) \oplus \mathfrak{su}(2^{n-1}) | \mathfrak{k} = \mathfrak{su}(2^{n-1})`
- Involution TBD
- CSA TBD

Overview of resulting decomposition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Count blocks
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If things had to be scratched, Perhaps this could be made a separate demo (though I am very interested in the contents here so maybe we can already talk about it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe we could actually have this demo focus on KAK theorem, including only the 2-qubit application.
Then we can have a Khaneja-Glaser decomposition demo as a follow-up?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah something like that, or even more generally a demo on recursive decomposition, but I think that would depend on our findings this quarter and how much we want to invest (seems like a lot of work to do all of this 😅 )

Comment on lines 55 to 61
Group and algebra interaction
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Exponential map
- adjoint action of group on algebra
- adjoint action of algebra on algebra -> adjoint representation
- adjoint identity (-> g-sim demo)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much you plan on talking about these points but could be kept brief

@dwierichs dwierichs changed the title [Empty Draft] Demo: The KAK theorem [Draft] Demo: The KAK theorem Oct 23, 2024
@dwierichs dwierichs marked this pull request as ready for review October 23, 2024 09:09
Copy link

Thank you for opening this pull request.

You can find the built site at this link.

Deployment Info:

  • Pull Request ID: 1227
  • Deployment SHA: 366837e302dad7dd4def3dd9cb16b5e9b1f3ca54
    (The Deployment SHA refers to the latest commit hash the docs were built from)

Note: It may take several minutes for updates to this pull request to be reflected on the deployed site.

Copy link
Collaborator

@Qottmann Qottmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I absolutely love this and can see this become a super valuable resource for anyone with a physics brackground wanting to dive deeper into the topic (think, in particular, future residents)

In terms of length, it is indeed a chonker but honestly that is fine for this kind of demo. I'd even go as far as saying that it could do with more content, in particular a more non-trivial example beyond su(2). At least for my taste, feel free to go all in.

We should perhaps have someone that is unfamiliar with these concepts also read the demo

Comment on lines +61 to +66
.. math::

\mathfrak{su}(2)
&= \left\{x \in \mathbb{C}^{(2\times 2)} {\large|} x^\dagger = -x , \text{tr}[x]=0\right\}\\
&= \left\{\left(\begin{array} i a & b + ic \\ -b + ic & -i a \end{array}\right)
{\large |} a, b, c \in \mathbb{R}\right\}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not start with pauli matrices from the get-go? 😅

Comment on lines +77 to +82
There is a simple way to see this; Multiplying a skew-Hermitian matrix
:math:`x\in\mathfrak{su}(n)` by a complex number :math:`c\in\mathbb{C}` will yield
:math:`(cx)^\dagger=\overline{c} x^\dagger=-\overline{c} x,` so that
the result might no longer be in the algebra! If we keep it to real scalars
:math:`c\in\mathbb{R}` only, we have :math:`\overline{c}=c,` so that
:math:`(cx)^\dagger=-cx` and we're fine.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There is a simple way to see this; Multiplying a skew-Hermitian matrix
:math:`x\in\mathfrak{su}(n)` by a complex number :math:`c\in\mathbb{C}` will yield
:math:`(cx)^\dagger=\overline{c} x^\dagger=-\overline{c} x,` so that
the result might no longer be in the algebra! If we keep it to real scalars
:math:`c\in\mathbb{R}` only, we have :math:`\overline{c}=c,` so that
:math:`(cx)^\dagger=-cx` and we're fine.
There is a simple way to see this; Multiplying a skew-Hermitian matrix
:math:`x\in\mathfrak{su}(n)` by a complex number :math:`c\in\mathbb{C}` will yield
:math:`(cx)^\dagger=\overline{c} x^\dagger=-\overline{c} x,` so that
the result might no longer be skew-Hermitian, i.e. no longer in the algebra! If we keep it to real scalars
:math:`c\in\mathbb{R}` only, we have :math:`\overline{c}=c,` so that
:math:`(cx)^\dagger=-cx` and we're fine.

(personal preference)

all_hermitian = all(qml.equal(qml.adjoint(op).simplify(), op) for op in su2)
print(f"The operators are all Hermitian: {all_hermitian}")

su2_lie_closed = qml.pauli.dla.lie_closure(su2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
su2_lie_closed = qml.pauli.dla.lie_closure(su2)
su2_lie_closed = qml.lie_closure(su2)

# :doc:`g-sim: Lie algebraic classical simulations </demos/tutorial_liesim/>` for
# further discussion.
#
# .. admonition:: Derivation: Adjoint representations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

#
# .. math::
#
# \text{Ad}_{\exp(x)} : \mathfrak{g} \to \mathfrak{g},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the previous definition its mapping $\mathcal{G} \times \mathfrak{g} \rightarrow \mathfrak{g}$

Comment on lines +699 to +700
# factorizations in general, and for quantum circuit decompositions in particular.
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to also discuss kak decompositions for specific ops (i.e. writing some_op in g = K_1 a K_2) as well as the version where the op is in m and we can get away with KAK^dagger

p = check_cartan_decomposition(su4, su2_su2, space_name)

######################################################################
# .. admonition:: Mathematical detail
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nice!

#
# \mathfrak{a} = \text{span}_{\mathbb{R}}\{iX_0X_1, iY_0Y_1, iZ_0Z_1\}
#
# Clearly, these three operators commute, making :math:`\mathfrak{a}` Abelian.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Clearly, these three operators commute, making :math:`\mathfrak{a}` Abelian.
# These three operators commute, making :math:`\mathfrak{a}` Abelian.

fig, ax = qml.draw_mpl(su4_gate, wire_order=[0, 1])(params)

######################################################################
# And that's a wrap on our KAK theorem application for two-qubit gates!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we easily get the optimal 2qubit decomposition from this somehow?

Comment on lines +817 to +818
# :math:`y_{1,2}` and :math:`a` for a given gate :math:`U.` If you are
# curious about this question, watch out for follow-up demos!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# :math:`y_{1,2}` and :math:`a` for a given gate :math:`U.` If you are
# curious about this question, watch out for follow-up demos!
# :math:`y_{1,2}` and :math:`a` for a given gate :math:`U.`

wouldnt make promises, I'd directly refer to the Kökcü paper or other resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants