Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR makes `LinearOrder` lawfully extend `Ord`. Since `LinearOrder` has decidable order relations, we take `compare` to be `compareOfLessAndEq` by default for a linear order. Since typeclass synthesis is preferred by structure instances to optparams, this does not create non-defeq diamonds for types which already have a different implementation of `Ord`. We also add a field `compare_eq_compareOfLessAndEq` which encodes the lawful quality by demanding equality to the canonical comparison. Motivation: `Array` functions like `min` largely use `Ord`, so this lets us seamlessly use these array functions when we only have a linear order. See [zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Ord.20.C9.91.20from.20LinearOrder.20.C9.91.3F). Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
- Loading branch information
1 parent
39576ed
commit f92bbb9
Showing
5 changed files
with
172 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters