Zulip Chat Archive
Stream: general
Topic: Cubics
Yaël Dillies (Apr 13 2022 at 14:01):
@David Kurniadi Angdinata, why did you not define docs#cubic as polynomial.degree_le R 3
(docs#polynomial.degree_le)?
Riccardo Brasca (Apr 13 2022 at 14:11):
I remember a PR about something similar, let me search.
Riccardo Brasca (Apr 13 2022 at 14:13):
It's #6428, but the only explanation is "Working directly with specific polynomials (like X^n - X - 1
) is really painful, since whenever you try to do something simple like checking that the polynomial is monic or computing its degree, you have to prove a bunch of trivial inequalities. Bundling solves this problem".
Kevin Buzzard (Apr 13 2022 at 14:14):
right -- proving that the degree of x^2+1 is 2 is surprisingly annoying right now (as one of my UG students found out a few weeks ago)
Kevin Buzzard (Apr 13 2022 at 14:14):
(and it's not even true if R is the zero ring ;-) )
Damiano Testa (Apr 13 2022 at 20:28):
I find that working with nat_degree_le
is way better.
Yaël Dillies (Apr 13 2022 at 20:29):
What Riccardo is describing sounds like a case for a strong dedicated API, but not really a case for a dedicated structure.
Thomas Browning (Apr 13 2022 at 20:44):
Damiano Testa said:
I find that working with
nat_degree_le
is way better.
Certainly, but proving the other inequality is still painful.
Thomas Browning (Apr 13 2022 at 20:45):
Yaël Dillies said:
What Riccardo is describing sounds like a case for a strong dedicated API, but not really a case for a dedicated structure.
I also came to this conclusion for the trinomials project. I hope to return to it at some point, and see if I can avoid bundled trinomials.
David Ang (Apr 14 2022 at 01:06):
@Yaël Dillies I just thought it was easier to work with four coefficients than with a submodule of R[X], and I was really just following the quadratic_discriminant
file that’s already present (PS: can an admin kick my other account? I don’t have access to that one anymore and want to receive the right pings)
David Ang (Apr 14 2022 at 01:16):
When I wrote this I really only needed cubics that aren’t quadratic/linear/constant (so the four coefficients are kinda natural to start from), but I was told to include the degenerate cases as well, so now R[X] <= 3 seems more natural
Damiano Testa (Apr 14 2022 at 18:08):
Just a follow-up on the difficulty of computing explicit nat_degree
s, I gave it a shot! Below is my attempt: it has not been easy! But I was indeed able to prove that the degree of X^2 + 1
is 2
in any non-trivial semiring! :upside_down:
Computing degrees
Kevin Buzzard (Apr 14 2022 at 18:23):
Thanks Damiano -- I think you've made my point quite well :-/
Damiano Testa (Apr 14 2022 at 18:27):
Btw, the challenge is now to find a polynomial written as a sum of terms with distinct exponents and non-zero coefficients, for which the above code does not compute the degree!
Eric Rodriguez (Apr 14 2022 at 18:33):
I don't see the issue:
import data.polynomial.degree.definitions
open polynomial
example {R} [semiring R] [nontrivial R] : (X ^ 2 + 1 : polynomial R).nat_degree = 2 :=
begin
rw [nat_degree_add_eq_left_of_nat_degree_lt, nat_degree_X_pow],
simp,
end
Damiano Testa (Apr 14 2022 at 18:35):
Sure, I was just giving a general procedure to compute natdegrees of explicit polynomials
Eric Rodriguez (Apr 14 2022 at 18:35):
Oh, does this work for any polynomial? That's exciting!
Damiano Testa (Apr 14 2022 at 18:41):
Well, it works on 2...
Patrick Massot (Apr 14 2022 at 18:49):
It would be nice to make it a norm_num
extension
Damiano Testa (Apr 14 2022 at 19:59):
Patrick, I'm happy to try, but I'm not even entirely sure what is a norm_num
extension.
Moreover, I think that all the code above could be much simpler if I only knew some metaprogramming. I would need a lot of help with that.
Eric Rodriguez (Apr 14 2022 at 23:02):
norm_num
essentially works in an "extendable" way, I'm not really sure how. but it means that if you have some definition that you want to evaluate, you don't have to edit the core tactic, you can just do it in a separate file
Eric Rodriguez (Apr 14 2022 at 23:02):
cc @Mario Carneiro, he made most of this I think
Damiano Testa (Apr 15 2022 at 05:23):
Thanks Eric, I'll look a little at the various norm_num
files and will ask questions.
Damiano Testa (Apr 15 2022 at 05:25):
By the way, most of the structure above is about sorting a sum of monomials by degree, which is independent of computing degrees. I can see if abel
or ring
works there.
Last updated: Dec 20 2023 at 11:08 UTC