feat(QuantumInfo): Robertson uncertainty relation for mixed states - #1587
naype888-cloud wants to merge 11 commits into
Conversation
Robertson's uncertainty relation for two Hermitian matrices on a finite-dimensional pure state (robertson_uncertainty), and the quantum Cramér-Rao bound for a unitarily-generated one-parameter family under the standard locally-unbiased-estimator normalization (cramerRao_pureState_unitary), proved from Cauchy-Schwarz rather than assumed as a corollary of Robertson. Includes the supporting Ket/Matrix API (toEuclideanSpace, onVec, expValC, expVal, variance, centered) needed to state and prove both. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
|
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.
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. |
|
@Timeroot would you be able to review this PR? |
Robertson's "The Uncertainty Principle" (Phys. Rev. 34) is a two-page letter on pages 163-164, not 163-166. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Timeroot
left a comment
There was a problem hiding this comment.
I think the main thing is that this should be done for MState instead. You'll find it has a lot more of the API you want already there.
|
|
||
| /-- The state vector of a `Ket`, seen in `EuclideanSpace ℂ d` where Mathlib's inner product | ||
| space API (in particular Cauchy–Schwarz) is available. -/ | ||
| def Ket.toEuclideanSpace (ψ : Ket d) : EuclideanSpace ℂ d := |
There was a problem hiding this comment.
This can use ketToEuclidean in Braket.lean, feel free to make that non-private. Same for the two lemmas below.
|
|
||
| /-- The action of a matrix on a vector of `EuclideanSpace ℂ d`, via `Matrix.mulVec` on the | ||
| underlying function. -/ | ||
| def Matrix.onVec (A : Matrix d d ℂ) (v : EuclideanSpace ℂ d) : EuclideanSpace ℂ d := |
There was a problem hiding this comment.
I'm not sure this definition should exist, but if it should, it should go in another file!
|
|
||
| /-- Two Hermitian matrices commute past the inner product: `⟪v, A w⟫ = ⟪A v, w⟫`. This is the | ||
| only place `A.IsHermitian` is used in this file; everything else is Cauchy–Schwarz. -/ | ||
| lemma Matrix.IsHermitian.inner_onVec_comm {A : Matrix d d ℂ} (hA : A.IsHermitian) |
There was a problem hiding this comment.
Down to here, all in another file if keeping at all.
| ring | ||
|
|
||
| /-- Expectation value of a matrix `A` on the pure state `ψ`: `⟨ψ, A ψ⟩`. -/ | ||
| def Ket.expValC (ψ : Ket d) (A : Matrix d d ℂ) : ℂ := |
There was a problem hiding this comment.
You know I think actually this whole thing can be done for mixed states, which easily generalized the Ket formulation. I don't think it's any more mathematically complicated. These values like expValC are just restating the specialization for MState.expValC, and so you might as well go that route!
| Matrix.conjTranspose_mul, hG.eq, hO.eq, Complex.star_def, Complex.conj_I] | ||
| module | ||
| have hantisym : ψ.expValC (G * O) - ψ.expValC (O * G) = | ||
| (inner ℂ (ψ.centered G) (ψ.centered O) : ℂ) - |
There was a problem hiding this comment.
This type of inner ℂ and starRingEnd ℂ notation is much much more verbose than it needs to be. I think most of this could be done much shorter.
Really this whole proof could likely be golfed down..
Addresses @Timeroot's review: rebuild the file on `MState` instead of `Ket`, reusing the existing `MState.exp_val` / `exp_val_ℂ` API. - Drops `Ket.toEuclideanSpace`, `Matrix.onVec` (+ its 5 lemmas), `Ket.expValC` and friends: ~120 lines removed. - `MState.variance`, `MState.comm_exp_val` are new first-class API; the GNS Cauchy–Schwarz `|Tr(ρ XᴴY)|² ≤ Tr(ρ XᴴX)·Tr(ρ YᴴY)` is a small private section (`hsVec`, realizing the Hilbert–Schmidt space as `EuclideanSpace ℂ (d × d)`) that can move to `QuantumInfo/ForMathlib/` if preferred. - `robertson_uncertainty` now holds for every finite-dimensional state, not just pure ones. `cramerRao_unitary` is its corollary under the commutator normalization; `cramerRao_pure_unitary` is the pure-state specialization, where `4·Var_ρ(G)` is exactly the quantum Fisher information. - Module docstring reworked: the Helstrom / Braunstein–Caves QFI identification is scoped to the pure case; for mixed states `4·Var_ρ(G) ≥ QFI_SLD`, so the bound is valid but not tight. lake build QuantumInfo.Measurements.CramerRao: OK. lake build QuantumInfo: OK. scripts/lint-style.py: OK. No sorry. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks, this makes sense. I reworked the file around `MState` instead of the
pure-state `Ket` formulation. The auxiliary `Ket.toEuclideanSpace`,
`Matrix.onVec`, and `Ket.expValC` definitions are gone; the result now
uses the
existing `MState.exp_val_ℂ` / `MState.exp_val` API and proves Robertson
directly
for mixed states, with the pure-state Cramér–Rao statement as a
specialization.
…On Sat, Aug 29, 2026 at 2:26 PM Alex Meiburg ***@***.***> wrote:
***@***.**** commented on this pull request.
I think the main thing is that this should be done for MState instead.
You'll find it has a lot more of the API you want already there.
------------------------------
In QuantumInfo/Measurements/CramerRao.lean
<#1587 (comment)>
:
> +## C. The quantum Cramér–Rao bound
+-/
+
***@***.*** public section
+
+noncomputable section
+
+open scoped ComplexConjugate
+
+variable {d : Type*} [Fintype d]
+
+/-! ## A. Expectation value and variance of a Hermitian observable on a pure state -/
+
+/-- The state vector of a `Ket`, seen in `EuclideanSpace ℂ d` where Mathlib's inner product
+space API (in particular Cauchy–Schwarz) is available. -/
+def Ket.toEuclideanSpace (ψ : Ket d) : EuclideanSpace ℂ d :=
This can use ketToEuclidean in Braket.lean, feel free to make that
non-private. Same for the two lemmas below.
------------------------------
In QuantumInfo/Measurements/CramerRao.lean
<#1587 (comment)>
:
> + ψ.toEuclideanSpace i = ψ.vec i := rfl
+
+lemma Ket.norm_toEuclideanSpace (ψ : Ket d) : ‖ψ.toEuclideanSpace‖ = 1 := by
+ rw [EuclideanSpace.norm_eq]
+ simp only [Ket.toEuclideanSpace_apply]
+ rw [ψ.normalized']
+ exact Real.sqrt_one
+
+lemma Ket.inner_self_toEuclideanSpace (ψ : Ket d) :
+ inner ℂ ψ.toEuclideanSpace ψ.toEuclideanSpace = (1 : ℂ) := by
+ rw ***@***.***_self_eq_norm_sq_to_K ℂ, ψ.norm_toEuclideanSpace]
+ norm_num
+
+/-- The action of a matrix on a vector of `EuclideanSpace ℂ d`, via `Matrix.mulVec` on the
+underlying function. -/
+def Matrix.onVec (A : Matrix d d ℂ) (v : EuclideanSpace ℂ d) : EuclideanSpace ℂ d :=
I'm not sure this definition should exist, but if it should, it should go
in another file!
------------------------------
In QuantumInfo/Measurements/CramerRao.lean
<#1587 (comment)>
:
> + refine Finset.sum_congr rfl fun j _ => Finset.sum_congr rfl fun k _ => ?_
+ ring
+
+lemma Matrix.onVec_sub (A B : Matrix d d ℂ) (v : EuclideanSpace ℂ d) :
+ (A - B).onVec v = A.onVec v - B.onVec v := by
+ ext i
+ simp [Matrix.onVec_apply, sub_mul, Finset.sum_sub_distrib]
+
+lemma Matrix.onVec_smul (c : ℂ) (A : Matrix d d ℂ) (v : EuclideanSpace ℂ d) :
+ (c • A).onVec v = c • A.onVec v := by
+ ext i
+ simp [Matrix.onVec_apply, Finset.mul_sum, mul_assoc]
+
+/-- Two Hermitian matrices commute past the inner product: `⟪v, A w⟫ = ⟪A v, w⟫`. This is the
+only place `A.IsHermitian` is used in this file; everything else is Cauchy–Schwarz. -/
+lemma Matrix.IsHermitian.inner_onVec_comm {A : Matrix d d ℂ} (hA : A.IsHermitian)
Down to here, all in another file if keeping at all.
------------------------------
In QuantumInfo/Measurements/CramerRao.lean
<#1587 (comment)>
:
> +only place `A.IsHermitian` is used in this file; everything else is Cauchy–Schwarz. -/
+lemma Matrix.IsHermitian.inner_onVec_comm {A : Matrix d d ℂ} (hA : A.IsHermitian)
+ (v w : EuclideanSpace ℂ d) :
+ inner ℂ v (A.onVec w) = inner ℂ (A.onVec v) w := by
+ simp only [PiLp.inner_apply, RCLike.inner_apply', Matrix.onVec_apply, Finset.mul_sum,
+ Finset.sum_mul, map_sum, map_mul]
+ rw [Finset.sum_comm]
+ refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => ?_
+ have hij : (starRingEnd ℂ) (A i j) = A j i := by
+ have := congrFun (congrFun hA.eq j) i
+ simpa [Matrix.conjTranspose_apply] using this
+ rw [hij]
+ ring
+
+/-- Expectation value of a matrix `A` on the pure state `ψ`: `⟨ψ, A ψ⟩`. -/
+def Ket.expValC (ψ : Ket d) (A : Matrix d d ℂ) : ℂ :=
You know I think actually this whole thing can be done for mixed states,
which easily generalized the Ket formulation. I don't think it's any more
mathematically complicated. These values like expValC are just restating
the specialization for MState.expValC, and so you might as well go that
route!
------------------------------
In QuantumInfo/Measurements/CramerRao.lean
<#1587 (comment)>
:
> +commutator. This is the standard 1929 inequality (H. P. Robertson, *The Uncertainty Principle*,
+Phys. Rev. 34, 163–164), specialized here to finite dimension. -/
+theorem robertson_uncertainty {ψ : Ket d} {G O : Matrix d d ℂ}
+ (hG : G.IsHermitian) (hO : O.IsHermitian) :
+ (ψ.expVal (Complex.I • (G * O - O * G))) ^ 2 / 4 ≤ ψ.variance G * ψ.variance O := by
+ have hCS : ‖(inner ℂ (ψ.centered G) (ψ.centered O) : ℂ)‖ ≤
+ ‖ψ.centered G‖ * ‖ψ.centered O‖ := norm_inner_le_norm _ _
+ have hprodsq : (‖ψ.centered G‖ * ‖ψ.centered O‖) ^ 2 = ψ.variance G * ψ.variance O := by
+ rw [mul_pow, ψ.norm_centered_sq hG, ψ.norm_centered_sq hO]
+ have hcomm_herm : (Complex.I • (G * O - O * G)).IsHermitian := by
+ unfold Matrix.IsHermitian
+ rw [Matrix.conjTranspose_smul, Matrix.conjTranspose_sub, Matrix.conjTranspose_mul,
+ Matrix.conjTranspose_mul, hG.eq, hO.eq, Complex.star_def, Complex.conj_I]
+ module
+ have hantisym : ψ.expValC (G * O) - ψ.expValC (O * G) =
+ (inner ℂ (ψ.centered G) (ψ.centered O) : ℂ) -
This type of inner ℂ and starRingEnd ℂ notation is much much more verbose
than it needs to be. I think most of this could be done much shorter.
Really this whole proof could likely be golfed down..
—
Reply to this email directly, view it on GitHub
<#1587?email_source=notifications&email_token=B5YMS3ZNEUUNWYWEXF3ZAFD5MM4APA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMBVHEYDONRQGMY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-5059076031>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B5YMS356MIXPBUNGPQ537SL5MM4APAVCNFSNUABFKJSXA33TNF2G64TZHM3TQNZVG42DSNZYHNEXG43VMU5TKMRYGQ4DCMZZGE2KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/B5YMS37ZQ5WTR76U4VKS45D5MM4APA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMBVHEYDONRQGMY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/B5YMS3ZHLNUGGFMNYHZRTVT5MM4APA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMBVHEYDONRQGMY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
<leanprover-community/physlib/pull/1587/review/5059076031
***@***.***>
|
|
CI "Lean based style linters" flagged 3 issues on the MState redo: - `defsWithUnderscore`: `MState.comm_exp_val` -> `MState.commExpVal` (defs use lowerCamelCase). - `unusedArguments` on `hsVec_apply` (`[Fintype d]`, `[DecidableEq d]`) and `hsVec_inner` (`[DecidableEq d]`): replace the earlier `set_option linter.unusedSectionVars false` with canonical `omit ... in`. Also trims the module docstring and drops the redundant `Mathlib.Analysis.InnerProductSpace.Basic` import. `lake build QuantumInfo.Measurements.CramerRao` OK. `lake exe runPhyslibLinters` -> "Linting passed for QuantumInfo." Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@Timeroot do you think we are in a position to merge this? |
|
@jstoobysmith No, at a minimum I'd need points 2, 4, 7 above addressed |
|
Sorry my bad - presumed these where covered by the latest commit. awaiting-author |
…inty Rework per Timeroot's review: rename CramerRao → RobertsonUncertainty (point 7), move exp_val_ℂ_hermitian to MState.lean as @[simp] (point 2), add MState.variance + variance_nonneg near exp_val (point 4), restate the corollary as 1 ≤ 4 * Var(O) * Var(G) without positivity hypothesis (point 6), delete cramerRao_pure_unitary (point 8). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for the thorough review — sorry for the delay getting back. This commit addresses the points you flagged as minimum for merge:
Still working on points 1, 3, 5 (replacing -awaiting-author |
Drop sqrtMat wrapper — use ρ.M.sqrt directly from HermitianMat.Sqrt API. Replace commExpVal with Bracket instance on HermitianMat (⁅G, O⁆ = i(GO − OG)), so the theorem reads ρ.exp_val ⁅G, O⁆. Add section note explaining why hsVec (the HS embedding) is still needed. Warm up module docstring. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Follow-up commit addressing the remaining points:
All 8 review points addressed. Build green (9257 jobs). — Eduardo Nava-Hernández, B-ACQM 2026 |
|
"My English isn't great, but I'm uploading this code as the foundation for a theorem that already compiles in Lean 4. The setup requires a Cauchy-Robertson-Fiedler-Niven-Szego chain, so I’ll be validating whatever is missing along that chain until I can prove Nava-Robertson "dimensional uncertainty theorem" using those pillars. This is just one part of it, but I’ll be closing the gaps step by step. Once I have all the pieces in place, I’ll build the final theorem on top of them. Like I said, it already compiles and type-checks, but it’s still missing a canonical basis in several places. I've already fixed all the code style to match the requirements here." |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Looking at this PR, it might also be suitable to go directly into ./Physlib, where a lot of the underlying quantities are already defined. e.g. in ./Physlib/QuantumMechanics/Operators where we already have variance etc. |
Per jstoobysmith's review on PR leanprover-community#1587, relocate the mixed-state Robertson uncertainty relation from QuantumInfo/Measurements into Physlib/QuantumMechanics/Operators/MixedStateUncertainty.lean, next to the existing pure-state Robertson bounds in Operators/Uncertainty.lean. - New file Physlib/QuantumMechanics/Operators/MixedStateUncertainty.lean (Bracket instance, Hilbert-Schmidt embedding, robertson_uncertainty, robertson_normalized), with Physlib-style header/sections and the robertson1929uncertainty reference key. - Delete QuantumInfo/Measurements/RobertsonUncertainty.lean and its import in QuantumInfo.lean; keep MState helpers (exp_val_C_hermitian, variance, variance_nonneg) in MState.lean per Timeroot's points 2/4. - Register the file in Physlib.lean (sorted) and Operators/API-map.yaml. Physlib already imports QuantumInfo.ForMathlib (precedent: StatisticalMechanics/MicroCanonicalEnsemble/ThermoQuantities), so the QuantumInfo.States.Mixed.MState import introduces no import cycle. lake build OK (9355 jobs); check_file_imports, check_dup_tags, sorry_lint and runPhyslibLinters all pass. Co-Authored-By: Kimi <noreply@moonshot.cn>
|
Done — the mixed-state Robertson relation now lives in I'll be brief, because there is a large amount of mathematics still to be discharged: this PR is |
|
Sorry, I just realised there is this exact result here: Are there any improvements you would want to include there? You may also be interested in the following ongoing zulip |
The mixed-state Robertson file pulls QuantumInfo.ForMathlib.Matrix into the Physlib root environment, where its @[simp] Matrix.trace_submatrix subsumes Matrix.trace_reindex. The simpNF linter then flags trace_reindex as provable by simp. The lemma has no simp users (only one explicit erw), so keep it as a plain lemma for that rewrite instead of a duplicate simp lemma. lake build OK (9355 jobs); runPhyslibLinters passes for Physlib and QuantumInfo. Co-Authored-By: Kimi <noreply@moonshot.cn>
|
Thank you for pointing that out — the existing
A pure state is a rank-1 density matrix; a mixed state is any positive semidefinite trace-1 matrix. Every pure-state bound follows from the mixed-state version (specialize to rank 1), but the converse does not hold — the density-matrix framework requires the Beyond the generalization itself, the PR also contributes:
Happy to coordinate with the Zulip discussion on integrating |
|
Maybe it is worth posting a quick message on that zulip, to see what people think, and how to best implement this |
|
So, if I understood the comments on the Zulip correctly, what we currently have actually does take account of mixed states. |
|
sry guys i all ready fix the MSstates and the observation by timeroot and joseph, i shutdown this PR, and upload a newone attending your sugestions, this is the newone PR. #1676 |
feat(QuantumInfo): Robertson uncertainty relation for mixed states
Proves Robertson's uncertainty relation (1929) for two Hermitian observables on an arbitrary
finite-dimensional mixed state (
MState), via Cauchy–Schwarz on the Hilbert–Schmidt space.Single new file plus its import line, and three helper lemmas on
MState.t-quantum-infoFiles
QuantumInfo/Measurements/RobertsonUncertainty.lean— new file, 228 lines.QuantumInfo.lean— onepublic importline for the new module (kept sorted).QuantumInfo/States/Mixed/MState.lean— three helper lemmas (exp_val_ℂ_hermitian,variance,variance_nonneg).Definitions added
All in
QuantumInfo/Measurements/RobertsonUncertainty.lean.HermitianMat.Bracket⁅G, O⁆ = i(GO − OG)as aHermitianMat.MState.hsVecEuclideanSpace ℂ (d × d).MState.centeredVecA √ρ − ⟨A⟩ √ρin Hilbert–Schmidt space.Theorems
robertson_uncertaintyG, Oon a mixed stateρ:⟨i[G,O]⟩² / 4 ≤ Var(G) · Var(O). (H. P. Robertson, Phys. Rev. 34, 163–164 (1929).)robertson_normalized⟨i[G,O]⟩ = 1:1 ≤ 4 · Var(O) · Var(G). Free of positivity hypotheses.Proof strategy
Embed
√ρandA√ρintoEuclideanSpace ℂ (d × d)(the Hilbert–Schmidt space), form thecentered vector
A√ρ − ⟨A⟩√ρ, show its squared norm is the variance, then apply Cauchy–Schwarzto the pair of centered vectors. The imaginary part of the inner product recovers the commutator
expectation.
On
hsVecvsMatrix.toEuclideanLinhsVecis a deliberately minimal wrapper placing matrix entries intoEuclideanSpace ℂ (d × d).Using Mathlib's
Matrix.toEuclideanLinwould pull in an additional[DecidableEq d]threadingbeyond what is already needed for the commutator bracket. Happy to switch if reviewers prefer.
References
AI disclosure
AI-assisted (Claude). The author has certified every definition, theorem statement, and proof
step, and has personally verified the bibliographic references.