Skip to content

refactor: use cmpLE in LinearOrder - #42569

Open
astrainfinita wants to merge 4 commits into
leanprover-community:masterfrom
astrainfinita:linearorder_cmple
Open

refactor: use cmpLE in LinearOrder#42569
astrainfinita wants to merge 4 commits into
leanprover-community:masterfrom
astrainfinita:linearorder_cmple

Conversation

@astrainfinita

Copy link
Copy Markdown
Collaborator

Open in Gitpod

@astrainfinita astrainfinita added the t-order Order theory label Aug 8, 2026
@github-actions github-actions Bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

PR summary 7a3c1f3e4d

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ Std.LawfulLECmp.eq_cmpLE
+ cmpLE_eq_eq
+ cmpLE_eq_gt
+ cmpLE_eq_lt
+ compareOfLessAndEq_eq_cmpLE
+ compare_eq_compareOfLessAndEq
+ isGE_cmpLE
+ isLE_cmpLE

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 7a3c1f3).

  • +12 new declarations
  • −4 removed declarations
+CompleteLinearOrder.compare_eq_cmpLE
-CompleteLinearOrder.compare_eq_compareOfLessAndEq
+ConditionallyCompleteLinearOrder.compare_eq_cmpLE
-ConditionallyCompleteLinearOrder.compare_eq_compareOfLessAndEq
+LinearOrder.compare_eq_cmpLE
-LinearOrder.compare_eq_compareOfLessAndEq
+Std.LawfulLECmp.eq_cmpLE
+cmpLE_eq_eq
+cmpLE_eq_gt
+cmpLE_eq_lt
+compareOfLessAndEq_eq_cmpLE
+compare_eq_compareOfLessAndEq
+isGE_cmpLE
+isLE_cmpLE
+tacticCmpLE_rfl
-tacticCompareOfLessAndEq_rfl

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 7a3c1f3e4d
Reference commit ac10dc7e9a

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/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).

@astrainfinita astrainfinita changed the title chore: use cmpLE in LinearOrder refactor: use cmpLE in LinearOrder Aug 8, 2026
@github-actions github-actions Bot removed the large-import Automatically added label for PRs with a significant increase in transitive imports label Aug 8, 2026
@JovanGerb

Copy link
Copy Markdown
Contributor

What is the motivation for preferring cmpLE? Is it computationally more efficient?

@astrainfinita

astrainfinita commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

I'm trying to remove the DecidableEq and DecidableLT fields from LinearOrder. I'll open a follow-up PR soon.

@github-actions github-actions Bot added the tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-order Order theory tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants