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

feat: cleanup some Nat lemmas #177

Closed
wants to merge 17 commits into from

Conversation

fgdorais
Copy link
Collaborator

@fgdorais fgdorais commented Jul 4, 2023

Depends on #182

Potentially breaking changes:

  • Changed Nat.mul_lt_mul (1 use in Mathlib). See comments below.
  • Made two parameters implicit in Nat.lt_add_right (4 uses in Mathlib)
  • Made parameters implicit for Nat.add_le_add_iff_left (no uses in Mathlib)
  • Made parameters implicit for Nat.add_le_add_iff_right (no uses in Mathlib)
  • Made parameters implicit for Nat.add_lt_add_iff_left (no uses in Mathlib)
  • Made parameters implicit for Nat.add_lt_add_iff_right (no uses in Mathlib)
  • Made parameters implicit for Nat.dvd_iff_mod_eq_zero (16 uses in Mathlib)
  • Renamed Nat.max_le (no uses in Mathlib) to Nat.max_le_iff and added new Nat.max_le (Mathlib conformance)
  • Renamed Nat.le_min (no uses in Mathlib) to Nat.le_min_iff and added new Nat.le_min (Mathlib conformance)
  • Protected Nat.zero_le (unknown uses in Mathlib; at least one hiding clause)
  • Protected Nat.one_pos (unknown uses in Mathlib)
  • Protected Nat.two_pos (no uses in Mathlib)
  • Deprecated Nat.lt_min (no uses in Mathlib)
  • Deprecated Nat.add_le_to_le_sub (no uses in Mathlib)
  • Deprecated Nat.succ_add_eq_succ_add (4 uses in Mathlib)
  • Deprecated Nat.mul_le_mul_of_nonneg_left (4 uses in Mathlib)
  • Deprecated Nat.mul_le_mul_of_nonneg_right (3 uses in Mathlib)
  • Deprecated Nat.mul_lt_mul' (2 uses in Mathlib)
  • Deprecated Nat.zero_max (1 use in Mathlib)
  • Deprecated Nat.zero_min (no uses in Mathlib)
  • Deprecated Nat.max_zero (no uses in Mathlib)
  • Deprecated Nat.min_zero (no uses in Mathlib)

Deprecated lemmas all have recommended replacements.

@fgdorais fgdorais marked this pull request as draft July 4, 2023 20:37
Std/Data/Nat/Lemmas.lean Outdated Show resolved Hide resolved
@fgdorais fgdorais force-pushed the nat-golfing branch 5 times, most recently from b35d31f to a19f551 Compare July 5, 2023 17:01
@fgdorais fgdorais marked this pull request as ready for review July 5, 2023 17:03
@fgdorais fgdorais force-pushed the nat-golfing branch 2 times, most recently from d362c9b to f849b35 Compare July 6, 2023 12:20
@fgdorais fgdorais marked this pull request as draft July 8, 2023 15:43
@fgdorais
Copy link
Collaborator Author

fgdorais commented Jul 8, 2023

Regarding #118: I'm tempted to rename Nat.mul_lt_mul₀ to just Nat.mul_lt_mul. There are some issues:

  • On the one hand, Mathlib has mul_lt_mul₀ in Mathlib.Algebra.Order.WithZero so it makes sense to use the same name. On the other hand, like every theorem in that file, the subscript zero indicates WithZero which doesn't make much sense as a distinction in Nat.
  • On the one hand, there is a deprecated Nat.mul_lt_mul with one use in Mathlib. On the other hand, the old Nat.mul_lt_mul was a bad theorem with unnecessarily strong hypotheses, so it's a good riddance.

@fgdorais fgdorais force-pushed the nat-golfing branch 5 times, most recently from 8f59712 to b580f2f Compare July 8, 2023 21:25
@fgdorais
Copy link
Collaborator Author

fgdorais commented Jul 8, 2023

I finally opted for Nat.mul_lt_mul over Nat.mul_lt_mul₀. What tipped the scale for me is that the old Nat.mul_lt_mul was just a bad theorem. Existing uses can be replaced by Nat.mul_lt_mul_of_lt_of_le after adapting the hypotheses.

@fgdorais fgdorais marked this pull request as ready for review July 8, 2023 21:31
Potentially breaking changes:

* Two parameters of `Nat.lt_add_right` have been made implicit.
Potentially breaking changes:

* Changed `Nat.mul_lt_mul`, use `Nat.mul_lt_mul_of_lt_of_le` instead
* Deprecated `Nat.mul_lt_mul'`
* Deprecated `Nat.mul_le_mul_of_nonneg_left`
* Deprecated `Nat.mul_le_mul_of_nonneg_right`
Potentially breaking changes:

* Changed `Nat.max_le`, use `Nat.max_le_iff` instead.
* Changed `Nat.le_min`, use `Nat.le_min_iff` instead.
* Deprecated `Nat.lt_min`
* Deprecated `Nat.max_zero`
* Deprecated `Nat.min_zero`
* Deprecated `Nat.zero_max`
* Deprecated `Nat.zero_min`
Potentially breaking changes:

* Made parameters implicit for `Nat.add_le_add_iff_left`
* Made parameters implicit for `Nat.add_le_add_iff_right`
* Made parameters implicit for `Nat.add_lt_add_iff_left`
* Made parameters implicit for `Nat.add_lt_add_iff_right`
* Made parameters implicit for `Nat.dvd_iff_mod_eq_zero`
@fgdorais fgdorais marked this pull request as draft July 11, 2023 00:43
@fgdorais
Copy link
Collaborator Author

Now broken up into smaller pieces.

@fgdorais fgdorais closed this Jul 23, 2023
@fgdorais fgdorais deleted the nat-golfing branch November 20, 2023 14:10
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.

None yet

2 participants