Skip to content

feat(Channel): formalize positive trace-preserving transposition#3404

Merged
LionSR merged 5 commits into
mainfrom
codex/wolf-ch3-transpose-positive-3391
Jun 22, 2026
Merged

feat(Channel): formalize positive trace-preserving transposition#3404
LionSR merged 5 commits into
mainfrom
codex/wolf-ch3-transpose-positive-3391

Conversation

@LionSR

@LionSR LionSR commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Motivation

Description

  • Adds Matrix.transposeLinearMapComplex on M_n(ℂ) via Matrix.transposeLinearEquiv.
  • Proves Matrix.transposeLinearMapComplex_isPositiveMap (positivity: PSD is preserved under transposition) using PosSemidef.transpose.
  • Proves Matrix.transposeLinearMapComplex_isTracePreservingMap (trace invariance) using trace_transpose through simp.
  • Adds blueprint theorem thm:transpose_positive_trace_preserving in blueprint/src/chapter/ch04_channels.tex with \lean{} tags for both new declarations, establishing transposition as the standard positive-but-not-CP example.

Testing

  • lake env lean TNLean/Channel/Basic.lean
  • python3 scripts/blueprint_lean_sync.py --root . --diff-base origin/main --ci
  • python3 scripts/check_reader_facing_prose.py --root . --diff-base origin/main --ci
  • chktex -q -l blueprint/.chktexrc blueprint/src/chapter/ch04_channels.tex
  • git diff --check

Closes #3391

Note

Low Risk
Small, localized additions to channel foundations and blueprint sync; proofs are short and use existing Mathlib transpose facts.

Overview
Adds Matrix.transposeLinearMapComplex on M_n(ℂ) via Mathlib's transposeLinearEquiv, and proves it is IsPositiveMap (PSD preserved under transpose) and IsTracePreservingMap (trace unchanged).

TNLean/Channel/Basic.lean module docs now cite Wolf Ch. 3 as well as Ch. 6 and list the new lemmas. Blueprint Ch. 4 gains Theorem "Transposition is positive and trace-preserving" (thm:transpose_positive_trace_preserving) linked to those Lean names—setting up transposition as the standard positive, trace-preserving map that is not CP.

Reviewed by Cursor Bugbot for commit 4c4b18a. Bugbot is set up for automated code reviews on this repo. Configure here.


Note

Low Risk
Small additive lemmas and blueprint sync; proofs delegate to existing Mathlib transpose/PSD facts with no changes to channel or density-matrix core logic.

Overview
Formalizes matrix transposition on M_n(ℂ) as the standard positive, trace-preserving linear map (Wolf Ch. 3 example), wired into Lean and the blueprint.

Adds Matrix.transposeLinearMapComplex via Mathlib’s transposeLinearEquiv, with short proofs that it is IsPositiveMap (PosSemidef.transpose) and IsTracePreservingMap (simp on trace). TNLean/Channel/Basic.lean module docs now cite Wolf Ch. 3 and list these lemmas.

Blueprint Ch. 4 gains Theorem thm:transpose_positive_trace_preserving (proof sketch + \lean{} links) immediately after the trace-preserving definition, before completely positive maps.

Reviewed by Cursor Bugbot for commit 59e67ab. Bugbot is set up for automated code reviews on this repo. Configure here.

@claude claude Bot added formalization Lean 4 formalization task wolf-ch3 Wolf Lecture Notes - Chapter 3: Positive but not completely positive maps labels Jun 22, 2026
@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown

PR cleanup

Field Before After
Title `feat(Channel): formalize positive trace-preserving transposition` unchanged
Body Missing --- separator before Addresses; Motivation lacked source file/section citation; Cursor Bugbot block wrapped in HTML comment tags Restructured: added --- separator, cited Notes/WolfNoteTexSource/ch03_positive_not_completely.tex §3.1 lines ~32–37 in Motivation, added parent issue #995 reference, preserved Cursor Bugbot block cleanly
Labels (none) added: `formalization`, `wolf-ch3`
Issue linked to #3391

Conventions: CONTRIBUTING.md

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review: APPROVE ✅

This is a clean, well-scoped PR that formalizes matrix transposition as a positive, trace-preserving linear map on M_n(ℂ) per Wolf Ch. 3 §3.1.

Assessment by category

1. 🔴 Proof integrity — No issues. No sorry, axiom, admit, native_decide, unsafeCast, or other blockers in the changed code.

2. 🔴 Proof correctness — Both proofs are mathematically sound:

  • transposeLinearMapComplex_isPositiveMap: uses PosSemidef.transpose (Mathlib LinearAlgebra/Matrix/PosDef.lean:85), which proves that transposition preserves PSD via the quadratic-form definition. The simpa correctly unfolds transposeLinearMapComplex.
  • transposeLinearMapComplex_isTracePreservingMap: uses trace_transpose (Mathlib LinearAlgebra/Matrix/Trace.lean:73), which is rfl. The simp chain correctly reduces through LinearEquiv.toLinearMap_applytransposeLinearEquiv_applytrace_transpose.

Both theorems are faithful to the source (Notes/WolfNoteTexSource/ch03_positive_not_completely.tex, lines ~32–37): the statement is exactly "transposition is positive and trace-preserving" with no extra hypotheses.

3. 🟡 Mathlib style — No issues. Naming follows conventions (lowerCamelCase for transposeLinearMapComplex, snake_case for theorems). simp/simpa calls use explicit lemma lists. Variable binder pattern (variable (n : Type*) / variable {n : Type*}) is standard Mathlib idiom. The results are placed in the Matrix namespace where they naturally belong.

4. 🔴 Type safety — No issues. [Fintype n] appears only on the trace-preservation theorem where it's mathematically needed. [DecidableEq n] is handled implicitly via the existing IsPositiveMap/IsTracePreservingMap definitions. No universe or coercion problems.

5. 🟡 Performance — No concerns. Both proofs are 2-3 lines with no heavy computation.

6. 🟡 Modularity & duplication — No issues. The definition reuses Matrix.transposeLinearEquiv from Mathlib directly rather than introducing an ad hoc linear map. All lemmas used (PosSemidef.transpose, trace_transpose) are existing Mathlib results.

7. 🟡 Documentation — Adequate. All three new declarations have docstrings. Module-level doc comments updated to cite Wolf Ch. 3 and list the new results. The blueprint entry (thm:transpose_positive_trace_preserving) is clear and self-contained.

8. Paper-gap notes — Not applicable (no files changed under docs/paper-gaps/).

Summary

The PR correctly proves that θ(A) = Aᵀ on M_n(ℂ) is a positive, trace-preserving linear map — the first two properties of the canonical example of a positive-but-not-CP map from Wolf Ch. 3 §3.1. The third property (not CP) is explicitly out of scope per issue #3391.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review summary

Category A — Blueprint ↔ Lean equivalence: no issues.

  • Theorem thm:transpose_positive_trace_preserving links to two Lean declarations (Matrix.transposeLinearMapComplex_isPositiveMap and Matrix.transposeLinearMapComplex_isTracePreservingMap). Both resolve and match the blueprint statement (positivity + trace-preservation of $\theta(X)=X^T$).
  • Both Lean proofs are sorry-free; statement and proof \leanok are valid.
  • \uses{def:positive_map, def:trace_preserving} labels both exist (lines 8 and 31 of the file).
  • No stale \notready, no missing \leanok, no renamed declarations.

Category B — Prose quality: 1 issue.

  • The positivity half of the proof sketch ("because transposition preserves positive semidefiniteness") is a circular verbal claim that restates the conclusion without the supporting identity. See inline comment on line 50. The trace-preservation half correctly shows the identity $\tr(X^T)=\tr(X)$ and needs no change.

Counts: 0 equivalence mismatches, 0 stale \leanok, 1 prose issue (formula missing).

Comment thread blueprint/src/chapter/ch04_channels.tex Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review summary

Small, well-scoped addition formalizing matrix transposition $\theta(X)=X^\top$ as a positive, trace-preserving map on $M_n(\mathbb{C})$ (Wolf Ch. 3, §3.1). The mathematics is correct and the proofs are clean. One 🟡 documentation-consistency item remains (inline comment), so I'm requesting changes per the review rubric.

Proof integrity 🔴 — clean

No sorry, axiom, native_decide, admit, or kernel bypasses. I built the file locally (lake env lean TNLean/Channel/Basic.lean, exit 0, no warnings).

Proof correctness 🔴 — clean

  • Matrix.transposeLinearMapComplex_isPositiveMap: intro A hA; simpa [transposeLinearMapComplex] using hA.transposehA.transpose : Aᵀ.PosSemidef, and simp reduces transposeLinearMapComplex n A to Aᵀ via the @[simps apply]-generated Matrix.transposeLinearEquiv_apply. Correct and minimal.
  • Matrix.transposeLinearMapComplex_isTracePreservingMap: intro A; simp [transposeLinearMapComplex] discharges trace Aᵀ = trace A through Matrix.trace_transpose. Correct.

The blueprint claim (thm:transpose_positive_trace_preserving) is mathematically sound and faithful to the source: it asserts only positivity and trace preservation (not the "not CP" half), matching what is formalized.

Type safety 🔴 — clean

I verified the elaborated signatures. IsPositiveMap requires no Fintype/DecidableEq (its @-signature is {n : Type*} → (Matrix n n ℂ →ₗ[ℂ] Matrix n n ℂ) → Prop), so the positivity theorem correctly carries no instance hypotheses. IsTracePreservingMap uses trace, which needs [Fintype n], and the trace theorem declares exactly that. No autoImplicit reliance, no coercion issues. The two theorems' instance assumptions are each minimal and correct — not an inconsistency.

Mathlib style 🟡 / Modularity ℹ️

  • transposeLinearMapComplex is a thin specialization of Matrix.transposeLinearEquiv to R = α = ℂ on square matrices. The specialization is justified as a bridge to the ℂ-typed IsPositiveMap/IsTracePreservingMap predicates — acceptable, not flagged.
  • Naming (camelCase def, snake_case theorems) is fine.

Documentation 🟡 — one item

The transposeLinearMapComplex docstring uses \(...\) LaTeX delimiters, inconsistent with the file's backtick-unicode convention and Mathlib's documented $...$ inline-math delimiter (docs/MATHLIB_doc.md:158); see the inline comment with a suggested fix.

Verdict

Requesting changes solely for the docstring notation. Once the inline suggestion is applied, this is good to merge.

Comment thread TNLean/Channel/Basic.lean Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary — PR #3404

PR: feat(Channel): formalize positive trace-preserving transposition
Verdict: REQUEST CHANGES — 1 🟡 issue remains unresolved

What this PR does

Adds Matrix.transposeLinearMapComplex on $M_n(\mathbb{C})$ via Mathlib's transposeLinearEquiv, with proofs that transposition is positive (transposeLinearMapComplex_isPositiveMap) and trace-preserving (transposeLinearMapComplex_isTracePreservingMap). Blueprint Ch. 4 gains Theorem thm:transpose_positive_trace_preserving.

Previous review cycle follow-up

  • Resolved (Thread 1): The blueprint proof was updated to use formula-first reasoning ($X = C^\dagger C \implies X^T = C^T\overline{C} = \overline{C}^\dagger\overline{C} \ge 0$) instead of the tautological "transposition preserves positive semidefiniteness." The proof is now mathematically self-contained and follows the prose style guide.
  • Still unresolved (Thread 2): The transposeLinearMapComplex docstring at TNLean/Channel/Basic.lean:89 still uses \(M_n(\mathbb C)\) instead of the file's backtick-unicode convention (see inline comment).

Category-by-category assessment

Category Status
🔴 Proof integrity ✅ No sorry, axiom, or circular reasoning
🔴 Proof correctness ✅ Both proofs are mathematically correct; PosSemidef.transpose and trace_transpose confirmed in Mathlib
🟡 Mathlib style ✅ Naming, variable conventions, lemma placement all follow Mathlib patterns
🔴 Type safety ✅ No universe issues; [Fintype n] properly scoped to trace theorem
🟡 Performance ✅ Trivial one-liner simpa/simp proofs
🟡 Modularity & duplication ✅ Good reuse of Matrix.transposeLinearEquiv from Mathlib
🟡 Documentation ❌ Docstring for transposeLinearMapComplex uses \(...\) instead of backtick-unicode (file convention)
🟡 Paper-gap notes ✅ N/A

Action required

Fix the docstring on TNLean/Channel/Basic.lean:89 to use backtick-unicode notation matching the rest of the file:

/-- Matrix transposition as a complex-linear map on `M_n(ℂ)`. -/

This is a one-line change. No other issues found — the proofs are correct, the blueprint proof is formula-first, and all other categories pass cleanly.

Comment thread TNLean/Channel/Basic.lean Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — APPROVE

Small, well-scoped PR formalizing matrix transposition $\theta(X)=X^\top$ on $M_n(\mathbb C)$ as a positive, trace-preserving linear map (Wolf Ch. 3 §3.1, Notes/WolfNoteTexSource/ch03_positive_not_completely.tex lines 32–37: "The transposition is trace preserving and positive"). The two previously-raised issues from earlier review cycles have been addressed in later commits.

1. 🔴 Proof integrity — clean

No sorry, axiom, admit, native_decide, unsafeCast, or kernel bypasses in the diff. I built the file locally: lake env lean TNLean/Channel/Basic.lean → exit 0, no warnings.

2. 🔴 Proof correctness — clean

  • Matrix.transposeLinearMapComplex_isPositiveMap (TNLean/Channel/Basic.lean:96): intro A hA; simpa [transposeLinearMapComplex] using hA.transpose. hA.transpose : Aᵀ.PosSemidef comes from Matrix.PosSemidef.transpose (Mathlib/LinearAlgebra/Matrix/PosDef.lean:85), whose ring constraint [CommRing R'] [PartialOrder R'] [StarRing R'] is satisfied by ℂ. simp reduces transposeLinearMapComplex n A to Aᵀ via the @[simps apply]-generated Matrix.transposeLinearEquiv_apply (Mathlib/Data/Matrix/Basic.lean:883). Matches.
  • Matrix.transposeLinearMapComplex_isTracePreservingMap (TNLean/Channel/Basic.lean:102): intro A; simp [transposeLinearMapComplex] discharges trace Aᵀ = trace A through the @[simp] lemma Matrix.trace_transpose (Mathlib/LinearAlgebra/Matrix/Trace.lean:73, definitionally rfl). Correct.

The result is faithful to the source: the statement is exactly positivity + trace preservation, with no extra hypotheses smuggled in. The "not CP" half is explicitly out of scope per #3391.

3. 🔴 Type safety — clean

The Mathlib 4.31 Matrix.PosSemidef is defined over n →₀ R (Finsupp), so it carries no [Fintype n]/[DecidableEq n] requirement; consequently transposeLinearMapComplex_isPositiveMap correctly declares no instance hypotheses, while transposeLinearMapComplex_isTracePreservingMap declares exactly [Fintype n] (needed by trace). The two signatures' instance assumptions are each minimal and correct. No universe or coercion problems.

4. 🟡 Mathlib style — clean

Naming follows convention (lowerCamelCase def, snake_case theorems). The variable (n : Type*) / variable {n : Type*} toggle is standard. simp/simpa use explicit lemma lists. Results placed in the Matrix namespace, where they belong.

5. 🟡 Performance — no concern

Both proofs are ≤3 lines with no heavy computation.

6. 🟡 Modularity & duplication — clean

transposeLinearMapComplex is a thin specialization of Matrix.transposeLinearEquiv (R = α = ℂ), justified as a bridge to the ℂ-typed IsPositiveMap/IsTracePreservingMap predicates rather than an ad-hoc map. All supporting lemmas are existing Mathlib results.

7. 🟡 Documentation — addressed

All three new declarations carry docstrings; the module doc and References now cite Wolf Ch. 3. The earlier concern that the transposeLinearMapComplex docstring used \( ... \) delimiters is resolved in commit 02ef1f1, which switches to $ ... $ — the inline-math delimiter documented in docs/MATHLIB_doc.md:158. I've resolved that bot thread. (ℹ️ advisory only: the file's other docstrings use backtick-unicode M_n(ℂ); $...$ is equally Mathlib-valid, so no change is required.)

8. Paper-gap notes — N/A

No files under docs/paper-gaps/ changed.

Blueprint ↔ Lean sync and prose quality are out of scope here (handled by the Blueprint Sync & Prose Review workflow).

Verdict: No outstanding 🔴 or 🟡 issues. Approving.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — APPROVE ✅

Small, well-scoped PR formalizing matrix transposition $\theta(X)=X^\top$ on $M_n(\mathbb{C})$ as a positive, trace-preserving linear map. I type-checked the changed file locally (lake env lean TNLean/Channel/Basic.lean → exit 0, no warnings) and verified faithfulness against the cited source.

1. 🔴 Proof integrity — clean

No sorry, axiom, admit, native_decide, unsafeCast, or kernel bypasses in the diff.

2. 🔴 Proof correctness — clean

  • Matrix.transposeLinearMapComplex_isPositiveMap (TNLean/Channel/Basic.lean:96): intro A hA; simpa [transposeLinearMapComplex] using hA.transpose. hA.transpose : Aᵀ.PosSemidef comes from Matrix.PosSemidef.transpose; simp reduces transposeLinearMapComplex n A to Aᵀ via the @[simps apply]-generated Matrix.transposeLinearEquiv_apply. Correct and minimal.
  • Matrix.transposeLinearMapComplex_isTracePreservingMap (TNLean/Channel/Basic.lean:102): intro A; simp [transposeLinearMapComplex] discharges trace Aᵀ = trace A through Matrix.trace_transpose. Correct.

Faithfulness: The source (Notes/WolfNoteTexSource/ch03_positive_not_completely.tex:35) states verbatim "The transposition is trace preserving and positive". The Lean statements assert exactly positivity and trace preservation with no extra hypotheses; the "not completely positive" half is explicitly out of scope per #3391. Matches the source hypothesis set.

3. 🟡 Mathlib style — clean

lowerCamelCase def, snake_case theorems, explicit simp/simpa lemma lists, variable (n) / variable {n} toggle, placed in the Matrix namespace where it belongs.

4. 🔴 Type safety — clean

Matrix.PosSemidef carries no [Fintype n]/[DecidableEq n], so the positivity theorem correctly declares no instance hypotheses; transposeLinearMapComplex_isTracePreservingMap declares exactly [Fintype n] as required by trace. Each signature's instance assumptions are minimal and correct. No universe or coercion issues.

5. 🟡 Performance — no concern

Both proofs are ≤3 lines; no heavy computation.

6. 🟡 Modularity & duplication — clean

transposeLinearMapComplex is a thin specialization of Matrix.transposeLinearEquiv (R = α = ℂ), justified as a bridge to the ℂ-typed IsPositiveMap/IsTracePreservingMap predicates. Supporting lemmas are existing Mathlib results.

7. 🟡 Documentation — addressed

All three new declarations carry docstrings; the module doc and References now cite Wolf Ch. 3. The earlier concern that the transposeLinearMapComplex docstring used \( ... \) delimiters is resolved — it now uses backtick-unicode (`Matrix n n ℂ`), matching the file convention. I resolved that outdated bot thread.

8. Paper-gap notes — N/A

No files under docs/paper-gaps/ changed.

Blueprint ↔ Lean sync and prose quality are out of scope here (handled by the dedicated Blueprint Sync & Prose Review workflow).

Verdict: No outstanding 🔴 or 🟡 issues. Approving.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — APPROVE ✅

Small, well-scoped PR formalizing matrix transposition $\theta(X)=X^\top$ on $M_n(\mathbb{C})$ as a positive, trace-preserving linear map (Wolf Ch. 3 §3.1, Notes/WolfNoteTexSource/ch03_positive_not_completely.tex lines 35–37: "The transposition is trace preserving and positive"). All previously-raised issues from earlier review cycles are resolved.

1. 🔴 Proof integrity — clean

No sorry, axiom, admit, native_decide, unsafeCast, or kernel bypasses in the diff.

2. 🔴 Proof correctness — clean

  • Matrix.transposeLinearMapComplex_isPositiveMap (TNLean/Channel/Basic.lean:96): intro A hA; simpa [transposeLinearMapComplex] using hA.transpose. hA.transpose : Aᵀ.PosSemidef comes from Matrix.PosSemidef.transpose (Mathlib/LinearAlgebra/Matrix/PosDef.lean:85), whose proof uses commutativity of multiplication and Finsupp summation to show the quadratic form condition holds for $A^T$ when it holds for $A$. Correct.
  • Matrix.transposeLinearMapComplex_isTracePreservingMap (TNLean/Channel/Basic.lean:102): intro A; simp [transposeLinearMapComplex] discharges trace Aᵀ = trace A through Matrix.trace_transpose (definitionally rfl). Correct.

The result is faithful to the source: the statement is exactly positivity + trace preservation, with no extra hypotheses smuggled in. The "not CP" third property is explicitly out of scope per issue #3391.

3. 🔴 Type safety — clean

  • Matrix.PosSemidef is defined over n →₀ R (Finsupp) and does not intrinsically require [Fintype n]. The [Fintype n] [DecidableEq n] constraints come from IsPositiveMap's section variables and are added as implicit instance arguments by Lean elaboration. Both theorems carry the correct instance assumptions.
  • The positivity theorem needs no explicit Fintype (added implicitly); the trace theorem correctly declares [Fintype n] (needed by trace). No coercion or universe issues.

4. 🟡 Mathlib style — clean

  • Naming follows convention: camelCase def, snake_case theorems.
  • variable (n : Type*) / variable {n : Type*} toggle is standard Mathlib idiom.
  • Results placed in Matrix namespace — correct location.
  • simp/simpa use explicit lemma lists.

5. 🟡 Performance — no concern. Both proofs are ≤3 lines with no heavy computation.

6. 🟡 Modularity & duplication — clean. transposeLinearMapComplex reuses Matrix.transposeLinearEquiv from Mathlib directly, with no ad-hoc reimplementations.

7. 🟡 Documentation — addressed

All three new declarations carry docstrings. Module doc and References now cite Wolf Ch. 3. The previously-flagged \(...\) docstring notation has been replaced with backtick-unicode `Matrix n n ℂ` matching the rest of the file.

8. 🟡 Paper-gap notes — N/A (no files changed under docs/paper-gaps/).

Previous review follow-up

  • Resolved (Thread 1): Blueprint proof updated to formula-first reasoning ($X = C^\dagger C \implies X^T = C^T\overline{C} = \overline{C}^\dagger\overline{C} \ge 0$).
  • Resolved (Thread 3): Docstring now uses backtick-unicode (resolved in this review cycle).

Verdict

No outstanding 🔴 or 🟡 issues. Approving.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blueprint ↔ Lean & Prose Review — 0 issues (A), 0 issues (B)

Category A — Blueprint ↔ Lean equivalence

A.1 — Mathematical equivalence. The blueprint theorem (ch04_channels.tex) asserts "$\theta(X) = X^T$ on $M_D(\mathbb{C})$ is positive and trace-preserving." The \lean{} tag lists two Lean declarations whose conjunction covers exactly this claim:

  • Matrix.transposeLinearMapComplex_isPositiveMap: IsPositiveMap (transposeLinearMapComplex n) — no finiteness hypothesis required (positivity is pointwise). ✓
  • Matrix.transposeLinearMapComplex_isTracePreservingMap [Fintype n]: IsTracePreservingMap (transposeLinearMapComplex n)Fintype n is implicit in the blueprint's "$M_D(\mathbb{C})$" context. ✓

The Lean statements are weakly more general (arbitrary n : Type*), which is not a sync bug: the blueprint claims the finite-dimensional special case that the Lean results cover.

A.2 — \leanok accuracy. Both Lean proofs are sorry-free (simpa ... using hA.transpose and simp [transposeLinearMapComplex]). The statement \leanok and proof \leanok are both valid.

A.4 — \uses accuracy. \uses{def:positive_map, def:trace_preserving} — both labels exist in the chapter (lines 8 and 31 of ch04_channels.tex). Correct.

Category B — Prose quality

The proof sketch is now formula-driven:

$$X = C^\dagger C \implies X^T = C^T\overline{C} = \overline{C}^\dagger\overline{C} \geq 0, \qquad \operatorname{tr}(X^T) = \operatorname{tr}(X).$$

The identity chain is mathematically correct: $(C^\dagger)^T = \overline{C}$ and $(\overline{C})^\dagger = C^T$, so $C^T\overline{C} = \overline{C}^\dagger\overline{C} \geq 0$ as a Gram form. The formula-first rule is satisfied.

No banned software-engineering terms, no Lean jargon, no LLM writing patterns found.

Housekeeping

Resolved one outdated claude-authored thread (PRRT_kwDORK8b986LZu2U) whose notation complaint (docstring used \(M_n(\mathbb{C})\)) has been fixed — the current code correctly uses `M_n(ℂ)`.

Summary: 0 equivalence mismatches, 0 stale \leanok, 0 prose issues.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — feat(Channel): formalize positive trace-preserving transposition

Verdict: APPROVE. No 🔴 or 🟡 issues found. The changes are a small, faithful formalization of Wolf Ch. 3 §3.1 (transposition as the standard positive, trace-preserving, not-completely-positive map).

Proof integrity 🔴

Clean. No sorry, axiom, native_decide, or kernel bypasses. lake env lean TNLean/Channel/Basic.lean compiles (exit 0).

Proof correctness 🔴

  • Matrix.transposeLinearMapComplex_isPositiveMap: simpa [transposeLinearMapComplex] using hA.transpose. The @[simps apply] on transposeLinearEquiv reduces transposeLinearMapComplex n A to Aᵀ, and Matrix.PosSemidef.transpose (valid over a CommRing+PartialOrder+StarRing, which ℂ satisfies) closes the goal. Correct.
  • Matrix.transposeLinearMapComplex_isTracePreservingMap: simp [transposeLinearMapComplex] reduces to trace Aᵀ = trace A, discharged by the simp lemma Matrix.trace_transpose. Correct.

Both proofs are short and delegate to existing Mathlib facts rather than reproving — no brute-forced tactic chains.

Type safety 🔴

Matrix.PosSemidef is defined via finitely-supported vectors (n →₀ R), so IsPositiveMap carries no Fintype/DecidableEq requirement. The positivity theorem is therefore correctly stated for arbitrary n : Type* with no instance binders, while the trace theorem correctly adds [Fintype n] (trace is a finite sum). No reliance on autoImplicit-inserted instances, no coercion or universe issues.

Style / Modularity / Documentation 🟡

  • Naming follows conventions: transposeLinearMapComplex (camelCase def), ..._isPositiveMap / ..._isTracePreservingMap (snake_case theorems).
  • Reuses Mathlib's Matrix.transposeLinearEquiv instead of introducing an ad-hoc linear map — no duplication.
  • Both new declarations and the def have docstrings stating their mathematical meaning; module docstring and ## Main results updated to cite Wolf Ch. 3.

Paper-gaps

No files under docs/paper-gaps/ are touched, so no paper-gap review applies.

The blueprint theorem thm:transpose_positive_trace_preserving and its proof sketch (X = C†C ⟹ Xᵀ = Cᵀ C̄ = C̄† C̄ ≥ 0; tr(Xᵀ) = tr(X)) are mathematically correct, but blueprint↔Lean sync and prose are out of scope for this review thread.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Verdict: APPROVE — no blocking issues found.

What this PR does

Adds Matrix.transposeLinearMapComplex (matrix transposition as a ℂ-linear map on M_n(ℂ)) and proves it is positive (transposeLinearMapComplex_isPositiveMap) and trace-preserving (transposeLinearMapComplex_isTracePreservingMap), formalizing Wolf Ch. 3, §3.1 (lines ~32–37). Adds the corresponding blueprint theorem thm:transpose_positive_trace_preserving with equation-based proof sketch.

Category-by-category findings

Category Severity Status
Proof integrity 🔴 Clean — no sorry, axiom, or suspicious patterns
Proof correctness 🔴 Both proofs are correct and grounded in Mathlib (PosSemidef.transpose, trace_transpose)
Mathlib style 🟡 Names follow conventions; tactic usage minimal and idiomatic
Type safety 🔴 Compiles clean; [Fintype n] correctly required only where trace needs it
Performance 🟡 Trivial simpa/simp proofs — no timeout risk
Modularity 🟡 Uses Matrix.transposeLinearEquiv from Mathlib rather than ad hoc definition
Documentation 🟡 All declarations have docstrings matching file conventions; module doc updated
Paper-gap notes - N/A (no paper-gap files changed)

Previous review threads

All three prior bot threads are resolved and outdated. Both flagged issues have been addressed:

  • Blueprint proof updated from verbal to equation-based form.
  • Docstring notation fixed from \(...\) to backtick-quoted unicode.

No 🔴 or 🟡 issues remain. The PR is faithful to the cited source (Wolf Ch. 3, lines 32–37: "The transposition is trace preserving and positive") and ready to merge.

@LionSR LionSR merged commit 12df7a9 into main Jun 22, 2026
17 checks passed
@LionSR LionSR deleted the codex/wolf-ch3-transpose-positive-3391 branch June 22, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

formalization Lean 4 formalization task wolf-ch3 Wolf Lecture Notes - Chapter 3: Positive but not completely positive maps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transposition is a positive, trace-preserving map

2 participants