Skip to content

[Merged by Bors] - feat: add reduce_mod_char! variant that searches through hypotheses#11478

Closed
Vierkantor wants to merge 2 commits intomasterfrom
reduce_mod_char-expensive
Closed

[Merged by Bors] - feat: add reduce_mod_char! variant that searches through hypotheses#11478
Vierkantor wants to merge 2 commits intomasterfrom
reduce_mod_char-expensive

Conversation

@Vierkantor
Copy link
Copy Markdown
Contributor

I won't have a lot of time to work on this PR until April, so please feel free to take it over before then.

I initially wanted to use synthInstance rather than findLocalDeclWithType? but because n is not an outParam in CharP R n, the typeclass system won't work unless we know the value of n already.

Perhaps findLocalDeclWithType? is cheap enough to make this part of standard reduce_mod_char behaviour. I'd like to profile our usecases to find out if indeed this holds when expressions become much more complicated.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reduce_mod_char.20doesn't.20work


Open in Gitpod

I won't have a lot of time to work on this PR until April, so please feel free to take it over before then.

I initially wanted to use `synthInstance` rather than `findLocalDeclWithType?` but because `n` is not an outParam in `CharP R n`, the typeclass system won't work unless we know the value of `n` already.

Perhaps `findLocalDeclWithType?` is cheap enough to make this part of standard `reduce_mod_char` behaviour. I'd like to profile our usecases to find out if indeed this holds when expressions become much more complicated.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reduce_mod_char.20doesn't.20work
@Vierkantor Vierkantor added awaiting-review please-adopt Inactive PR (would be valuable to adopt) t-meta Tactics, attributes or user commands awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. labels Mar 18, 2024
@github-actions github-actions bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Mar 18, 2024
@Vierkantor Vierkantor removed the please-adopt Inactive PR (would be valuable to adopt) label Apr 5, 2024
@alexjbest
Copy link
Copy Markdown
Member

How expensive is expensive? I know you said it saves some time in your test cases but I really wonder if we might want the expensive version to be the default, especially if the only users of reduce mod char are real users.

@robertylewis
Copy link
Copy Markdown
Member

@Vierkantor this PR looks good to me! I'm fine merging with this behavior as optional for now, since maybe a proper performance comparison isn't on anyone's radar. It seems helpful to get the new behavior on master. Maybe we could make a tracking issue for changing the default.

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 19, 2024

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

@github-actions github-actions bot added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed awaiting-review labels Jun 19, 2024
@github-actions
Copy link
Copy Markdown

PR summary 1b64ccc5ac

Import changes

No significant changes to the import graph


Declarations diff

+ ZMod'
+ ZMod'.instCharP
+ instance : CommRing (ZMod' n) := inferInstanceAs (CommRing (ZMod n))

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

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

@robertylewis
Copy link
Copy Markdown
Member

bors merge

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Jun 19, 2024
mathlib-bors bot pushed a commit that referenced this pull request Jun 19, 2024
…#11478)

I won't have a lot of time to work on this PR until April, so please feel free to take it over before then.

I initially wanted to use `synthInstance` rather than `findLocalDeclWithType?` but because `n` is not an outParam in `CharP R n`, the typeclass system won't work unless we know the value of `n` already.

Perhaps `findLocalDeclWithType?` is cheap enough to make this part of standard `reduce_mod_char` behaviour. I'd like to profile our usecases to find out if indeed this holds when expressions become much more complicated.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reduce_mod_char.20doesn't.20work




Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 19, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: add reduce_mod_char! variant that searches through hypotheses [Merged by Bors] - feat: add reduce_mod_char! variant that searches through hypotheses Jun 19, 2024
@mathlib-bors mathlib-bors bot closed this Jun 19, 2024
@mathlib-bors mathlib-bors bot deleted the reduce_mod_char-expensive branch June 19, 2024 11:32
AntoineChambert-Loir pushed a commit that referenced this pull request Jun 20, 2024
…#11478)

I won't have a lot of time to work on this PR until April, so please feel free to take it over before then.

I initially wanted to use `synthInstance` rather than `findLocalDeclWithType?` but because `n` is not an outParam in `CharP R n`, the typeclass system won't work unless we know the value of `n` already.

Perhaps `findLocalDeclWithType?` is cheap enough to make this part of standard `reduce_mod_char` behaviour. I'd like to profile our usecases to find out if indeed this holds when expressions become much more complicated.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reduce_mod_char.20doesn't.20work




Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
grunweg pushed a commit that referenced this pull request Jun 20, 2024
…#11478)

I won't have a lot of time to work on this PR until April, so please feel free to take it over before then.

I initially wanted to use `synthInstance` rather than `findLocalDeclWithType?` but because `n` is not an outParam in `CharP R n`, the typeclass system won't work unless we know the value of `n` already.

Perhaps `findLocalDeclWithType?` is cheap enough to make this part of standard `reduce_mod_char` behaviour. I'd like to profile our usecases to find out if indeed this holds when expressions become much more complicated.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reduce_mod_char.20doesn't.20work




Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
kbuzzard pushed a commit that referenced this pull request Jun 26, 2024
…#11478)

I won't have a lot of time to work on this PR until April, so please feel free to take it over before then.

I initially wanted to use `synthInstance` rather than `findLocalDeclWithType?` but because `n` is not an outParam in `CharP R n`, the typeclass system won't work unless we know the value of `n` already.

Perhaps `findLocalDeclWithType?` is cheap enough to make this part of standard `reduce_mod_char` behaviour. I'd like to profile our usecases to find out if indeed this holds when expressions become much more complicated.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reduce_mod_char.20doesn't.20work




Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
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). ready-to-merge This PR has been sent to bors. t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants