leanprover / leanprover/reference-manual

Document new order classes

Open
#583 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

doc-request
Dominant language
Lean
Stars
129
Forks
67
Avg merge
1d 15h
Merged PRs (30d)
16

Description

What question should the reference manual answer?

How should I implement orderings for my type?

Additional context

The system of ordering relations was recently revamped, and should be documented.

The overall description is in this thread, and I got these further details to add:

Most order-related stuff can be found in Init.Data.Order.

Lemmas about linear orders are not required to require all the basic operations (like LE, LT, Ord, BEq, Min and so on). The need to require LE and IsLinearOrder, and for each additional operation X, LawfulOrderX. How this plays out for max?_eq_some_iff can be seen in the linked post.

Assume that you are writing a lemma about a linear order and only want to require LE. It is possible to use lemmas requiring more operations: Opening Classical.Order activates default instances for the operations, derived from LE. For example, the OrientedOrd instance in Init.Data.Order.Lemmas, which does not mention LT, can rely on the lemma compare_eq_lt [Ord α] [LT α] [LE α] [LawfulOrderOrd α] [LawfulOrderLT α] {a b : α} : compare a b = .lt ↔ a < b.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Init.Data.Order and the linked Zulip feedback thread to understand the revamped ordering relations and their required operations. Document how to implement orderings for a type, including the LE and IsLinearOrder requirements, LawfulOrderX classes, and Classical.Order defaults. Done means the reference manual answers the stated implementation question and covers these details.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.