Zulip Chat Archive

Stream: Is there code for X?

Topic: Basic properties of polynomials


Luke Mantle (Feb 05 2023 at 01:37):

Are there lemmas for each of the following properties of polynomials?

  • A sum of polynomials is a polynomial
  • A product of polynomials is a polynomial
  • The derivative of a polynomial is a polynomial

Eric Wieser (Feb 05 2023 at 02:24):

I suspect it's not the answer you want, but +, *, and docs#polynomial.derivative seem to match those requests

Eric Wieser (Feb 05 2023 at 02:30):

Your first two questions, in the context of docs#polynomial, is like asking "is there a lemma that says the sum of integers is an integer".

Yakov Pechersky (Feb 05 2023 at 02:49):

I think that maybe this can be interpreted as, are the polynomials a semiring?

Yakov Pechersky (Feb 05 2023 at 02:51):

Or, functions that when evaluated are pointwise equivalent to polynomial.eval, that is also true on sums of such functions

Junyan Xu (Feb 05 2023 at 03:09):

For this interpretation, we have docs#polynomial.eval_add, docs#polynomial.eval_mul, and docs#polynomial.deriv

Kevin Buzzard (Feb 05 2023 at 07:50):

Note that over finite rings there can be different polynomials giving rise to the same functions, so polynomials are no longer determined by the functions they induce

Luke Mantle (Feb 06 2023 at 22:23):

Junyan Xu said:

For this interpretation, we have docs#polynomial.eval_add, docs#polynomial.eval_mul, and docs#polynomial.deriv

Hmm ok this might be what I'm looking for.

Well, suppose I have (f : ℝ → ℝ) (h : ∀ x : ℝ, f x = x - 1). How can I show that f is a polynomial so that I can then use these properties on it?

Eric Wieser (Feb 06 2023 at 22:41):

You can show that f = (X - 1 : polynomial ℝ).eval

Eric Wieser (Feb 06 2023 at 22:42):

That likely follows from ext, simp [h]

Ruben Van de Velde (Feb 06 2023 at 22:42):

Yeah, "f is a polynomial" would be expressed in type theory as \exists p : \R[X], p.eval = f

Kevin Buzzard (Feb 06 2023 at 22:44):

Just to reiterate, there is a map from polynomials to functions, but to say that a function "is" a polynomial is not really meaningful in lean. And there are cases where two polynomials can give the same function.

Luke Mantle (Feb 06 2023 at 23:21):

Kevin Buzzard said:

Just to reiterate, there is a map from polynomials to functions, but to say that a function "is" a polynomial is not really meaningful in lean. And there are cases where two polynomials can give the same function.

Right, I'll keep this in mind

Luke Mantle (Feb 06 2023 at 23:23):

Ruben Van de Velde said:

Yeah, "f is a polynomial" would be expressed in type theory as \exists p : \R[X], p.eval = f

So I tried going this route, but I'm not sure quite what the proof would look like. This is my failed attempt:

example (f :   ) (h :  x : , f x = x - 1) :  p : (polynomial ),  x : , f x = (p.eval x) :=
begin
  use ((λ x, x - 1) : (polynomial )),
end

Eric Wieser (Feb 06 2023 at 23:31):

The polynomial you want is X - 1, not (λ x, x - 1). docs#polynomial.X

Luke Mantle (Feb 06 2023 at 23:48):

Eric Wieser said:

The polynomial you want is X - 1, not (λ x, x - 1). docs#polynomial.X

Ah, ok, thanks!

Johan Commelin (Feb 07 2023 at 03:54):

Kevin Buzzard said:

Just to reiterate, there is a map from polynomials to functions, but to say that a function "is" a polynomial is not really meaningful in lean. And there are cases where two polynomials can give the same function.

@Luke Mantle I would argue that it isn't even mathematically correct outside of Lean to say that a function "is" a polynomial. It is important to distinguish the two!

Junyan Xu (Feb 07 2023 at 05:26):

To be fair, people definitely talk about polynomial functions.

Johan Commelin (Feb 07 2023 at 06:45):

Yes, but in my experience, it is always called that: a polynomial function.

Adam Topaz (Feb 07 2023 at 15:37):

The philosophical difference is that a polynomial over a ring AA can be evaluated at elements in any AA-algebra, but a polynomial function on AA can only be evaluated at elements of AA

Adam Topaz (Feb 07 2023 at 15:37):

At least that's how I distinguish the two

Anne Baanen (Feb 07 2023 at 15:45):

To me an important difference is there can be many more polynomials than polynomial functions: over a finite field, there are finitely many polynomial functions (since there are finitely many functions) but infinitely many polynomials.

Jireh Loreaux (Feb 07 2023 at 16:42):

While I understand the (important) distinction between polynomial and polynomial function, in my analysis circles we generally only ever use the term "polynomial". If necessary, context is used to disambiguate.

Kevin Buzzard (Feb 07 2023 at 16:49):

Yeah, if you're working over the reals (as the original poster was) then it's less of an issue. The only reason it comes up is because lean is working over a general base so the issue is there in lean whether or not you care about it


Last updated: Dec 20 2023 at 11:08 UTC