Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(Mathlib/Data/Nat/Factorial/NatCast): add IsUnit lemmas #22237

Closed
wants to merge 10 commits into from

Conversation

mariainesdff
Copy link
Collaborator

@mariainesdff mariainesdff commented Feb 24, 2025

Co-authored-by: AntoineChambert-Loir [email protected]
Co'authored-by: Eric Wieser eric-wieser


Open in Gitpod

@mariainesdff mariainesdff added the t-algebra Algebra (groups, rings, fields, etc) label Feb 24, 2025
Copy link

github-actions bot commented Feb 24, 2025

PR summary 5084bccb6e

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Data.Nat.Factorial.NatCast (new file) 467

Declarations diff

+ natCast_factorial_iff_of_charP
+ natCast_factorial_of_algebra
+ natCast_factorial_of_le
+ natCast_factorial_of_lt

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

Copy link
Collaborator

@Ruben-VandeVelde Ruben-VandeVelde left a comment

Choose a reason for hiding this comment

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

Seems reasonable

maintainer merge

Copy link

github-actions bot commented Mar 2, 2025

🚀 Pull request has been placed on the maintainer queue by Ruben-VandeVelde.

Copy link
Collaborator

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

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

bors d+

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Mar 2, 2025

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

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

bors d+

Thanks!

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Mar 6, 2025

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

Comment on lines 60 to 76
-- TODO: move / golf
theorem natCast_iff_of_charP {n : ℕ} : IsUnit (n : A) ↔ ¬ (p ∣ n) := by
constructor
· rintro ⟨x, hx⟩
rw [← CharP.cast_eq_zero_iff (R := A), ← hx]
have := CharP.nontrivial_of_char_ne_one (R := A) (Nat.Prime.ne_one Fact.out : p ≠ 1)
exact x.ne_zero
· intro h
rw [ ← ZMod.cast_natCast' (n := p)]
refine ⟨⟨ZMod.cast (n : ZMod p), ZMod.cast (n⁻¹ : ZMod p), ?_, ?_⟩, rfl⟩
all_goals rw [← ZMod.cast_mul (m := p) dvd_rfl]
· rw [mul_inv_cancel₀ (G₀ := ZMod p), ZMod.cast_one']
rw [ne_eq, ZMod.natCast_zmod_eq_zero_iff_dvd]
assumption
· rw [inv_mul_cancel₀ (G₀ := ZMod p), ZMod.cast_one']
rw [ne_eq, ZMod.natCast_zmod_eq_zero_iff_dvd]
assumption
Copy link
Member

Choose a reason for hiding this comment

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

This is now in #22669

@mariainesdff mariainesdff added the WIP Work in progress label Mar 11, 2025
@mariainesdff mariainesdff added awaiting-CI and removed WIP Work in progress labels Mar 11, 2025
@mariainesdff
Copy link
Collaborator Author

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Mar 11, 2025
Co-authored-by: AntoineChambert-Loir <[email protected]>
Co'authored-by: Eric Wieser [eric-wieser](https://github.com/eric-wieser)



Co-authored-by: Eric Wieser <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Mar 11, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Mathlib/Data/Nat/Factorial/NatCast): add IsUnit lemmas [Merged by Bors] - feat(Mathlib/Data/Nat/Factorial/NatCast): add IsUnit lemmas Mar 11, 2025
@mathlib-bors mathlib-bors bot closed this Mar 11, 2025
@mathlib-bors mathlib-bors bot deleted the mariainesdff/natCast_factorial branch March 11, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated t-algebra Algebra (groups, rings, fields, etc)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants