refactor(PEPS): use native equivalences for double-complement configs#3137
refactor(PEPS): use native equivalences for double-complement configs#3137LionSR wants to merge 1 commit into
Conversation
|
PR cleanup
Issue search: Checked branch name, PR body, PR title, commit messages, and open issues mentioning Conventions: CONTRIBUTING.md |
There was a problem hiding this comment.
Blueprint ↔ Lean equivalence and prose review
Category A — Blueprint ↔ Lean equivalence and status
regionDoubleComplBoundaryConfigEquiv (Recovery10.lean) is referenced in blueprint/src/chapter/ch24_peps_ft_region_transfer_maps.tex:219 inside the \lean{...} list for thm:peps_region_transfer_coeff_double_factorization, which carries \leanok. The PR changes only the proof body (explicit where/funext/simp block → Equiv.piCongrLeft' _ (...).symm); the declaration name and type signature are unchanged and the new term contains no sorry. Blueprint sync remains valid.
regionDoubleComplPhysicalConfigEquiv (BlockCoeffTransfer.lean) has no direct blueprint entry — ch24_peps_ft_region_transfer_insertions.tex:484 references only regionDoubleComplPhysicalConfig (the underlying function, not the equivalence). This gap is pre-existing and not introduced by this PR.
No \leanok becomes invalid, no \notready becomes stale, and no \lean{...} tag requires renaming.
Category B — Prose quality
No prose is changed. The only new lines are Lean proof terms (Equiv.arrowCongr and Equiv.piCongrLeft'); no docstrings, module comments, or .tex files are touched.
Summary: 0 equivalence mismatches, 0 stale \leanok, 0 prose issues.
There was a problem hiding this comment.
Review: refactor(PEPS): use native equivalences for double-complement configs
Verdict: APPROVE — no 🔴 or 🟡 issues found.
This is a clean, minimal proof-only refactor that replaces two hand-written Equiv records with Mathlib combinators, exactly the kind of library reuse the contributing guidelines encourage. I verified correctness both by definitional analysis and by a full local build.
Proof integrity 🔴 — clean
No sorry/axiom/admit/native_decide/unsafeCast introduced (rg over both files returns nothing new). Declaration names and type signatures of regionDoubleComplPhysicalConfigEquiv (BlockCoeffTransfer.lean) and regionDoubleComplBoundaryConfigEquiv (Recovery10.lean) are unchanged.
Proof correctness 🔴 — verified
The load-bearing question for this refactor is whether each new combinator's toFun is definitionally equal to the previous explicit toFun, since downstream proofs (regionBlockedTensorInjective_doubleCompl's change, and regionBlockedTensorMap_doubleCompl's Equiv.sum_comp) depend on it.
regionDoubleComplPhysicalConfigEquiv: oldtoFun = regionDoubleComplPhysicalConfig R = fun w => σ (regionDoubleComplVertexEquiv R w). NewEquiv.arrowCongr (regionDoubleComplVertexEquiv R).symm (Equiv.refl (Fin d))reduces itstoFun σtofun x => σ ((regionDoubleComplVertexEquiv R).symm.symm x), i.e.fun x => σ (regionDoubleComplVertexEquiv R x)— definitionally identical.regionDoubleComplBoundaryConfigEquiv: the boundary config codomainFin (A.bondDim f.1)is dependent, which is why the old proof neededcongr 1.Equiv.piCongrLeft' _ (regionBoundaryEdgeDoubleComplEquiv R).symmtype-checks here precisely becauseregionBoundaryEdgeDoubleComplEquiv_apply_coe(Recovery6) makes the underlying-edge coercionrfl, so the target∀ b, Fin (bondDim (e.symm b).1)is defeq to∀ b, Fin (bondDim b.1), andtoFun = fun b => bdry (regionBoundaryEdgeDoubleComplEquiv R b) = regionDoubleComplBoundaryConfig A R bdry.
Confirmed empirically: lake build TNLean.PEPS.RegionBlock.BlockCoeffTransfer TNLean.PEPS.RegionBlock.Recovery10 and all downstream modules build at exit 0. The only warnings emitted are the pre-existing Copyright too short! header-linter warnings on the RegionBlock/* files, which are untouched by this diff.
Style / type safety / performance / modularity / documentation 🟡 — clean
Replacing bespoke Equiv records with Equiv.arrowCongr / Equiv.piCongrLeft' improves modularity and removes duplicated left_inv/right_inv boilerplate. No new instances, coercion chains, or universe concerns. Docstrings on both definitions are unchanged and remain accurate. No paper-gap notes touched.
Looks good to merge once moved out of draft.
There was a problem hiding this comment.
Review: refactor(PEPS): use native equivalences for double-complement configs
Verdict: APPROVE — no 🔴 or 🟡 issues found. Concurring with the earlier claude[bot] reviews.
Proof integrity 🔴 — clean
No sorry/axiom/admit/native_decide/unsafeCast introduced. The only warnings from the build are pre-existing Copyright too short! header-linter warnings on the RegionBlock/* files, untouched by this diff.
Proof correctness 🔴 — verified
Both new combinator definitions are definitionally equivalent to the old hand-written Equiv records:
-
regionDoubleComplPhysicalConfigEquiv(BlockCoeffTransfer.lean:148):Equiv.arrowCongr (regionDoubleComplVertexEquiv R).symm (Equiv.refl (Fin d))reducestoFun ftof ∘ (regionDoubleComplVertexEquiv R), which is definitionallyregionDoubleComplPhysicalConfig R. The oldtoFunmatches exactly. -
regionDoubleComplBoundaryConfigEquiv(Recovery10.lean:135):Equiv.piCongrLeft' _ (regionBoundaryEdgeDoubleComplEquiv R).symmhandles the dependent codomainFin (A.bondDim f.1)correctly. The key property is thatregionBoundaryEdgeDoubleComplEquiv_apply_coe(Recovery6.lean:92-94) makes the underlying edge coercion definitional, soP (e.symm b) = Fin (A.bondDim b.val)byrfl— no transport needed.
Downstream proofs (regionBlockedTensorInjective_doubleCompl, regionBlockedTensorMap_doubleCompl) depend only on the equivalence type and toFun being definitionally regionDoubleComplPhysicalConfig/regionDoubleComplBoundaryConfig, which is preserved.
Confirmed: lake build TNLean.PEPS.RegionBlock.BlockCoeffTransfer TNLean.PEPS.RegionBlock.Recovery10 exits 0.
Style / type safety / performance / modularity / documentation 🟡 — all clean
- Style: Replacing bespoke
Equivrecords withEquiv.arrowCongr/Equiv.piCongrLeft'improves library reuse and removes duplicatedleft_inv/right_invboilerplate. Declaration names and type signatures are unchanged. - Type safety: No new instances, coercion chains, or universe concerns. Type inference for the
_argument topiCongrLeft'resolves correctly from the target type annotation. - Performance: Trivial — these are combinator applications with no recursive or heavy computation.
- Modularity: The underlying transport functions (
regionDoubleComplPhysicalConfigin Recovery6,regionDoubleComplBoundaryConfigin Recovery6) remain defined and are still used in 10+ downstream call sites — no dead code created. - Documentation: Existing docstrings on both definitions are preserved unchanged and remain accurate.
Paper-gap notes 🟡 — N/A
No files under docs/paper-gaps/ are changed.
Looks good to merge.
Motivation
Equivrecords for the double-complement boundary and physical configuration transports duplicate structure already present in Mathlib, creating unnecessary proof obligations.Equiv.piCongrLeft'andEquiv.arrowCongrreduces custom reasoning and makes the constructions more legible.Description
TNLean/PEPS/RegionBlock/Recovery10.lean:regionDoubleComplBoundaryConfigEquivis now constructed viaEquiv.piCongrLeft'applied toregionBoundaryEdgeDoubleComplEquiv(replacing a hand-builtEquivrecord).TNLean/PEPS/RegionBlock/BlockCoeffTransfer.lean:regionDoubleComplPhysicalConfigEquivis now constructed viaEquiv.arrowCongrapplied toregionDoubleComplVertexEquiv(replacing a hand-builtEquivrecord).Testing
lake env lean TNLean/PEPS/RegionBlock/Recovery10.leanlake env lean TNLean/PEPS/RegionBlock/BlockCoeffTransfer.leanlake build TNLean.PEPS.RegionBlock.Recovery10 TNLean.PEPS.RegionBlock.BlockCoeffTransfer -q --log-level=inforg -n "sorry|axiom|admit|native_decide|unsafeCast" TNLean/PEPS/RegionBlock/Recovery10.lean TNLean/PEPS/RegionBlock/BlockCoeffTransfer.lean || true— no new proof obligations introduced.lake build TNLean) reports only pre-existing warnings outside the changed files, including the known sorry inTNLean/MPS/Periodic/Overlap/Case3.lean.Note
Low Risk
Proof-only refactor with no API or theorem signature changes; behavior is intended to stay definitionally aligned with the previous manual equivalences.
Overview
Replaces hand-built
Equivrecords for double-complement physical and boundary configuration transport with Mathlib combinators:Equiv.arrowCongronregionDoubleComplVertexEquivandEquiv.piCongrLeft'onregionBoundaryEdgeDoubleComplEquiv.The change is localized to
regionDoubleComplPhysicalConfigEquivinBlockCoeffTransfer.leanandregionDoubleComplBoundaryConfigEquivinRecovery10.lean; downstream proofs still call the same transport functions and equivalence names, so blocked-tensor and injectivity statements are unchanged.Reviewed by Cursor Bugbot for commit 800b01b. Bugbot is set up for automated code reviews on this repo. Configure here.