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] - chore(RingTheory/Polynomial/Basic): add lemma aeval_natDegree_le #10659

Closed
wants to merge 1 commit into from

Conversation

jcommelin
Copy link
Member

This lemma is used in the proof of existence of Cartan subalgebras


Open in Gitpod

This lemma is used in the proof of existence of Cartan subalgebras
@jcommelin jcommelin added awaiting-review The author would like community review of the PR awaiting-CI labels Feb 17, 2024
Comment on lines +1133 to +1148
rw [MvPolynomial.aeval_def, MvPolynomial.eval₂]
apply (Polynomial.natDegree_sum_le _ _).trans
apply Finset.sup_le
intro d hd
simp_rw [Function.comp_apply, ← C_eq_algebraMap]
apply (Polynomial.natDegree_C_mul_le _ _).trans
apply (Polynomial.natDegree_prod_le _ _).trans
have : ∑ i in d.support, (d i) * n ≤ m * n := by
rw [← Finset.sum_mul]
apply mul_le_mul' (.trans _ hF) le_rfl
rw [MvPolynomial.totalDegree]
exact Finset.le_sup_of_le hd le_rfl
apply (Finset.sum_le_sum _).trans this
rintro i -
apply Polynomial.natDegree_pow_le.trans
exact mul_le_mul' le_rfl (hf i)
Copy link
Collaborator

Choose a reason for hiding this comment

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

golf (untested)

Suggested change
rw [MvPolynomial.aeval_def, MvPolynomial.eval₂]
apply (Polynomial.natDegree_sum_le _ _).trans
apply Finset.sup_le
intro d hd
simp_rw [Function.comp_apply, ← C_eq_algebraMap]
apply (Polynomial.natDegree_C_mul_le _ _).trans
apply (Polynomial.natDegree_prod_le _ _).trans
have : ∑ i in d.support, (d i) * n ≤ m * n := by
rw [← Finset.sum_mul]
apply mul_le_mul' (.trans _ hF) le_rfl
rw [MvPolynomial.totalDegree]
exact Finset.le_sup_of_le hd le_rfl
apply (Finset.sum_le_sum _).trans this
rintro i -
apply Polynomial.natDegree_pow_le.trans
exact mul_le_mul' le_rfl (hf i)
rw [aeval_def, eval₂]
refine (natDegree_sum_le _ _).trans <| Finset.sup_le fun d hd ↦ ?_
simp_rw [Function.comp_apply, ← C_eq_algebraMap]
refine (natDegree_C_mul_le _ _).trans <| (natDegree_prod_le _ _).trans <|
(Finset.sum_le_sum fun i _ ↦ natDegree_pow_le.trans (mul_le_mul' le_rfl (hf i))).trans ?_
rw [← Finset.sum_mul]
exact mul_le_mul' (.trans (Finset.le_sup_of_le hd le_rfl) hF) le_rfl

Copy link
Collaborator

@j-loreaux j-loreaux Feb 17, 2024

Choose a reason for hiding this comment

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

Let's not golf quite this much (although some of it is probably okay). For instance, the original with the separate .trans applications is much more readable.

apply (Polynomial.natDegree_C_mul_le _ _).trans
apply (Polynomial.natDegree_prod_le _ _).trans

Arguably, with this many .trans applications (there's one other), this should be a calc block.

Copy link
Member Author

Choose a reason for hiding this comment

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

The calc proof looks like this. I'm not sure it actually increases readability.

Suggested change
rw [MvPolynomial.aeval_def, MvPolynomial.eval₂]
apply (Polynomial.natDegree_sum_le _ _).trans
apply Finset.sup_le
intro d hd
simp_rw [Function.comp_apply, ← C_eq_algebraMap]
apply (Polynomial.natDegree_C_mul_le _ _).trans
apply (Polynomial.natDegree_prod_le _ _).trans
have : ∑ i in d.support, (d i) * n ≤ m * n := by
rw [← Finset.sum_mul]
apply mul_le_mul' (.trans _ hF) le_rfl
rw [MvPolynomial.totalDegree]
exact Finset.le_sup_of_le hd le_rfl
apply (Finset.sum_le_sum _).trans this
rintro i -
apply Polynomial.natDegree_pow_le.trans
exact mul_le_mul' le_rfl (hf i)
calc natDegree ((aeval f) F)
= natDegree (F.sum fun s a ↦ (algebraMap R R[X]) a * s.prod fun n e ↦ f n ^ e) := by
rw [MvPolynomial.aeval_def, MvPolynomial.eval₂]
_ ≤ F.support.fold max 0
(natDegree ∘ fun i ↦ ((algebraMap R R[X]) (F.coeff i) * i.prod fun n e ↦ f n ^ e)) :=
Polynomial.natDegree_sum_le _ _
_ ≤ m * n := Finset.sup_le ?_
intro d hd
have aux : ∑ i in d.support, (d i) * n ≤ m * n := by
rw [← Finset.sum_mul]
apply mul_le_mul' (.trans _ hF) le_rfl
rw [MvPolynomial.totalDegree]
exact Finset.le_sup_of_le hd le_rfl
calc natDegree ((algebraMap R R[X]) (coeff d F) * d.prod fun n e ↦ f n ^ e)
= natDegree (Polynomial.C (coeff d F) * d.prod fun n e ↦ f n ^ e) := by rw [C_eq_algebraMap]
_ ≤ natDegree (Finsupp.prod d fun n e ↦ f n ^ e) := Polynomial.natDegree_C_mul_le _ _
_ ≤ ∑ i in d.support, natDegree (f i ^ (d i)) := Polynomial.natDegree_prod_le _ _
_ ≤ m * n := (Finset.sum_le_sum ?_).trans aux
rintro i -
calc natDegree (f i ^ d i)
≤ d i * natDegree (f i) := Polynomial.natDegree_pow_le
_ ≤ d i * n := mul_le_mul' le_rfl (hf i)

@j-loreaux
Copy link
Collaborator

Consider a calc block for part of the proof for increased readability, but it's acceptable as is.

bors d+

@mathlib-bors
Copy link

mathlib-bors bot commented Feb 17, 2024

✌️ jcommelin 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 and removed awaiting-review The author would like community review of the PR labels Feb 17, 2024
@jcommelin jcommelin added the awaiting-review The author would like community review of the PR label Feb 17, 2024
@ocfnash ocfnash removed the awaiting-review The author would like community review of the PR label Feb 18, 2024
@ocfnash
Copy link
Contributor

ocfnash commented Feb 18, 2024

We seem to have several reasonable proofs none of which is obviously superior. More importantly, the statement is good.

bors merge

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Feb 18, 2024
mathlib-bors bot pushed a commit that referenced this pull request Feb 18, 2024
)

This lemma is used in the proof of existence of Cartan subalgebras
@mathlib-bors
Copy link

mathlib-bors bot commented Feb 18, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore(RingTheory/Polynomial/Basic): add lemma aeval_natDegree_le [Merged by Bors] - chore(RingTheory/Polynomial/Basic): add lemma aeval_natDegree_le Feb 18, 2024
@mathlib-bors mathlib-bors bot closed this Feb 18, 2024
@mathlib-bors mathlib-bors bot deleted the jmc-aeval-natdegree-le branch February 18, 2024 14:02
riccardobrasca pushed a commit that referenced this pull request Feb 19, 2024
)

This lemma is used in the proof of existence of Cartan subalgebras
thorimur pushed a commit that referenced this pull request Feb 24, 2024
)

This lemma is used in the proof of existence of Cartan subalgebras
thorimur pushed a commit that referenced this pull request Feb 26, 2024
)

This lemma is used in the proof of existence of Cartan subalgebras
dagurtomas pushed a commit that referenced this pull request Mar 22, 2024
)

This lemma is used in the proof of existence of Cartan subalgebras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants