Skip to content

docs(quantum-info): add qubit API map - #1501

Merged
jstoobysmith merged 2 commits into
leanprover-community:masterfrom
Robby955:physlib/qubit-api-map-20260806
Aug 12, 2026
Merged

docs(quantum-info): add qubit API map#1501
jstoobysmith merged 2 commits into
leanprover-community:masterfrom
Robby955:physlib/qubit-api-map-20260806

Conversation

@Robby955

Copy link
Copy Markdown
Contributor

Motivation

Related to #1414, the tracking map for the qubit API in #850. An API map records the implemented status and source location of each requirement for an API, so the gap between a planned API and the current library stays visible in-tree.

Changes

Adds QuantumInfo/States/Pure/API-map.yaml, 25 requirements of which 11 are done. The done entries cover Qubit itself, the gates X, Y, Z, H, S and T with their relations, controllize and CNOT, states up to a global phase, POVM measurements, and the fidelity and trace distance, together with the finite dimensional constructions the qubit case instantiates: kets and bras, density matrices, unitary evolution and products. Those last are recorded as the ambient theory rather than as results about Qubit, since none of them mentions it.

Fourteen requirements are recorded as not done. Twelve have nothing behind them in the library yet: the Bloch vector and the Pauli decomposition of a state, the rotation gates and the decomposition of a general single-qubit unitary, the Born rule, the Bell and singlet-triplet bases, a closed form for the fidelity of two qubit states, the positive partial transpose criterion, registers of several qubits with universality of H, T and CNOT, and the link from kets on Qubit to the finite dimensional Hilbert space of a two element target. The other two are the Bloch sphere and the Bargmann invariant. Those are written and proved, in BlochSphere.lean and BargmannInvariant.lean, but QuantumInfo.lean imports neither, so nothing builds them and I did not want to record them as done; you may want to look at that separately from this map.

Two things I am unsure about. This is the first API map inside QuantumInfo rather than under Physlib, and the map is titled Qubits while it sits at QuantumInfo/States/Pure, whose largest module is the general Braket.lean. Tell me if you would rather it lived under Physlib/QuantumMechanics, or were split along the lines of #850 and #848.

Checks

python3 scripts/api_map_linter.py --repo . passes with no missing files and no missing names, resolving 74 declarations against the Lean sources, and no Lean source is touched.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for this pull-request (PR). If this is your first PR, welcome to the community!

Below is what will happen next. Please read carefully if you are not familiar with the process. You may open other PRs while this one is being reviewed, and can stack PRs on top of each other, so don't let these steps slow you down.

  1. Some automated checks will be run on your PR. You can see the results of these checks at the buttom of your PR page. If any of these checks fail, you will need to fix the issues before your PR can be merged. You can learn more about these here, including how to run them locally, which is sometimes quicker than relying on the GitHub Actions. If you have never had a PR merged before, you may have to wait for a reviewer to manually start these checks (this is for security).

  2. A reviewer will look at your PR and may ask you to make changes. This may happen a couple of days after you submit your PR, so you may need to be patient. But it should not be longer than that - if it is please bring it to the attention of the community on the Zulip. The level of review will depend on where your PR is submitted. If it is submitted to ./Physlib or ./QuantumInfo, the review will be more thorough than if it is submitted to ./PhyslibAlpha. You can find out more about what the review process is looking for in our review guidelines. If a reviewer adds an awaiting-author label to your PR, address the review comments, then please remove that label by adding a comment with -awaiting-author. This helps us keep track of reviews.

  3. The reviewer will either approve your PR, or request more changes (in which case we return to step 2). Once your PR is approved, it will be merged by a maintainer, this should happen shortly after approval, though you may get more comments at this stage.

Tip: The easiest way to get have a fast review is to submit a PR that is small and self-contained, and has clear documentation explaining why things are the way they are in your chages.

If you have any problems or questions, please reach out to the community on the Zulip.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we move this to ./Physlib/QuantumMechanics/Qubit/API-map.yaml, as the long-term plan is to move the QuantumInfo stuff from ./QuantumInfo to ./Physlib eventually.

Comment thread QuantumInfo/States/Pure/API-map.yaml Outdated
done: true
location: "QuantumInfo/States/Pure/Braket.lean (Ket, Bra, FunLike (Ket d) d ℂ, FunLike (Bra d) d ℂ, Coe (Ket d) (Bra d), Coe (Bra d) (Ket d), FunLike (Bra d) (Ket d) ℂ, dot, Ket.normalized, Ket.basis, uniform_superposition, Braket.dot_self_eq_one)"

- description: "Density matrices of a finite dimensional system are defined, carrying a coercion to Hermitian matrices and a `Prob` valued inner product of two states, and the API contains expectation values, the spectrum, the maximally mixed state, the embedding of pure states, and the purity together with its characterization of the pure states."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should split this up a bit, as I think Density matrices should likely sit in another API map

@jstoobysmith jstoobysmith added the awaiting-author A reviewer has asked the author a question or requested changes label Aug 11, 2026
…and split out the finite dimensional mixed-state content
@Robby955

Copy link
Copy Markdown
Contributor Author

Moved to Physlib/QuantumMechanics/Qubit/API-map.yaml, and split the content: the map now keeps the qubit-scoped and pure-state entries only. The density matrix, evolution, measurement and distinguishability entries are gone from it and can get their own map under #848.

@Robby955
Robby955 marked this pull request as ready for review August 11, 2026 18:10

@jstoobysmith jstoobysmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved - looks good. Will merge shortly

@jstoobysmith jstoobysmith added ready-to-merge This PR is approved and will be merged shortly and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 12, 2026
@jstoobysmith
jstoobysmith merged commit f3da8ce into leanprover-community:master Aug 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR is approved and will be merged shortly t-states-qi

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants