Skip to content

Definition of HilbertSpace#1184

Merged
jstoobysmith merged 2 commits into
leanprover-community:masterfrom
teng10:master
Jun 14, 2026
Merged

Definition of HilbertSpace#1184
jstoobysmith merged 2 commits into
leanprover-community:masterfrom
teng10:master

Conversation

@teng10

@teng10 teng10 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Hello,

I'm a new contributor to lean and saw the project on UnitaryHack, I didnt see explicit projects there so I looked over existing issues and decided to work on the definition of HilbertSpace to start. This PR makes progress towards the issue
I have tried to follow the TODO instructions in QuantumMechanics\HilbertSpace.lean.

Summary of changes

  • Added a FiniteHilbertSpace structure as EuclideanSpace carrying a val etnry as suggested in the TODO.
    • Because we are defining a structure, we need to use equivEuclideanto transfer AddCommGroupand Module properties for a vector space.
  • The rest of the files are to carry over properties of a Hilbert space , as we need the definition to have the following properties such that it is compatible with QuantumInfo/Finite/Braket.lean.
    (H : Type*) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] [FiniteDimensional ℂ H]
  • The linearEquivEuclidean definition transfers NormedAddCommGroup, InnerProductSpace, CompleteSpaceand FiniteDimensional.
  • Finally to make this defintiion compatible to TightBindingChain/Basic.lean , we also define basisFun.

AI usage
As a beginner in writing lean code, I have used claude code and instructed the writing to be as close to mathlib quality. I have interacted with the AI for multiple sessions and have read all the lines of the code and tried to have a high level understanding as mentioned above. However, I realize I probably am not able to fully understand the nuance of design decisions and would very much appreciate your feedback on these.

The modfied files compile in lean, my linter passed 1/7 but is currently taking a very long time on step 2, if its ok I can come back to the linter.
Additionallz I have followed the review guidelines but could have missed something. Look forward to your feedback.

…hain/Basic.lean to be compatible with the new definition.
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for this PR, which will now be reviewed. Please
see our review guidelines
if you are not familiar with the process. You should expect a back and forth
with a reviewer before your PR is merged. See also that link for how to
add appropriate labels to your PR. The PR will also go through a number
of automated checks. You can learn more about these here,
including how to run them locally.

If you want to bring attention to this PR, please write a message on this
thread of the Lean Zulip.

/-- The finite dimensional Hilbert space of dimension `n`. -/
def FiniteHilbertSpace (n : ℕ) : Type := EuclideanSpace ℂ (Fin n)
-- def FiniteHilbertSpace (n : ℕ) : Type := EuclideanSpace ℂ (Fin n)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For reference, I kept the old definition here as comments

@jstoobysmith

Copy link
Copy Markdown
Member

This looks like a great first PR. Only one comment from me which is: Feel free to remove the old stuff - it is saved in the git history, so we can always retrieve it if need be.

I've added an awaiting-author label, when this is done could you comment with a comment that says -awaiting-author (this will remove this label).

@jstoobysmith jstoobysmith added the awaiting-author A reviewer has asked the author a question or requested changes label Jun 14, 2026
@teng10

teng10 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Ok thanks for the feedback! I removed the commented code

@teng10

teng10 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author A reviewer has asked the author a question or requested changes label Jun 14, 2026

@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 shortly

@jstoobysmith jstoobysmith added the ready-to-merge This PR is approved and will be merged shortly label Jun 14, 2026
@jstoobysmith jstoobysmith merged commit 89c4ede into leanprover-community:master Jun 14, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants