Skip to content

[Merged by Bors] - refactor (NumberTheory/ModularForms, Analysis/Complex/UpperHalfPlane) Refactor and clean up coercions#18385

Closed
CBirkbeck wants to merge 33 commits intomasterfrom
CB_modforms_mm
Closed

[Merged by Bors] - refactor (NumberTheory/ModularForms, Analysis/Complex/UpperHalfPlane) Refactor and clean up coercions#18385
CBirkbeck wants to merge 33 commits intomasterfrom
CB_modforms_mm

Conversation

@CBirkbeck
Copy link
Copy Markdown
Collaborator

@CBirkbeck CBirkbeck commented Oct 29, 2024

The code for SL(2, Z) and modular forms had lots of custom local notations, repeated in each file, for certain chains of coercions. We get rid of many of these, and harmonise the remaining ones using scoped (rather than file-local) notations. Separately, we get rid of a lot of annoying duplicate API lemmas by avoiding using subgroups as subtypes unless absolutely necessary.

Co-authored-by: David Loeffler d.loeffler.01@cantab.net


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 29, 2024

PR summary 0b967b2ef4

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ instCoeFun
+ slash_action_eqn''
++- coe_one
- Gamma0_det
- SlashInvariantFormClass.coe_coe
- mul_slash_subgroup
- subgroupAction
- subgroupGLPos
- subgroupSL
- subgroup_moeb
- subgroup_on_SL_apply
- subgroup_on_glpos
- subgroup_on_glpos_smul_apply
- subgroup_slash
- subgroup_to_SL_tower
- subgroup_to_sl_moeb

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.

@loefflerd
Copy link
Copy Markdown
Contributor

loefflerd commented Oct 30, 2024

I think we're moving in the right direction here. It's still annoying that we need these up-arrow notations at all, but at least this imposes a bit more order upon them.

I have two three one further refactoring suggestions:

  • migrate the last 150 lines of LinearAlgebra/Matrix/SpecialLinearGroup.lean (the part which is specific to SL2Z) into Modular.lean, which avoids having two different definitions of the same notation in the same file
  • rename Modular.lean to ModularGroup.lean

EDIT: Actually, forget that. The existing Modular file doesn't do what I thought it did, so I'm less convinced this is a good idea; and all this shuffling around is delaying your efforts to add new stuff. I still think we should:

  • for each scoped notation, say in the docstring for it what namespace it is scoped in (since the mouseover text in VSCode doesn't provide this information automatically)

@loefflerd
Copy link
Copy Markdown
Contributor

!bench

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit d0fd9f0.
The entire run failed.
Found no significant differences.

@loefflerd loefflerd changed the title Small refactor of Slash invariant forms and Modular forms refactor (NumberTheory/ModularForms, Analysis/Complex/UpperHalfPlane) Refactor and clean up coercions Oct 30, 2024
@loefflerd
Copy link
Copy Markdown
Contributor

!bench

@loefflerd loefflerd added the t-number-theory Number theory (also use t-algebra or t-analysis to specialize) label Oct 30, 2024
@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 0b967b2.
There were significant changes against commit c6c4ad2:

  Benchmark                                         Metric                    Change
  ==================================================================================
+ build                                             .olean serialization       -5.9%
+ build                                             process pre-definitions    -5.1%
+ ~Mathlib.Analysis.Complex.UpperHalfPlane.Basic    instructions              -16.9%
+ ~Mathlib.NumberTheory.ModularForms.SlashActions   instructions              -71.6%

@github-actions
Copy link
Copy Markdown

File Instructions %
build -639.472⬝10⁹ (-0.47%)
lint -99.924⬝10⁹ (-1.48%)
3 files, Instructions -2.0⬝10⁹
File Instructions %
Mathlib.NumberTheory.ModularForms.CongruenceSubgroups -1.123⬝10⁹ (-5.98%)
Mathlib.NumberTheory.ModularForms.Basic -1.339⬝10⁹ (-5.12%)
Mathlib.NumberTheory.ModularForms.SlashInvariantForms -1.812⬝10⁹ (-14.86%)
File Instructions %
Mathlib.NumberTheory.Modular -3.264⬝10⁹ (-3.87%)
Mathlib.Analysis.Complex.UpperHalfPlane.Basic -14.453⬝10⁹ (-16.85%)
Mathlib.NumberTheory.ModularForms.SlashActions -58.132⬝10⁹ (-71.60%)

Copy link
Copy Markdown
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

LGTM

bors d=loefflerd

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Oct 31, 2024

✌️ loefflerd can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Oct 31, 2024
@loefflerd
Copy link
Copy Markdown
Contributor

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Oct 31, 2024
… Refactor and clean up coercions (#18385)

The code for SL(2, Z) and modular forms had lots of custom local notations, repeated in each file, for certain chains of coercions. We get rid of many of these, and harmonise the remaining ones using scoped (rather than file-local) notations. Separately, we get rid of a lot of annoying duplicate API lemmas by avoiding using subgroups as subtypes unless absolutely necessary.

Co-authored-by: David Loeffler <d.loeffler.01@cantab.net>



Co-authored-by: Chris Birkbeck <c.birkbeck@uea.ac.uk>
Co-authored-by: Chris Birkbeck <c.birkbeck@ucl.ac.uk>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Oct 31, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor (NumberTheory/ModularForms, Analysis/Complex/UpperHalfPlane) Refactor and clean up coercions [Merged by Bors] - refactor (NumberTheory/ModularForms, Analysis/Complex/UpperHalfPlane) Refactor and clean up coercions Oct 31, 2024
@mathlib-bors mathlib-bors bot closed this Oct 31, 2024
@mathlib-bors mathlib-bors bot deleted the CB_modforms_mm branch October 31, 2024 13:54
grunweg pushed a commit that referenced this pull request Nov 2, 2024
… Refactor and clean up coercions (#18385)

The code for SL(2, Z) and modular forms had lots of custom local notations, repeated in each file, for certain chains of coercions. We get rid of many of these, and harmonise the remaining ones using scoped (rather than file-local) notations. Separately, we get rid of a lot of annoying duplicate API lemmas by avoiding using subgroups as subtypes unless absolutely necessary.

Co-authored-by: David Loeffler <d.loeffler.01@cantab.net>



Co-authored-by: Chris Birkbeck <c.birkbeck@uea.ac.uk>
Co-authored-by: Chris Birkbeck <c.birkbeck@ucl.ac.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-number-theory Number theory (also use t-algebra or t-analysis to specialize)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants