Skip to content

refactor(Analysis): golf Mathlib/Analysis/Normed/Unbundled/SpectralNorm#38646

Open
yuanyi-350 wants to merge 1 commit intoleanprover-community:masterfrom
yuanyi-350:A_12
Open

refactor(Analysis): golf Mathlib/Analysis/Normed/Unbundled/SpectralNorm#38646
yuanyi-350 wants to merge 1 commit intoleanprover-community:masterfrom
yuanyi-350:A_12

Conversation

@yuanyi-350
Copy link
Copy Markdown
Collaborator

  • rewrites spectralValue_eq_zero_iff via eq_X_pow_iff_natDegree_le_natTrailingDegree and spectralValueTerms_of_lt_natDegree
  • rewrites spectralNorm.eq_of_normalClosure' as two applications of spectralNorm.eq_of_tower
  • tidies spectralNorm_unique by switching the local transported structures to set/letI/haveI with inferInstanceAs

Extracted from #37968

Open in Gitpod

@yuanyi-350 yuanyi-350 added codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly labels Apr 28, 2026
@github-actions github-actions Bot added the t-analysis Analysis (normed *, calculus) label Apr 28, 2026
@github-actions
Copy link
Copy Markdown

PR summary 900c9b0390

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.


Increase in tech debt: (relative, absolute) = (1.00, 0.07)
Current number Change Type
14 1 backward.inferInstanceAs.wrap.data

Current commit 7f61de83bf
Reference commit 900c9b0390

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

I ran a profiler comparison for the changed declarations in this PR.

Results (seconds):

  • spectralValue_eq_zero_iff: 0.102787 -> 0.023925 (-76.72%)
  • spectralNorm.eq_of_normalClosure': 1.672272 -> 0.474995 (-71.59%)
  • spectralNorm_unique: 2.640024 -> 4.344001 (+64.54%)

Overall:

  • spectralValue_eq_zero_iff and spectralNorm.eq_of_normalClosure' are substantially faster.
  • spectralNorm_unique regresses noticeably and dominates the net slowdown.

@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-radar
Copy link
Copy Markdown

leanprover-radar commented Apr 28, 2026

Benchmark results for 7f61de8 against 900c9b0 are in. No significant results found. @yuanyi-350

  • 🟥 build//instructions: +18.9G (+0.01%)

Small changes (1🟥)

  • 🟥 build/module/Mathlib.Lean.MessageData.ForExprs//instructions: +248.7M (+6.13%)

/-- If `K` is a field complete with respect to a nontrivial nonarchimedean multiplicative norm and
`L/K` is an algebraic extension, then any power-multiplicative `K`-algebra norm on `L` coincides
with the spectral norm. -/
theorem spectralNorm_unique [CompleteSpace K] {f : AlgebraNorm K L} (hf_pm : IsPowMul f) :
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you should revert all changes for this theorem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants