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

asymmetry requirements in PartialOrd #54

Open
VitalyAnkh opened this issue Oct 22, 2021 · 0 comments
Open

asymmetry requirements in PartialOrd #54

VitalyAnkh opened this issue Oct 22, 2021 · 0 comments

Comments

@VitalyAnkh
Copy link

In the blog post tour of rust standard library traits, I feel the paragraph of asymmetry requirements in partial_cmp is not right:

All PartialOrd impls must ensure that comparisons are asymmetric and transitive. That means for all a, b, and c:

  • a < b implies !(a > b) (asymmetry)
  • a < b && b < c implies a < c (transitivity)

In the document for PartialOrd, there is no part about asymmetry. The requirements for partial_cmp is:

The comparison must satisfy, for all a, b and c:

  • transitivity: a < b and b < c implies a < c. The same must hold for both == and >.
  • duality: a < b if and only if b > a.

Maybe the document is updated and we should catch up?

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

No branches or pull requests

1 participant