-
Notifications
You must be signed in to change notification settings - Fork 297
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
[Merged by Bors] - feat(data/equiv/derangements/basic): define derangements #7526
Conversation
This is rather messy; would really appreciate suggestions. I read through a few mathlib files, but I'm definitely not super-familiar with Lean conventions yet.
oops, left the wrong name in after copy-pasting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some stylistic suggestions:
FWIW i did manage to get the option-based approach working last night: https://pastebin.com/aCKb5TqW i don't know if one way or the other is more lean-y, but i'm happy to submit whichever one makes more sense |
Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Eric <37984851+ericrbg@users.noreply.github.com>
It turns out that working with `derangements (option \alpha)` was much easier, mostly because working with `\alpha` is easier than working with the set `{a}^c` for some `a`. So this got around a lot of the issues with sets/types and giving things names to appease the elaborator. There's still a few more TODOs, but I've incorporated the changes that were suggested (e.g. no non-terminal simps, style guidelines, pull things into files).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good!
Here's my final batch of suggestions. LGTM otherwise
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@HenrySwanson, there are a bunch of "outdated" but "unresolved" conversations above. Could you please clean those up (either explaining why they are still unresolved, or just clicking resolve), so I can easily tell where things stand? |
@semorrison Okay, I've been able to resolve all but one of them. Once that last one is done I can ping you on Zulip :) |
bors d+ |
✌️ HenrySwanson can now approve this pull request. To approve and merge a pull request, simply reply with |
bors r+ |
This proves two formulas for the number of derangements on _n_ elements, and defines some combinatorial equivalences involving derangements on α and derangements on certain subsets of α. This proves Theorem 88 on Freek's list. Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
Pull request successfully merged into master. Build succeeded: |
Also, added entries back to 100.yaml
…ments (#9089) This defines `card_derangements` as the cardinality of the set of derangements of a fintype, and `num_derangements` as a function from N to N, and proves their equality, along with some other lemmas. Context: PR #7526 grew too large and had to be split in half. The first half retained the original PR ID, and this is the second half. This adds back the finite.lean and exponential.lean files. Also, added entries back to 100.yaml. Co-authored-by: Johan Commelin <johan@commelin.net>
This proves two formulas for the number of derangements on n elements, and defines some combinatorial equivalences
involving derangements on α and derangements on certain subsets of α. This proves Theorem 88 on Freek's list.
This is rather messy; would really appreciate suggestions. I read through a few mathlib files, but I'm definitely not
super-familiar with Lean conventions yet.
I have a bunch of specific things I'd like feedback on, with
-- TODO
comments.I'm also trying to get something with
equiv.perm.decompose_option
working, but it's not looking promising. :| There's a nice equivalence fromperm (option α)
to(option α) x (perm α)
that could be used. It restricts on derangements toα x {f : perm α // [no fixed points, or f(none) is the only fixed point]}
, which is tempting, for obvious reasons. But the intermediate casting of subtypes is hard. I'll update this if it works out, but it's not looking like it'll be any cleaner.