Zulip Chat Archive

Stream: new members

Topic: Functions with various real domains


Notification Bot (Feb 26 2022 at 04:35):

Callum Cassidy-Nolan has marked this topic as unresolved.

Callum Cassidy-Nolan (Feb 26 2022 at 04:36):

If I had a function defined on R \to \R then how could I state that that function is increasing only for 3 < x ? I'm using strict_mono for increasing function.

Jireh Loreaux (Feb 26 2022 at 04:42):

I think strict_mono is quantified over the whole type. So, you could roll your own strictly increasing statement for 3 < x, or you could use a subtype (the former will be preferable).

Callum Cassidy-Nolan (Feb 26 2022 at 04:47):

What about if I simply wanted a function who's domain was all reals except zero? Is there a way to encode this in the functions type itself?

Jireh Loreaux (Feb 26 2022 at 04:53):

Subtypes: { x : real // x ≠ 0}. The downside is that you don't get all the theorems about real numbers because this subtype isn't the real numbers. Often it's better to just give your function a "garbage value" where you don't have a definition. Then the function is still total, and it's still defined on the real numbers. Then, in your theorems about that function, you just add the hypothesis x≠0.

Kevin Buzzard (Feb 26 2022 at 08:00):

A great example is the inverse function on the reals sending x to x⁻¹. In lean we have 0⁻¹ = 0 rather than defining inverse only on nonzero elements. It turns out to be much less painful this way.

Yaël Dillies (Feb 26 2022 at 08:43):

Callum Cassidy-Nolan said:

If I had a function defined on R → \R then how could I state that that function is increasing only for 3 < x ? I'm using strict_mono for increasing function.

docs#strict_mono_on

Jireh Loreaux (Feb 26 2022 at 14:00):

Oh, I forgot about that. Nice.


Last updated: Dec 20 2023 at 11:08 UTC