-
Notifications
You must be signed in to change notification settings - Fork 347
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(Logic/Equiv/Basic): sumSigmaDistrib, finSigmaFinEquiv #19618
base: master
Are you sure you want to change the base?
Conversation
PR summary 9fcfebfbc1Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
I also defined |
Oh haha! When I was writing mine (which was pretty much the exact same time as you writing yours) I checked loogle/mathlib but not the current PRs. I guess it's a testament to Mathlib's naming convention, that two of us could write totally separate implementations of the same idea, that do the exact same thing, with the exact same name. |
@@ -388,6 +388,17 @@ theorem finPiFinEquiv_single {m : ℕ} {n : Fin m → ℕ} [∀ i, NeZero (n i)] | |||
rintro x hx | |||
rw [Pi.single_eq_of_ne hx, Fin.val_zero', zero_mul] | |||
|
|||
/-- Equivalence between the Sigma type `(i : Fin m) × Fin (n i)` and `Fin (∑ i : Fin m, n i)`. -/ | |||
def finSigmaFinEquiv {m : ℕ} {n : Fin m → ℕ} : (i : Fin m) × Fin (n i) ≃ Fin (∑ i : Fin m, n i) := |
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.
Could you please provide a few API lemmas that will help working with this defn?
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.
I added finSigmaFinEquiv_apply
and finSigmaFinEquiv_one
. I would add finSigmaFinEquiv_symm_apply
but I don't think there's a particularly clean statement of the inverse equivalence (at least, not clean enough to be useful - I think the forward apply should be preferred)
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.
Note that there's WIP in Batteries to provide a more cohesive framework for Fin
equivalences: leanprover-community/batteries#1007.
My PR also defines auxiliary functions that explicitly identify the inverse equivalence #19013.
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.
I see, I guess one can write it in terms of these divSum
and modSum
you defined. Well, I guess we both have definitions of this equivalence. I'll leave mine like this (without a the _symm_apply
lemma), I'm fine with either definition getting merged. #19695 just requires some definition of finSigmaFinEquiv.
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.
I'm also fine with either definitions, and wonder if we could have the best of both worlds (explicit formulas from my PR, plus theorems that relate it to your PR).
Apart from one comment, LGTM |
Upstreamed from the EquationalTheories project.