Skip to content

[Merged by Bors] - chore: shortcut instance for Nat to be mul-torsion-free#31027

Closed
YaelDillies wants to merge 2 commits intoleanprover-community:masterfrom
YaelDillies:nat_mul_torsion_free
Closed

[Merged by Bors] - chore: shortcut instance for Nat to be mul-torsion-free#31027
YaelDillies wants to merge 2 commits intoleanprover-community:masterfrom
YaelDillies:nat_mul_torsion_free

Conversation

@YaelDillies
Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies commented Oct 28, 2025

This instance can already be found by typeclass search using the fact that Nat is a LinearOrderedCommMonoidWithZero, but it is better practice to not rely on algebraic order theory to prove algebraic results about such basic types. Similarly for IsAddTorsionFree Int.

From ClassFieldTheory


Open in Gitpod

@github-actions github-actions bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Oct 28, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 28, 2025

PR summary 8c36f10cba

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ instIsAddTorsionFree
+ instIsMulTorsionFree

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

@github-actions github-actions bot added the t-algebra Algebra (groups, rings, fields, etc) label Oct 28, 2025
@github-actions github-actions bot removed the large-import Automatically added label for PRs with a significant increase in transitive imports label Oct 29, 2025
@YaelDillies YaelDillies added the CFT Part of the ongoing formalisation of class field theory label Nov 2, 2025
@YaelDillies YaelDillies force-pushed the nat_mul_torsion_free branch 4 times, most recently from ac429cf to 7e47398 Compare November 6, 2025 15:50
This instance can already be found by typeclass search using the fact that `Nat` is a `LinearOrderedCommMonoidWithZero`, but it is better practice to not rely on algebraic order theory to prove algebraic results about such basic types. Similarly for `IsAddTorsionFree Int`.
Comment on lines +51 to +52
instance instIsAddTorsionFree : IsAddTorsionFree ℤ where
nsmul_right_injective _n hn _x _y := Int.eq_of_mul_eq_mul_left (by cutsat)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
instance instIsAddTorsionFree : IsAddTorsionFree ℤ where
nsmul_right_injective _n hn _x _y := Int.eq_of_mul_eq_mul_left (by cutsat)
instance instIsAddTorsionFree : IsAddTorsionFree ℤ where
nsmul_right_injective _n hn _x _y := Int.eq_of_mul_eq_mul_left <| ofNat_ne_zero.mpr hn

(optional)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, I'm pretty sure Kim would prefer us to use cutsat here

@ocfnash
Copy link
Copy Markdown
Contributor

ocfnash commented Nov 22, 2025

Please add comments to the shortcut instances explaining why they exist.

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Nov 22, 2025

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

@ghost ghost added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Nov 22, 2025
@YaelDillies
Copy link
Copy Markdown
Contributor Author

bors merge

mathlib-bors bot pushed a commit that referenced this pull request Nov 22, 2025
This instance can already be found by typeclass search using the fact that `Nat` is a `LinearOrderedCommMonoidWithZero`, but it is better practice to not rely on algebraic order theory to prove algebraic results about such basic types. Similarly for `IsAddTorsionFree Int`.

From ClassFieldTheory
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Nov 22, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore: shortcut instance for Nat to be mul-torsion-free [Merged by Bors] - chore: shortcut instance for Nat to be mul-torsion-free Nov 22, 2025
@mathlib-bors mathlib-bors bot closed this Nov 22, 2025
@YaelDillies YaelDillies deleted the nat_mul_torsion_free branch November 22, 2025 15:43
alok added a commit to alok/mathlib4 that referenced this pull request Mar 17, 2026
…lib4

* 'master' of https://github.com/leanprover-community/mathlib4: (3130 commits)
  feat(SetTheory/ZFC): add `ZFSet.card` (leanprover-community#29365)
  feat: grind annotations for `choose_spec` (leanprover-community#31927)
  chore(scripts): update nolints.json (leanprover-community#31975)
  feat(Analysis): cos (n * π) = (-1) ^ n (leanprover-community#31971)
  chore: rename `mul_le_mul_right'` to `mul_le_mul_left` (leanprover-community#30242)
  chore: update Mathlib dependencies 2025-11-22 (leanprover-community#31955)
  feat(MeasureTheory): ae-measurability notation wrt non-standard sigma-algebra (leanprover-community#31910)
  doc: add missing spaces around doc code blocks (leanprover-community#31917)
  chore: update Mathlib dependencies 2025-11-22 (leanprover-community#31945)
  chore: shortcut instance for `Nat` to be mul-torsion-free (leanprover-community#31027)
  doc(Topology/Algebra/Algebra): outdated TODO (leanprover-community#31944)
  feat(EqHaar): add `addHaar_nnreal_smul` (leanprover-community#31922)
  chore(Algebra): make invertibleInv an instance (leanprover-community#31916)
  chore(Algebra): change two statements in CubicDiscriminant (leanprover-community#31912)
  chore(MeasureTheory): mark `map_dirac`  as simp (leanprover-community#31909)
  feat: `LinearOrder` instance for `Empty` (leanprover-community#31889)
  chore: deprecate all remaining modules in `Analysis/NormedSpace` (leanprover-community#31913)
  feat(SimpleGraph): weaker condition for paths in acyclic graphs (leanprover-community#25814)
  chore: do not set `group` when declaring option (leanprover-community#31888)
  chore: clean up more unused `Decidable*` instances in types (leanprover-community#31934)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CFT Part of the ongoing formalisation of class field theory delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants