Skip to content

Add profiling and defeq guidance in style #764

Merged
bryangingechen merged 10 commits intoleanprover-community:lean4from
mattrobball:guidance_defeq
Dec 17, 2025
Merged

Add profiling and defeq guidance in style #764
bryangingechen merged 10 commits intoleanprover-community:lean4from
mattrobball:guidance_defeq

Conversation

@mattrobball
Copy link
Contributor

@mattrobball mattrobball commented Dec 10, 2025

Contributor guidance around transparency and code design was requested. Note that some of these opinions are mine.

Co-authored-by: Bryan Gin-ge Chen <[email protected]>
Copy link
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Thanks a lot for writing this! I have a few grammar nits only.

Co-authored-by: Michael Rothgang <[email protected]>
performance regressions. In particular, if the PR touches significant components
of the language like adding instances, adding `simp` lemmas, changing imports,
or creating new definitions, then authors should benchmark their changes
proactively.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very broadly formulated. Do we really want to require a benchmark for every PR containing one of these? I think that in practice, most added instances or simp lemmas are for (very) specialized declarations with specific discrimination keys, so no performance regression would be expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is intentionally broad. The only real limit is benchmarking capacity. I don't see a way to draw it lower that it becomes effectively meaningless or convoluted. Suggestions welcome.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about:

"In particular, if the PR touches significant components of the library like adding generic instances, adding generic simp lemmas, changing imports or changing transparency levels of definitions, then authors should benchmark their changes proactively."

"generic" is of course vague, and we could maybe say something more precise in terms of discrimination keys, but I am not sure this would help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A lot of things here would become simple with better automation. Checking for weak keys is one. I would keep the import switching because that is a completely inscrutable ball of yarn right now.

If this is meant for contributors that know little, then the default should be simple to understand and execute.

Co-authored-by: Michael Rothgang <[email protected]>
Comment on lines 549 to 550
- `irreducible` definitions are never unfolded unless the user explicitly
requests it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this explain (or point to documentation that explains) how to "request" unfolding of irreducible defs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Please add if you can. See the tactic file for documentation. I can't git right now

mattrobball and others added 3 commits December 10, 2025 10:57
Co-authored-by: Robin Carlier <[email protected]>
Co-authored-by: Robin Carlier <[email protected]>
Co-authored-by: Robin Carlier <[email protected]>
Copy link
Contributor

@b-mehta b-mehta left a comment

Choose a reason for hiding this comment

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

looks nice!

@jcommelin
Copy link
Member

Thanks! This looks good to me (modulo the open suggestions).

@bryangingechen
Copy link
Collaborator

Shall we merge this as is? Maybe we can iterate on the advice about benchmarking in a future PR?

@bryangingechen bryangingechen merged commit bd500c3 into leanprover-community:lean4 Dec 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants