Skip to content

feat(PhyslibAlpha): the spin-1/2 representation is given by half the Pauli matrices - #2099

Merged
jstoobysmith merged 1 commit into
leanprover-community:masterfrom
dl-eigenart:spin-half-pauli
Nov 16, 2026
Merged

jstoobysmith merged 1 commit into
leanprover-community:masterfrom
dl-eigenart:spin-half-pauli

Conversation

@dl-eigenart

Copy link
Copy Markdown
Contributor

This PR adds PhyslibAlpha/QuantumMechanics/AngularMomentum/SpinHalf.lean and links the abstract spin-½ representation standard 1 to the Pauli matrices. The new file contains 110 lines with seven lemmas and does not introduce any new definitions.

Previously, these two aspects were separate: spin ½ as standard 1 from the sl2 construction in PhyslibAlpha, and the Pauli matrices in Physlib/Relativity/PauliMatrices. A search in Physlib, PhyslibAlpha, and QuantumInfo did not yield any existing lemmas that express this identification.

The seven lemmas show:
The matrices of Jx, Jy, and Jz in standard 1 are exactly σ₁ / 2, σ₂ / 2, and σ₃ / 2.
The ladder operators J₊ and J₋ have the matrices [[0, 1], [0, 0]] and [[0, 0], [1, 0]], respectively, i.e., σ₊ and σ₋.
The normalized basis vectors normVec 1 0 and normVec 1 1 correspond to the standard basis vectors v 0 and v 1.
This makes the connection between the abstract spin-½ representation “standard 1” and the Pauli matrices from Physlib/Relativity/PauliMatrices explicit. The basis lemmas also show that the normalized basis of the CG files over ℝ is exactly the standard basis. The notations |↑⟩ = v₀ and |↓⟩ = v₁ thus use the same indexing on both sides. This PR does not contain a lemma that connects the real basis to the complex basis.

Conventions:
We have ℏ = 1. The indices 0, 1, 2 denote the x-, y-, and z-component.

The basis is arranged such that

|↑⟩ = |0⟩ = v 0 has the eigenvalue m = +½,
|↓⟩ = |1⟩ = v 1 has the eigenvalue m = −½.

Thus, σ₃|↑⟩ = +|↑⟩. The ladder operators use the Condon–Shortley phase without an additional sign, i.e., J₊|↓⟩ = +|↑⟩.

Structure and Proofs:
The matrix identities are proven entry-by-entry using ext and fin_cases i <;> fin_cases j. The case distinction is thus performed over the four matrix entries (i, j). For J₊ and J₋, the expressions are first rewritten in terms of ρE and ρF, respectively, using the existing lemmas standard_Jp and standard_Jm; their definitions are then applied. For the remaining matrix equalities, the required definitions of ρE, ρF, and ρH are applied. The results are in a separate file because they import the Pauli matrices from Physlib. Addition.lean should not have this additional dependency.

LinearMap.toMatrix' is used for the matrix representation: StandardSl2Module ℂ 1 is Fin 2 → ℂ, so toMatrix' directly returns the matrix with respect to the standard basis.

Deliberately not included in this PR:

  • No new definition for spin ½ or σ / 2: The representation is already given by standard 1; an additional definition would introduce the same thing twice.
  • No re-proofs of the commutator relations: These are already covered by the fields comm_xy, comm_yz, and comm_zx of the structure, as well as by pauliMatrix_commutator from feat(Relativity): add Levi-Civita form of the Pauli matrix commutator #2031 for the Pauli matrices.
  • There is currently no direct connection to the qubit gates X, Y, Z, or to 𝐔[Qubit] from QuantumInfo. This will be implemented after the qubit file is moved from QuantumInfo to Physlib; see Merge ./QuantumInfo into ./Physlib #1960.

Verification:
Verified based on the master branch at commit be0a9ee. The following tests were successful:

Build of the new module
lint-style.sh
alphaPythonLinters.sh
module_doc_lint
alphaFileImports
Batteries-#lint for PhyslibAlpha
lint_all and auxillary_script_test were not run.

Related PRs and Issues:
#2007 – CG circuit for ½ ⊗ ½
#2031 – Commutator of the Pauli matrices with the Levi-Civita symbol
#2010 – Ry
#1960 – Moving the qubit file from QuantumInfo to Physlib

…Pauli matrices

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added medium PhyslibAlpha Pull requests which are for modifications to PhyslibAlpha. labels Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

While you wait for a review, note that you can review PRs too; reviewing is not restricted to maintainers. Our review guidelines explain what to look for.

Over time, contributions such as reviews, maintenance and documentation are recorded on contributions.physlib.io.

Three main points:

  • Comment -awaiting-author on its own line to remove that label from your PR.
  • Comment blocked-by-PR or -blocked-by-PR on its own line to add or remove that label, respectively.
  • The first review might take several days to arrive. If in doubt message on the Zulip.

For the author: Please read

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 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 changes.

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

For reviewers: Summary of your PR

Found differences:
@@ PhyslibAlpha.QuantumMechanics.AngularMomentum.SpinHalf @@
+ module added PhyslibAlpha.QuantumMechanics.AngularMomentum.SpinHalf (+110 -0)
  namespaces PhyslibAlpha.Sl2
+ added lemma normVec_one_one
+ added lemma normVec_one_zero
+ added lemma toMatrix'_standard_one_Jm
+ added lemma toMatrix'_standard_one_Jp
+ added lemma toMatrix'_standard_one_Jx
+ added lemma toMatrix'_standard_one_Jy
+ added lemma toMatrix'_standard_one_Jz
@@ PhyslibAlpha @@
! module modified PhyslibAlpha (+1 -0)
9 differences

The declarations are found by reading the diff as text, without regard for namespaces, so a declaration whose keyword and name are on different lines is missed, and two declarations of the same name in different namespaces are listed as one. A change to a proof, or to the body of a definition, does not appear. See scripts/alpha/github/pr_summary.lean.

Summary of commit 6dfbfbf, remade whenever a commit is pushed.

@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 - will merge now.

@jstoobysmith jstoobysmith added the ready-to-merge This PR is approved and will be merged shortly label Nov 16, 2026
@jstoobysmith
jstoobysmith added this pull request to the merge queue Nov 16, 2026
Merged via the queue into leanprover-community:master with commit 08a6c1b Nov 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

medium PhyslibAlpha Pull requests which are for modifications to PhyslibAlpha. ready-to-merge This PR is approved and will be merged shortly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants