Skip to content

[Merged by Bors] - chore(Data/Int): golf entire le_natCast_sub using omega#28299

Closed
euprunin wants to merge 1 commit intoleanprover-community:masterfrom
euprunin:golf-clxii
Closed

[Merged by Bors] - chore(Data/Int): golf entire le_natCast_sub using omega#28299
euprunin wants to merge 1 commit intoleanprover-community:masterfrom
euprunin:golf-clxii

Conversation

@euprunin
Copy link
Copy Markdown
Contributor

@euprunin euprunin commented Aug 12, 2025


Show trace profiling of le_natCast_sub (20 ms before, <10 ms after)

Trace profiling of le_natCast_sub before PR 28299

diff --git a/Mathlib/Data/Int/Lemmas.lean b/Mathlib/Data/Int/Lemmas.lean
index ac1ca078a2..2a26314260 100644
--- a/Mathlib/Data/Int/Lemmas.lean
+++ b/Mathlib/Data/Int/Lemmas.lean
@@ -22,2 +22,3 @@ namespace Int
 
+set_option trace.profiler true in
 theorem le_natCast_sub (m n : ℕ) : (m - n : ℤ) ≤ ↑(m - n : ℕ) := by
ℹ [629/629] Built Mathlib.Data.Int.Lemmas
info: Mathlib/Data/Int/Lemmas.lean:24:0: [Elab.async] [0.020812] elaborating proof of Int.le_natCast_sub
  [Elab.definition.value] [0.020452] Int.le_natCast_sub
    [Elab.step] [0.020104] 
          by_cases h : m ≥ n
          · exact le_of_eq (Int.ofNat_sub h).symm
          · simp [le_of_not_ge h]
      [Elab.step] [0.020095] 
            by_cases h : m ≥ n
            · exact le_of_eq (Int.ofNat_sub h).symm
            · simp [le_of_not_ge h]
        [Elab.step] [0.017594] · simp [le_of_not_ge h]
          [Elab.step] [0.017565] simp [le_of_not_ge h]
            [Elab.step] [0.017561] simp [le_of_not_ge h]
              [Elab.step] [0.017553] simp [le_of_not_ge h]
Build completed successfully.

Trace profiling of le_natCast_sub after PR 28299

diff --git a/Mathlib/Data/Int/Lemmas.lean b/Mathlib/Data/Int/Lemmas.lean
index ac1ca078a2..3af2a60b4b 100644
--- a/Mathlib/Data/Int/Lemmas.lean
+++ b/Mathlib/Data/Int/Lemmas.lean
@@ -22,6 +22,5 @@ namespace Int
 
+set_option trace.profiler true in
 theorem le_natCast_sub (m n : ℕ) : (m - n : ℤ) ≤ ↑(m - n : ℕ) := by
-  by_cases h : m ≥ n
-  · exact le_of_eq (Int.ofNat_sub h).symm
-  · simp [le_of_not_ge h]
+  omega
 
✔ [629/629] Built Mathlib.Data.Int.Lemmas
Build completed successfully.

Open in Gitpod

@github-actions github-actions bot added the t-data Data (lists, quotients, numbers, etc) label Aug 12, 2025
@github-actions
Copy link
Copy Markdown

PR summary d24b0b7957

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

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
Copy Markdown
Contributor

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

maintainer merge

@github-actions
Copy link
Copy Markdown

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

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Aug 13, 2025
@riccardobrasca
Copy link
Copy Markdown
Member

Thanks!

bors merge

@ghost ghost added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Aug 13, 2025
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Aug 13, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore(Data/Int): golf entire le_natCast_sub using omega [Merged by Bors] - chore(Data/Int): golf entire le_natCast_sub using omega Aug 13, 2025
@mathlib-bors mathlib-bors bot closed this Aug 13, 2025
Paul-Lez pushed a commit to Paul-Lez/mathlib4 that referenced this pull request Aug 23, 2025
pechersky pushed a commit to pechersky/mathlib4 that referenced this pull request Aug 25, 2025
vlad902 pushed a commit to vlad902/mathlib4 that referenced this pull request Aug 26, 2025
vlad902 pushed a commit to vlad902/mathlib4 that referenced this pull request Oct 4, 2025
vlad902 pushed a commit to vlad902/mathlib4 that referenced this pull request Nov 22, 2025
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