Skip to content

[Merged by Bors] - feat(RCLike): add Continuous.re and similar - #34419

Closed
ster-oc wants to merge 14 commits into
leanprover-community:masterfrom
ster-oc:prop-dot-re-im
Closed

ster-oc wants to merge 14 commits into
leanprover-community:masterfrom
ster-oc:prop-dot-re-im

Conversation

@ster-oc

@ster-oc ster-oc commented Jan 25, 2026

Copy link
Copy Markdown
Contributor

This PR adds dot notation for re, im, conj and ofReal for Continuous, LipschitzWith and Memℓp.
Given hf : Continuous f it allows to use hf.re to express Continuous (fun x ↦ (f x).re), similarly to the usual hf.add hg.

I also can add the same features for Summable but I am not sure where to place them, suggestions are appreciated!


Open in Gitpod

@github-actions github-actions Bot added new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-analysis Analysis (normed *, calculus) labels Jan 25, 2026
@github-actions

github-actions Bot commented Jan 25, 2026 •

Copy link
Copy Markdown

PR summary 2d34e0f1f3

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ LipschitzOnWith.nnNorm'
+ LipschitzOnWith.norm'
+ LipschitzWith.nnNorm'
+ LipschitzWith.norm'
+ Memℓp.bddAbove
+ Memℓp.finite_dsupport
+ Memℓp.of_summable
+ Memℓp.summable
+ _root_.Continuous.conj
+ _root_.Continuous.im
+ _root_.Continuous.normSq
+ _root_.Continuous.ofReal
+ _root_.Continuous.re
+ _root_.ContinuousAt.conj
+ _root_.ContinuousAt.im
+ _root_.ContinuousAt.normSq
+ _root_.ContinuousAt.ofReal
+ _root_.ContinuousAt.re
+ _root_.ContinuousOn.conj
+ _root_.ContinuousOn.im
+ _root_.ContinuousOn.normSq
+ _root_.ContinuousOn.ofReal
+ _root_.ContinuousOn.re
+ _root_.ContinuousWithinAt.conj
+ _root_.ContinuousWithinAt.im
+ _root_.ContinuousWithinAt.normSq
+ _root_.ContinuousWithinAt.ofReal
+ _root_.ContinuousWithinAt.re
+ _root_.Filter.Tendsto.conj
+ _root_.Filter.Tendsto.im
+ _root_.Filter.Tendsto.normSq
+ _root_.Filter.Tendsto.ofReal'
+ _root_.Filter.Tendsto.re
+ _root_.LipschitzOnWith.conj
+ _root_.LipschitzOnWith.im
+ _root_.LipschitzOnWith.ofReal
+ _root_.LipschitzOnWith.re
+ _root_.LipschitzWith.conj
+ _root_.LipschitzWith.im
+ _root_.LipschitzWith.ofReal
+ _root_.LipschitzWith.re
+ conj_iff
+ im
+ lipschitzWith_one_conj
+ lipschitzWith_one_im
+ lipschitzWith_one_ofReal
+ lipschitzWith_one_re
+ ofReal
+ ofReal_iff
+ of_conj
+ of_neg
+ re
- bddAbove
- finite_dsupport
- lipschitzWith_im
- lipschitzWith_ofReal
- lipschitzWith_re
- summable

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.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 2d34e0f).

  • +58 new declarations
  • −3 removed declarations
+Continuous.conj
+Continuous.fun_normSq
+Continuous.im
+Continuous.normSq
+Continuous.ofReal
+Continuous.re
+ContinuousAt.conj
+ContinuousAt.fun_normSq
+ContinuousAt.im
+ContinuousAt.normSq
+ContinuousAt.ofReal
+ContinuousAt.re
+ContinuousOn.conj
+ContinuousOn.fun_normSq
+ContinuousOn.im
+ContinuousOn.normSq
+ContinuousOn.ofReal
+ContinuousOn.re
+ContinuousWithinAt.conj
+ContinuousWithinAt.fun_normSq
+ContinuousWithinAt.im
+ContinuousWithinAt.normSq
+ContinuousWithinAt.ofReal
+ContinuousWithinAt.re
+Filter.Tendsto.conj
+Filter.Tendsto.im
+Filter.Tendsto.normSq
+Filter.Tendsto.ofReal'
+Filter.Tendsto.re
+LipschitzOnWith.conj
+LipschitzOnWith.im
+LipschitzOnWith.nnNorm
+LipschitzOnWith.nnNorm'
+LipschitzOnWith.norm
+LipschitzOnWith.norm'
+LipschitzOnWith.ofReal
+LipschitzOnWith.re
+LipschitzWith.conj
+LipschitzWith.im
+LipschitzWith.nnNorm
+LipschitzWith.nnNorm'
+LipschitzWith.norm
+LipschitzWith.norm'
+LipschitzWith.ofReal
+LipschitzWith.re
+Memℓp.conj
+Memℓp.conj_iff
+Memℓp.im
+Memℓp.ofReal
+Memℓp.ofReal_iff
+Memℓp.of_conj
+Memℓp.of_neg
+Memℓp.of_summable
+Memℓp.re
-RCLike.lipschitzWith_im
-RCLike.lipschitzWith_ofReal
+RCLike.lipschitzWith_one_conj
+RCLike.lipschitzWith_one_im
+RCLike.lipschitzWith_one_ofReal
+RCLike.lipschitzWith_one_re
-RCLike.lipschitzWith_re

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.33)
Current number Change Type (weak)
3 1 large files

Current commit 2d34e0f1f3
Reference commit 5d0d3c0c77

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.py 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).

@ster-oc ster-oc changed the title feat(RCLike): add Continuous.re and similar to expand dot notation feat(RCLike): add Continuous.re and similar to expand dot notation Jan 25, 2026
@ster-oc ster-oc changed the title feat(RCLike): add Continuous.re and similar to expand dot notation feat(RCLike): add Continuous.re and similar Jan 26, 2026
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/Normed/Lp/lpSpace.lean Resolved
@j-loreaux j-loreaux added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Jan 27, 2026
@ster-oc

ster-oc commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @j-loreaux!

I thought about the issue with the naming, but I saw that docs#MeasureTheory.Integrable.re already exists.
I drew the conclusion that it was ok to have only the RCLike version and use that to close goals for both Complex.re and RCLike.re (it does work if the right modules are imported, I would say Mathlib.Analysis.Complex.Basic).

I am not sure how to name it to include RCLike and still being able to use dot notation. RCLike.Continuous.re allows hf.re after open RCLike but it did not look like the way to go to me. Let me know what you think!

@j-loreaux

Copy link
Copy Markdown
Contributor

Thanks for pushing back a bit on this. On second thought, let's just leave it so there are only RCLike versions. I think it will be too much duplication otherwise (until we get a fancy attribute that will autogenerate the complex versions for us).

@ster-oc

ster-oc commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

Sorry for the delay,
I have moved LipschitzWith.norm and used Memℓp.mono to golf a bit (probably one could golf more).
I also added Memℓp.norm and the one related lemma from your repo because it seems relevant with the PR.

There is also Summable.re to add, but since Multipliable.re does not hold, I am not sure where to put it in Mathlib.

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Feb 18, 2026
Comment thread Mathlib/Analysis/Normed/Lp/lpSpace.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
@j-loreaux j-loreaux added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Feb 24, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Mar 30, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@j-loreaux

Copy link
Copy Markdown
Contributor

@ster-oc do you have any interest in taking this up again?

@ster-oc

ster-oc commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@j-loreaux Yes, absolutely!
Sorry I haven't followed up on it in so long. I will pick it back up tomorrow so we can close it.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 11, 2026
@ster-oc

ster-oc commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

@j-loreaux I had to disable the 1500 lines linter in RCLike/Basic.lean and set it to 1700 for CI. I would say this is provisional and the file should be refactored

@ster-oc

ster-oc commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 11, 2026

@j-loreaux j-loreaux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm pretty happy with this. The only real issue is that things that reference RCLike.re, RCLike.im, or RCLike.ofReal should have rclike somewhere in the name. In general, I would suggest things like Continuous.rclike_re and similar.

Thanks! @ster-oc

reCLM.continuous

open Filter in
theorem _root_.Filter.Tendsto.re (hf : Tendsto f l (𝓝 a)) :

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's do this here and in the ones below, so that rclike appears in the name somewhere.

Suggested change
theorem _root_.Filter.Tendsto.re (hf : Tendsto f l (𝓝 a)) :
theorem _root_.Filter.Tendsto.rclike_re (hf : Tendsto f l (𝓝 a)) :

Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
Comment thread Mathlib/Analysis/RCLike/Basic.lean Resolved
@j-loreaux j-loreaux added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 17, 2026
@ster-oc

ster-oc commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

The only real issue is that things that reference RCLike.re, RCLike.im, or RCLike.ofReal should have rclike somewhere in the name. In general, I would suggest things like Continuous.rclike_re and similar.

I think we were already discussing this same issue months ago.
Let me point out that there are already theorems in mathlib that do not follow this convention (see Integrable.re, Measurable.re, AEMeasurable.re and many more). Should I change those names too?

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 19, 2026
@j-loreaux

Copy link
Copy Markdown
Contributor

Oh, I apologize. I remember that now.

Okay, let's just go with this version and if they get inconvenient then we can change them later. Thanks!

bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Nov 20, 2026
@j-loreaux

Copy link
Copy Markdown
Contributor

bors r-

@mathlib-bors

mathlib-bors Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Bors build canceled.

Address comments or fix if necessary, and then someone with permission can run bors r+.

@mathlib-bors mathlib-bors Bot removed the ready-to-merge This PR has been sent to bors. label Nov 20, 2026
@j-loreaux

Copy link
Copy Markdown
Contributor

oops, I thought I saw a green check on this?

bors d+

@mathlib-bors mathlib-bors Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Nov 20, 2026
@mathlib-bors

mathlib-bors Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

✌️ ster-oc can now approve this pull request until 2026-12-04 16:39 UTC (in 2 weeks). To approve and merge, reply with bors r+. More detailed instructions are available here.

⚠️ This delegation only covers changes within Archive/**, Counterexamples/**, docs/**, DownstreamTest/**, Mathlib/**, MathlibTest/**, Wanted/**, widget/**, Archive.lean, Counterexamples.lean, docs.lean, Mathlib.lean, Wanted.lean; an author commit touching anything else will revoke it. Bors also revokes it if a later push changes too many files for it to check the full list — even if it stays within scope.

@ster-oc

ster-oc commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Ups, downstream of lipschitzWith_one_ofReal broke. Fixed now.

Thank you very much for the reviews @j-loreaux!

@j-loreaux j-loreaux added the auto-merge-after-CI Please do not add manually. Requests for a bot to merge automatically once CI is done. label Nov 21, 2026
@mathlib-auto-merge

Copy link
Copy Markdown

As this PR is labelled auto-merge-after-CI, we are now sending it to bors:

bors merge

@mathlib-bors mathlib-bors Bot added ready-to-merge This PR has been sent to bors. bors-staging This PR is currently being built by bors on the staging branch. labels Nov 21, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Nov 21, 2026
This PR adds dot notation for `re`, `im`, `conj` and `ofReal` for `Continuous`, `LipschitzWith` and `Memℓp`.
Given `hf : Continuous f` it allows to use `hf.re` to express `Continuous (fun x ↦ (f x).re)`, similarly to the usual `hf.add hg`.

I also can add the same features for `Summable` but I am not sure where to place them, suggestions are appreciated!

Co-authored-by: ster99 <stefano.rocca.99@gmail.com>
@mathlib-bors

mathlib-bors Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title feat(RCLike): add Continuous.re and similar [Merged by Bors] - feat(RCLike): add Continuous.re and similar Nov 21, 2026
@mathlib-bors mathlib-bors Bot closed this Nov 21, 2026
@mathlib-bors mathlib-bors Bot removed the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-after-CI Please do not add manually. Requests for a bot to merge automatically once CI is done. bors-staging This PR is currently being built by bors on the staging branch. new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! ready-to-merge This PR has been sent to bors. t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants