Skip to content

[Merged by Bors] - feat(Data/ZMod): coprime_mod_iff_coprime#34500

Closed
metakunt wants to merge 2 commits intoleanprover-community:masterfrom
metakunt:int-coprime
Closed

[Merged by Bors] - feat(Data/ZMod): coprime_mod_iff_coprime#34500
metakunt wants to merge 2 commits intoleanprover-community:masterfrom
metakunt:int-coprime

Conversation

@metakunt
Copy link
Copy Markdown
Collaborator

@metakunt metakunt commented Jan 27, 2026

No description provided.

@github-actions github-actions bot added the t-data Data (lists, quotients, numbers, etc) label Jan 27, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 27, 2026

PR summary 01988d5fe9

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ coprime_mod_iff_coprime

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.


No changes to technical debt.

You can run this locally as

./scripts/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).

@joneugster joneugster self-assigned this Jan 30, 2026
Copy link
Copy Markdown
Contributor

@joneugster joneugster left a comment

Choose a reason for hiding this comment

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

Wouldn't it be better to add the following lemma instead:

@[simp]
lemma coprime_mod_iff_coprime (m n : ℕ) : (m % n).Coprime n ↔ m.Coprime n := by
  -- copied from PR, can probably be golfed
  suffices (m % n).gcd n = m.gcd n by grind
  exact Nat.ModEq.gcd_eq (by simp [Nat.ModEq])

then your lemma is simply the following:

lemma coprime_of_cast_of_val_iff_coprime (m n : ℕ) : (m : ZMod n).val.Coprime n ↔ m.Coprime n := by
  simp only [val_natCast, coprime_mod_iff_coprime]

(also could you then reevaluate if the second lemma needs to be added at all, please? Didn't think about it myself)

@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Jan 30, 2026
@metakunt metakunt changed the title feat(Data/ZMod): coprime_of_cast_of_val_iff_coprime feat(Data/ZMod): coprime_mod_iff_coprime Jan 30, 2026
@metakunt
Copy link
Copy Markdown
Collaborator Author

I've removed my lemma and added yours. I spent about 30 minutes trying to golf the proof but failed.

@joneugster
Copy link
Copy Markdown
Contributor

Thanks! Sorry I made you waste your time.

maintainer merge

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by joneugster.

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jan 31, 2026
@riccardobrasca
Copy link
Copy Markdown
Member

Thanks!

bors merge

@ghost ghost added ready-to-merge This PR has been sent to bors. and removed awaiting-author A reviewer has asked the author a question or requested changes. maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Jan 31, 2026
mathlib-bors bot pushed a commit that referenced this pull request Jan 31, 2026
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jan 31, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Data/ZMod): coprime_mod_iff_coprime [Merged by Bors] - feat(Data/ZMod): coprime_mod_iff_coprime Jan 31, 2026
@mathlib-bors mathlib-bors bot closed this Jan 31, 2026
YellPika pushed a commit to YellPika/mathlib4 that referenced this pull request Feb 3, 2026
michaellee94 pushed a commit to michaellee94/mathlib4 that referenced this pull request Feb 15, 2026
Maldooor pushed a commit to Maldooor/mathlib4 that referenced this pull request Feb 25, 2026
pfaffelh pushed a commit to pfaffelh/mathlib4 that referenced this pull request Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants