Skip to content

feat: Hilbert space & unbounded operators on Space#957

Merged
jstoobysmith merged 22 commits intoleanprover-community:masterfrom
gloges:hilbert-space
Feb 28, 2026
Merged

feat: Hilbert space & unbounded operators on Space#957
jstoobysmith merged 22 commits intoleanprover-community:masterfrom
gloges:hilbert-space

Conversation

@gloges
Copy link
Contributor

@gloges gloges commented Feb 21, 2026

Initial progress for single-particle QM on Space d, addressing #851.

SpaceDHilbertSpace and SchwartzSubmodule carry over from 1d with only minor changes (cf. OneDimension/HilbertSpace).
UnboundedOperator is defined using LinearPMap with additional density and closability hypotheses. Nothing in UnboundedOperator depends on the particular Hilbert space and can be easily generalized in the future.

A few sorries remain to be filled in; two I think I can do after understanding how to work with InnerProductSpace/PiL2.

Copy link
Member

@jstoobysmith jstoobysmith left a comment

Choose a reason for hiding this comment

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

Many thanks for this PR

@gloges
Copy link
Contributor Author

gloges commented Feb 23, 2026

Still more to do (e.g. products, x,p,L instances), but I think this is a good break point now that everything is sorry free.

@gloges gloges marked this pull request as ready for review February 23, 2026 12:45
Copy link
Collaborator

@morrison-daniel morrison-daniel left a comment

Choose a reason for hiding this comment

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

Since you mentioned being a beginner I added quite a few comments to help with style and structure, but really it is quite good work. Feel free to comment/DM on Zulip if you have questions!

/-- The domain of an unbounded operator is dense in the Hilbert space. -/
dense_domain : Dense (domain : Set HS)
/-- An unbounded operator is closable. -/
is_closable : toLinearPMap.IsClosable
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this isn't necessary since dense_domain and CompleteSpace should guarantee this condition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Closability is required for the adjoint to be densely defined and thus also of type UnboundedOperator (cf. Schmüdgen Theorem 1.8.i).

Copy link
Collaborator

Choose a reason for hiding this comment

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

What I mean is that I believe on a HilbertSpace (or some other common setting) any densely defined linear map is closable and so we don't need this as a separate assumption. I say this because I often see the existence of a closure be implicitly assumed in some references. Perhaps we leave this as is for now and see under what conditions closability is guaranteed and consider a refactor later.

instance : CoeFun (UnboundedOperator HS)
(fun U : UnboundedOperator HS ↦ U.domain → HS) := ⟨toFun'⟩

lemma ext' (U T : UnboundedOperator HS) : U.toLinearPMap = T.toLinearPMap → U = T := by
Copy link
Collaborator

Choose a reason for hiding this comment

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

[ext] attribute should auto-generate this lemma and the one below.

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 autogenerated ext lemma is (x.domain = y.domain) → (x.toFun ≍ y.toFun) → x = y and the HEq docs say to avoid it, so I think this is worth keeping.

@morrison-daniel morrison-daniel added awaiting-author A reviewer has asked the author a question or requested changes t-quantum-mechanics Quantum mechanics labels Feb 25, 2026
@morrison-daniel
Copy link
Collaborator

Also, in general it is helpful for review to break up larger changes like this into multiple smaller PRs around 100-200 lines if you can. Don't worry about it for this one, but keep it in mind for the future.

@morrison-daniel morrison-daniel self-assigned this Feb 25, 2026
@gloges
Copy link
Contributor Author

gloges commented Feb 25, 2026

Thanks very much for the comprehensive feedback! I've extracted the submodule lemmas for getting the inner product structure onto the LinearPMap graphs into the Mathematics folder and done some clean-up on the UnboundedOperator file. I've kept ext' (and ext_iff') as the autogenerated version is slightly different: (x.domain = y.domain) → (x.toFun ≍ y.toFun) → x = y.

@jstoobysmith
Copy link
Member

This looks good to me, but I think Daniel has now got a tighter control of this PR so will leave any final reviews to him.

@jstoobysmith jstoobysmith removed the awaiting-author A reviewer has asked the author a question or requested changes label Feb 26, 2026
/-- The domain of an unbounded operator is dense in the Hilbert space. -/
dense_domain : Dense (domain : Set HS)
/-- An unbounded operator is closable. -/
is_closable : toLinearPMap.IsClosable
Copy link
Collaborator

Choose a reason for hiding this comment

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

What I mean is that I believe on a HilbertSpace (or some other common setting) any densely defined linear map is closable and so we don't need this as a separate assumption. I say this because I often see the existence of a closure be implicitly assumed in some references. Perhaps we leave this as is for now and see under what conditions closability is guaranteed and consider a refactor later.

Comment on lines +285 to +287
rw [adjoint_toLinearPMap, adjoint_graph_eq_graph_adjoint U†.dense_domain]
rw [adjoint_toLinearPMap, adjoint_graph_eq_graph_adjoint U.dense_domain]
rw [closure_toLinearPMap, ← IsClosable.graph_closure_eq_closure_graph U.is_closable]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay sounds good

@morrison-daniel
Copy link
Collaborator

I manually removed a couple extraneous blank lines that (hopefully) won't break anything, will approve after that.

@morrison-daniel morrison-daniel added the ready-to-merge This PR is approved and will be merged shortly label Feb 28, 2026
Copy link
Member

@jstoobysmith jstoobysmith left a comment

Choose a reason for hiding this comment

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

I’ve approved this aswell and will merge now

@jstoobysmith jstoobysmith merged commit 6286c6b into leanprover-community:master Feb 28, 2026
3 checks passed
JayYarlott pushed a commit to Complex-Quantum-Systems-Research-Group/PhysLean that referenced this pull request Mar 3, 2026
…ity#957)

* d-dim Hilbert space

* d-dim schwartz submodule

* init progress on unbounded ops

* init progress on unbounded ops

* submodule lemmas

* abstract away Hilbert space

* linter fixes

* sorry removed: closable => adjoint dense

* sorry removed: symm + dense => closable

* sorry-free

* comments

* UnboundedOperator extends LinearPMap

* remove unnecessary coe

* relocate submodule lemmas

* style improvements

* more improvements

* extract adjoint_isClosable_dense

* minor cleanup

* lint fixes

* Remove extra blank lines

* Remove extra blank lines

---------

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>
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-quantum-mechanics Quantum mechanics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants