Zulip Chat Archive
Stream: general
Topic: Casting NNReal to Set Real?
Jack McCarthy (Nov 15 2025 at 23:41):
Sorry if this is a bit of noobie question, but how can I get Lean to interpret NNReal as a Set Real? Specifically, I'm trying to get code like this to compile:
import Mathlib.Probability.Moments.Basic
example sq_convex : ConvexOn ℝ NNReal (fun (x : ℝ) ↦ x^2) := sorry
Aaron Liu (Nov 15 2025 at 23:57):
You want Set.Ici 0
Aaron Liu (Nov 15 2025 at 23:58):
that's the closed-infinite Interval with endpoint 0
Aaron Liu (Nov 16 2025 at 00:01):
actually probably you will need to write Set.Ici (0 : ℝ) since by default you will get the natural number zero
Jack McCarthy (Nov 16 2025 at 00:09):
Thanks I will try this!
Kevin Buzzard (Nov 16 2025 at 00:31):
Note that NNReal is a type but Ici 0 is a term.
Yury G. Kudryashov (Nov 16 2025 at 00:33):
Another option is to use ConvexOn NNReal Set.univ (fun x : NNReal => x ^ 2).
Last updated: Dec 20 2025 at 21:32 UTC