feat(algebra): assemble the skew-unitary congruence - #7589
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The Lean implementation and Blueprint sync appear consistent with the stated CPSV17 construction, with only a minor documentation-header mismatch noted.
Pull request overview
This PR extends TNLean.Algebra.UnitaryCongruence to cover the skew-symmetric branch of the CPSV17 paired-projector construction, adding reusable lemmas for weighted sums of orthogonal projectors and synchronizing the corresponding Blueprint lemma in Chapter 28.
Changes:
- Add reusable multiplication and unitarity lemmas for weighted sums over mutually orthogonal Hermitian idempotents.
- Formalize the CPSV17 paired-projector assembly in the skew branch, producing symmetric unitary
S, real skew-symmetric unitaryΛ, and the factorizationx = Sᵀ * Λ * S. - Add a Blueprint lemma entry (
\leanok) for the paired-projector skew congruence and wire it into the dependency graph of the (still\notready) full normal-form lemma.
File summaries
| File | Description |
|---|---|
| TNLean/Algebra/UnitaryCongruence.lean | Adds weighted-sum infrastructure and proves the skew paired-projector congruence assembly theorem. |
| blueprint/src/chapter/ch28_mpu.tex | Adds/marks the paired-projector skew congruence lemma as checked and updates \uses dependencies accordingly. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Addressed the Copilot documentation finding in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f5e653c0d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the Codex source-citation finding by adding a reader-visible CPSV17 lemma citation in |
There was a problem hiding this comment.
Reviewed for (A) blueprint ↔ Lean equivalence/status and (B) prose quality only, per the scoped mandate.
Category A — equivalence and status
- New lemma
lem:mpu_skew_unitary_paired_projectors↔Matrix.exists_skew_unitary_congruence_of_paired_projectorschecked hypothesis-by-hypothesis: finite index sets (K→κ, I→m), HermitianP k(hPstar), the combined orthogonal-idempotent family overSum κ κ(hPmul) capturing "family {P_k, P_k^T} mutually orthogonal projectors," and the identity resolution (hPsum) capturing "sums to the identity." Conclusion formulas forx,S,Λmatch the paper phases (e^{-iπ/4},e^{-iE_k/2},i) term-for-term, and the five asserted properties (S^T=S,Sunitary,Λreal,Λ^T=-Λ,Λunitary,x=S^TΛS) match the Lean conjuncts one-to-one. No hypothesis strengthening/weakening found. \leanokon both the statement and proof is valid: the declaration resolves, the signature matches per above, andgrep -n 'sorry|admit|axiom|native_decide' TNLean/Algebra/UnitaryCongruence.leanis empty.\notreadyonlemma:conjclass-normalform-continuousremains correct — it still has no\lean{}counterpart and depends on the not-yet-formalized spectral-pair extraction (#7587); the added\uses{lem:mpu_skew_unitary_paired_projectors}edge is accurate given the new lemma's role.- Module docstring header was updated to cover both branches (this also resolves the earlier
copilot-pull-request-reviewerthread on the stale header — left that thread's resolution to a maintainer since I don't own it). - The two new helper lemmas (
weighted_sum_mul_weighted_sum,weighted_sum_mem_unitaryGroup) are reusable technical building blocks, not paper-level statements, so no blueprint entry is expected for them (consistent with existing ledger entries of the same kind).
Category B — prose quality
- New blueprint lemma/proof text is pure mathematics, no Lean identifiers or banned software/LLM phrasing.
- The proof sketch is formula-driven as required: it displays the weight identity
(e^{-iπ/4}e^{-iE_k/2})^2 i = e^{-iE_k}rather than describing the phase cancellation in words only. - No banned-term or Lean-jargon hits in the changed docstring/blueprint text.
No new findings in either category — 0 equivalence mismatches, 0 stale \leanok/\notready, 0 prose issues.
Note: the existing unresolved chatgpt-codex-connector thread (visible citation for the new lemma's source) is still open and not fixed by this diff, but it falls outside my A/B mandate (citation-formatting practice, not a math-equivalence or banned-language issue), so I neither duplicated nor resolved it.
There was a problem hiding this comment.
Summary
Reviewed TNLean/Algebra/UnitaryCongruence.lean and blueprint/src/chapter/ch28_mpu.tex against CPSV17 (Papers/1703.09188/paper_v2.tex, lines 1054–1082) and the Lean development.
Mathematical faithfulness. Matrix.exists_skew_unitary_congruence_of_paired_projectors (UnitaryCongruence.lean:189) matches the skew branch of lemma:conjclass-normalform-continuous (paper lines 1066–1082): given a paired family {P_k, P_k^T} of Hermitian orthogonal idempotents summing to 1, it produces S = e^{-iπ/4}∑ e^{-iE_k/2}(P_k+P_k^T) and Λ̃ = i∑(P_k-P_k^T), and shows S^T = S, S unitary, Λ̃ real and skew-symmetric and unitary, and x = S^T Λ̃ S. I checked the phase algebra by hand: (e^{-iπ/4}e^{-iE_k/2})² · i = e^{-iπ/2}e^{-iE_k}·i = (-i)(i)e^{-iE_k} = e^{-iE_k} for the P_k term, and (e^{-iπ/4}e^{-iE_k/2})²·(-i) = -e^{-iE_k} for the P_k^T term — this reproduces x = ∑ e^{-iE_k}(P_k - P_k^T) exactly as in the paper (hphase/hphase_neg, lines ~336–360).
The Hermiticity hypothesis hPstar on P is not a smuggled restriction: the paper's own proof of 𝑃̄_E = P_E^\dagger (used to derive Λ̃ real) implicitly relies on the same fact, since "orthogonal projector" in this source means self-adjoint idempotent throughout. The lemma is honestly scoped as a new blueprint entry (lem:mpu_skew_unitary_paired_projectors) feeding into the still-\notready lemma:conjclass-normalform-continuous via \uses{...} — it is not mislabeled as the full source theorem, so no paper-gap note is required for the "projectors are given rather than derived from a spectral decomposition" gap (spectral-pair extraction is correctly deferred to #7587).
Proof integrity. No sorry/admit/axiom/native_decide in the changed file. The two new general-purpose lemmas (weighted_sum_mul_weighted_sum, weighted_sum_mem_unitaryGroup) are reusable and correctly generalize over an arbitrary orthogonal-idempotent family, not hardcoded to Sum κ κ.
Prior review threads. Both the Copilot module-header finding and the Codex citation finding are addressed in the diff (module docstring now names both branches at UnitaryCongruence.lean:13; the new lemma carries \cite[Lemma~\texttt{lemma:conjclass-normalform-continuous}]{Cirac2017MPU} inline, matching the style of the preceding symmetric-branch entry) and are already marked resolved on GitHub — no action needed.
Style/docs. Docstrings present on all three new declarations; naming follows convention (exists_..., weighted_sum_...); Cirac2017MPU is a valid, already-used bib key.
No 🔴 blockers or 🟡 requires-changes issues found. Approving.
|
Post-merge verification on exact |
There was a problem hiding this comment.
Scope: blueprint↔Lean equivalence/status (A) and prose quality (B) only.
Category A — blueprint ↔ Lean equivalence
Checked the new lemma lem:mpu_skew_unitary_paired_projectors (blueprint) against Matrix.exists_skew_unitary_congruence_of_paired_projectors (Lean):
-
Hypotheses. Blueprint's "$P_k$ Hermitian projectors" + "${P_k,P_k^T}$ mutually orthogonal, sums to the identity" corresponds exactly to
hPstar(Hermitian on$P_k$ ; Hermiticity of$P_k^T$ is a correct derived fact, not smuggled in) +hPmul(idempotency at$a=b$ , pairwise orthogonality at$a\neq b$ , including the same-$k$ cross term$P_k P_k^T=0$ ) +hPsum(sum overSum κ κ= 1). No silent strengthening or weakening. -
Conclusion. Formulas for
$x$ ,$S$ ,$\widetilde\Lambda$ match term-by-term (phases, sums, transposes).$S^T=S$ ,$\overline{\widetilde\Lambda}=\widetilde\Lambda$ (entrywise conjugate, matchingMatrix.map (starRingEnd ℂ), not conjugate-transpose),$\widetilde\Lambda^T=-\widetilde\Lambda$ , both unitary, and$x=S^T\widetilde\Lambda S$ all line up with the Lean conjunctions. The existential/let-bound Lean phrasing is a standard restatement of "the matrix given by this formula has these properties," not a weaker claim. -
\leanokaccuracy. Both the statement and proof\leanokare valid:Matrix.exists_skew_unitary_congruence_of_paired_projectorsresolves, andrg -n "sorry|admit|axiom" TNLean/Algebra/UnitaryCongruence.leanis empty. -
\notreadyaccuracy.lemma:conjclass-normalform-continuouscorrectly stays\notready— this PR supplies only the projectors-given branch; spectral-pair extraction and$\det=1$ remain open (per PR body, tracked as #7587/#7588). The added\uses{..., lem:mpu_skew_unitary_paired_projectors}on that parent entry is accurate. - Both prior bot review threads (module header mismatch, invisible-only citation) are already fixed in the current diff and marked resolved — nothing outstanding there.
No equivalence mismatches found.
Category B — prose quality
The new blueprint lemma and proof sketch are formula-driven throughout (explicit sums, phases, and the key identity
Summary: 0 equivalence mismatches, 0 stale \leanok/\notready, 0 prose issues.
There was a problem hiding this comment.
Reviewed against the cited source (Papers/1703.09188/paper_v2.tex, lines 1066–1084) and the blueprint. This PR is already merged; filing this review for the record since CI just completed on the merge commit.
Source fidelity
Lines 1066–1084 of paper_v2.tex state the skew branch of lemma:conjclass-normalform-continuous: for lem:mpu_skew_unitary_paired_projectors (blueprint/src/chapter/ch28_mpu.tex:6708) restates exactly this, with the domain of lemma:conjclass-normalform-continuous correctly stays \notready (det
Proof correctness (TNLean/Algebra/UnitaryCongruence.lean)
-
weighted_sum_mul_weighted_sum/weighted_sum_mem_unitaryGroup: correctly generalize "sum of unit-modulus-weighted mutually-orthogonal Hermitian idempotents summing to 1 is unitary." Stated over a genericι, not hard-coded toSum κ κ— appropriately reusable, and I didn't find a pre-existing equivalent in Mathlib or.lake/packages/qiclean(checkedQICLean/Algebra/{OrthogonalProjection,EigenvectorProjection}.lean). -
exists_skew_unitary_congruence_of_paired_projectors: hand-checked the algebra.hPmuloverSum κ κcorrectly encodes orthogonality of all pairs, including$P_k\cdot P_k^T=0$ for every$k$ (sinceinl k ≠ inr kalways), matching "the family${P_k,P_k^T}$ ... mutually orthogonal" in the blueprint. The phase identity inhphase/hphase_negis exactly$(e^{-i\pi/4}e^{-iE_k/2})^2\cdot i=e^{-iE_k}$ and$(e^{-i\pi/4}e^{-iE_k/2})^2\cdot(-i)=-e^{-iE_k}$ , which are the two coefficients needed for$S^T\Lambda S$ to reassemble$x=\sum_k e^{-iE_k}(P_k-P_k^T)$ — verified againsthquarter's$e^{-i\pi/2}=-i$ andhhalf.hΛ_real/hΛ_transposecorrectly derive$\overline\Lambda=\Lambda$ ,$\Lambda^T=-\Lambda$ fromhPstarviahPmap/hPtransposeMap. Nosorry/axiom/native_decide.
Prior review threads
Confirmed via GraphQL that both bot threads are resolved and the fixes are present in the final diff: the module docstring now reads "Congruence factorizations of symmetric and skew-symmetric unitary matrices" (Copilot's finding), and the new lemma carries a visible \cite[Lemma~\texttt{lemma:conjclass-normalform-continuous}]{Cirac2017MPU} in the rendered blueprint text, not just the LaTeX % Source lines comment (Codex's P1 finding).
Advisory (non-blocking)
hphase/hphase_neg (lines ~313–359) go through a manual show ... by ring rewrite before applying hquarter/hhalf; this works but is more verbose than necessary — likely shrinkable with ring_nf plus the two exponential facts. Not required before merge (it already merged), just a candidate for docs/tactic_patterns.md/proof-shrink follow-up if this pattern recurs.
No blocking or must-fix issues found.
What changed
[
S=e^{-i\pi/4}\sum_E e^{-iE/2}(P_E+P_E^T),
\qquad
\widetilde\Lambda=i\sum_E(P_E-P_E^T)
]
[
x=S^T\widetilde\Lambda S
]
\notreadyThe proof follows CPSV17 lines 1066-1082 and retains the source phase$e^{-i\pi/4}$ . It makes no rank-one projector assumption and no continuity claim.
Validation
lake build TNLean.Algebra.UnitaryCongruence(2980/2980 on exact hot-main cache)git diff --checkCloses #7586
Advances #7580
Advances #7572