feat(Algebra/BigOperators/Fin): Add finSigmaFinEquiv#19013
feat(Algebra/BigOperators/Fin): Add finSigmaFinEquiv#19013
finSigmaFinEquiv#19013Conversation
PR summary 9a02067e37Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type |
|---|---|---|
| 5120 | -2 | porting notes |
Current commit 9a02067e37
Reference commit 8d28d21b27
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
YaelDillies
left a comment
There was a problem hiding this comment.
I agree with you that m = 0 has to be treated separately
|
@YaelDillies addressed your comments. I still think there is a uniform definition (this is what |
I disagree, see the commit I pushed. There is no need to deal with a case separately that is impossible. |
|
I have refactored The naming takes inspiration from |
| This is defined en-route to `Fin.divSum`, which is the dependent version of `Fin.divNat`. | ||
| -/ | ||
| def divSum? {m : ℕ} (n : Fin m → ℕ) (k : ℕ) : Option (Fin m) := | ||
| find (fun i => k < ∑ j, n (castLE i.isLt j)) |
There was a problem hiding this comment.
This looks wrong to me; isLt is a proof of <, but castLE is about ≤. Can you make the type j explicit here to make it clearer what is going on?
There was a problem hiding this comment.
Since i.isLt : i.val < n is definitionally equal to i.val.succ <= n, the sum is over j : Fin i.val.succ.
| This is defined en-route to `Fin.divSum`, which is the dependent version of `Fin.divNat`. | ||
| -/ | ||
| def divSum? {m : ℕ} (n : Fin m → ℕ) (k : ℕ) : Option (Fin m) := | ||
| find (fun i => k < ∑ j : Fin i.val.succ, n (castLE i.isLt j)) |
There was a problem hiding this comment.
Possibly better as
| find (fun i => k < ∑ j : Fin i.val.succ, n (castLE i.isLt j)) | |
| find (fun i => k < ∑ j ≤ i, n j) |
which avoids the .succ and casting
There was a problem hiding this comment.
Yeah, this is certainly possible and looks nicer. I'd probably want to propagate this change to finPiFinEquiv as well (which a quick search tells me isn't used anywhere else). It also means that I'll need to add more lemmas about sum over Finset.Iic.
If all of this sounds good to you, then I'll make the changes.
There was a problem hiding this comment.
Yes, makes sense to me
This PR adds
finSigmaFinEquivwhich is the equivalence(i : Fin m) × Fin (n i) ≃ Fin (∑ i, n i). This is the dependent version offinProdFinEquiv.CI should be passing, but there are two things I'd like feedback on:
m = 0separately. Is there a more uniform definition?Fin.join, which is the analogue ofList.join. I can now technically defineFin.joinas:but this looks horrible. This highly motivates refactoring
invFunas two new definitions:I'm not sure what to call these functions. The analogues in the non-dependent case are
divNatandmodNat.