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

[Merged by Bors] - feat(ring_theory/polynomial): Vieta's formula in terms of polynomial.roots #14908

Closed
wants to merge 22 commits into from

Conversation

alreadydone
Copy link
Collaborator

@alreadydone alreadydone commented Jun 23, 2022

Specialize multiset.prod_X_sub_C_coeff to the root multiset of a split polynomial over an integral domain to derive the familiar Vieta's formula; update undergrad.yaml.

Make various stylistic improvements to polynomial/vieta.lean: most notably, open polynomial to be able to omit the prefix in polynomial.X and polynomial.C. Instead, write mv_polynomial.X with the prefix because it's less frequent.

Prove miscellaneous lemmas list.prod_map_neg, multiset.prod_map_neg, list.map_nth_le and multiset.length_to_list, which are remnants of a previous approach to prove polynomial.vieta superseded by #15008. See below/#14908 for the original motivation for introducing them.


Open in Gitpod

Below is the PR description before #15008 was merged:

  • In order to derive the multiset version of prod_C_add_X_coeff from the existing fintype-indexed version, we need to index (with repetition) the elements of a multiset s using a function f from a fintype α, such that (@finset.univ α _).val.map f = s, see Zulip.

  • I originally opt to use α = fin s.card but finally switched to @kmill's multiset.has_coe_to_sort. The new lemmas map_nth_le in list/range.lean and length_to_list in multiset/basic.lean were needed originally but no longer now, but I think they're worth having.

  • Add new big_operator lemma list/multiset.prod_map_neg to facilitate transition from multiset.prod_C_add_X_coeff to multiset.prod_X_sub_C_coeff.

@alreadydone alreadydone added the awaiting-review The author would like community review of the PR label Jun 23, 2022
src/data/multiset/basic.lean Outdated Show resolved Hide resolved
src/ring_theory/polynomial/vieta.lean Outdated Show resolved Hide resolved
@alreadydone alreadydone added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Jun 23, 2022
@alreadydone alreadydone added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jun 24, 2022
bors bot pushed a commit that referenced this pull request Aug 16, 2022
…m_esymm for multiset (#15008)

This is a proof of Vieta's formula for `multiset`: 
```lean
lemma multiset.prod_X_add_C_eq_sum_esymm (s : multiset R) :
  (s.map (λ r, polynomial.X  + polynomial.C r)).prod 
 = ∑ j in finset.range (s.card + 1), (polynomial.C (s.esymm j) * polynomial.X ^ (s.card - j))
```
where
```lean
def multiset.esymm (s : multiset R) (n : ℕ) : R := ((s.powerset_len n).map multiset.prod).sum
```
From this, we deduce the proof of the  formula for `mv_polynomial`:
```lean
lemma prod_C_add_X_eq_sum_esymm :
  (∏ i : σ, (polynomial.X + polynomial.C (X i)) : polynomial (mv_polynomial σ R) )=
  ∑ j in range (card σ + 1),  (polynomial.C (esymm σ R j) * polynomial.X ^ (card σ - j))
```
with 
```lean
def mv_polynomial.esymm (n : ℕ) : mv_polynomial σ R := ∑ t in powerset_len n univ, ∏ i in t, X i
```

It is better to go in this direction since there does not seem to be a natural way to prove the `multiset` version from the `mv_polynomial` version due to the difficulty to enumerate the elements of a `multiset` with a `fintype`, see this [Zulip thread](https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/.E2.9C.94.20fintype.20enumerating.20a.20multiset) and the discussion from #14908.

We prove, as suggested in [#14908](#14908 (comment)) , that `mv_polynomial.esymm` is obtained by specialising `multiset.esymm`. However, we do not refactor the results of  `ring_theory/polynomial/symmetric` in terms of `multiset.esymm`.

From flt-regular
@alreadydone alreadydone removed the awaiting-review The author would like community review of the PR label Aug 16, 2022
@alreadydone alreadydone added the awaiting-review The author would like community review of the PR label Aug 19, 2022
@alreadydone
Copy link
Collaborator Author

With master merged and description updated, this PR is ready for another look!

src/ring_theory/polynomial/vieta.lean Outdated Show resolved Hide resolved
@alreadydone alreadydone added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Aug 19, 2022
@alreadydone alreadydone added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 19, 2022
@riccardobrasca
Copy link
Member

Thanks!

bors d+

@bors
Copy link

bors bot commented Aug 19, 2022

✌️ alreadydone can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@github-actions github-actions bot added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Aug 19, 2022
@alreadydone
Copy link
Collaborator Author

bors r+

bors bot pushed a commit that referenced this pull request Aug 20, 2022
….roots` (#14908)

Specialize `multiset.prod_X_sub_C_coeff` to the root multiset of a split polynomial over an integral domain to derive the familiar Vieta's formula; update *undergrad.yaml*.

Make various stylistic improvements to *polynomial/vieta.lean*: most notably, `open polynomial` to be able to omit the prefix in `polynomial.X` and `polynomial.C`. Instead, write `mv_polynomial.X` with the prefix because it's less frequent.

Prove miscellaneous lemmas `list.prod_map_neg`, `multiset.prod_map_neg`, `list.map_nth_le` and `multiset.length_to_list`, which are remnants of a previous approach to prove `polynomial.vieta` superseded by #15008. See below/#14908 for the original motivation for introducing them.
@bors
Copy link

bors bot commented Aug 20, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(ring_theory/polynomial): Vieta's formula in terms of polynomial.roots [Merged by Bors] - feat(ring_theory/polynomial): Vieta's formula in terms of polynomial.roots Aug 20, 2022
@bors bors bot closed this Aug 20, 2022
@bors bors bot deleted the vieta_multiset branch August 20, 2022 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants