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

feat: shortlex order on lists #20310

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

Conversation

hannahfechtner
Copy link
Collaborator

@hannahfechtner hannahfechtner commented Dec 29, 2024

Given a relation r on a type α, the shortlex order over r on lists (first compare by length; if equal, then compare by lexicographic order over r) is defined. We prove that this inherits properties from the underlying relation r such as trichotomous-icity, asymmetry, order-connectedness.

Most importantly, Shortlex r is well-founded if r is well-founded, giving a well-founded order on lists. (Notably, List.Lex is not well-founded).


Open in Gitpod

Copy link

github-actions bot commented Dec 29, 2024

messageFile.md

@github-actions github-actions bot added the t-data Data (lists, quotients, numbers, etc) label Dec 29, 2024
Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments, sorry for not having time right now for a more thorough review.

Co-authored-by: Eric Wieser <[email protected]>
Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming largely looks good now, thanks! (or at least, as good as the existing List.Lex naming...)

Perhaps @vihdzp has some opinions around the names of the WellFounded stuff, and whether some instances are missing.

hannahfechtner and others added 4 commits December 30, 2024 22:30
@hannahfechtner
Copy link
Collaborator Author

I noticed that there is something going on with aux in a number of the List.Lex instances - it got too long to type here so I posted on Zulip: https://leanprover.zulipchat.com/#narrow/channel/113489-new-members/topic/aux.20appearing.20in.20instance

@eric-wieser eric-wieser changed the title feat : shortlex order on lists feat: shortlex order on lists Dec 31, 2024
Copy link
Collaborator

@vihdzp vihdzp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial remarks. I expect that there's a lot of golfing that can be done here.

hannahfechtner and others added 3 commits January 20, 2025 15:53
Co-authored-by: Violeta Hernández <[email protected]>
Co-authored-by: Violeta Hernández <[email protected]>
Co-authored-by: Violeta Hernández <[email protected]>
Copy link

messageFile.md

Co-authored-by: Violeta Hernández <[email protected]>
Copy link

messageFile.md

1 similar comment
Copy link

messageFile.md

Copy link

messageFile.md

Copy link

messageFile.md

Copy link

messageFile.md

Copy link

messageFile.md

@eric-wieser
Copy link
Member

If you merge master, then the bot will stop posting such silly messages!

Copy link

github-actions bot commented Feb 7, 2025

PR summary ec90975413

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Data.List.Shortlex (new file) 605

Declarations diff

+ InvImage.isAsymm
+ InvImage.trichotomous
+ IsAsymm
+ Shortlex
+ _root_.Acc.shortlex
+ _root_.List.shortlex_def
+ _root_.List.shortlex_iff_lex
+ append_left
+ append_right
+ cons_iff
+ isAsymm
+ isTrichotomous
+ nil_left_or_eq_nil
+ not_nil_right
+ of_length_lt
+ of_lex
+ singleton_iff
+ wf

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/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).

@kbuzzard kbuzzard added the awaiting-author A reviewer has asked the author a question or requested changes label Feb 17, 2025
@madvorak
Copy link
Collaborator

We certainly want to have Shortlex in Mathlib!

Co-authored-by: Violeta Hernández <[email protected]>
@hannahfechtner hannahfechtner removed the awaiting-author A reviewer has asked the author a question or requested changes label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-data Data (lists, quotients, numbers, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants