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

chore: prefer · == a over a == · #430

Merged
merged 1 commit into from
Dec 13, 2023
Merged

chore: prefer · == a over a == · #430

merged 1 commit into from
Dec 13, 2023

Conversation

kim-em
Copy link
Collaborator

@kim-em kim-em commented Dec 10, 2023

Mathlib currently uses · == a everywhere, and never a == ·. Std is a mix; this PR brings it into line with Mathlib.

However, List.elem in Lean uses a == ·.

I will, at some point, investigate if it is possible to change that. If not, we probably should switch everything downstream. (And add doc-strings on BEq explaining which is the preferred convention.)

@joehendrix joehendrix added the will-merge-soon PR will be merged soon. Any concerns should be raised quickly. label Dec 12, 2023
@joehendrix joehendrix merged commit 7ef8b7c into main Dec 13, 2023
@joehendrix joehendrix deleted the flip_beq_tests branch December 13, 2023 15:51
github-merge-queue bot pushed a commit to leanprover/lean4 that referenced this pull request Jun 14, 2024
We recently discovered inconsistencies in Mathlib and Std over the
ordering of the arguments for `==`.

The most common usage puts the "more variable" term on the LHS, and the
"more constant" term on the RHS, however there are plenty of exceptions,
and they cause unnecessary pain when switching (particularly, sometimes
requiring otherwise unneeded `LawfulBEq` hypotheses).

This convention is consistent with the (obvious) preference for `x == 0`
over `0 == x` when one term is a literal.

We recently updated Std to use this convention
leanprover-community/batteries#430

This PR changes the two major places in Lean that use the opposite
convention, and adds a suggestion to the docstring for `BEq` about the
preferred convention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
will-merge-soon PR will be merged soon. Any concerns should be raised quickly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants